redis based router & roomstore

This commit is contained in:
David Zhao
2021-01-17 00:12:05 -08:00
parent 9064f6ade1
commit 30e99e8c6b
28 changed files with 1559 additions and 404 deletions
+11 -2
View File
@@ -6,8 +6,9 @@ import (
)
type Config struct {
Port uint32 `yaml:"port"`
RTC RTCConfig `yaml:"rtc"`
Port uint32 `yaml:"port"`
RTC RTCConfig `yaml:"rtc"`
Redis RedisConfig `yaml:"redis"`
// multi-node configuration,
MultiNode bool `yaml:"multi_node"`
@@ -24,6 +25,11 @@ type RTCConfig struct {
MaxBufferTime int `yaml:"max_buffer_time"`
}
type RedisConfig struct {
Address string `yaml:"address"`
Password string `yaml:"password"`
}
func NewConfig(confString string) (*Config, error) {
// start with defaults
conf := &Config{
@@ -35,6 +41,9 @@ func NewConfig(confString string) (*Config, error) {
"stun.l.google.com:19302",
},
},
Redis: RedisConfig{
Address: "localhost:6379",
},
}
if confString != "" {
yaml.Unmarshal([]byte(confString), conf)