Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 83 Imported by: 0

Documentation

Overview

Package cli implements the diverge command-line interface, providing commands for creating, listing, deleting, and managing preview environments.

Index

Constants

View Source
const (
	// AnnotationGuidance is the annotation key used to deliver steering guidance to an AgentTask.
	AnnotationGuidance = "divergedev.com/guidance"
	// AnnotationGuidanceTimestamp records the UTC timestamp when guidance was dispatched.
	AnnotationGuidanceTimestamp = "divergedev.com/guidance-timestamp"
)
View Source
const (

	// LabelAtlasMode identifies the Atlas mode ("versioned" or "declarative").
	LabelAtlasMode = "divergedev.com/atlas-mode"
)

Variables

View Source
var (
	// ErrTailscaleNotFound indicates that no suitable local network interface could be found during detector fallback.
	ErrTailscaleNotFound = errors.New("tailscale interface not found: make sure tailscale is running or pass --endpoint")
	// ErrNoGitRepo indicates that the detector failed to find a git repository in the current directory.
	ErrNoGitRepo = errors.New("not in a git repository")
)
View Source
var ErrBaselinePodNotFound = errors.New("no baseline pod found")

ErrBaselinePodNotFound is returned when no baseline pod can be found for the given service name and namespace.

View Source
var ErrCollision = errors.New("preview group collision")

ErrCollision indicates that a preview group with the same name already exists but belongs to a different owner.

View Source
var ErrInvalidServiceName = errors.New("invalid service name")

ErrInvalidServiceName is returned when the service name is not a valid Kubernetes label value.

View Source
var ErrNamedTargetPortNotFound = fmt.Errorf("named target port not found in pod containers")
View Source
var ErrNoTunnelCredential = errors.New("no credential available for the diverge server")

ErrNoTunnelCredential is returned when no credential can be resolved for the tunnel. The server authenticates every Tunnel RPC by Kubernetes TokenReview, so connecting without one only ever yields 401.

View Source
var ErrServerNotFound = fmt.Errorf("diverge server not found in cluster")

Functions

func BundleAtlasConfigMap added in v0.11.0

func BundleAtlasConfigMap(ctx context.Context, kubeClient client.Client, namespace, envName, baseDir string, atlasCfg *config.AtlasSettings, dryRun bool) (*corev1.ConfigMap, string, error)

BundleAtlasConfigMap bundles a local migration directory or schema file into an ephemeral ConfigMap.

func Execute

func Execute(version, commit, date string)

Execute is the main entry point for the diverge CLI. It injects version metadata into the App, initializes the root command if needed, and runs it.

func NewRootCmd

func NewRootCmd(app *App) *cobra.Command

NewRootCmd constructs the root cobra.Command with persistent flags for kubeconfig, namespace, and context, and registers all subcommands (create, delete, init, list, logs, open, status, validate, version).

func RenderDot added in v0.8.0

func RenderDot(g *topology.ServiceGraph, w io.Writer) error

func RenderJSON added in v0.8.0

func RenderJSON(g *topology.ServiceGraph, w io.Writer) error

func RenderMermaid added in v0.8.0

func RenderMermaid(g *topology.ServiceGraph, w io.Writer) error

func RootCmd

func RootCmd() *cobra.Command

RootCmd returns the root cobra command. External modules (e.g., diverge-enterprise) use this to add enterprise subcommands.

Types

type AgentRepoConfig added in v0.14.0

type AgentRepoConfig struct {
	Version string            `yaml:"version" json:"version"`
	Agent   AgentRepoSettings `yaml:"agent" json:"agent"`
}

AgentRepoConfig models the repository-level agent configuration file (.diverge/agent.yaml).

func LoadAgentRepoConfig added in v0.14.0

func LoadAgentRepoConfig(rootDir string) (*AgentRepoConfig, error)

LoadAgentRepoConfig attempts to read and parse .diverge/agent.yaml from the specified directory or working dir.

type AgentRepoSettings added in v0.14.0

