Fix stun test

This commit is contained in:
世界 2026-04-10 20:59:59 +08:00
parent adeea0f707
commit 6bb84ab3a6
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

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():