qcc/internal/config/config.go
Niko Marmeladkov fc0caf13ef
Initial commit: QuiC Call server
- PoW (Hashcash) authentication
- X.509 CA for phone number certificates (+0 XXX YYY ZZZ)
- QUIC transport (hysteria quic-go fork) with ACME TLS
- Custom append-only DB engine (from NikoGram)
- Call signaling (dial/ring/accept/reject/end)
- E2EE media relay (X25519 + ChaCha20-Poly1305)
- Brutal congestion control (from hysteria)
- Media datagram relay (Opus/VP9/H264/H265)
- Graceful shutdown
2026-06-30 12:38:34 +03:00

64 lines
1.6 KiB
Go

package config
import (
"time"
"github.com/spf13/viper"
)
type Config struct {
Server ServerConfig `mapstructure:"server"`
ACME ACMEConfig `mapstructure:"acme"`
PoW PoWConfig `mapstructure:"pow"`
Identity IdentityConfig `mapstructure:"identity"`
CA CAConfig `mapstructure:"ca"`
Relay RelayConfig `mapstructure:"relay"`
DataDir string `mapstructure:"data_dir"`
LogLevel string `mapstructure:"log_level"`
}
type ServerConfig struct {
Listen string `mapstructure:"listen"`
}
type ACMEConfig struct {
Domains []string `mapstructure:"domains"`
Email string `mapstructure:"email"`
CA string `mapstructure:"ca"`
Type string `mapstructure:"type"`
DNS ACMEDNSConfig `mapstructure:"dns"`
}
type ACMEDNSConfig struct {
Name string `mapstructure:"name"`
Config map[string]string `mapstructure:"config"`
}
type PoWConfig struct {
Difficulty int `mapstructure:"difficulty"`
ChallengeTTL time.Duration `mapstructure:"challenge_ttl"`
}
type IdentityConfig struct {
Cooldown time.Duration `mapstructure:"cooldown"`
Prefix string `mapstructure:"prefix"`
}
type CAConfig struct {
KeyType string `mapstructure:"key_type"`
Validity time.Duration `mapstructure:"validity"`
}
type RelayConfig struct {
BandwidthUp string `mapstructure:"bandwidth_up"`
BandwidthDown string `mapstructure:"bandwidth_down"`
MediaTimeout time.Duration `mapstructure:"media_timeout"`
}
func Load() *Config {
cfg := &Config{}
if err := viper.Unmarshal(cfg); err != nil {
panic(err)
}
return cfg
}