|
@@ -5,6 +5,7 @@ import (
|
|
"net"
|
|
"net"
|
|
"net/netip"
|
|
"net/netip"
|
|
"os"
|
|
"os"
|
|
|
|
+ "strings"
|
|
"syscall"
|
|
"syscall"
|
|
|
|
|
|
"github.com/sagernet/sing-box/adapter"
|
|
"github.com/sagernet/sing-box/adapter"
|
|
@@ -41,7 +42,7 @@ func (l *Listener) ListenUDP() (net.PacketConn, error) {
|
|
if l.tproxy {
|
|
if l.tproxy {
|
|
listenConfig.Control = control.Append(listenConfig.Control, func(network, address string, conn syscall.RawConn) error {
|
|
listenConfig.Control = control.Append(listenConfig.Control, func(network, address string, conn syscall.RawConn) error {
|
|
return control.Raw(conn, func(fd uintptr) error {
|
|
return control.Raw(conn, func(fd uintptr) error {
|
|
- return redir.TProxy(fd, !M.ParseSocksaddr(address).IsIPv4(), true)
|
|
|
|
|
|
+ return redir.TProxy(fd, !strings.HasSuffix(network, "4"), true)
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
}
|