Update system_dialer.go

pull/4927/head
风扇滑翔翼 2025-07-25 01:56:27 +08:00 committed by GitHub
parent 4c15c118e0
commit ba6c3040e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 3 deletions

View File

@ -3,6 +3,7 @@ package internet
import ( import (
"context" "context"
"math/rand" "math/rand"
gonet "net"
"syscall" "syscall"
"time" "time"
@ -87,10 +88,17 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
Dest: destAddr, Dest: destAddr,
}, nil }, nil
} }
// Chrome defaults
keepAliveConfig := gonet.KeepAliveConfig{
Enable: true,
Idle: 45 * time.Second,
Interval: 45 * time.Second,
Count: -1,
}
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: time.Duration(-1), KeepAliveConfig: keepAliveConfig,
} }
if sockopt != nil || len(d.controllers) > 0 { if sockopt != nil || len(d.controllers) > 0 {