Update system_listener.go

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

View File

@ -2,12 +2,12 @@ package internet
import ( import (
"context" "context"
gonet "net"
"os" "os"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"syscall" "syscall"
"time"
"github.com/pires/go-proxyproto" "github.com/pires/go-proxyproto"
"github.com/sagernet/sing/common/control" "github.com/sagernet/sing/common/control"
@ -88,7 +88,13 @@ func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *S
network = addr.Network() network = addr.Network()
address = addr.String() address = addr.String()
lc.Control = getControlFunc(ctx, sockopt, dl.controllers) lc.Control = getControlFunc(ctx, sockopt, dl.controllers)
lc.KeepAlive = time.Duration(-1) lc.KeepAliveConfig = gonet.KeepAliveConfig{
// Set Enable to true but all other fields to -1 to use system defaults (see https://pkg.go.dev/net#KeepAliveConfig)
Enable: true,
Idle: -1,
Interval: -1,
Count: -1,
}
if sockopt != nil { if sockopt != nil {
if sockopt.TcpMptcp { if sockopt.TcpMptcp {
lc.SetMultipathTCP(true) lc.SetMultipathTCP(true)