Commit eb55d0f
peer/portforward: address Copilot review on #503 (round 2)
portforward/manual.go:
- ManualForwarder.MapPort now sets Protocol="TCP" to match the
UPnP-based Forwarder, which hard-codes the same value. Samizdat-in
inbound traffic is TCP-only on both code paths; widening to UDP
later means widening both forwarders together.
- Defensive guard: MapPort returns an error when constructed with
port==0. pickManualForwarder already range-checks 1..65535 before
calling NewManualForwarder, but the check belongs on the type
itself — a caller that bypasses the validator (programmatic use,
tests, future code paths) gets a clear error instead of silently
registering port 0 with lantern-cloud.
portforward/manual_test.go:
- Asserts Protocol="TCP" in TestManualForwarder.
- TestManualForwarder_RejectsZeroPort verifies the new guard.
peer/peer.go:
- slog warning in the env-var path used 'error' as the attribute
key while every other log line in this file uses 'err'. Renamed
for log-aggregation consistency.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 7f8224d commit eb55d0f
3 files changed
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
650 | | - | |
| 650 | + | |
651 | 651 | | |
652 | 652 | | |
653 | 653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
50 | 60 | | |
51 | 61 | | |
52 | 62 | | |
| 63 | + | |
53 | 64 | | |
54 | 65 | | |
55 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments