config

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenStorageInline      = "inline"
	TokenStorageKeychain    = "keychain"
	CredentialProviderMacOS = "macos"
	MTLSStorageKeychain     = "keychain"
	MTLSStoragePKCS11       = "pkcs11"
)
View Source
const DefaultMacOSKeychainTokenService = "io.rstream.auth"

Variables

This section is empty.

Functions

func CreateTURNCredentialsFromEnv added in v1.10.0

func CreateTURNCredentialsFromEnv(
	ctx context.Context,
	opts ...TURNCredentialsEnvOptions,
) (*rstream.TURNCredentials, error)

func DefaultAPIURL

func DefaultAPIURL() string

func DefaultConfigPath

func DefaultConfigPath() (string, error)

func DefaultMacOSKeychainContextTokenAccount added in v1.16.0

func DefaultMacOSKeychainContextTokenAccount(name, apiURL string) string

func DefaultMacOSKeychainTokenAccount added in v1.16.0

func DefaultMacOSKeychainTokenAccount(apiURL string) string

func DeleteToken added in v1.16.0

func DeleteToken(storage TokenStorage) error

func FlattenTransport

func FlattenTransport(cfg *TransportConfig) rstream.Dialer

func MTLSConfigFromAuth added in v1.15.0

func MTLSConfigFromAuth(auth *Auth) (*tls.Config, bool, error)

func NewClientFromEnv

func NewClientFromEnv() (*rstream.Client, error)

func NewClientFromEnvOptions

func NewClientFromEnvOptions(opts ClientEnvOptions) (*rstream.Client, error)

func NewClientFromResolved

func NewClientFromResolved(resolved Resolved) (*rstream.Client, error)

func NormalizeAPIURL added in v1.15.0

func NormalizeAPIURL(apiURL string) string

func StoreToken added in v1.16.0

func StoreToken(storage TokenStorage, token string) error

func TokenFromAuth

func TokenFromAuth(auth *Auth) (string, bool, error)

func WriteAtomic

func WriteAtomic(path string, cfg Config) error

Types

type Auth

type Auth struct {
	Token *Token `yaml:"token,omitempty"`
	MTLS  *MTLS  `yaml:"mtls,omitempty"`
}

type BindConfig

type BindConfig struct {
	Mode      string `yaml:"mode,omitempty"`
	Interface string `yaml:"interface,omitempty"`
	Address   string `yaml:"address,omitempty"`
}

type ClientEnvOptions

type ClientEnvOptions struct {
	ConfigPath    string
	APIURL        string
	Context       string
	Engine        string
	Token         string
	MTLSCert      string
	MTLSKey       string
	RequireEngine bool
	RequireToken  bool
}

type ClientResolution

type ClientResolution struct {
	ConfigPath string
	Config     Config
	Resolved   Resolved
}

func ResolveFromEnv

func ResolveFromEnv(opts ClientEnvOptions) (ClientResolution, error)

type Config

type Config struct {
	Version      int           `yaml:"version,omitempty"`
	Defaults     Defaults      `yaml:"defaults,omitempty"`
	Environments []Environment `yaml:"environments,omitempty"`
	Contexts     []Context     `yaml:"contexts,omitempty"`
}

func Load

func Load(path string) (Config, error)

func (*Config) EnsureEnvironment

func (c *Config) EnsureEnvironment(apiURL string) *Environment

func (*Config) EnsureVersion

func (c *Config) EnsureVersion()

func (*Config) FindContextByName

func (c *Config) FindContextByName(name string) (*Context, int, error)

func (*Config) FindContextByNameAndAPIURL

func (c *Config) FindContextByNameAndAPIURL(name, apiURL string) (*Context, int, error)

func (*Config) FindContextForAPIURL

func (c *Config) FindContextForAPIURL(name, apiURL string) (*Context, int, error)

func (*Config) FindContextUnlinked

func (c *Config) FindContextUnlinked(name string) (*Context, int, error)

func (*Config) FindEnvironment

func (c *Config) FindEnvironment(apiURL string) (*Environment, int)

func (*Config) Normalize

func (c *Config) Normalize()

type Context

type Context struct {
	Name            string           `yaml:"name"`
	APIURL          string           `yaml:"apiUrl,omitempty"`
	ProjectEndpoint string           `yaml:"projectEndpoint,omitempty"`
	Engine          string           `yaml:"engine,omitempty"`
	TURNDomain      string           `yaml:"turnDomain,omitempty"`
	TURNPort        int              `yaml:"turnPort,omitempty"`
	TURNSPort       int              `yaml:"turnsPort,omitempty"`
	Auth            *Auth            `yaml:"auth,omitempty"`
	Transport       *TransportConfig `yaml:"transport,omitempty"`
}

type DNSConfig

type DNSConfig struct {
	Override   string `yaml:"override,omitempty"`
	TLS        *bool  `yaml:"tls,omitempty"`
	ServerName string `yaml:"serverName,omitempty"`
	DNSSEC     *bool  `yaml:"dnssec,omitempty"`
}

type DefaultContext

type DefaultContext struct {
	Name string `yaml:"name,omitempty"`
}

type Defaults

