mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-08-09 11:57:13 +03:00
Fix DefaultGateway
This commit is contained in:
@@ -126,18 +126,19 @@ func (s *ServerEndpoint) DialContext(ctx context.Context, network string, destin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if gateway == nil {
|
if gateway == nil {
|
||||||
if destination.IsIPv4() {
|
if s.defaultGateway != nil {
|
||||||
|
gateway = s.defaultGateway
|
||||||
|
} else if destination.IsIPv4() {
|
||||||
gateway = &destination.Addr
|
gateway = &destination.Addr
|
||||||
destination = M.Socksaddr{
|
destination = M.Socksaddr{
|
||||||
Addr: Loopback,
|
Addr: Loopback,
|
||||||
Port: destination.Port,
|
Port: destination.Port,
|
||||||
}
|
}
|
||||||
} else if s.defaultGateway != nil {
|
|
||||||
gateway = s.defaultGateway
|
|
||||||
} else {
|
} else {
|
||||||
return nil, E.New("missing gateway")
|
return nil, E.New("missing gateway")
|
||||||
}
|
}
|
||||||
} else if destination.Addr.Compare(*gateway) == 0 {
|
}
|
||||||
|
if destination.Addr.Compare(*gateway) == 0 {
|
||||||
destination = M.Socksaddr{
|
destination = M.Socksaddr{
|
||||||
Addr: Loopback,
|
Addr: Loopback,
|
||||||
Port: destination.Port,
|
Port: destination.Port,
|
||||||
|
|||||||
Reference in New Issue
Block a user