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

ipn/{localapi, ipnlocal}: forget the prior exit node when localAPI is used to zero the ExitNodeID #11681

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

barnstar
Copy link
Member

@barnstar barnstar commented Apr 10, 2024

Updates tailscale/corp#18724

When localAPI clients directly set ExitNodeID to "", the expected behaviour is that the prior exit node also gets zero'd - effectively setting the UI state back to 'no exit node was ever selected'

If a client wants to zero the exit node, but remember it, they use SetUseExitNodeEnabled.

The IntenalExitNodePrior has been changed to be a non-opaque type, as it is read by the UI to render the users last selected exit node, and must be concrete type. Future-us can either break this, or deprecate it and replace it with something more interesting.

@barnstar barnstar force-pushed the jonathan/forget-last-exit-node branch 2 times, most recently from 27934ad to f0e498e Compare April 10, 2024 13:14
Copy link
Member

@bradfitz bradfitz left a comment

Choose a reason for hiding this comment

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

Code's fine but I feel like we've gone down the wrong path if we have to add this explosion of so-related APIs around all this.

I also don't see why this is needed--- if they set it to None and we set that with EditPrefs, do we care if they toggle it back on with the toggle API and it goes back to the previous pre-None one?

And if we really care, can we make EditPrefs do the clearing of the old one instead?

@barnstar
Copy link
Member Author

@bradfitz It's about visually representing the state where you have no exit node set, and you have no prior preference. This is just a UX thing. Without this, selecting none is the equivalent of selecting "off". There's no combination of prefs or api calls that gives ExitNodeID="" and Prior=""... Prior is always set to something, and therefore, it's always shown in the UI.

If you're OK with making InternalPrior not internal (ie: let the UI just set it), that seems like the simplest approach.

@bradfitz
Copy link
Member

Oh, so there's the root of the problem: the UI's assuming some distinction between Off and None that doesn't actually exist.

I assume you're also reading the Internal value and trying to make sense of it? It's supposed to be an opaque string with future meanings like "something in country $X" in the future. I don't think the UI should be reading it.

@barnstar barnstar force-pushed the jonathan/forget-last-exit-node branch from f0e498e to 6cad885 Compare April 11, 2024 14:35
@barnstar barnstar changed the title ipn/{localapi, ipnlocal}: implement endpoint to allow clients to reset all exit node selections ipn/{localapi, ipnlocal}: forget the prior exit node when localAPI is used to zero the ExitNodeID Apr 11, 2024
mp.InternalExitNodePrior = ""
mp.InternalExitNodePriorSet = true
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This is way simpler than a new endpoint. It's really just localAPI zeroing the ExitNodeID we care about. Should be all backwards and future compatible. The backend is still free to set that InternalExitNodePrior to "future thing" when an ExitNode is enabled, and the UI will still zero it if the user decides Exit Nodes aren't their thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm @bradfitz just saw your comment there about the opacity of that internal value... The right answer seems to be "add a value the UI can read"... And leave future considerations for the future.

@barnstar barnstar requested a review from bradfitz April 11, 2024 14:40
@barnstar barnstar force-pushed the jonathan/forget-last-exit-node branch 3 times, most recently from b28c268 to 2c8c6b6 Compare April 11, 2024 15:39
@oxtoacart
Copy link
Contributor

Pardon my confusion, but does this already incorporate the OSS change?

@barnstar
Copy link
Member Author

Pardon my confusion, but does this already incorporate the OSS change?

It does. This is a slight modification to that. I ran into the noted UX issue of not being able to do the "None" thing when trying to get things matchy-matchy with iOS.

@barnstar barnstar force-pushed the jonathan/forget-last-exit-node branch from 2c8c6b6 to 353492d Compare April 15, 2024 13:15
… used to zero the ExitNodeID

Updates tailscale/corp#18724

When localAPI clients directly set ExitNodeID to "", the expected behaviour is that the prior exit node also gets zero'd - effectively setting the UI state back to 'no exit node was ever selected'

The IntenalExitNodePrior has been changed to be a non-opaque type, as it is read by the UI to render the users last selected exit node, and must be concrete type. Future-us can either break this, or deprecate it and replace it with something more interesting.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
@barnstar barnstar force-pushed the jonathan/forget-last-exit-node branch from 353492d to 5c9fd8f Compare April 15, 2024 13:17
@barnstar barnstar requested a review from oxtoacart April 15, 2024 13:18
@barnstar barnstar merged commit 7e2b426 into main Apr 16, 2024
48 checks passed
@barnstar barnstar deleted the jonathan/forget-last-exit-node branch April 16, 2024 18:53
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

3 participants