From 7b1427b843b8ac2089d0a1dd2b99371870f52e0e Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 10 Oct 2022 22:10:36 +0800 Subject: [PATCH] fix: set default tun udp timeout to 5 minutes --- listener/sing/sing.go | 3 +++ listener/sing_tun/server.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/listener/sing/sing.go b/listener/sing/sing.go index f53844dc..df55f100 100644 --- a/listener/sing/sing.go +++ b/listener/sing/sing.go @@ -5,6 +5,7 @@ import ( "errors" "net" "sync" + "time" "github.com/Dreamacro/clash/adapter/inbound" C "github.com/Dreamacro/clash/constant" @@ -19,6 +20,8 @@ import ( "github.com/sagernet/sing/common/uot" ) +const UDPTimeout = 5 * time.Minute + type ListenerHandler struct { TcpIn chan<- C.ConnContext UdpIn chan<- *inbound.PacketAdapter diff --git a/listener/sing_tun/server.go b/listener/sing_tun/server.go index 2e388440..1b97da19 100644 --- a/listener/sing_tun/server.go +++ b/listener/sing_tun/server.go @@ -78,7 +78,7 @@ func New(options config.Tun, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.P if options.UDPTimeout != 0 { udpTimeout = options.UDPTimeout } else { - udpTimeout = int64(C.DefaultUDPTimeout.Seconds()) + udpTimeout = int64(sing.UDPTimeout.Seconds()) } includeUID := uidToRange(options.IncludeUID) if len(options.IncludeUIDRange) > 0 {