Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer to PeerConfig method #71

Closed
muhlemmer opened this issue Sep 26, 2019 · 3 comments
Closed

Peer to PeerConfig method #71

muhlemmer opened this issue Sep 26, 2019 · 3 comments

Comments

@muhlemmer
Copy link
Contributor

I'm writing a getter/ setter kind of config app for which I need to convert wgtypes.Peer to wgtypes.PeerConfig. I'm planning to write a helper function for that. If you guys are interested, I can make it a method of wgtypes.Peer and send a pull request instead.

I'm thinking of the following design:

// PeerConfig converts Peer into a config.
// Empty fields become nil in output, so those properties will not be reconfigured.
// Remove field in output is always false.
// ReplaceAllowedIPs configures the likewise named field in output.
func(p *Peer)PeerConfig(ReplaceAllowedIPs bool) PeerConfig
@mdlayher
Copy link
Member

I think at this time, I'd prefer to keep the API small and focused. In addition, I think some of the configuration structures could use some more work (see #7).

If this ends up being a popular request, I will reconsider though.

@muhlemmer
Copy link
Contributor Author

Ok. I already have the helper function in my project. Is was no biggie. The only two tests I had to do where for PresharedKey and PersistentKeepaliveInterval. The rest where already compatible types. Let me know whenever you change your mind.

If time allows I will look into #7.

@mdlayher
Copy link
Member

Closing due to no further feedback for a month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants