mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-03 03:47:39 +03:00
Fix set gateway
This commit is contained in:
parent
edabb6d7ba
commit
d0887eabba
1 changed files with 12 additions and 8 deletions
20
tun.go
20
tun.go
|
@ -103,10 +103,12 @@ func (o *Options) Inet4GatewayAddr() netip.Addr {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
return o.Inet4Address[0].Addr()
|
return o.Inet4Address[0].Addr()
|
||||||
default:
|
default:
|
||||||
if HasNextAddress(o.Inet4Address[0], 1) {
|
if !o.InterfaceScope {
|
||||||
return o.Inet4Address[0].Addr().Next()
|
if HasNextAddress(o.Inet4Address[0], 1) {
|
||||||
} else {
|
return o.Inet4Address[0].Addr().Next()
|
||||||
return o.Inet4Address[0].Addr()
|
} else {
|
||||||
|
return o.Inet4Address[0].Addr()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,10 +129,12 @@ func (o *Options) Inet6GatewayAddr() netip.Addr {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
return o.Inet6Address[0].Addr()
|
return o.Inet6Address[0].Addr()
|
||||||
default:
|
default:
|
||||||
if HasNextAddress(o.Inet6Address[0], 1) {
|
if !o.InterfaceScope {
|
||||||
return o.Inet6Address[0].Addr().Next()
|
if HasNextAddress(o.Inet6Address[0], 1) {
|
||||||
} else {
|
return o.Inet6Address[0].Addr().Next()
|
||||||
return o.Inet6Address[0].Addr()
|
} else {
|
||||||
|
return o.Inet6Address[0].Addr()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue