mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove legacy wsconncache (#11816)
Fixes #8218 Removes `wsconncache` and related "is legacy?" functions and API calls that were used by it. The only leftover is that Agents still use the legacy IP, so that back level clients or workspace proxies can dial them correctly. We should eventually remove this: #11819
This commit is contained in:
@@ -31,8 +31,8 @@ import (
|
||||
// client only dials a single agent at a time.
|
||||
//
|
||||
// Deprecated: use tailnet.IP() instead. This is kept for backwards
|
||||
// compatibility with wsconncache.
|
||||
// See: https://github.com/coder/coder/issues/8218
|
||||
// compatibility with outdated CLI clients and Workspace Proxies that dial it.
|
||||
// See: https://github.com/coder/coder/issues/11819
|
||||
var WorkspaceAgentIP = netip.MustParseAddr("fd7a:115c:a1e0:49d6:b259:b7ac:b1b2:48f4")
|
||||
|
||||
var ErrSkipClose = xerrors.New("skip tailnet close")
|
||||
@@ -149,16 +149,10 @@ type WorkspaceAgentConn struct {
|
||||
// @typescript-ignore WorkspaceAgentConnOptions
|
||||
type WorkspaceAgentConnOptions struct {
|
||||
AgentID uuid.UUID
|
||||
AgentIP netip.Addr
|
||||
CloseFunc func() error
|
||||
}
|
||||
|
||||
func (c *WorkspaceAgentConn) agentAddress() netip.Addr {
|
||||
var emptyIP netip.Addr
|
||||
if cmp := c.opts.AgentIP.Compare(emptyIP); cmp != 0 {
|
||||
return c.opts.AgentIP
|
||||
}
|
||||
|
||||
return tailnet.IPFromUUID(c.opts.AgentID)
|
||||
}
|
||||
|
||||
|
||||
@@ -345,11 +345,6 @@ func (c *Client) DialWorkspaceAgent(dialCtx context.Context, agentID uuid.UUID,
|
||||
|
||||
agentConn = NewWorkspaceAgentConn(conn, WorkspaceAgentConnOptions{
|
||||
AgentID: agentID,
|
||||
// Newer agents will listen on two IPs: WorkspaceAgentIP and an IP
|
||||
// derived from the agents UUID. We need to use the legacy
|
||||
// WorkspaceAgentIP here since we don't know if the agent is listening
|
||||
// on the new IP.
|
||||
AgentIP: WorkspaceAgentIP,
|
||||
CloseFunc: func() error {
|
||||
cancel()
|
||||
<-connector.closed
|
||||
|
||||
Reference in New Issue
Block a user