WireGuard / wgctrl-go

Package wgctrl enables control of WireGuard interfaces on multiple platforms.
https://godoc.org/golang.zx2c4.com/wireguard/wgctrl
MIT License
730 stars 85 forks source link

wireguardctrl: consider eliminating Client.DeviceByIndex #6

Closed mdlayher closed 5 years ago

mdlayher commented 5 years ago

This function is arguably less friendly than Client.DeviceByName. On top of this, there is no concept of an interface index in the userspace interface, so in wguser, it is implemented by calling net.InterfaceByIndex and then Client.DeviceByName immediately after.

Removing this function also means that the method Client.DeviceByName could be shortened to just Client.Device.

olemd commented 5 years ago

I agree, remove it. It simplifies the code, both because of less code and because I don't expect anyone would ever use DeviceByIndex via wireguardctrl.

mdlayher commented 5 years ago

SGTM, I think I'll just do it. Anybody who cares about interface index can do a lookup on their own and then use Device(name string). :)