Fix stun test

This commit is contained in:
世界
2026-04-10 20:59:59 +08:00
parent ef12123c97
commit 723cee38f2
+5
View File
@@ -9,6 +9,8 @@ import (
"net/netip" "net/netip"
"time" "time"
"github.com/sagernet/sing/common/bufio"
"github.com/sagernet/sing/common/bufio/deadline"
E "github.com/sagernet/sing/common/exceptions" E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata" M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network" N "github.com/sagernet/sing/common/network"
@@ -431,6 +433,9 @@ func Run(options Options) (*Result, error) {
defer func() { defer func() {
_ = packetConn.Close() _ = packetConn.Close()
}() }()
if deadline.NeedAdditionalReadDeadline(packetConn) {
packetConn = deadline.NewPacketConn(bufio.NewPacketConn(packetConn))
}
select { select {
case <-ctx.Done(): case <-ctx.Done():