tailscale/ipn/localapi
Brad Fitzpatrick 0e10a3f580 net/tsdial, ipn/localapi, client/local: let clients dial non-Tailscale addresses directly
Add a tsdial.Dialer.UserDialPlan method that resolves an address and
reports whether the dialer would route it via Tailscale. The LocalAPI
/dial handler now uses this to skip proxying for addresses that aren't
Tailscale routes (e.g. localhost), returning a Dial-Self response with
the resolved address so the client can dial it directly. This avoids
an unnecessary round-trip through the daemon for local connections.

The client's UserDial handles the new response by dialing the resolved
address itself, and the server passes the pre-resolved IP:port for
Tailscale dials to avoid redundant DNS lookups.

Thanks to giacomo and Moyao for pointing this out!

Updates tailscale/corp#39702

Change-Id: I78d640f11ccd92f43ddd505cbb0db8fee19f43a6
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2026-04-27 09:33:27 -07:00
..
cert.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
debug.go client,cmd/tailscale,ipn/{ipnlocal,localapi}: add debug CLI command to clear netmap caches (#19213) 2026-04-02 12:06:39 -07:00
debugderp.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
disabled_stubs.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
localapi_drive.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
localapi_test.go net/tsdial, ipn/localapi, client/local: let clients dial non-Tailscale addresses directly 2026-04-27 09:33:27 -07:00
localapi.go net/tsdial, ipn/localapi, client/local: let clients dial non-Tailscale addresses directly 2026-04-27 09:33:27 -07:00
pprof.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
serve.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
syspolicy_api.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
tailnetlock.go ipn,tka: improve Tailnet Lock logs 2026-04-01 17:08:12 +01:00