feat: allow DERP headers to be set (#6572)

* feat: allow DERP headers to be set

* chore: remove custom flag

* Clone DERP header on client create

* Adjust to use interface to cast headers

---------

Co-authored-by: Kyle Carberry <kyle@carberry.com>
This commit is contained in:
Josh Vawdrey
2023-03-21 18:43:20 +00:00
committed by GitHub
co-authored by Kyle Carberry
parent d8aee26776
commit 97f77c4507
4 changed files with 30 additions and 11 deletions
+8
View File
@@ -143,9 +143,17 @@ func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, opti
}
ip := tailnet.IP()
var header http.Header
headerTransport, ok := c.HTTPClient.Transport.(interface {
Header() http.Header
})
if ok {
header = headerTransport.Header()
}
conn, err := tailnet.NewConn(&tailnet.Options{
Addresses: []netip.Prefix{netip.PrefixFrom(ip, 128)},
DERPMap: connInfo.DERPMap,
DERPHeader: &header,
Logger: options.Logger,
BlockEndpoints: options.BlockEndpoints,
})