type Defaults struct {
	Context *DefaultContext `yaml:"context,omitempty"`
}

type EnvSettings

type EnvSettings struct {
	ConfigPath string
	APIURL     string
	Context    string
	Engine     string
	Token      string
	MTLSCert   string
	MTLSKey    string
	UseQUIC    bool
}

func ReadEnv

func ReadEnv() EnvSettings

type Environment

type Environment struct {
	APIURL    string           `yaml:"apiUrl"`
	Auth      *Auth            `yaml:"auth,omitempty"`
	Transport *TransportConfig `yaml:"transport,omitempty"`
}

type FileLock

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

func LockFile

func LockFile(path string) (*FileLock, error)

func (*FileLock) Unlock

func (l *FileLock) Unlock()

type MTLS added in v1.15.0

type MTLS struct {
	Certificate     string       `yaml:"certificate,omitempty"`
	CertificateFile string       `yaml:"certificateFile,omitempty"`
	Key             string       `yaml:"key,omitempty"`
	KeyFile         string       `yaml:"keyFile,omitempty"`
	Storage         *MTLSStorage `yaml:"storage,omitempty"`
}

type MTLSStorage added in v1.16.0

type MTLSStorage struct {
	Kind              string `yaml:"kind,omitempty"`
	Provider          string `yaml:"provider,omitempty"`
	Module            string `yaml:"module,omitempty"`
	OpenSSLProvider   string `yaml:"opensslProvider,omitempty"`
	TokenLabel        string `yaml:"tokenLabel,omitempty"`
	TokenSerial       string `yaml:"tokenSerial,omitempty"`
	Slot              *int   `yaml:"slot,omitempty"`
	KeyLabel          string `yaml:"keyLabel,omitempty"`
	KeyIDHex          string `yaml:"keyIdHex,omitempty"`
	Certificate       string `yaml:"certificate,omitempty"`
	CertificateFile   string `yaml:"certificateFile,omitempty"`
	CertificateLabel  string `yaml:"certificateLabel,omitempty"`
	CertificateIDHex  string `yaml:"certificateIdHex,omitempty"`
	CertificateSHA256 string `yaml:"certificateSHA256,omitempty"`
	PINEnv            string `yaml:"pinEnv,omitempty"`
	MaxSessions       int    `yaml:"maxSessions,omitempty"`
}

type ProxyConfig

type ProxyConfig struct {
	HTTP            string            `yaml:"http,omitempty"`
	SOCKS5          string            `yaml:"socks5,omitempty"`
	Username        string            `yaml:"username,omitempty"`
	Password        string            `yaml:"password,omitempty"`
	Headers         map[string]string `yaml:"headers,omitempty"`
	FromEnvironment *bool             `yaml:"fromEnvironment,omitempty"`
}

type ResolveInput

type ResolveInput struct {
	Config               Config
	FlagAPIURL           string
	FlagContext          string
	FlagEngine           string
	FlagToken            string
	FlagMTLSCert         string
	FlagMTLSKey          string
	EnvAPIURL            string
	EnvContext           string
	EnvEngine            string
	EnvToken             string
	EnvMTLSCert          string
	EnvMTLSKey           string
	IgnoreDefaultContext bool
	RequireToken         bool
	RequireEngine        bool
	ResolveToken         bool
}

type Resolved

type Resolved struct {
	APIURL          string
	ContextName     string
	Environment     *Environment
	Context         *Context
	Engine          string
	Token           string
	Transport       rstream.Dialer
	TLSClientConfig *tls.Config
}

func Resolve

func Resolve(input ResolveInput) (Resolved, error)

type TURNCredentialsEnvOptions added in v1.10.0

type TURNCredentialsEnvOptions struct {
	ConfigPath      string
	APIURL          string
	Context         string
	Token           string
	ProjectID       string
	ProjectEndpoint string
	ClusterDomain   string
	TURNPort        int
	TURNSPort       int
	TTL             time.Duration
	Mode            *rstream.TURNCredentialMode
}

type Token

type Token struct {
	Storage *TokenStorage `yaml:"storage,omitempty"`
}

type TokenStorage

type TokenStorage struct {
	Kind     string `yaml:"kind,omitempty"`
	Provider string `yaml:"provider,omitempty"`
	Value    string `yaml:"value,omitempty"`
	Service  string `yaml:"service,omitempty"`
	Account  string `yaml:"account,omitempty"`
}

func NewMacOSKeychainTokenStorage added in v1.16.0

func NewMacOSKeychainTokenStorage(apiURL string) TokenStorage

type TransportConfig

type TransportConfig struct {
	Bind     *BindConfig  `yaml:"bind,omitempty"`
	IPFamily string       `yaml:"ipFamily,omitempty"`
	DNS      *DNSConfig   `yaml:"dns,omitempty"`
	MPTCP    *bool        `yaml:"mptcp,omitempty"`
	Proxy    *ProxyConfig `yaml:"proxy,omitempty"`
	UseQUIC  *bool        `yaml:"useQuic,omitempty"`
}

func MergeTransport

func MergeTransport(base, override *TransportConfig) *TransportConfig

Jump to

Keyboard shortcuts

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