params_windows.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. package water
  2. // PlatformSpecificParams defines parameters in Config that are specific to
  3. // Windows. A zero-value of such type is valid.
  4. type PlatformSpecificParams struct {
  5. // ComponentID associates with the virtual adapter that exists in Windows.
  6. // This is usually configured when driver for the adapter is installed. A
  7. // zero-value of this field, i.e., an empty string, causes the interface to
  8. // use the default ComponentId. The default ComponentId is set to tap0901,
  9. // the one used by OpenVPN.
  10. ComponentID string
  11. // InterfaceName is a friendly name of the network adapter as set in Control Panel.
  12. // Of course, you may have multiple tap0901 adapters on the system, in which
  13. // case we need a friendlier way to identify them.
  14. InterfaceName string
  15. // Network is required when creating a TUN interface. The library will call
  16. // net.ParseCIDR() to parse this string into LocalIP, RemoteNetaddr,
  17. // RemoteNetmask. The underlying driver will need those to generate ARP
  18. // response to Windows kernel, to emulate an TUN interface.
  19. // Please note that it cannot perceive the IP changes caused by DHCP, user
  20. // configuration to the adapter and etc,. If IP changed, please reconfigure
  21. // the adapter using syscall, just like openDev().
  22. // For detail, please refer
  23. // https://github.com/OpenVPN/tap-windows6/blob/master/src/device.c#L431
  24. // and https://github.com/songgao/water/pull/13#issuecomment-270341777
  25. Network string
  26. }
  27. func defaultPlatformSpecificParams() PlatformSpecificParams {
  28. return PlatformSpecificParams{
  29. ComponentID: "tap0901",
  30. Network: "192.168.1.10/24",
  31. }
  32. }