Update water go.mod references, fix some bugs in TAP mode (which should hopefully fix Windows support too)

This commit is contained in:
Neil Alexander 2019-07-20 16:13:54 +01:00
parent 36201895e7
commit 48ad3c5d7f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
5 changed files with 33 additions and 18 deletions

View file

@ -71,6 +71,9 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
// Sets the MTU of the TAP adapter.
func (tun *TunAdapter) setupMTU(mtu int) error {
if tun.iface == nil || tun.iface.Name() == "" {
return errors.New("Can't configure MTU as TAP adapter is not present")
}
// Set MTU
cmd := exec.Command("netsh", "interface", "ipv6", "set", "subinterface",
fmt.Sprintf("interface=%s", tun.iface.Name()),
@ -88,6 +91,9 @@ func (tun *TunAdapter) setupMTU(mtu int) error {
// Sets the IPv6 address of the TAP adapter.
func (tun *TunAdapter) setupAddress(addr string) error {
if tun.iface == nil || tun.iface.Name() == "" {
return errors.New("Can't configure IPv6 address as TAP adapter is not present")
}
// Set address
cmd := exec.Command("netsh", "interface", "ipv6", "add", "address",
fmt.Sprintf("interface=%s", tun.iface.Name()),