integration/tsic: add WithDERPOverHTTP for the non-TLS embedded DERP

Sets TS_DEBUG_DERP_WS_CLIENT + TS_DEBUG_USE_DERP_HTTP so a client can reach hsic's plain-HTTP embedded DERP over websockets; the counterpart to hsic.WithoutTLS.
This commit is contained in:
Kristoffer Dalby
2026-06-26 13:16:43 +00:00
parent 1867213b69
commit a4ec76605e
+19
View File
@@ -98,6 +98,7 @@ type TailscaleInContainer struct {
caCerts [][]byte
headscaleHostname string
withWebsocketDERP bool
withDERPOverHTTP bool
withSSH bool
withTags []string
withEntrypoint []string
@@ -160,6 +161,18 @@ func WithWebsocketDERP(enabled bool) Option {
}
}
// WithDERPOverHTTP makes the client reach the DERP server over plain-HTTP
// websockets (TS_DEBUG_DERP_WS_CLIENT + TS_DEBUG_USE_DERP_HTTP). It is the
// counterpart to [hsic.WithoutTLS]: a Headscale serving its embedded DERP without
// TLS is otherwise unreachable, because the client defaults to dialing DERP over
// HTTPS.
func WithDERPOverHTTP() Option {
return func(tsic *TailscaleInContainer) {
tsic.withWebsocketDERP = true
tsic.withDERPOverHTTP = true
}
}
// WithSSH enables SSH for the Tailscale instance.
func WithSSH() Option {
return func(tsic *TailscaleInContainer) {
@@ -372,6 +385,12 @@ func New(
tailscaleOptions.Env,
fmt.Sprintf("TS_DEBUG_DERP_WS_CLIENT=%t", tsic.withWebsocketDERP),
)
// Plain-HTTP DERP additionally needs the client to dial http:// instead of
// the default https://; see [WithDERPOverHTTP].
if tsic.withDERPOverHTTP {
tailscaleOptions.Env = append(tailscaleOptions.Env, "TS_DEBUG_USE_DERP_HTTP=true")
}
}
tailscaleOptions.ExtraHosts = append(tailscaleOptions.ExtraHosts,