Documentation
¶
Index ¶
- Constants
- func Bicopy(ctx context.Context, c1, c2 io.ReadWriteCloser)
- func ExpandRelativeHomePath(in string) (string, error)
- func New(options Options) io.Closer
- type Conn
- type CoordinatorDialer
- type FetchMetadata
- type Metadata
- type Options
- type ReconnectingPTYRequest
- type Stats
- type StatsReporter
- type TailnetConn
- func (c *TailnetConn) Close() error
- func (c *TailnetConn) CloseWithError(_ error) error
- func (c *TailnetConn) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
- func (c *TailnetConn) Ping() (time.Duration, error)
- func (c *TailnetConn) ReconnectingPTY(id string, height, width uint16, command string) (net.Conn, error)
- func (c *TailnetConn) SSH() (net.Conn, error)
- func (c *TailnetConn) SSHClient() (*ssh.Client, error)
- func (c *TailnetConn) Speedtest(direction speedtest.Direction, duration time.Duration) ([]speedtest.Result, error)
- type WebRTCConn
- func (c *WebRTCConn) Close() error
- func (c *WebRTCConn) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
- func (c *WebRTCConn) ReconnectingPTY(id string, height, width uint16, command string) (net.Conn, error)
- func (c *WebRTCConn) SSH() (net.Conn, error)
- func (c *WebRTCConn) SSHClient() (*ssh.Client, error)
- func (*WebRTCConn) Speedtest(_ speedtest.Direction, _ time.Duration) ([]speedtest.Result, error)
- type WebRTCDialer
Constants ¶
const ( ProtocolReconnectingPTY = "reconnecting-pty" ProtocolSSH = "ssh" ProtocolDial = "dial" // MagicSessionErrorCode indicates that something went wrong with the session, rather than the // command just returning a nonzero exit code, and is chosen as an arbitrary, high number // unlikely to shadow other exit codes, which are typically 1, 2, 3, etc. MagicSessionErrorCode = 229 )
Variables ¶
This section is empty.
Functions ¶
func Bicopy ¶ added in v0.5.11
func Bicopy(ctx context.Context, c1, c2 io.ReadWriteCloser)
Bicopy copies all of the data between the two connections and will close them after one or both of them are done writing. If the context is canceled, both of the connections will be closed.
func ExpandRelativeHomePath ¶ added in v0.5.11
ExpandRelativeHomePath expands the tilde at the beginning of a path to the current user's home directory and returns a full absolute path.
Types ¶
type Conn ¶
type Conn interface { io.Closer Closed() <-chan struct{} Ping() (time.Duration, error) CloseWithError(err error) error ReconnectingPTY(id string, height, width uint16, command string) (net.Conn, error) SSH() (net.Conn, error) Speedtest(direction speedtest.Direction, duration time.Duration) ([]speedtest.Result, error) SSHClient() (*ssh.Client, error) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) }
Conn is a temporary interface while we switch from WebRTC to Wireguard networking.
type CoordinatorDialer ¶ added in v0.8.11
CoordinatorDialer is a function that constructs a new broker. A dialer must be passed in to allow for reconnects.
type FetchMetadata ¶ added in v0.8.11
FetchMetadata is a function to obtain metadata for the agent.
type Options ¶
type Options struct { CoordinatorDialer CoordinatorDialer WebRTCDialer WebRTCDialer FetchMetadata FetchMetadata StatsReporter StatsReporter ReconnectingPTYTimeout time.Duration EnvironmentVariables map[string]string Logger slog.Logger }
type ReconnectingPTYRequest ¶ added in v0.5.2
type ReconnectingPTYRequest struct { Data string `json:"data"` Height uint16 `json:"height"` Width uint16 `json:"width"` }
ReconnectingPTYRequest is sent from the client to the server to pipe data to a PTY.
type Stats ¶ added in v0.8.12
type Stats struct { NumConns int64 `json:"num_comms"` RxBytes int64 `json:"rx_bytes"` TxBytes int64 `json:"tx_bytes"` }
Stats records the Agent's network connection statistics for use in user-facing metrics and debugging. Each member value must be written and read with atomic.
type StatsReporter ¶ added in v0.8.12
type StatsReporter func( ctx context.Context, log slog.Logger, stats func() *Stats, ) (io.Closer, error)
StatsReporter periodically accept and records agent stats.
type TailnetConn ¶ added in v0.8.11
func (*TailnetConn) Close ¶ added in v0.8.11
func (c *TailnetConn) Close() error
func (*TailnetConn) CloseWithError ¶ added in v0.8.11
func (c *TailnetConn) CloseWithError(_ error) error
func (*TailnetConn) DialContext ¶ added in v0.8.11
func (*TailnetConn) ReconnectingPTY ¶ added in v0.8.11
type WebRTCConn ¶ added in v0.8.11
type WebRTCConn struct { // Negotiator is responsible for exchanging messages. Negotiator proto.DRPCPeerBrokerClient *peer.Conn }
Conn wraps a peer connection with helper functions to communicate with the agent.
func (*WebRTCConn) Close ¶ added in v0.8.11
func (c *WebRTCConn) Close() error
func (*WebRTCConn) DialContext ¶ added in v0.8.11
func (c *WebRTCConn) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
DialContext dials an arbitrary protocol+address from inside the workspace and proxies it through the provided net.Conn.
func (*WebRTCConn) ReconnectingPTY ¶ added in v0.8.11
func (c *WebRTCConn) ReconnectingPTY(id string, height, width uint16, command string) (net.Conn, error)
ReconnectingPTY returns a connection serving a TTY that can be reconnected to via ID.
The command is optional and defaults to start a shell.
func (*WebRTCConn) SSH ¶ added in v0.8.11
func (c *WebRTCConn) SSH() (net.Conn, error)
SSH dials the built-in SSH server.