mirror of
https://github.com/tale/headplane.git
synced 2026-07-26 07:48:14 +00:00
fix(wasm): account for custom DERP ports when checking the probe
Closes HP-540
This commit is contained in:
@@ -138,8 +138,8 @@ build_wasm() {
|
|||||||
"$(dirname "$WASM_OUTPUT")/wasm_exec.js"
|
"$(dirname "$WASM_OUTPUT")/wasm_exec.js"
|
||||||
|
|
||||||
# Vendor dependencies and apply the DERP port patch.
|
# Vendor dependencies and apply the DERP port patch.
|
||||||
# Tailscale's derphttp WebSocket URL builder ignores DERPPort,
|
# Tailscale's browser WebSocket and netcheck URL builders ignore
|
||||||
# which breaks WASM connections to non-443 DERP servers.
|
# DERPPort, which breaks WASM connections to non-443 DERP servers.
|
||||||
echo "==> Vendoring Go dependencies for WASM patch"
|
echo "==> Vendoring Go dependencies for WASM patch"
|
||||||
go mod vendor
|
go mod vendor
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Fix DERP WebSocket URL to include non-standard ports.
|
Fix DERP browser URLs to include non-standard ports.
|
||||||
|
|
||||||
Tailscale's derphttp client ignores DERPPort when building WebSocket
|
Tailscale's browser DERP paths ignore DERPPort when building WebSocket
|
||||||
URLs, causing connections to fail when DERP servers run on non-443
|
and HTTP-only netcheck probe URLs, causing connections to fail when DERP
|
||||||
ports (e.g. :8443). The TCP dial path correctly handles DERPPort
|
servers run on non-443 ports (e.g. :8443). The TCP dial path correctly
|
||||||
but the WebSocket path (used in WASM/browser builds) does not.
|
handles DERPPort but the browser paths used by WASM builds do not.
|
||||||
|
|
||||||
--- a/derp/derphttp/derphttp_client.go
|
--- a/derp/derphttp/derphttp_client.go
|
||||||
+++ b/derp/derphttp/derphttp_client.go
|
+++ b/derp/derphttp/derphttp_client.go
|
||||||
@@ -28,3 +28,19 @@ but the WebSocket path (used in WASM/browser builds) does not.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddressFamilySelector decides whether IPv6 is preferred for
|
// AddressFamilySelector decides whether IPv6 is preferred for
|
||||||
|
|
||||||
|
--- a/net/netcheck/netcheck.go
|
||||||
|
+++ b/net/netcheck/netcheck.go
|
||||||
|
@@ -1103,7 +1103,11 @@
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
node := rg.Nodes[0]
|
||||||
|
- req, _ := http.NewRequestWithContext(ctx, "HEAD", "https://"+node.HostName+"/derp/probe", nil)
|
||||||
|
+ host := node.HostName
|
||||||
|
+ if node.DERPPort != 0 {
|
||||||
|
+ host = net.JoinHostPort(node.HostName, fmt.Sprint(node.DERPPort))
|
||||||
|
+ }
|
||||||
|
+ req, _ := http.NewRequestWithContext(ctx, "HEAD", "https://"+host+"/derp/probe", nil)
|
||||||
|
// One warm-up one to get HTTP connection set
|
||||||
|
// up and get a connection from the browser's
|
||||||
|
// pool.
|
||||||
|
|||||||
Reference in New Issue
Block a user