support multiple network interfaces

This commit is contained in:
ginuerzh
2022-03-01 21:48:50 +08:00
parent 07132d8de7
commit ffdf11e89e
44 changed files with 431 additions and 474 deletions

View File

@ -40,8 +40,11 @@ func (d *tcpDialer) Dial(ctx context.Context, addr string, opts ...dialer.DialOp
opt(&options)
}
var netd net.Dialer
conn, err := netd.DialContext(ctx, "tcp", addr)
netd := options.NetDialer
if netd == nil {
netd = dialer.DefaultNetDialer
}
conn, err := netd.Dial(ctx, "tcp", addr)
if err != nil {
d.logger.Error(err)
}