Fix bind_address

This commit is contained in:
世界
2022-08-25 14:49:49 +08:00
parent e859c0a6ef
commit d481bd7993
3 changed files with 17 additions and 10 deletions

View File

@@ -113,7 +113,10 @@ func NewDefault(router adapter.Router, options option.DialerOptions) *DefaultDia
}
var bindUDPAddr string
udpDialer := dialer
bindAddress := netip.Addr(options.BindAddress)
var bindAddress netip.Addr
if options.BindAddress != nil {
bindAddress = options.BindAddress.Build()
}
if bindAddress.IsValid() {
dialer.LocalAddr = &net.TCPAddr{
IP: bindAddress.AsSlice(),