fix rejoin error - #37
Merged
Merged
Conversation
Signed-off-by: kerthcet <kerthcet@gmail.com>
Member
Author
|
/lgtm |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves tunnel-mode resiliency by ensuring the Tailscale mesh is (re)established as part of each reconnect attempt, and adds license/notice documentation for the Tailscale dependency used in tunnel mode.
Changes:
- Reworks tunnel mode flow so
setup_tunnel()is called on every reconnect-loop iteration (and errors no longer crash the daemon). - Makes
setup_tunnel()idempotent by only spawningtailscaledwhen not already running, while always re-runningtailscale up. - Adds
THIRD_PARTY_NOTICES.mdand links it from the README to document third-party components (Tailscale).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| THIRD_PARTY_NOTICES.md | Adds third-party licensing notice for Tailscale usage in tunnel mode. |
| sandd/src/main.rs | Re-establishes tunnel on reconnect loop; makes setup_tunnel idempotent and more reconnect-friendly. |
| README.md | Links to third-party notices from the License section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+827
to
+847
| if tailscaled_running { | ||
| info!("tailscaled already running; re-joining mesh"); | ||
| } else { | ||
| info!("Starting tailscaled..."); | ||
| // --socks5-server is what makes tunnel mode actually work: with | ||
| // --tun=userspace-networking there is no TUN device and thus no kernel route | ||
| // to the tailnet (100.64.0.0/10), so a plain socket to the controller's mesh | ||
| // address always fails. The SOCKS5 proxy is the entry point INTO tailscaled's | ||
| // userspace network stack; connect_and_serve dials the controller through it | ||
| // (see TUNNEL_SOCKS_PROXY) so the WebSocket rides the mesh. Bound to localhost | ||
| // so only this container's daemon can use it. | ||
| Command::new("tailscaled") | ||
| .arg("--tun=userspace-networking") | ||
| .arg(format!("--socks5-server={}", TUNNEL_SOCKS_PROXY)) | ||
| .arg("--state=/var/lib/tailscale/tailscaled.state") | ||
| .spawn() | ||
| .context("Failed to start tailscaled")?; | ||
|
|
||
| // Give tailscaled time to start | ||
| tokio::time::sleep(Duration::from_secs(2)).await; | ||
| } |
InftyAI-Agent
approved these changes
Aug 4, 2026
InftyAI-Agent
left a comment
Member
There was a problem hiding this comment.
Approved: PR has both lgtm and approved labels
InftyAI-Agent
approved these changes
Aug 4, 2026
InftyAI-Agent
left a comment
Member
There was a problem hiding this comment.
Approved: PR has both lgtm and approved labels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
Which issue(s) this PR fixes
Fixes #
Special notes for your reviewer
Does this PR introduce a user-facing change?