type AgentRepoSettings struct {
	AllowedModels []string `yaml:"allowedModels,omitempty" json:"allowedModels,omitempty"`
	AllowedTools  []string `yaml:"allowedTools,omitempty" json:"allowedTools,omitempty"`
	BudgetUSD     string   `yaml:"budgetUSD,omitempty" json:"budgetUSD,omitempty"`
	MaxIterations int32    `yaml:"maxIterations,omitempty" json:"maxIterations,omitempty"`
	BaseBranch    string   `yaml:"baseBranch,omitempty" json:"baseBranch,omitempty"`
	Sandbox       struct {
		Provider       string `yaml:"provider,omitempty" json:"provider,omitempty"`
		PoolRef        string `yaml:"poolRef,omitempty" json:"poolRef,omitempty"`
		TemplateRef    string `yaml:"templateRef,omitempty" json:"templateRef,omitempty"`
		TimeoutSeconds int32  `yaml:"timeoutSeconds,omitempty" json:"timeoutSeconds,omitempty"`
	} `yaml:"sandbox,omitempty" json:"sandbox,omitempty"`
}

AgentRepoSettings contains configurable parameters for tasks targeting the repository.

type App

type App struct {
	Kubeconfig string
	Namespace  string
	Context    string
	NoColor    bool
	Version    string
	Commit     string
	Date       string

	Client    client.Client        // For testing
	Clientset kubernetes.Interface // For testing (logs needs CoreV1)
}

App holds shared CLI state including Kubernetes connection details, version metadata, and optional API clients supplied by tests.

func (*App) KubeClient

func (app *App) KubeClient() (client.Client, kubernetes.Interface, error)

KubeClient returns a controller-runtime client and a kubernetes.Clientset. It returns injected clients when app.Client is non-nil; otherwise it creates both clients from kubeconfig.

func (*App) ResolveNamespace

func (app *App) ResolveNamespace() error

ResolveNamespace resolves the namespace from the kubeconfig if not explicitly set via --namespace flag.

func (*App) RestConfig added in v0.7.0

func (app *App) RestConfig() (*rest.Config, error)

RestConfig returns the REST config.

type ChainTokenSource added in v0.11.0

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

ChainTokenSource tries a sequence of TokenSource implementations in order, returning the first non-empty token found.

func NewChainTokenSource added in v0.11.0

func NewChainTokenSource(sources ...TokenSource) *ChainTokenSource

NewChainTokenSource creates a ChainTokenSource from the provided sources.

func (*ChainTokenSource) Token added in v0.11.0

func (c *ChainTokenSource) Token(ctx context.Context) (string, error)

type ConfigWatcher added in v0.7.0

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

func NewConfigWatcher added in v0.7.0

func NewConfigWatcher(crdClient client.Client, pgName string, envFile string, opts ...ConfigWatcherOption) *ConfigWatcher

func (*ConfigWatcher) LatestEnvMap added in v0.7.0

func (cw *ConfigWatcher) LatestEnvMap() map[string]string

LatestEnvMap returns a copy of the most recently computed env map. Thread-safe — called by Supervisor's envBuilder on each restart.

func (*ConfigWatcher) SetOnEnvChange added in v0.7.0

func (cw *ConfigWatcher) SetOnEnvChange(fn func(diff map[string]string))

SetOnEnvChange registers an env change callback after construction. Must be called before Watch() starts.

func (*ConfigWatcher) Watch added in v0.7.0

func (cw *ConfigWatcher) Watch(ctx context.Context) error

type ConfigWatcherOption added in v0.7.0

type ConfigWatcherOption func(*ConfigWatcher)

ConfigWatcherOption configures optional behavior for a ConfigWatcher.

func WithOnEnvChange added in v0.7.0

func WithOnEnvChange(fn func(diff map[string]string)) ConfigWatcherOption

WithOnEnvChange registers a callback invoked when env vars change. The diff map contains changed keys with "old → new" descriptions.

func WithOnUpdate added in v0.7.0

WithOnUpdate registers a callback invoked when PreviewGroup service status changes.

func WithProxyAddr added in v0.7.0

func WithProxyAddr(addr string) ConfigWatcherOption

WithProxyAddr sets the loopback proxy address for .env.diverge output.

func WithProxyMode added in v0.7.0

func WithProxyMode(mode string) ConfigWatcherOption

WithProxyMode sets the loopback proxy mode for .env.diverge output.

type DefaultEnvironmentDetector

type DefaultEnvironmentDetector struct{}

DefaultEnvironmentDetector provides actual OS/network detection implementations.

func (*DefaultEnvironmentDetector) DetectGitBranch

