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

WIP: Optional values "the other way" and replace peer with peers #16

Closed
wants to merge 4 commits into from

Conversation

nsg
Copy link

@nsg nsg commented Dec 24, 2021

Proposed Changes

This commit is based on top of #15, I do not think this PR should be merged as-is, this is a breaking change that would break peoples installations. It implements the discussion in #14 and re-implements #15 in another way.

Peers

If you like to go forward with this, or something similar I think we need to do one of 3 things:

a) Make it a breaking change, clearly communicate this to the users, or
b) Make some form of migration script that rewrites the configuration to the new format, or
c) Support both peer and peers

I initially tried to implement c, but it quickly got messy. I considered b as a better solution. In this PR i just did a :)

peers:
  - public_key: pUBlickey=
    pre_shared_key: ''
    endpoint: myserver.example.com:1234
    allowed_ips:
      - 10.0.0.0/24
    persistent_keep_alive: '25'

This is exactly the same syntax, just a list of possible multiple peers. You can inspect the commit that adds this functionality here: nsg@698b4d3

A few notes:

Optional values "the other way"

This is the alternative implementation of #15, instead of messing with empty variables this just makes the values optional via the built in functionality. This feels more like "The Home Assistant Way" but has the disadvantage that we wont get a nice sample configuration generated on first install. This change should be backward compatible.

See the commit here: nsg@414f2f9

To summarize

Feel free to close this, see this more as a PR with code samples and ideas ... I think nsg@414f2f9 could be an interesting alternative to #15 for example. If you feel you like to move forward with the idea of supporting multiple peers I would love to discuss what you think about the options a, b or c.

Oh, this code is not that well tested, it runs (for me) 😁

Related Issues / PRs

"allowed_ips":[
"10.6.0.0/24"
],
"persistent_keep_alive": "25"
Copy link
Owner

@bigmoby bigmoby Dec 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this param is very important to keep

Copy link
Author

@nsg nsg Dec 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works just fine without persistent_keep_alive, if you only plan to make outbound connections it works. But you are correct that it's probably a good idea to make sure it's set. Most people expect this behavior :)

@bigmoby
Copy link
Owner

bigmoby commented Dec 26, 2021

Hi @nsg thank you so much for your contribute 🙏
In these days I saw both PRs you left WIP and I get several hints from your code. I create the 0.1.9 version of this add-on, I hope you could enjoy it! 👍
Many thanks,
Bigmoby

@bigmoby bigmoby closed this Dec 26, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants