SSHOnPort pipes the SSH protocol over the returned net.Conn. This connects to the built-in SSH server in the workspace agent on the specified port.
(ctx context.Context, port uint16)
| 286 | // SSHOnPort pipes the SSH protocol over the returned net.Conn. |
| 287 | // This connects to the built-in SSH server in the workspace agent on the specified port. |
| 288 | func (c *agentConn) SSHOnPort(ctx context.Context, port uint16) (*gonet.TCPConn, error) { |
| 289 | ctx, span := tracing.StartSpan(ctx) |
| 290 | defer span.End() |
| 291 | |
| 292 | if !c.AwaitReachable(ctx) { |
| 293 | return nil, xerrors.Errorf("workspace agent not reachable in time: %v", ctx.Err()) |
| 294 | } |
| 295 | |
| 296 | c.SendConnectedTelemetry(c.agentAddress(), tailnet.TelemetryApplicationSSH) |
| 297 | return c.DialContextTCP(ctx, netip.AddrPortFrom(c.agentAddress(), port)) |
| 298 | } |
| 299 | |
| 300 | // SSHClient calls SSH to create a client |
| 301 | func (c *agentConn) SSHClient(ctx context.Context) (*ssh.Client, error) { |
no test coverage detected