Documentation
¶
Overview ¶
Package config owns Hosted and App Local configuration and ICE discovery. Callers provide configuration inputs; loading opens no runtime resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NATPredictionStunURLs ¶
NATPredictionStunURLs returns the two auxiliary listeners derived from the first ordinary STUN authority on UDP 3478.
func Origin ¶
Origin ports the WHATWG URL `origin` getter for the http/https/ws/wss schemes this package accepts: new URL("https://Example.com:443/").origin is "https://example.com". It is exported so app and cmd can compare request origins without a second copy of the rule. Invalid hosts/ports return empty.
Types ¶
type Config ¶
type Config struct {
Env Environment
Port int
ListenHost string
PublicBaseURL *url.URL
// AllowedOrigins is a membership test only; map order is not observable.
AllowedOrigins map[string]struct{}
SiteAccessPassword string
RoomDatabasePath string
RoomEmptyTimeoutSeconds int
MaxViewersPerRoom int
EndpointMediaCopyCapacity int
SFU *SFUConfig
STUNURLs []string
// STUNListenAddresses is populated only by Hosted configuration. Local
// discovery URLs do not make the Client an externally reachable STUN server.
STUNListenAddresses []string
NATPredictionEnabled bool
// NATPredictionSTUNURLs is nil when unset, which IceConfig distinguishes
// from a configured empty list.
NATPredictionSTUNURLs []string
}
Config describes runtime configuration. Zero values mean open site access, process-memory rooms, and no SFU fallback.
func Load ¶
Load validates the whole process environment. Presence, not emptiness, distinguishes an explicit value from an unset value where that distinction is part of the contract.
func Local ¶
func Local(options LocalOptions) (Config, error)
type Environment ¶
type Environment string
Environment selects development-only behavior. A stale unit file must fail closed rather than fall back to development.
const ( EnvironmentDevelopment Environment = "development" EnvironmentProduction Environment = "production" )
The two accepted PIIK_ENV values.
type LocalOptions ¶
type LocalOptions struct {
// Port 0 selects the default 8787.
Port int
PublicAddress string
PublicOrigin string
AllowedAddresses []string
SiteAccessPassword string
STUNURLs []string
NATPredictionSTUNURLs []string
}
LocalOptions describes App-selected Local composition. It never reads the process environment.