func (d *DefaultEnvironmentDetector) DetectGitBranch(ctx context.Context) (string, error)

DetectGitBranch performs its designated operation.

func (*DefaultEnvironmentDetector) DetectLocalIP

func (d *DefaultEnvironmentDetector) DetectLocalIP(ctx context.Context) (string, error)

DetectLocalIP performs its designated operation.

func (*DefaultEnvironmentDetector) DetectServiceName

func (d *DefaultEnvironmentDetector) DetectServiceName(ctx context.Context) (string, error)

DetectServiceName performs its designated operation.

func (*DefaultEnvironmentDetector) DetectUsername

func (d *DefaultEnvironmentDetector) DetectUsername(ctx context.Context) (string, error)

DetectUsername performs its designated operation.

type DevOption

type DevOption func(*DevOptions)

DevOption configures DevOptions (e.g. WithDetector, WithPort, WithService).

func WithEnvironmentDetector

func WithEnvironmentDetector(d EnvironmentDetector) DevOption

WithEnvironmentDetector allows injecting a custom EnvironmentDetector for testing.

func WithServerDiscoverer added in v0.11.0

func WithServerDiscoverer(d ServerDiscoverer) DevOption

WithServerDiscoverer allows injecting a custom ServerDiscoverer for testing.

func WithSessionManager added in v0.11.0

func WithSessionManager(m devsession.Manager) DevOption

WithSessionManager allows injecting a custom devsession.Manager for testing.

type DevOptions

type DevOptions struct {
	Detector       EnvironmentDetector
	Discoverer     ServerDiscoverer
	SessionManager devsession.Manager
	// contains filtered or unexported fields
}

DevOptions holds optional configuration for the dev command.

type DevSessionJSONItem added in v0.11.0

type DevSessionJSONItem struct {
	Service   string `json:"service"`
	Developer string `json:"developer"`
	Branch    string `json:"branch"`
	Hostname  string `json:"hostname"`
	Heartbeat string `json:"heartbeat"`
	Status    string `json:"status"`
}

DevSessionJSONItem represents a dev session in JSON format compatible with IDE views.

type EnvironmentDetector

type EnvironmentDetector interface {
	// DetectLocalIP returns the developer's routable IP (e.g., Tailscale).
	DetectLocalIP(ctx context.Context) (string, error)

	// DetectGitBranch returns the current git branch name.
	DetectGitBranch(ctx context.Context) (string, error)

	// DetectServiceName returns the service name from .diverge.yaml or cwd.
	DetectServiceName(ctx context.Context) (string, error)

	// DetectUsername returns the current OS username.
	DetectUsername(ctx context.Context) (string, error)
}

EnvironmentDetector abstracts OS/network dependencies for testability.

type FileTokenSource added in v0.11.0

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

FileTokenSource reads a token from a file path (such as a projected Kubernetes ServiceAccount token) and reloads it dynamically when the file's modification time changes.

func NewFileTokenSource added in v0.11.0

func NewFileTokenSource(path string) *FileTokenSource

NewFileTokenSource creates a FileTokenSource reading from the given path.

func (*FileTokenSource) Token added in v0.11.0

func (f *FileTokenSource) Token(ctx context.Context) (string, error)

type GraphFormat added in v0.8.0

type GraphFormat string
const (
	FormatText    GraphFormat = "text"
	FormatMermaid GraphFormat = "mermaid"
	FormatDot     GraphFormat = "dot"
	FormatJSON    GraphFormat = "json"
)

type K8sServerDiscoverer added in v0.11.0

type K8sServerDiscoverer struct {
	K8sClient  kubernetes.Interface
	RestConfig *rest.Config
	Namespace  string // Target or active namespace from kubeconfig
}

K8sServerDiscoverer locates the Diverge server in a Kubernetes cluster using label selectors across candidate namespaces and sets up a local port-forward to an active pod.

func (*K8sServerDiscoverer) Discover added in v0.11.0

func (d *K8sServerDiscoverer) Discover(ctx context.Context) (serverAddr string, stopChan chan struct{}, err error)

Discover locates the Diverge server and starts a port-forward.

type KubeTaskClient added in v0.14.0

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

KubeTaskClient implements TaskClient using direct Kubernetes API calls.

func NewKubeTaskClient added in v0.14.0

func NewKubeTaskClient(c client.Client) *KubeTaskClient

