client

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package client implements the rift tunnel client.

Index

Constants

This section is empty.

Variables

View Source
var ErrMCPNotCompiled = errors.New("MCP support not compiled in; rebuild with -tags mcp")

ErrMCPNotCompiled is returned when the binary was built without the `mcp` build tag and the user requests Protocol=mcp at runtime. Rebuild with `go build -tags mcp` to enable the MCP wire protocol.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client connects to a rift server and manages tunnel registration.

func New

func New(cfg config.ClientConfig, ts store.TokenStore, log *zap.Logger) *Client

New creates a Client.

func (*Client) Close added in v0.1.0

func (c *Client) Close() error

Close cancels an in-flight Connect and waits for it to return. Idempotent; subsequent calls return nil without blocking. Safe to call before Connect.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect dials the server and reconnects with exponential backoff until ctx is done. Returns a non-nil error only for permanent server errors (auth failure, rate limit, token expired) that retrying will not fix, or the parent ctx error (context.Canceled / context.DeadlineExceeded) when the parent ctx caused the exit. Returns nil only when Close was the cause of exit.

When the parent ctx expires while the most recent dial attempt failed (typically TLS verification or a refused connection), the returned error joins the parent ctx error with the last connection error so callers can inspect both via errors.Is.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL