chore: rename client Listen to ConnectRPC (#11916)

ConnectRPC seems more appropriate for this function
This commit is contained in:
Spike Curtis
2024-02-01 14:44:11 +04:00
committed by GitHub
parent 1031ccb3c9
commit 1aa117b9ec
6 changed files with 16 additions and 17 deletions

View File

@ -171,9 +171,8 @@ func (c *Client) RewriteDERPMap(derpMap *tailcfg.DERPMap) {
}
}
// Listen connects to the workspace agent API WebSocket
// that handles connection negotiation.
func (c *Client) Listen(ctx context.Context) (drpc.Conn, error) {
// ConnectRPC connects to the workspace agent API and tailnet API
func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error) {
rpcURL, err := c.SDK.URL.Parse("/api/v2/workspaceagents/me/rpc")
if err != nil {
return nil, xerrors.Errorf("parse url: %w", err)
@ -210,7 +209,7 @@ func (c *Client) Listen(ctx context.Context) (drpc.Conn, error) {
netConn := &closeNetConn{
Conn: wsNetConn,
closeFunc: func() {
_ = conn.Close(websocket.StatusGoingAway, "Listen closed")
_ = conn.Close(websocket.StatusGoingAway, "ConnectRPC closed")
},
}
config := yamux.DefaultConfig()