Feature: dial different NIC for all proxies (#1714)

This commit is contained in:
Dreamacro
2021-11-07 16:48:51 +08:00
committed by GitHub
parent bcb301b730
commit 1a7830f18e
21 changed files with 206 additions and 139 deletions

View File

@ -1,29 +1,27 @@
package dialer
var DefaultOptions []Option
import "go.uber.org/atomic"
type config struct {
skipDefault bool
var (
DefaultOptions []Option
DefaultInterface = atomic.NewString("")
)
type option struct {
interfaceName string
addrReuse bool
}
type Option func(opt *config)
type Option func(opt *option)
func WithInterface(name string) Option {
return func(opt *config) {
return func(opt *option) {
opt.interfaceName = name
}
}
func WithAddrReuse(reuse bool) Option {
return func(opt *config) {
return func(opt *option) {
opt.addrReuse = reuse
}
}
func WithSkipDefault(skip bool) Option {
return func(opt *config) {
opt.skipDefault = skip
}
}