WireGuard / wgctrl-go

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

Peer map instead of a Peer list #145

Closed SaadAhmedGit closed 3 months ago

SaadAhmedGit commented 3 months ago

Currently, wgctrl-go provides a list of peers but this is really slow for operations where the number of peers are very large and random access would be desirable such as getting the bandwidth usage of a particular peer or it's allowed IPs.

A map where the key is the public key of a peer and the value is the peer type itself, would make things better in cases of random access desirability.

I am happy to contribute as well. So if it sounds good, let me know.

mdlayher commented 3 months ago

No thanks, the underlying APIs return the peers list as an array. There's nothing stopping you from converting the array to a map for your own use.