Skip to content

feat: allow DERP headers to be set #6572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clone DERP header on client create
  • Loading branch information
kylecarbs committed Mar 21, 2023
commit 2e81ac62d577900b63643b70c9b977010b5fd89c
1 change: 0 additions & 1 deletion cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ func createUnauthenticatedClient(cmd *cobra.Command, serverURL *url.URL) (*coder

client.HTTPClient.Transport = transport
client.DERPHeader = &http.Header{}

for header, value := range transport.headers {
client.DERPHeader.Set(header, value)
}
Expand Down
3 changes: 2 additions & 1 deletion codersdk/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,11 @@ func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, opti
}

ip := tailnet.IP()
header := c.DERPHeader.Clone()
conn, err := tailnet.NewConn(&tailnet.Options{
Addresses: []netip.Prefix{netip.PrefixFrom(ip, 128)},
DERPMap: connInfo.DERPMap,
DERPHeader: c.DERPHeader,
DERPHeader: &header,
Logger: options.Logger,
BlockEndpoints: options.BlockEndpoints,
})
Expand Down