From 68df19ae1347a2b22cbbd0c8e78d38ccaf95bafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 27 Mar 2025 21:54:30 +0800 Subject: [PATCH] Fix tailscale dialer --- protocol/tailscale/endpoint.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/protocol/tailscale/endpoint.go b/protocol/tailscale/endpoint.go index f24f931f..5a0731f7 100644 --- a/protocol/tailscale/endpoint.go +++ b/protocol/tailscale/endpoint.go @@ -2,8 +2,10 @@ package tailscale import ( "context" + "crypto/tls" "fmt" "net" + "net/http" "net/netip" "net/url" "os" @@ -212,6 +214,18 @@ func (t *Endpoint) Start(stage adapter.StartStage) error { t.stack = ipStack localBackend := t.server.ExportLocalBackend() + localBackend.SetHTTPTestClient(&http.Client{ + Transport: &http.Transport{ + ForceAttemptHTTP2: true, + DialContext: func(ctx context.Context, network, address string) (net.Conn, error) { + return t.server.Dialer.DialContext(ctx, network, M.ParseSocksaddr(address)) + }, + TLSClientConfig: &tls.Config{ + RootCAs: adapter.RootPoolFromContext(t.ctx), + }, + }, + }) + perfs := &ipn.MaskedPrefs{ ExitNodeIPSet: true, AdvertiseRoutesSet: true,