Closed nmiculinic closed 5 years ago
This is an interesting idea, but to my knowledge, these operations are more so the domain of route netlink and other OS-specific APIs, and not related to the actual WireGuard device implementations (generic netlink, userspace, etc.).
I think it'd make more sense to create/delete WireGuard interfaces and set IP/link parameters in another package, in order to keep the scope of this one focused on managing parameters of existing links.
Closing as out of scope, per https://github.com/mdlayher/wireguardctrl/pull/27#issuecomment-476317106.
How about having the address at least? That's the part what's hardest for me since I'm not that experiences with netlink socket (( and that's the one I'm actually missing the most ))
I'm not entirely sure what you mean. Getting or setting the IP address would be done using a route netlink operation on Linux, or other OS-specific operation on another platform.
You'd need to pull in a different library such as https://github.com/vishvananda/netlink or https://gitlab.com/mergetb/tech/rtnl to set the IP address anyway. You could get the device's IP address with net.Interface from the standard library.
Does this package handle the routes via netlink socket? Or not?
I mean when you do wg-quick up
it setups the wireguard device, routing table and adds ip addresses on the interface
Those operations are not handled by this package. This package only gets and sets data available in the generic netlink and userspace interfaces:
https://www.wireguard.com/xplatform/ https://godoc.org/github.com/mdlayher/wireguardctrl/wgtypes#Config https://godoc.org/github.com/mdlayher/wireguardctrl/wgtypes#Device
I'd love if wireguardctrl supported wg-quick configuration options in wgtypes.Config.
I'm mostly interested in:
I can open rudimentary PR for this