Versions in this module Expand all Collapse all v0 v0.1.0 Sep 14, 2026 Changes in this version + const AllPortsSentinel + const DefaultAPIBaseURL + const DefaultClusterID + const DefaultGatewayAddr + const DefaultGatewayHost + var ErrDuplicateHost = errors.New("host already connected for this tunnel") + var ErrInvalidPort = errors.New("invalid port number: must be 1-65535") + var ErrInvalidProtocol = errors.New("invalid protocol: must be http, https, or auto") + var ErrInvalidScope = errors.New("invalid token scope: must be host or connect") + var ErrInvalidTunnelDescription = errors.New(...) + var ErrInvalidTunnelID = errors.New("invalid tunnel ID: must be 8 chars of lowercase letters and digits 2-7") + var ErrMissingAPIKey = errors.New("missing API key: set it via Config.APIKey or HW_API_KEY env var") + var ErrQuotaExceeded = errors.New("account quota exceeded") + var ErrTunnelNotFound = errors.New("tunnel not found") + func IsAPIError(err error) (code string, ok bool) + type APIError struct + Code string + Message string + func (e *APIError) Error() string + type Client struct + func NewClient(cfg Config) (*Client, error) + func (c *Client) Connect(ctx context.Context, cfg ConnectConfig) error + func (c *Client) CreatePort(ctx context.Context, tunnelID string, port int, protocol string, ...) error + func (c *Client) CreateTunnel(ctx context.Context, name, description string, expiration *int) (*Tunnel, error) + func (c *Client) DeleteAllTunnels(ctx context.Context) error + func (c *Client) DeletePort(ctx context.Context, tunnelID string, port int) error + func (c *Client) DeleteTunnel(ctx context.Context, tunnelID string) error + func (c *Client) GetLimits(ctx context.Context) (*Limits, error) + func (c *Client) Host(ctx context.Context, cfg HostConfig) error + func (c *Client) IssueToken(ctx context.Context, tunnelID, scope string) (*TunnelToken, error) + func (c *Client) ListPorts(ctx context.Context, tunnelID string) ([]Port, error) + func (c *Client) ListTunnels(ctx context.Context) ([]Tunnel, error) + func (c *Client) ShowPort(ctx context.Context, tunnelID string, port int) (*Port, error) + func (c *Client) ShowTunnel(ctx context.Context, tunnelID string) (*TunnelDetail, error) + func (c *Client) UpdatePort(ctx context.Context, tunnelID string, port int, allowAnonymous *bool) error + func (c *Client) UpdateTunnel(ctx context.Context, tunnelID string, name, description *string, ...) error + type Config struct + APIBaseURL string + APIKey string + GatewayAddr string + GatewayHost string + HTTPClient *http.Client + StatusWriter io.Writer + type ConnectConfig struct + APIKey string + JWTToken string + LocalIP string + OnReady func(forwardings []Forwarding) + Ports []int + TunnelID string + type Forwarding struct + LocalIP string + LocalPort int + RemotePort int + type HostConfig struct + APIKey string + JWTToken string + OnReady func(ports []int) + Ports []int + TunnelID string + type HostResult struct + Ports []int + TunnelID string + TunnelURL string + type Limits struct + ActiveTunnels int64 + MaxConnectionsPerPort int32 + MaxHTTPRequestsPerMinutePerPort int32 + MaxHostsPerTunnel int32 + MaxPortsPerTunnel int32 + MaxTunnelBandwidthBytesPerSecond int64 + MaxTunnels int32 + QuotaBytes int64 + RemainingBytes int64 + ResetAt int64 + type Port struct + AllowAnonymous bool + Port int32 + Protocol string + TunnelID string + type Tunnel struct + Description string + ExpirationHours int + ID string + Name string + PortCount int + TunnelExpiration uint32 + type TunnelDetail struct + Description string + ID string + Name string + Status *TunnelStatus + TunnelExpiration uint32 + type TunnelStatus struct + ClientConnectionCount int + HostConnectionCount int + TotalDownloadBytes int64 + TotalUploadBytes int64 + type TunnelToken struct + Scope string + Token string + TunnelID string v0.0.1-test.1 Sep 14, 2026