1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 15:36:41 -05:00

fix bind addr check

This commit is contained in:
Darien Raymond 2019-01-12 09:44:51 +01:00
parent ef739c2127
commit ee13f7a562
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -40,7 +40,7 @@ func resolveSrcAddr(network net.Network, src net.Address) net.Addr {
} }
func hasBindAddr(sockopt *SocketConfig) bool { func hasBindAddr(sockopt *SocketConfig) bool {
return len(sockopt.BindAddress) > 0 && sockopt.BindPort > 0 return sockopt != nil && len(sockopt.BindAddress) > 0 && sockopt.BindPort > 0
} }
func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest net.Destination, sockopt *SocketConfig) (net.Conn, error) { func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest net.Destination, sockopt *SocketConfig) (net.Conn, error) {
@ -67,7 +67,7 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
} }
dialer := &net.Dialer{ dialer := &net.Dialer{
Timeout: time.Second * 60, Timeout: time.Second * 16,
DualStack: true, DualStack: true,
LocalAddr: resolveSrcAddr(dest.Network, src), LocalAddr: resolveSrcAddr(dest.Network, src),
} }