2021-09-06 23:07:34 +08:00
|
|
|
package dialer
|
|
|
|
|
2021-10-10 23:44:09 +08:00
|
|
|
var DefaultOptions []Option
|
2021-09-06 23:07:34 +08:00
|
|
|
|
|
|
|
type config struct {
|
|
|
|
skipDefault bool
|
|
|
|
interfaceName string
|
|
|
|
addrReuse bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type Option func(opt *config)
|
|
|
|
|
|
|
|
func WithInterface(name string) Option {
|
|
|
|
return func(opt *config) {
|
|
|
|
opt.interfaceName = name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithAddrReuse(reuse bool) Option {
|
|
|
|
return func(opt *config) {
|
|
|
|
opt.addrReuse = reuse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithSkipDefault(skip bool) Option {
|
|
|
|
return func(opt *config) {
|
|
|
|
opt.skipDefault = skip
|
|
|
|
}
|
|
|
|
}
|