fix: set default tun udp timeout to 5 minutes

This commit is contained in:
wwqgtxx 2022-10-10 22:10:36 +08:00
parent 77a3c1c3ae
commit 7b1427b843
2 changed files with 4 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import (
"errors" "errors"
"net" "net"
"sync" "sync"
"time"
"github.com/Dreamacro/clash/adapter/inbound" "github.com/Dreamacro/clash/adapter/inbound"
C "github.com/Dreamacro/clash/constant" C "github.com/Dreamacro/clash/constant"
@ -19,6 +20,8 @@ import (
"github.com/sagernet/sing/common/uot" "github.com/sagernet/sing/common/uot"
) )
const UDPTimeout = 5 * time.Minute
type ListenerHandler struct { type ListenerHandler struct {
TcpIn chan<- C.ConnContext TcpIn chan<- C.ConnContext
UdpIn chan<- *inbound.PacketAdapter UdpIn chan<- *inbound.PacketAdapter

View file

@ -78,7 +78,7 @@ func New(options config.Tun, tcpIn chan<- C.ConnContext, udpIn chan<- *inbound.P
if options.UDPTimeout != 0 { if options.UDPTimeout != 0 {
udpTimeout = options.UDPTimeout udpTimeout = options.UDPTimeout
} else { } else {
udpTimeout = int64(C.DefaultUDPTimeout.Seconds()) udpTimeout = int64(sing.UDPTimeout.Seconds())
} }
includeUID := uidToRange(options.IncludeUID) includeUID := uidToRange(options.IncludeUID)
if len(options.IncludeUIDRange) > 0 { if len(options.IncludeUIDRange) > 0 {