ipn: allow FQDN in exit node selection

To match the format of exit node suggestions and ensure that the result
is not ambiguous, relax exit node CLI selection to permit using a FQDN
including the trailing dot.

Updates #12618

Change-Id: I04b9b36d2743154aa42f2789149b2733f8555d3f
Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
This commit is contained in:
Adrian Dewhurst
2024-07-15 11:13:11 -04:00
committed by Adrian Dewhurst
parent fec41e4904
commit 0834712c91
3 changed files with 31 additions and 3 deletions

View File

@ -810,7 +810,7 @@ func exitNodeIPOfArg(s string, st *ipnstate.Status) (ip netip.Addr, err error) {
match := 0
for _, ps := range st.Peer {
baseName := dnsname.TrimSuffix(ps.DNSName, st.MagicDNSSuffix)
if !strings.EqualFold(s, baseName) {
if !strings.EqualFold(s, baseName) && !strings.EqualFold(s, ps.DNSName) {
continue
}
match++