mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-10 14:18:40 +00:00
Sockopt: Add dialTimeout
This commit is contained in:
parent
16eee1b89c
commit
43b57825fa
4 changed files with 51 additions and 33 deletions
|
@ -87,8 +87,12 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
|
|||
if sockopt != nil && (sockopt.TcpKeepAliveInterval != 0 || sockopt.TcpKeepAliveIdle != 0) {
|
||||
goStdKeepAlive = time.Duration(-1)
|
||||
}
|
||||
dialTimeout := time.Second * 16
|
||||
if sockopt != nil && sockopt.DialTimeout > 0 {
|
||||
dialTimeout = time.Second * time.Duration(sockopt.DialTimeout)
|
||||
}
|
||||
dialer := &net.Dialer{
|
||||
Timeout: time.Second * 16,
|
||||
Timeout: dialTimeout,
|
||||
LocalAddr: resolveSrcAddr(dest.Network, src),
|
||||
KeepAlive: goStdKeepAlive,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue