Merge pull request #77 from neilalexander/windows

Add ability to select specific interface by friendly name on Windows
This commit is contained in:
Neil Alexander 2018-05-09 16:47:01 +01:00 committed by GitHub
commit 6d944d8ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,11 @@ func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int)
config := water.Config{DeviceType: water.TAP} config := water.Config{DeviceType: water.TAP}
config.PlatformSpecificParams.ComponentID = "tap0901" config.PlatformSpecificParams.ComponentID = "tap0901"
config.PlatformSpecificParams.Network = "169.254.0.1/32" config.PlatformSpecificParams.Network = "169.254.0.1/32"
if ifname == "auto" {
config.PlatformSpecificParams.InterfaceName = ""
} else {
config.PlatformSpecificParams.InterfaceName = ifname
}
iface, err := water.New(config) iface, err := water.New(config)
if err != nil { if err != nil {
panic(err) panic(err)