peer: route the peer-box sing-box logger into radiance's slog#481
Open
myleshorton wants to merge 1 commit into
Open
peer: route the peer-box sing-box logger into radiance's slog#481myleshorton wants to merge 1 commit into
myleshorton wants to merge 1 commit into
Conversation
The second sing-box instance the peer client spins up was constructed with a plain box.BaseContext() and no sing-box log factory registered. That means router / dial / outbound errors from the peer-box landed on the box's default stderr logger and never reached lantern.log — which made the recent SmC verify-failure incident (FD #174614) unnecessarily hard to triage. The verifier's CONNECT handler returned within 17 ms with no error log anywhere in the lantern logs; the "why did api.iantem.io fail to dial?" answer was just silently swallowed. Mirror what vpn/tunnel.go:141-142 already does for the main tunnel's box — register lblog.NewFactory(slog.Default().Handler()) as the sblog.Factory on the peer-box's context before NewServiceWithContext. sing-box logger output now flows through radiance's slog and into lantern.log alongside everything else. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR routes the peer client’s secondary sing-box instance logging through Radiance’s slog pipeline so peer-box router/dial/outbound errors reach lantern.log.
Changes:
- Adds sing-box service/log imports and lantern-box log factory import.
- Registers an
sblog.Factoryon the peer box context before creating the libbox service.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+624
to
+626
| // peer-share verify failure — which made FD #174614 unnecessarily | ||
| // hard to triage. Mirrors vpn/tunnel.go's registration for the | ||
| // main tunnel's box. |
| // hard to triage. Mirrors vpn/tunnel.go's registration for the | ||
| // main tunnel's box. | ||
| ctx := box.BaseContext() | ||
| service.MustRegister[sblog.Factory](ctx, lblog.NewFactory(slog.Default().Handler())) |
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.
Summary
The second sing-box instance the peer client spins up was constructed with a plain `box.BaseContext()` and no sing-box log factory registered. That means router / dial / outbound errors from the peer-box landed on the box's default stderr logger and never reached `lantern.log` — which made the SmC verify-failure incident triaged today unnecessarily hard.
We had:
The peer's sing-box outbound dial to `api.iantem.io` failed almost instantly — but with zero error log anywhere in either `lantern.log` or `lantern_macos.log`. The `i.logger.ErrorContext(ctx, err)` at `lantern-box/protocol/samizdat/inbound.go:178` would have caught the underlying error, but the peer-box's logger output goes to a default stderr destination instead of slog.
Change
Mirror what `vpn/tunnel.go:141-142` already does for the main tunnel's box — register `lblog.NewFactory(slog.Default().Handler())` as the `sblog.Factory` on the peer-box's context before `NewServiceWithContext`. sing-box logger output now flows through radiance's slog and into `lantern.log` alongside everything else.
Test plan
Stack note
Branched off `fisk/peer-connection-events` because the peer module lives there. Will rebase onto main once the peer module merges.
🤖 Generated with Claude Code