mirror of https://github.com/XTLS/Xray-core
Update system_dialer.go
parent
9b0a02f8e6
commit
4ec20e9129
|
@ -3,7 +3,6 @@ package internet
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
gonet "net"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -88,22 +87,10 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
|
||||||
Dest: destAddr,
|
Dest: destAddr,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
TCPKeepAlive := time.Duration(1)
|
|
||||||
TCPKeepAliveConfig := gonet.KeepAliveConfig {
|
|
||||||
Enable: true,
|
|
||||||
Idle: 45 * time.Second,
|
|
||||||
Interval: 45 * time.Second,
|
|
||||||
Count: -1,
|
|
||||||
}
|
|
||||||
if sockopt != nil && (sockopt.TcpKeepAliveInterval != 0 || sockopt.TcpKeepAliveIdle != 0) {
|
|
||||||
TCPKeepAlive = time.Duration(-1)
|
|
||||||
TCPKeepAliveConfig.Enable = false
|
|
||||||
}
|
|
||||||
dialer := &net.Dialer{
|
dialer := &net.Dialer{
|
||||||
Timeout: time.Second * 16,
|
Timeout: time.Second * 16,
|
||||||
LocalAddr: resolveSrcAddr(dest.Network, src),
|
LocalAddr: resolveSrcAddr(dest.Network, src),
|
||||||
KeepAlive: TCPKeepAlive,
|
KeepAlive: time.Duration(-1),
|
||||||
KeepAliveConfig: TCPKeepAliveConfig,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if sockopt != nil || len(d.controllers) > 0 {
|
if sockopt != nil || len(d.controllers) > 0 {
|
||||||
|
|
Loading…
Reference in New Issue