config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DisplayConfigVersion = 1

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

func Save

func Save(path string, value Config) error

func Update added in v0.12.0

func Update(path string, update func(*Config) error) error

Update performs a read/modify/write transaction while holding the same sidecar lock used by Save. Endpoint selection is shared by the Desktop and CLI, so loading and saving in separate critical sections can otherwise drop a concurrent update.

Types

type Config

type Config struct {
	Current   string              `json:"current"`
	Endpoints map[string]Endpoint `json:"endpoints"`
	Display   *DisplayConfig      `json:"display,omitempty"`
}

func Load

func Load(path string) (Config, error)

func (Config) EffectiveDisplay added in v0.13.0

func (c Config) EffectiveDisplay() ([]string, error)

EffectiveDisplay returns the ordered aliases that should be visible to a client. A missing display section preserves the pre-display single-current behavior. The synthetic local alias is always valid, even when it has no explicit row in Endpoints.

func (Config) Names

func (c Config) Names() []string

func (*Config) NormalizeDisplay added in v0.13.0

func (c *Config) NormalizeDisplay() error

NormalizeDisplay validates and canonicalizes an explicitly configured display set. Current remains an independent foreground-connection choice; switching it must never add an alias to Display.

func (Config) Resolve

func (c Config) Resolve(name string) (Endpoint, error)

func (*Config) UnmarshalJSON added in v0.13.0

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts the preview sidebar field as a read-only migration path. Writes use Config.Display and therefore emit only the public display field.

type DisplayConfig added in v0.13.0

type DisplayConfig struct {
	Version   int               `json:"version"`
	Endpoints []string          `json:"endpoints"`
	Names     map[string]string `json:"names,omitempty"`
}

DisplayConfig is the client-local, ordered set of endpoint aliases shown together by the Desktop. Names only affect presentation; endpoint credentials and route metadata remain in Config.Endpoints.

type Endpoint

type Endpoint struct {
	Name      string `json:"name"`
	URL       string `json:"url"`
	Token     string `json:"token"`
	SSH       string `json:"ssh,omitempty"`
	SSHRemote string `json:"sshRemote,omitempty"`
	Type      string `json:"type,omitempty"`
	HostID    string `json:"host_id,omitempty"`
	RouteID   string `json:"route_id,omitempty"`
	ClientID  string `json:"client_id,omitempty"`
	// RefreshToken and the route fields are persisted by native clients. Keep
	// them in the shared Go model so CLI display writes cannot discard metadata
	// it does not otherwise interpret.
	RefreshToken    string `json:"refresh_token,omitempty"`
	DirectURL       string `json:"direct_url,omitempty"`
	RelayURL        string `json:"relay_url,omitempty"`
	RoutePreference string `json:"route_preference,omitempty"`
}

Jump to

Keyboard shortcuts

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