wintun: revise GetInterface()
- Make foreign interface found error numeric to ease condition detection. - Update GetInterface() documentation. - Make tun.CreateTUN() quit when foreign interface found before attempting to create a Wintun interface with a duplicate name. Creation is futile. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
8fdcf5ee30
commit
6a0a3a5406
2 changed files with 6 additions and 3 deletions
|
|
@ -71,6 +71,8 @@ func CreateTUN(ifname string) (TUNDevice, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to delete already existing Wintun interface: %v", err)
|
||||
}
|
||||
} else if err == windows.ERROR_ALREADY_EXISTS {
|
||||
return nil, fmt.Errorf("Foreign network interface with the same name exists")
|
||||
}
|
||||
wt, _, err = wintun.CreateInterface("WireGuard Tunnel Adapter", 0)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue