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

@ -36,12 +36,12 @@ func DialContext(ctx context.Context, network, address string, options ...Option
}
func ListenPacket(ctx context.Context, network, address string, options ...Option) (net.PacketConn, error) {
cfg := &config{}
cfg := &option{
interfaceName: DefaultInterface.Load(),
}
if !cfg.skipDefault {
for _, o := range DefaultOptions {
o(cfg)
}
for _, o := range DefaultOptions {
o(cfg)
}
for _, o := range options {
@ -64,12 +64,12 @@ func ListenPacket(ctx context.Context, network, address string, options ...Optio
}
func dialContext(ctx context.Context, network string, destination net.IP, port string, options []Option) (net.Conn, error) {
opt := &config{}
opt := &option{
interfaceName: DefaultInterface.Load(),
}
if !opt.skipDefault {
for _, o := range DefaultOptions {
o(opt)
}
for _, o := range DefaultOptions {
o(opt)
}
for _, o := range options {