Skip to content

Conversation

@eminence
Copy link
Member

This feature is designed to solve one specific use case that I personally have: roaming the client on and off ZScaler ZPA as I move my laptop between home and the office.

The way ZPA works is that when have it enabled, all DNS lookups for ZPA-protected hostnames are intercepted and converted into IP address for ZScaler endpoints (which then proxy the packets to the actual mosh-server host).

When ZPA is disabled (when you're inside a trusted corporate network), DNS lookups for the mosh-server host resolve to the "normal" IP address.

So this looks a lot like a roaming server.

This commit adds a new "re-resolve" command to trigger a manual DNS lookup. This is just a boring call to getaddrinfo (so no new fancy async resolver), and it's fully manual, so there's no attempts to automatically figure out when a new DNS lookup is needed.

This has been working well for my use case. Note that this approach is not general enough to work for everyone. For example, it doesn't handle the case where the actual hostname is known only to your ssh_config. And I've made no attempts to test anything other than IPv4. So this PR is marked as a "Draft" and will probably never be merged in its current form. But I'm sharing it here anyway because I'm sure others will find it useful.

Most of the code in this commit was written by Gemini AI.

set_MTU( remote_addr.sa.sa_family );
}

void Connection::set_remote_addr( const struct sockaddr* addr, socklen_t len )
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a little skeptical of of this impl (I think I want to unconditionally push a new Socket onto socks), but this does work as written. I'll revisit this later

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.

1 participant