Support new config method.

Refined code.
This commit is contained in:
lucus 2017-01-09 18:55:36 +09:00
parent cde943e7d7
commit 933e95c058
3 changed files with 81 additions and 27 deletions

View file

@ -1,3 +1,5 @@
// +build windows
package water
// PlatformSpecificParams defines parameters in Config that are specific to
@ -9,10 +11,22 @@ type PlatformSpecificParams struct {
// use the default ComponentId. The default ComponentId is set to tap0901,
// the one used by OpenVPN.
ComponentID string
// Network is required when creating a TUN interface. The library will call
// net.ParseCIDR() to parse this string into LocalIP, RemoteNetaddr,
// RemoteNetmask. The underlying driver will need those to generate ARP
// response to Windows kernel, to emulate an TUN interface.
// Please note that it cannot perceive the IP changes caused by DHCP, user
// configuration to the adapter and etc,. If IP changed, please reconfigure
// the adapter using syscall, just like openDev().
// For detail, please refer
// https://github.com/OpenVPN/tap-windows6/blob/master/src/device.c#L431
// and https://github.com/songgao/water/pull/13#issuecomment-270341777
Network string
}
func defaultPlatformSpecificParams() PlatformSpecificParams {
return PlatformSpecificParams{
ComponentId: "tap0901",
ComponentID: "tap0901",
Network: "192.168.1.10/24",
}
}