Fix DefaultGateway

This commit is contained in:
Shtorm
2026-08-08 20:43:13 +03:00
parent da4c532efb
commit 9f34cdb2f8

View File

@@ -126,18 +126,19 @@ func (s *ServerEndpoint) DialContext(ctx context.Context, network string, destin
}
}
if gateway == nil {
if destination.IsIPv4() {
if s.defaultGateway != nil {
gateway = s.defaultGateway
} else if destination.IsIPv4() {
gateway = &destination.Addr
destination = M.Socksaddr{
Addr: Loopback,
Port: destination.Port,
}
} else if s.defaultGateway != nil {
gateway = s.defaultGateway
} else {
return nil, E.New("missing gateway")
}
} else if destination.Addr.Compare(*gateway) == 0 {
}
if destination.Addr.Compare(*gateway) == 0 {
destination = M.Socksaddr{
Addr: Loopback,
Port: destination.Port,