chore: add Coder service prefix to tailnet (#14943)

re: #14715

This PR introduces the Coder service prefix: `fd60:627a:a42b::/48` and refactors our existing code as calling the Tailscale service prefix explicitly (rather than implicitly).

Removes the unused `Addresses` agent option. All clients today assume they can compute the Agent's IP address based on its UUID, so an agent started with a custom address would break things.
This commit is contained in:
Spike Curtis
2024-10-04 10:04:10 +04:00
committed by GitHub
parent 68ec532ca7
commit 7d9f5ab81d
16 changed files with 120 additions and 75 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ type AgentConnOptions struct {
}
func (c *AgentConn) agentAddress() netip.Addr {
return tailnet.IPFromUUID(c.opts.AgentID)
return tailnet.TailscaleServicePrefix.AddrFromUUID(c.opts.AgentID)
}
// AwaitReachable waits for the agent to be reachable.
+1 -1
View File
@@ -236,7 +236,7 @@ func (c *Client) DialAgent(dialCtx context.Context, agentID uuid.UUID, options *
CompressionMode: websocket.CompressionDisabled,
})
ip := tailnet.IP()
ip := tailnet.TailscaleServicePrefix.RandomAddr()
var header http.Header
if headerTransport, ok := c.client.HTTPClient.Transport.(*codersdk.HeaderTransport); ok {
header = headerTransport.Header