|
@@ -19,7 +19,6 @@ package vpn
|
|
|
import (
|
|
|
"fmt"
|
|
|
"log"
|
|
|
- "net"
|
|
|
"os/exec"
|
|
|
|
|
|
"github.com/mudler/water"
|
|
@@ -38,24 +37,10 @@ func prepareInterface(c *Config) error {
|
|
|
}
|
|
|
|
|
|
func createInterface(c *Config) (*water.Interface, error) {
|
|
|
- // TUN on Windows requires address and network to be set on device creation stage
|
|
|
- // We also set network to 0.0.0.0/0 so we able to reach networks behind the node
|
|
|
- // https://github.com/songgao/water/blob/master/params_windows.go
|
|
|
- // https://gitlab.com/openconnect/openconnect/-/blob/master/tun-win32.c
|
|
|
- ip, _, err := net.ParseCIDR(c.InterfaceAddress)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- network := net.IPNet{
|
|
|
- IP: ip,
|
|
|
- Mask: net.IPv4Mask(0, 0, 0, 0),
|
|
|
- }
|
|
|
config := water.Config{
|
|
|
DeviceType: c.DeviceType,
|
|
|
PlatformSpecificParams: water.PlatformSpecificParams{
|
|
|
- ComponentID: "tap0901",
|
|
|
InterfaceName: c.InterfaceName,
|
|
|
- Network: network.String(),
|
|
|
},
|
|
|
}
|
|
|
|