Remove strict route on windows
This commit is contained in:
parent
99492e0d70
commit
488c3b75f6
1 changed files with 19 additions and 44 deletions
|
|
@ -83,30 +83,6 @@ func (t *NativeTun) configure() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.options.AutoRoute {
|
if t.options.AutoRoute {
|
||||||
if t.options.StrictRoute {
|
|
||||||
if len(t.options.Inet4Address) > 0 {
|
|
||||||
for _, prefix := range []netip.Prefix{
|
|
||||||
netip.MustParsePrefix("0.0.0.0/1"),
|
|
||||||
netip.MustParsePrefix("128.0.0.0/1"),
|
|
||||||
} {
|
|
||||||
err := luid.AddRoute(prefix, netip.IPv4Unspecified(), 0)
|
|
||||||
if err != nil {
|
|
||||||
return E.Cause(err, "set ipv4 route")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(t.options.Inet6Address) > 0 {
|
|
||||||
for _, prefix := range []netip.Prefix{
|
|
||||||
netip.MustParsePrefix("::/1"),
|
|
||||||
netip.MustParsePrefix("8000::/1"),
|
|
||||||
} {
|
|
||||||
err := luid.AddRoute(prefix, netip.IPv6Unspecified(), 0)
|
|
||||||
if err != nil {
|
|
||||||
return E.Cause(err, "set ipv6 route")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if len(t.options.Inet4Address) > 0 {
|
if len(t.options.Inet4Address) > 0 {
|
||||||
if len(t.options.Inet4RouteAddress) > 0 {
|
if len(t.options.Inet4RouteAddress) > 0 {
|
||||||
for _, addr := range t.options.Inet4RouteAddress {
|
for _, addr := range t.options.Inet4RouteAddress {
|
||||||
|
|
@ -138,7 +114,6 @@ func (t *NativeTun) configure() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(t.options.Inet4Address) > 0 {
|
if len(t.options.Inet4Address) > 0 {
|
||||||
inetIf, err := luid.IPInterface(winipcfg.AddressFamily(windows.AF_INET))
|
inetIf, err := luid.IPInterface(winipcfg.AddressFamily(windows.AF_INET))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue