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
feat(protonvpn): Added ProtonVPN feature selection #2182
base: master
Are you sure you want to change the base?
feat(protonvpn): Added ProtonVPN feature selection #2182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice it's looking pretty good, just a few minor comments 😉 👍
err = validateFeatureFilters(*ss, vpnServiceProvider) | ||
if err != nil { | ||
return fmt.Errorf("for VPN service provider %s: %w", vpnServiceProvider, err) | ||
} | ||
|
||
if *ss.OwnedOnly && | ||
vpnServiceProvider != providers.Mullvad { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not incorporate OwnedOnly etc. (below) within validateFeatureFilters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this was a feature or a "subscription tier" filter. If it is a feature then it makes sense to move it as well!
// IPv6Only is true if VPN servers without IPv6 support should | ||
// be filtered. This is used with ProtonVPN. | ||
IPv6Only *bool `json:"ipv6_only"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this filter do? 🤔
Because AFAIK there are only IPv4 addresses to reach Protonvpn servers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure! It's indeed not a supported feature by any current server, but I just wanted to implement all features listed in protonvpn-nm-lib
@@ -10,7 +10,7 @@ import ( | |||
type ipToServer map[string]models.Server | |||
|
|||
func (its ipToServer) add(country, region, city, name, hostname string, | |||
free bool, entryIP netip.Addr) { | |||
free bool, entryIP netip.Addr, features *models.Features) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit just return the whole bunch of features after free bool
, or define an unexported features
struct in this package, up to you 😉 (and then add the free bool
to it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will wait with this to see what you decide about the features struct in models/server.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The features are defined at logical server level, "free" at physical server level, didn't feel right to put it both in the same struct, but will do if you prefer it.
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Hi, I applied (most of) your suggestions from the code review. I also added minimal unit tests (basically added to all the _test files) for all files changed in this PR. I also built my own image and started using it already. It seems to work, as far as I can tell. |
@qdm12 I've been running this code for a couple of days now myself (https://github.com/users/kvanzuijlen/packages/container/package/gluetun) and as far as I can tell it now fully works :). |
I know it's not completely done yet (missing tests, missing todo's for moving feature-related stuff to the new Features struct, docs, etc) but I wanted to open a PR to see if you agree with my chosen direction.
Closes #1582, partially #1103