Documentation
¶
Index ¶
- Variables
- func BuildBandwidthLimits(cfg *FileConfig) *limiter.ClientBandwidthLimits
- func CreateGetToken(ref *Ref, serverVersion string) types.GetToken
- func Dir(configPath string) string
- func FindFile() string
- func LoadRaw(path string) ([]byte, error)
- func ReadPIDFile(path string) (int, error)
- func RemovePIDFile(path string)
- func ResolvePublicHTTPNoAuthTiming(cfg *FileConfig) (time.Duration, time.Duration)
- func SaveAtomic(path string, cfg *FileConfig) error
- func SaveRawAtomic(path string, raw []byte) error
- func SignalReload(pidFile string) error
- func Validate(cfg *FileConfig) error
- func WritePIDFile(path string) error
- type AdminConfig
- type AdminDatabase
- type AdminRuntime
- type AdminUI
- type ApplyOptions
- type BandwidthLimitsConfig
- type ClientConfig
- type FileConfig
- type Manager
- type PublicHTTPNoAuthConfig
- type Ref
- type ReloadFunc
- type ResolvedAdmin
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
var SearchPaths = []string{
"{CWD}/.go-idp/inlets.yaml",
"{CWD}/.inlets.yaml",
"{HOME}/.go-idp/inlets/config.yaml",
"{HOME}/.config/inlets.yaml",
"{HOME}/.config/inlets.yml",
"/etc/go-idp/inlets/config.yaml",
"/etc/inlets/config.yaml",
}
SearchPaths defines default config file locations (priority order).
Functions ¶
func BuildBandwidthLimits ¶
func BuildBandwidthLimits(cfg *FileConfig) *limiter.ClientBandwidthLimits
func CreateGetToken ¶
CreateGetToken returns a GetToken function backed by ref.
func FindFile ¶
func FindFile() string
FindFile returns the first existing config path from SearchPaths.
func ReadPIDFile ¶
ReadPIDFile returns the pid stored in path.
func ResolvePublicHTTPNoAuthTiming ¶
func ResolvePublicHTTPNoAuthTiming(cfg *FileConfig) (time.Duration, time.Duration)
func SaveAtomic ¶
func SaveAtomic(path string, cfg *FileConfig) error
SaveAtomic writes cfg to path using a temp file and rename.
func SaveRawAtomic ¶
SaveRawAtomic writes raw YAML to path.
func SignalReload ¶
SignalReload sends SIGHUP to the process in pidFile.
func Validate ¶
func Validate(cfg *FileConfig) error
Validate returns a single error (errors.Join) or nil. Kept for callers that only need a yes/no answer.
func WritePIDFile ¶
WritePIDFile writes the current process id to path.
Types ¶
type AdminConfig ¶
type AdminConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Listen string `yaml:"listen" json:"listen,omitempty"`
Database AdminDatabase `yaml:"database" json:"database,omitempty"`
Runtime AdminRuntime `yaml:"runtime" json:"runtime,omitempty"`
UI AdminUI `yaml:"ui" json:"ui,omitempty"`
}
AdminConfig controls the optional admin console HTTP server.
type AdminDatabase ¶
type AdminDatabase struct {
Path string `yaml:"path" json:"path,omitempty"`
}
type AdminRuntime ¶
type ApplyOptions ¶
type ApplyOptions struct {
GetToken types.GetToken
Notification *client.NotificationConfig
BandwidthLimits *limiter.ClientBandwidthLimits
PublicHTTPNoAuthSessionTTL time.Duration
PublicHTTPNoAuthWarnLeadTime time.Duration
}
ApplyOptions carries runtime fields derived from FileConfig.
func BuildApplyOptions ¶
func BuildApplyOptions(cfg *FileConfig, serverVersion string, getToken types.GetToken) ApplyOptions
BuildApplyOptions constructs ApplyOptions from a config document.
type BandwidthLimitsConfig ¶
type BandwidthLimitsConfig struct {
Global *limiter.BandwidthLimit `yaml:"global" json:"global,omitempty"`
Clients map[string]*limiter.BandwidthLimit `yaml:"clients" json:"clients,omitempty"`
}
type ClientConfig ¶
type ClientConfig struct {
ClientID string `yaml:"clientId" json:"clientId"`
ClientSecret string `yaml:"clientSecret" json:"clientSecret"`
Config *client.Config `yaml:"config" json:"config,omitempty"`
BandwidthLimit *limiter.BandwidthLimit `yaml:"bandwidthLimit" json:"bandwidthLimit,omitempty"`
Tunnels []client.TunnelSpec `yaml:"tunnels,omitempty" json:"tunnels,omitempty"`
}
type FileConfig ¶
type FileConfig struct {
Domain string `yaml:"domain" json:"domain"`
Port int `yaml:"port" json:"port"`
TCPPort int `yaml:"tcpPort" json:"tcpPort"`
Secure *bool `yaml:"secure" json:"secure,omitempty"`
Token string `yaml:"token" json:"token,omitempty"`
Clients []ClientConfig `yaml:"clients" json:"clients,omitempty"`
Notification *client.NotificationConfig `yaml:"notification" json:"notification,omitempty"`
BandwidthLimits *BandwidthLimitsConfig `yaml:"bandwidthLimits" json:"bandwidthLimits,omitempty"`
PublicHTTPNoAuth *PublicHTTPNoAuthConfig `yaml:"publicHTTPNoAuth,omitempty" json:"publicHTTPNoAuth,omitempty"`
Admin *AdminConfig `yaml:"admin,omitempty" json:"admin,omitempty"`
}
FileConfig is the on-disk inlets server YAML document.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates config file reload.
func NewManager ¶
func NewManager(path string, ref *Ref, apply ReloadFunc) *Manager
type PublicHTTPNoAuthConfig ¶
type Ref ¶
type Ref struct {
// contains filtered or unexported fields
}
Ref holds the live server config document for hot reload.
func NewRef ¶
func NewRef(initial *FileConfig) *Ref
func (*Ref) Get ¶
func (r *Ref) Get() *FileConfig
func (*Ref) Set ¶
func (r *Ref) Set(cfg *FileConfig)
type ReloadFunc ¶
type ReloadFunc func(cfg *FileConfig) error
ReloadFunc applies a freshly loaded config to the running server.
type ResolvedAdmin ¶
type ResolvedAdmin struct {
Enabled bool
Host string
Port int
DatabasePath string
PidFile string
SnapshotInterval time.Duration
UIBasePath string
}
ResolvedAdmin holds parsed admin settings with defaults applied.
func ResolveAdmin ¶
func ResolveAdmin(cfg *FileConfig, configPath string) (*ResolvedAdmin, error)
ResolveAdmin applies defaults for admin settings.
func (*ResolvedAdmin) SameListen ¶ added in v1.29.3
func (r *ResolvedAdmin) SameListen(other *ResolvedAdmin) bool
SameListen reports whether two resolved admin configs bind the same HTTP listener.
type ValidationError ¶
ValidationError describes a single configuration problem with a machine-addressable path (dotted/indexed, e.g. "clients[2].clientSecret").
func ValidateWithDetails ¶
func ValidateWithDetails(cfg *FileConfig) []ValidationError
validateWithDetails runs the same checks as Validate but returns a structured list of errors keyed by JSON-pointer-like paths. The function is pure (does not load files) and is safe to call from request handlers.
func (ValidationError) Error ¶
func (e ValidationError) Error() string