mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-02 11:27: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":
|
||||
return o.Inet4Address[0].Addr()
|
||||
default:
|
||||
if HasNextAddress(o.Inet4Address[0], 1) {
|
||||
return o.Inet4Address[0].Addr().Next()
|
||||
} else {
|
||||
return o.Inet4Address[0].Addr()
|
||||
if !o.InterfaceScope {
|
||||
if HasNextAddress(o.Inet4Address[0], 1) {
|
||||
return o.Inet4Address[0].Addr().Next()
|
||||
} else {
|
||||
return o.Inet4Address[0].Addr()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,10 +129,12 @@ func (o *Options) Inet6GatewayAddr() netip.Addr {
|
|||
case "darwin":
|
||||
return o.Inet6Address[0].Addr()
|
||||
default:
|
||||
if HasNextAddress(o.Inet6Address[0], 1) {
|
||||
return o.Inet6Address[0].Addr().Next()
|
||||
} else {
|
||||
return o.Inet6Address[0].Addr()
|
||||
if !o.InterfaceScope {
|
||||
if HasNextAddress(o.Inet6Address[0], 1) {
|
||||
return o.Inet6Address[0].Addr().Next()
|
||||
} else {
|
||||
return o.Inet6Address[0].Addr()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue