Documentation
¶
Index ¶
- Constants
- func DefaultProfileDir(lookupEnv func(string) (string, bool)) (string, error)
- func EnvProxyConfigured(lookupEnv func(string) (string, bool)) bool
- func NormalizeControlPlaneURLPath(raw string) (string, error)
- func ProfilePath(name string, explicitDir string, lookupEnv func(string) (string, bool)) (string, string, error)
- func ProxyLogFields(proxyURL *url.URL, source ProxySource) []any
- func RedactProxyURL(proxyURL *url.URL) string
- func RegisterAdminFlags(fs *pflag.FlagSet)
- func RegisterFlags(fs *pflag.FlagSet)
- func ResolveControlPlanePath(baseURL *url.URL, urlPath, routePath string) *url.URL
- func ResolveProfileDir(explicitDir string, lookupEnv func(string) (string, bool)) (string, error)
- func ValidateProfileBytes(path string, data []byte) error
- func ValidateProfileFile(path string) error
- func ValidateProfileName(name string) error
- func ValidateTunnelID(tunnelID string) error
- func WriteUsage(fs *pflag.FlagSet, w io.Writer)
- type AdminConfig
- type AdminUIConfig
- type Config
- type ConfigSource
- type ControlPlaneConfig
- type HarpoonConfig
- type HarpoonHostClassifierConfig
- type HarpoonTarget
- type HarpoonTransportKind
- type HealthConfig
- type LogFormat
- type LoggingConfig
- type MCPChannelBinding
- type MCPConfig
- type MCPTransportKind
- type ProcessConfig
- type ProxyHealthConfig
- type ProxySource
- type RuntimeConfig
Constants ¶
const ( DefaultHarpoonMaxResponseBytes = 100 * 1024 DefaultHarpoonMaxRedirects = 5 )
const ( ProfileEnvName = "TUNNEL_CLIENT_PROFILE" ProfileFileEnvName = "TUNNEL_CLIENT_PROFILE_FILE" ProfileDirEnvName = "TUNNEL_CLIENT_PROFILE_DIR" ConfigEnvName = "TUNNEL_CLIENT_CONFIG" )
Variables ¶
This section is empty.
Functions ¶
func DefaultProfileDir ¶
DefaultProfileDir returns the XDG-backed default profile directory.
func NormalizeControlPlaneURLPath ¶
NormalizeControlPlaneURLPath validates and normalizes the optional control-plane URL prefix.
func ProfilePath ¶
func ProfilePath(name string, explicitDir string, lookupEnv func(string) (string, bool)) (string, string, error)
ProfilePath returns the on-disk path for a named profile.
func ProxyLogFields ¶
func ProxyLogFields(proxyURL *url.URL, source ProxySource) []any
ProxyLogFields builds log fields for proxy metadata, redacting credentials.
func RedactProxyURL ¶
func RegisterAdminFlags ¶
RegisterAdminFlags attaches admin/tunnel-management flags to the provided flag set.
func RegisterFlags ¶
RegisterFlags attaches all supported CLI flags to the provided flag set.
func ResolveControlPlanePath ¶
ResolveControlPlanePath resolves routePath from the control-plane host root plus urlPath.
func ResolveProfileDir ¶
ResolveProfileDir returns the directory used to store named profile files.
func ValidateProfileBytes ¶
ValidateProfileBytes parses profile contents without resolving referenced secrets.
func ValidateProfileFile ¶
ValidateProfileFile parses a profile file without resolving referenced secrets.
func ValidateProfileName ¶
ValidateProfileName verifies that name can be mapped to exactly one YAML file.
func ValidateTunnelID ¶
ValidateTunnelID verifies that the tunnel id matches the runtime contract.
Types ¶
type AdminConfig ¶
type AdminConfig struct {
BaseURL *url.URL
URLPath string
AdminKey string
OrganizationIDs []string
WorkspaceIDs []string
TLS *tlsconfig.Bundle
}
AdminConfig captures the options required for tunnel management API calls.
The admin CLI surface is intentionally narrower than the runtime client configuration: it only needs a base URL, an admin API key, and the scoped organization/workspace headers required by the control plane.
func LoadAdminConfig ¶
func LoadAdminConfig(fs *pflag.FlagSet, lookupEnv func(string) (string, bool)) (*AdminConfig, error)
LoadAdminConfig builds an AdminConfig from the provided flag set and environment.
It enforces that an admin API key is present and that at least one of organization_id or workspace_id is supplied to scope the request context.
type AdminUIConfig ¶
type AdminUIConfig struct {
// AllowRemote controls whether the embedded web UI and log endpoints are
// accessible from non-loopback clients.
//
// When false, the UI endpoints only respond to loopback requests (127.0.0.1/::1),
// even if the health server is bound to 0.0.0.0/::.
AllowRemote bool
// OpenBrowser controls whether tunnel-client attempts to open the embedded UI
// in the default browser on startup.
OpenBrowser bool
// LogBufferEvents controls how many recent log events the admin UI keeps in memory.
LogBufferEvents int
}
AdminUIConfig defines runtime behavior for the embedded admin web UI.
type Config ¶
type Config struct {
ControlPlane ControlPlaneConfig
Logging LoggingConfig
Health HealthConfig
Process ProcessConfig
MCP MCPConfig
AdminUI AdminUIConfig
Harpoon HarpoonConfig
ProxyHealth ProxyHealthConfig
TLS *tlsconfig.Bundle
Runtime RuntimeConfig
}
Config captures the runtime values required to start the tunnel client.
func Load ¶
Load builds a Config by combining CLI flag arguments with environment variables.
Flags take precedence over environment variables. Environment variables take precedence over the built-in defaults.
func LoadFromFlagSet ¶
LoadFromFlagSet builds a Config using the parsed values from the provided flag set.
It respects the same precedence rules as Load(): flags override environment variables, which override defaults.
type ConfigSource ¶
type ConfigSource struct {
Path string
ProfileName string
ProfilePath string
ProfileDir string
ProfileFile bool
}
ConfigSource describes the config file selected for this process.
func ResolveConfigSource ¶
func ResolveConfigSource(fs *pflag.FlagSet, lookupEnv func(string) (string, bool)) (ConfigSource, error)
ResolveConfigSource returns the config file selected by flags or environment.
type ControlPlaneConfig ¶
type ControlPlaneConfig struct {
BaseURL *url.URL
UnixSocketPath string
URLPath string
TunnelID types.TunnelID
OrganizationID string
APIKey string
MaxInFlightRequests int
PollTimeout time.Duration
PollDeadlineGuardrail time.Duration
// PollBackoffMin/PollBackoffMax allow overriding the poller's retry window.
// Zero values fall back to the internal defaults.
PollBackoffMin time.Duration
PollBackoffMax time.Duration
ClientCertificate *tlsconfig.ClientCertificate
ExtraHeaders map[string]string
HTTPProxy *url.URL
HTTPProxySource ProxySource
}
ControlPlaneConfig defines how the client reaches the tunnel control plane.
func (ControlPlaneConfig) PollDeadlineGuardrailOrDefault ¶
func (c ControlPlaneConfig) PollDeadlineGuardrailOrDefault() time.Duration
PollDeadlineGuardrailOrDefault returns the configured client deadline guardrail or its runtime default.
func (ControlPlaneConfig) PollDeadlineTimeoutOrDefault ¶
func (c ControlPlaneConfig) PollDeadlineTimeoutOrDefault() time.Duration
PollDeadlineTimeoutOrDefault returns the client HTTP/context deadline for one poll cycle.
func (ControlPlaneConfig) PollTimeoutOrDefault ¶
func (c ControlPlaneConfig) PollTimeoutOrDefault() time.Duration
PollTimeoutOrDefault returns the configured requested service wait or its runtime default.
type HarpoonConfig ¶
type HarpoonConfig struct {
AllowPlaintextHTTP bool
MaxResponseBytes int
MaxRedirects int
AdditionalTransports []HarpoonTransportKind
Targets []HarpoonTarget
CapturePayloads bool
HostClassifier HarpoonHostClassifierConfig
HTTPProxy *url.URL
HTTPProxySource ProxySource
}
HarpoonConfig captures configuration for the embedded harpoon MCP server.
func (HarpoonConfig) AdditionalTransportEnabled ¶
func (h HarpoonConfig) AdditionalTransportEnabled(kind HarpoonTransportKind) bool
AdditionalTransportEnabled reports whether a transport is enabled.
type HarpoonHostClassifierConfig ¶
type HarpoonHostClassifierConfig struct {
IncludeSuffix []string
IncludeRegex []string
IncludeLoopback bool
IncludePrivate bool
}
HarpoonHostClassifierConfig controls which hosts are treated as private.
type HarpoonTarget ¶
type HarpoonTarget struct {
Label string
Description string
BaseURL *url.URL
UnixSocketPath string
}
HarpoonTarget describes a configured harpoon target.
type HarpoonTransportKind ¶
type HarpoonTransportKind string
HarpoonTransportKind enumerates supported harpoon transports.
const (
HarpoonTransportHTTPStreamable HarpoonTransportKind = "http-streamable"
)
type HealthConfig ¶
HealthConfig defines the health server behavior.
type LogFormat ¶
type LogFormat int
LogFormat enumerates the supported logging formats.
func ParseLogFormat ¶
ParseLogFormat converts the provided raw string into a LogFormat value.
type LoggingConfig ¶
LoggingConfig defines logging behavior for the client.
type MCPChannelBinding ¶
type MCPChannelBinding struct {
Channel types.Channel
TransportKind MCPTransportKind
ServerURL *url.URL
UnixSocketPath string
Command string
CommandArgs []string
ClientCertificate *tlsconfig.ClientCertificate
HTTPProxy *url.URL
HTTPProxySource ProxySource
}
MCPChannelBinding maps one tunnel-service channel to one MCP transport.
Exactly one binding may exist per channel. The reserved harpoon channel is supplied by the embedded Harpoon server, not by user MCP config. Streamable HTTP bindings may carry proxy and mTLS settings; stdio bindings deliberately ignore HTTP-only settings because they communicate over child-process stdin/stdout rather than a network socket.
type MCPConfig ¶
type MCPConfig struct {
ServerURL *url.URL
UnixSocketPath string
Command string
CommandArgs []string
TransportKind MCPTransportKind
ClientCertificate *tlsconfig.ClientCertificate
ChannelBindings []MCPChannelBinding
ConnectionMaxTTL time.Duration
MaxConcurrentRequests int
ExtraHeaders map[string]string
DiscoveryExtraHeaders map[string]string
HTTPProxy *url.URL
HTTPProxySource ProxySource
}
MCPConfig captures configuration for the Model Context Protocol integration.
The legacy top-level ServerURL/Command fields mirror the main channel so older call sites can keep reading cfg.MCP.ServerURL while the dispatcher routes from ChannelBindings. New connector/channel behavior should be modeled as an MCPChannelBinding first, then projected to the legacy fields only for compatibility.
func (*MCPConfig) ChannelBindingFor ¶
func (c *MCPConfig) ChannelBindingFor(channel types.Channel) *MCPChannelBinding
ChannelBindingFor returns the configured binding for the provided channel.
func (*MCPConfig) MainChannelBinding ¶
func (c *MCPConfig) MainChannelBinding() *MCPChannelBinding
MainChannelBinding returns the binding for the main channel, if configured.
type MCPTransportKind ¶
type MCPTransportKind string
MCPTransportKind describes the available MCP transport types.
const ( MCPTransportHTTPStreamable MCPTransportKind = "http-streamable" MCPTransportStdio MCPTransportKind = "stdio" MCPTransportInMemory MCPTransportKind = "in-memory" )
type ProcessConfig ¶
type ProcessConfig struct {
PIDFile string
}
ProcessConfig defines process-level runtime settings.
type ProxyHealthConfig ¶
ProxyHealthConfig controls proxy connectivity checks.
type ProxySource ¶
type ProxySource string
ProxySource describes where an effective proxy value originated.
const ( ProxySourceNone ProxySource = "none" ProxySourceEnvironment ProxySource = "environment" ProxySourceIgnored ProxySource = "ignored" )
func (ProxySource) String ¶
func (s ProxySource) String() string