clash/component/dialer/options.go

35 lines
536 B
Go
Raw Normal View History

package dialer
import "go.uber.org/atomic"
var (
DefaultOptions []Option
DefaultInterface = atomic.NewString("")
)
type option struct {
interfaceName string
addrReuse bool
2021-11-08 08:59:48 +00:00
routingMark int
}
type Option func(opt *option)
func WithInterface(name string) Option {
return func(opt *option) {
opt.interfaceName = name
}
}
func WithAddrReuse(reuse bool) Option {
return func(opt *option) {
opt.addrReuse = reuse
}
}
2021-11-08 08:59:48 +00:00
func WithRoutingMark(mark int) Option {
return func(opt *option) {
opt.routingMark = mark
}
}