NewKubeTaskClient constructs a KubeTaskClient.

func (*KubeTaskClient) Create added in v0.14.0

func (c *KubeTaskClient) Create(ctx context.Context, task *v1alpha1.AgentTask) error

Create persists a new AgentTask.

func (*KubeTaskClient) Delete added in v0.14.0

func (c *KubeTaskClient) Delete(ctx context.Context, namespace, name string) error

Delete removes an AgentTask.

func (*KubeTaskClient) Get added in v0.14.0

func (c *KubeTaskClient) Get(ctx context.Context, namespace, name string) (*v1alpha1.AgentTask, error)

Get retrieves an AgentTask by namespace and name.

func (*KubeTaskClient) Guide added in v0.14.0

func (c *KubeTaskClient) Guide(ctx context.Context, namespace, name, message string) error

Guide sets steering annotations on an active AgentTask.

func (*KubeTaskClient) List added in v0.14.0

func (c *KubeTaskClient) List(ctx context.Context, namespace string) ([]v1alpha1.AgentTask, error)

List returns all AgentTasks in a namespace.

func (*KubeTaskClient) Pause added in v0.14.0

func (c *KubeTaskClient) Pause(ctx context.Context, namespace, name string) error

Pause suspends execution of an AgentTask.

func (*KubeTaskClient) Resume added in v0.14.0

func (c *KubeTaskClient) Resume(ctx context.Context, namespace, name string, budgetUSD string, tokens int64) error

Resume unpauses execution of an AgentTask and optionally bumps budget or tokens.

type KubeTaskGuider added in v0.14.0

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

KubeTaskGuider implements TaskGuider by recording steering instructions on the AgentTask resource.

func NewKubeTaskGuider added in v0.14.0

func NewKubeTaskGuider(c client.Client) *KubeTaskGuider

NewKubeTaskGuider constructs a KubeTaskGuider.

func (*KubeTaskGuider) Guide added in v0.14.0

func (g *KubeTaskGuider) Guide(ctx context.Context, namespace, name, message string) error

Guide records steering guidance directly on the AgentTask resource annotations.

type KubeTokenSource added in v0.11.0

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

KubeTokenSource leverages client-go's transport wrappers (including ExecProvider, AuthProvider, and token refreshers) to dynamically resolve bearer credentials from a Kubernetes rest.Config.

func NewKubeTokenSource added in v0.11.0

func NewKubeTokenSource(restCfg *rest.Config) (*KubeTokenSource, error)

NewKubeTokenSource creates a KubeTokenSource from rest.Config.

func (*KubeTokenSource) Token added in v0.11.0

func (k *KubeTokenSource) Token(ctx context.Context) (string, error)

type MockTaskClient added in v0.14.0

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

MockTaskClient provides an in-memory implementation of TaskClient for testing.

func NewMockTaskClient added in v0.14.0

func NewMockTaskClient() *MockTaskClient

NewMockTaskClient constructs an in-memory MockTaskClient.

func (*MockTaskClient) Create added in v0.14.0

func (m *MockTaskClient) Create(_ context.Context, task *v1alpha1.AgentTask) error

Create stores the task in memory.

func (*MockTaskClient) Delete added in v0.14.0

func (m *MockTaskClient) Delete(_ context.Context, namespace, name string) error

Delete removes a task from memory.

func (*MockTaskClient) Get added in v0.14.0

func (m *MockTaskClient) Get(_ context.Context, namespace, name string) (*v1alpha1.AgentTask, error)

Get retrieves a task from memory.

func (*MockTaskClient) Guide added in v0.14.0

func (m *MockTaskClient) Guide(_ context.Context, namespace, name, message string) error

Guide sets guidance annotations on the in-memory task.

func (*MockTaskClient) List added in v0.14.0

func (m *MockTaskClient) List(_ context.Context, namespace string) ([]v1alpha1.AgentTask, error)

List returns all tasks in memory for the given namespace.

func (*MockTaskClient) Pause added in v0.14.0

func (m *MockTaskClient) Pause(_ context.Context, namespace, name string) error

Pause marks the task suspended.

func (*MockTaskClient) Resume added in v0.14.0

func (m *MockTaskClient) Resume(_ context.Context, namespace, name string, budgetUSD string, tokens int64) error

Resume removes suspension and updates budgets.

