Skip to content

Commit

Permalink
Fix gateway select
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 6, 2024
1 parent d95423e commit 91efbd6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ func (o *Options) Inet4GatewayAddr() netip.Addr {
return o.Inet4Gateway
}
if len(o.Inet4Address) > 0 {
if HasNextAddress(o.Inet4Address[0], 1) {
return o.Inet4Address[0].Addr().Next()
} else if runtime.GOOS != "linux" {
return o.Inet4Address[0].Addr()
if HasNextAddress(o.Inet4Address[0], 1) {
return o.Inet4Address[0].Addr().Next()
} else if runtime.GOOS != "linux" && runtime.GOOS != "android" {
return o.Inet4Address[0].Addr()
}
}
}
return netip.IPv4Unspecified()
}

Expand All @@ -105,7 +105,7 @@ func (o *Options) Inet6GatewayAddr() netip.Addr {
if len(o.Inet6Address) > 0 {
if HasNextAddress(o.Inet6Address[0], 1) {
return o.Inet6Address[0].Addr().Next()
} else if runtime.GOOS != "linux" {
} else if runtime.GOOS != "linux" && runtime.GOOS != "android" {
return o.Inet6Address[0].Addr()
}
}
Expand Down

0 comments on commit 91efbd6

Please sign in to comment.