fix: 修复 Windows 端 IPv6 无法下行的问题
根因: netsh interface ipv6 命令参数名用错 - configureIPv6Addr: name= → interface=,IPv6 地址未实际分配到适配器 - SetMTU IPv6: name= → interface= 路由修复: - cidrToV6Prefix: 用 Mask.Size() 取前缀长度,修复 fmt.Sprintf(%d, mask) 输出字节切片的 bug - addRoute6/deleteRoute6: netsh → route -6,用 :: 作 on-link gateway - addRouteVia6/deleteRouteVia6: 加 -6 flag - defaultGateway6: route -6 print :: → route -6 print(避免过滤掉 ::/0) - applyFull: IPv6 bypass 路由失败不再阻断全隧道路由
This commit is contained in:
@@ -116,12 +116,16 @@ func (d *wintunDevice) ConfigureIPv6(localIP6 net.IP, prefix6 int) error {
|
||||
func (d *wintunDevice) configureIPv6Addr(ip net.IP, prefix int) error {
|
||||
addr := fmt.Sprintf("%s/%d", ip.String(), prefix)
|
||||
return execCmd("netsh", "interface", "ipv6", "add", "address",
|
||||
"name="+d.name, "address="+addr)
|
||||
"interface="+d.name, "address="+addr)
|
||||
}
|
||||
|
||||
func (d *wintunDevice) SetMTU(mtu int) error {
|
||||
return execCmd("netsh", "interface", "ipv4", "set", "subinterface",
|
||||
"name="+d.name, fmt.Sprintf("mtu=%d", mtu))
|
||||
if err := execCmd("netsh", "interface", "ipv4", "set", "subinterface",
|
||||
"name="+d.name, fmt.Sprintf("mtu=%d", mtu)); err != nil {
|
||||
return err
|
||||
}
|
||||
return execCmd("netsh", "interface", "ipv6", "set", "subinterface",
|
||||
"interface="+d.name, fmt.Sprintf("mtu=%d", mtu))
|
||||
}
|
||||
|
||||
// ensureWintunDLL extracts the embedded wintun.dll to the executable's
|
||||
|
||||
Reference in New Issue
Block a user