Commit e77b4d9
portforward: ManualForwarder.ExternalIP returns "" again
The original manualPortForwarder (introduced in b81b6b0) returned
"", nil from ExternalIP, leaning on lantern-cloud peer_handler's
"external_ip empty → use observed" fall-through to fill the IP from
the /v1/peer/register call's RemoteAddr. The refactor into
portforward.ManualForwarder regressed this path by actively probing
publicip.Detect, which fails on the only deployment where it
matters: machines with Lantern's own VPN tunnel up.
When the tunnel is up, outbound traffic routes through it. The
publicip discovery endpoints (api.iantem.io etc) either time out or
return the tunnel exit's IP rather than the user's WAN IP — neither
is what we want. Worse, the failure surfaces as a hard error so
peer.Client.Start aborts before /v1/peer/register is even called,
breaking peer-share for every user with a manual port + an active
tunnel.
Empty is also more correct: peer_handler uses the IP that will
actually receive inbound traffic on the manually-forwarded port (the
register-call's RemoteAddr), which is by definition the right answer.
Add a regression test pinning the empty-string contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b36b61a commit e77b4d9
2 files changed
Lines changed: 27 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 7 | | |
11 | 8 | | |
12 | 9 | | |
| |||
78 | 75 | | |
79 | 76 | | |
80 | 77 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
100 | 88 | | |
101 | 89 | | |
102 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
75 | 92 | | |
76 | 93 | | |
77 | 94 | | |
| |||
0 commit comments