Documentation
¶
Index ¶
- Constants
- func DefaultConfigPath() string
- func NewEmbeddedHandler(bridge MediaBridgeProvider) http.Handler
- func NewHandler(cfg *Config, bridge MediaBridge) (http.Handler, error)
- type CloseSessionResp
- type Config
- type DiagnosticMediaBridge
- type HealthResp
- type LocalStackASRConfig
- type LocalStackConfig
- type LocalStackLLMConfig
- type MediaBridge
- type MediaBridgeProvider
- type OfferResp
- type ServerConfig
- type TrustedIssuerConfig
Constants ¶
const ( // BackendGeminiLive bridges WebRTC voice sessions to Gemini Live. BackendGeminiLive = "gemini-live" // BackendLocalStack is the local ASR/LLM/TTS model stack. BackendLocalStack = "local-stack" )
Internal backend IDs. A gateway instance serves exactly one of these. They are gateway implementation details: they appear in gateway config, logs, and tests, but never in the client contract.
const DefaultGeminiModel = "gemini-3.8-live"
DefaultGeminiModel is the Gemini Live model used when config.model is empty.
Model IDs are bare, without the models/ resource-name prefix; the Gemini adapter qualifies them for the wire.
const DefaultVoiceScope = "voice.session"
DefaultVoiceScope is the OAuth scope a gateway requires on an OAuth access token that authorizes a voice session.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the canonical standalone voice gateway config path.
func NewEmbeddedHandler ¶
func NewEmbeddedHandler(bridge MediaBridgeProvider) http.Handler
NewEmbeddedHandler returns voice gateway RTC routes for a caller that already enforces request authentication before dispatch.
func NewHandler ¶
func NewHandler( cfg *Config, bridge MediaBridge, ) (http.Handler, error)
NewHandler returns a reusable voice gateway HTTP handler.
Types ¶
type CloseSessionResp ¶
type CloseSessionResp struct {
Status string `json:"status"`
}
CloseSessionResp is returned after closing a voice gateway session.
type Config ¶
type Config struct {
Server ServerConfig `toml:"server"`
Model string `toml:"model"`
Backend string `toml:"backend"`
LocalStack LocalStackConfig `toml:"local_stack"`
TrustedIssuers []TrustedIssuerConfig `toml:"trusted_issuers"`
}
Config is the static voice gateway configuration.
A gateway instance serves exactly one backend. Operators run multiple instances (and point clients at different URLs) to offer multiple profiles.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the standalone voice gateway defaults.
func LoadConfig ¶
LoadConfig reads config.toml, returning defaults when the file does not exist.
func (*Config) ValidateEmbedded ¶
ValidateEmbedded returns an error if c is not usable by an embedded service gateway.
type DiagnosticMediaBridge ¶
type DiagnosticMediaBridge interface {
DiagnoseVoiceRTC(ctx context.Context, sessionID string, client *voicev1.VoiceRTCClientDiagnostics) voicev1.VoiceRTCDiagnosticsResp
}
DiagnosticMediaBridge returns structured WebRTC connectivity diagnostics.
type HealthResp ¶
type HealthResp struct {
Status string `json:"status"`
}
HealthResp is returned by GET /api/voicegateway/v1/voice/health.
type LocalStackASRConfig ¶
type LocalStackASRConfig struct {
Provider string `toml:"provider"`
Remote string `toml:"remote"`
Model string `toml:"model"`
}
LocalStackASRConfig configures the local ASR (speech-to-text) adapter.
type LocalStackConfig ¶
type LocalStackConfig struct {
ASR LocalStackASRConfig `toml:"asr"`
LLM LocalStackLLMConfig `toml:"llm"`
}
LocalStackConfig configures local model adapters.
type LocalStackLLMConfig ¶
type LocalStackLLMConfig struct {
Provider string `toml:"provider"`
Remote string `toml:"remote"`
Model string `toml:"model"`
}
LocalStackLLMConfig configures the local LLM adapter.
type MediaBridge ¶
type MediaBridge interface {
HandleOffer(ctx context.Context, sdp string) (sdpAnswer, sessionID string, err error)
Close(sessionID string)
}
MediaBridge is the WebRTC media transport used by the voice gateway API.
type MediaBridgeProvider ¶
type MediaBridgeProvider func() MediaBridge
MediaBridgeProvider returns the current WebRTC media transport.
type ServerConfig ¶
ServerConfig configures gateway HTTP and WebRTC listeners.
type TrustedIssuerConfig ¶
type TrustedIssuerConfig struct {
// Service is the service kind allowed to issue tokens, for example "caic" or "mddb".
Service string `toml:"service"`
// Issuer is the backend origin that owns the signing key.
//
// It must match the service authorization base URL and the token backend origin.
Issuer string `toml:"issuer"`
// PublicKey is the imported Ed25519 public key used to verify scoped tokens from issuer.
//
// The expected format is the value returned by gomode.EncodeServiceSigningPublicKey.
PublicKey string `toml:"public_key"`
// OAuth enables OAuth 2.0 access token verification through discovery and JWKS.
OAuth bool `toml:"oauth"`
// Audience is the required OAuth token audience. It defaults to
// gomode.ScopedTokenAudience when empty.
Audience string `toml:"audience"`
// Scope is the OAuth scope a token must carry. It defaults to
// DefaultVoiceScope when empty.
Scope string `toml:"scope"`
}
TrustedIssuerConfig configures a service backend trusted to issue tokens.
Exactly one of PublicKey or OAuth selects the token form. PublicKey verifies the transitional scoped Ed25519 token. OAuth verifies a standard OAuth 2.0 access token through issuer metadata discovery and its published JWKS.
func (TrustedIssuerConfig) OAuthAudience ¶
func (c TrustedIssuerConfig) OAuthAudience() string
OAuthAudience returns the audience an OAuth token from this issuer must carry.
func (TrustedIssuerConfig) OAuthScope ¶
func (c TrustedIssuerConfig) OAuthScope() string
OAuthScope returns the scope an OAuth token from this issuer must carry.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api provides shared voice gateway API infrastructure.
|
Package api provides shared voice gateway API infrastructure. |
|
Package voicertc implements WebRTC voice sessions through the voice gateway protocol.
|
Package voicertc implements WebRTC voice sessions through the voice gateway protocol. |