type OpenBaoTokenSource added in v0.11.0

type OpenBaoTokenSource struct{}

OpenBaoTokenSource resolves credentials from OpenBao or HashiCorp Vault environment variables (BAO_TOKEN, VAULT_TOKEN) and home directory token files (~/.bao-token, ~/.vault-token). Note: This source is for application secrets and custom integrations; it is not used in resolveTunnelTokenSource because the Diverge server authenticates tunnels via Kubernetes TokenReview.

func NewOpenBaoTokenSource added in v0.11.0

func NewOpenBaoTokenSource() *OpenBaoTokenSource

NewOpenBaoTokenSource creates a token source for OpenBao/Vault.

func (*OpenBaoTokenSource) Token added in v0.11.0

func (o *OpenBaoTokenSource) Token(ctx context.Context) (string, error)

type PluginInfo added in v0.3.0

type PluginInfo struct {
	Kind        string `json:"kind"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

PluginInfo contains details about a single registered plugin provider.

type ProviderInfo added in v0.3.0

type ProviderInfo struct {
	Kind        string `json:"kind"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

ProviderInfo contains details about a single registered provider.

type ServerDiscoverer added in v0.11.0

type ServerDiscoverer interface {
	Discover(ctx context.Context) (serverAddr string, stopChan chan struct{}, err error)
}

ServerDiscoverer discovers a running Diverge server in Kubernetes and establishes access.

type StaticTokenSource added in v0.11.0

type StaticTokenSource string

StaticTokenSource provides a constant token string.

func (StaticTokenSource) Token added in v0.11.0

func (s StaticTokenSource) Token(ctx context.Context) (string, error)

type Supervisor added in v0.7.0

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

Supervisor manages the lifecycle of a child process, supporting safe restarts when environment configuration changes. It owns the signal loop and ensures proper process group reaping between restarts.

func NewSupervisor added in v0.7.0

func NewSupervisor(args []string, envBuilder func() map[string]string) *Supervisor

NewSupervisor creates a supervisor for the given command args. envBuilder is called fresh on each (re)start to produce a clean env map.

func (*Supervisor) RecordChildExit added in v0.7.0

func (s *Supervisor) RecordChildExit(startTime time.Time)

RecordChildExit records a child exit for circuit breaker tracking. Called after cmd.Wait() returns in the Run loop.

func (*Supervisor) RequestRestart added in v0.7.0

func (s *Supervisor) RequestRestart(reason string, envDiff map[string]string)

RequestRestart sends a non-blocking restart request to the supervisor.

func (*Supervisor) Run added in v0.7.0

func (s *Supervisor) Run(ctx context.Context) error

Run starts the child process and blocks until ctx is cancelled. It handles restart requests and parent signals (SIGINT/SIGTERM).

type TaskClient added in v0.14.0

type TaskClient interface {
	TaskGuider
	Create(ctx context.Context, task *v1alpha1.AgentTask) error
	Get(ctx context.Context, namespace, name string) (*v1alpha1.AgentTask, error)
	List(ctx context.Context, namespace string) ([]v1alpha1.AgentTask, error)
	Delete(ctx context.Context, namespace, name string) error
	Pause(ctx context.Context, namespace, name string) error
	Resume(ctx context.Context, namespace, name string, budgetUSD string, tokens int64) error
}

TaskClient unifies all agent task operations behind a testable, decoupled interface.

type TaskGuider added in v0.14.0

type TaskGuider interface {
	Guide(ctx context.Context, namespace, name, message string) error
}

TaskGuider provides steering instructions to an active AgentTask.

type TokenSource added in v0.11.0

type TokenSource interface {
	Token(ctx context.Context) (string, error)
}

TokenSource provides a credential for authenticating tunnel connections.

type TopAgentTaskRow added in v0.16.0

type TopAgentTaskRow struct {
	Name           string `json:"name" yaml:"name"`
	Namespace      string `json:"namespace" yaml:"namespace"`
	Phase          string `json:"phase" yaml:"phase"`
	Iteration      string `json:"iteration" yaml:"iteration"`
	TokensConsumed int64  `json:"tokensConsumed" yaml:"tokensConsumed"`
	CostUSD        string `json:"costUSD" yaml:"costUSD"`
	BudgetUSD      string `json:"budgetUSD" yaml:"budgetUSD"`
	Branch         string `json:"branch" yaml:"branch"`
}

TopAgentTaskRow represents an AgentTask entry in a top snapshot.

type TopEnvironmentRow added in v0.16.0

type TopEnvironmentRow struct {
	Name          string  `json:"name" yaml:"name"`
	Namespace     string  `json:"namespace" yaml:"namespace"`
	Phase         string  `json:"phase" yaml:"phase"`
	TTL           string  `json:"ttl" yaml:"ttl"`
	State         string  `json:"state" yaml:"state"`
	Hibernated    bool    `json:"hibernated" yaml:"hibernated"`
	Drifted       bool    `json:"drifted,omitempty" yaml:"drifted,omitempty"`
	HourlyCostUSD float64 `json:"hourlyCostUSD" yaml:"hourlyCostUSD"`
	URL           string  `json:"url" yaml:"url"`
}

TopEnvironmentRow represents an Environment entry in a top snapshot.

type TopPreviewGroupRow added in v0.16.0

type TopPreviewGroupRow struct {
	Name      string `json:"name" yaml:"name"`
	Namespace string `json:"namespace" yaml:"namespace"`
	Phase     string `json:"phase" yaml:"phase"`
	Services  int    `json:"services" yaml:"services"`
	Header    string `json:"header" yaml:"header"`
	Age       string `json:"age" yaml:"age"`
}

TopPreviewGroupRow represents a PreviewGroup entry in a top snapshot.

type TopSnapshot added in v0.16.0

type TopSnapshot struct {
	Timestamp     time.Time            `json:"timestamp" yaml:"timestamp"`
	Summary       TopSummary           `json:"summary" yaml:"summary"`
	Environments  []TopEnvironmentRow  `json:"environments" yaml:"environments"`
	PreviewGroups []TopPreviewGroupRow `json:"previewGroups" yaml:"previewGroups"`
	AgentTasks    []TopAgentTaskRow    `json:"agentTasks" yaml:"agentTasks"`
}

TopSnapshot holds a point-in-time view of Diverge resources and FinOps burn.

type TopSummary added in v0.16.0

type TopSummary struct {
	TotalEnvironments      int     `json:"totalEnvironments" yaml:"totalEnvironments"`
	ActiveEnvironments     int     `json:"activeEnvironments" yaml:"activeEnvironments"`
	HibernatedEnvironments int     `json:"hibernatedEnvironments" yaml:"hibernatedEnvironments"`
	PreviewGroups          int     `json:"previewGroups" yaml:"previewGroups"`
	AgentTasks             int     `json:"agentTasks" yaml:"agentTasks"`
	ActiveAgentTasks       int     `json:"activeAgentTasks" yaml:"activeAgentTasks"`
	HourlyBurnUSD          float64 `json:"hourlyBurnUSD" yaml:"hourlyBurnUSD"`
	ProjectedMonthlyUSD    float64 `json:"projectedMonthlyUSD" yaml:"projectedMonthlyUSD"`
	AgentLLMSpendUSD       float64 `json:"agentLLMSpendUSD" yaml:"agentLLMSpendUSD"`
}

TopSummary aggregates fleet-wide counts and FinOps cost metrics.

type TunnelClient added in v0.7.0

type TunnelClient struct {
	Ready chan struct{}
	// contains filtered or unexported fields
}

func NewTunnelClient added in v0.7.0

func NewTunnelClient(serverAddr string, localPort int, previewID, service, namespace, token string, logger *slog.Logger) *TunnelClient

NewTunnelClient is a backward-compatible wrapper creating a TunnelClient with a static token.

func NewTunnelClientWithTokenSource added in v0.11.0

func NewTunnelClientWithTokenSource(
	serverAddr string,
	localPort int,
	previewID, service, namespace string,
	tokenSource TokenSource,
	baseTransport http.RoundTripper,
	logger *slog.Logger,
) *TunnelClient

NewTunnelClientWithTokenSource creates a TunnelClient using a dynamic TokenSource and optional base transport (defaults to http.DefaultTransport).

func (*TunnelClient) Connect added in v0.7.0

func (tc *TunnelClient) Connect(ctx context.Context) error

func (*TunnelClient) ConnectWithRetry added in v0.7.0

func (tc *TunnelClient) ConnectWithRetry(ctx context.Context)

Jump to

Keyboard shortcuts

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