Documentation
¶
Overview ¶
Package relayclient talks to the relay control plane: it creates a session over REST and dials the runner WebSocket. It carries no terminal IO and knows nothing about the end-to-end keys — the relay is untrusted, so this is deliberately thin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client targets one relay origin (e.g. https://relay.example.com).
func New ¶
New parses the relay base URL. Plain http:// is allowed only to a loopback host (local development); for any other host it requires https unless allowInsecure is set, since the relay delivers executable viewer code and the secret rides in a fragment the browser refuses to use over an insecure non-local context.
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, id, runnerToken string, ttl time.Duration) (*Session, error)
CreateSession registers the runner-chosen session id + token with the relay, or re-claims them after a node loss. The runner generates both so the SAME session can be re-established on any relay node. Returns the relay's view (the assigned expiry).
func (*Client) DialRunner ¶
DialRunner opens the privileged runner WebSocket. A 401/404 handshake response is returned as *FatalDialError; other failures are transient and worth retrying.
type FatalDialError ¶
type FatalDialError struct {
Status int
}
FatalDialError marks a handshake rejection the runner should not retry: the session is unknown/expired (404) or the runner token is wrong (401).
func (*FatalDialError) Error ¶
func (e *FatalDialError) Error() string
func (*FatalDialError) NotFound ¶
func (e *FatalDialError) NotFound() bool
NotFound reports whether the relay had no such session (404). Unlike a 401 token rejection, this is recoverable: the runner can re-create the same id+token (e.g. after the relay node was replaced in a deploy) and keep relaying.