Documentation
¶
Overview ¶
Package wsconncache caches workspace agent connections by UUID. Deprecated: Use ServerTailnet instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentProvider ¶ added in v0.26.2
type AgentProvider struct {
Cache *Cache
}
func (*AgentProvider) AgentConn ¶ added in v0.26.2
func (a *AgentProvider) AgentConn(_ context.Context, agentID uuid.UUID) (*codersdk.WorkspaceAgentConn, func(), error)
func (*AgentProvider) Close ¶ added in v0.26.2
func (a *AgentProvider) Close() error
func (*AgentProvider) ReverseProxy ¶ added in v0.26.2
func (a *AgentProvider) ReverseProxy(targetURL *url.URL, dashboardURL *url.URL, agentID uuid.UUID) (*httputil.ReverseProxy, func(), error)
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func New
deprecated
New creates a new workspace connection cache that closes connections after the inactive timeout provided.
Agent connections are cached due to Wireguard negotiation taking a few hundred milliseconds, depending on latency.
Deprecated: Use coderd.NewServerTailnet instead. wsconncache is being phased out because it creates a unique Tailnet for each agent. See: https://github.com/coder/coder/issues/8218
func (*Cache) Acquire ¶
Acquire gets or establishes a connection with the dialer using the ID provided. If a connection is in-progress, that connection or error will be returned.
The returned function is used to release a lock on the connection. Once zero locks exist on a connection, the inactive timeout will begin to tick down. After the time expires, the connection will be cleared from the cache.
type Conn ¶
type Conn struct { *codersdk.WorkspaceAgentConn // contains filtered or unexported fields }
Conn wraps an agent connection with a reusable HTTP transport.
func (*Conn) Close ¶ added in v0.16.0
Close ends the HTTP transport if exists, and closes the agent.