turn server tls (#38)

* tls

* acm

* use cert/key files

* turn -> turns

* turn cert config

* updates

* move panic

* tidy

* final updates
This commit is contained in:
David Colburn
2021-07-01 17:00:49 -05:00
committed by GitHub
parent 4e6eafa63c
commit e543aaa98a
7 changed files with 74 additions and 57 deletions
+11 -4
View File
@@ -71,8 +71,10 @@ type RedisConfig struct {
type TURNConfig struct {
Enabled bool `yaml:"enabled"`
TCPPort int `yaml:"tcp_port"`
UDPPort int `yaml:"udp_port"`
Domain string `yaml:"domain"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
TLSPort int `yaml:"tls_port"`
PortRangeStart uint16 `yaml:"port_range_start"`
PortRangeEnd uint16 `yaml:"port_range_end"`
}
@@ -108,8 +110,7 @@ func NewConfig(confString string) (*Config, error) {
Redis: RedisConfig{},
TURN: TURNConfig{
Enabled: false,
TCPPort: 3478,
UDPPort: 3478,
TLSPort: 3478,
PortRangeStart: 12000,
PortRangeEnd: 14000,
},
@@ -143,6 +144,12 @@ func (conf *Config) UpdateFromCLI(c *cli.Context) error {
if c.IsSet("redis-password") {
conf.Redis.Password = c.String("redis-password")
}
if c.IsSet("turn-cert") {
conf.TURN.CertFile = c.String("turn-cert")
}
if c.IsSet("turn-key") {
conf.TURN.KeyFile = c.String("turn-key")
}
// expand env vars in filenames
file, err := homedir.Expand(os.ExpandEnv(conf.KeyFile))
if err != nil {