webhooks support (#81)

This commit is contained in:
David Zhao
2021-08-09 09:57:37 -07:00
committed by GitHub
parent 1f4288744c
commit 9495646f1a
12 changed files with 286 additions and 19 deletions
+8 -1
View File
@@ -12,7 +12,7 @@ import (
"gopkg.in/yaml.v3"
)
var DEFAULT_STUN_SERVERS = []string{
var DefaultStunServers = []string{
"stun.l.google.com:19302",
"stun1.l.google.com:19302",
}
@@ -25,6 +25,7 @@ type Config struct {
Audio AudioConfig `yaml:"audio"`
Room RoomConfig `yaml:"room"`
TURN TURNConfig `yaml:"turn"`
WebHook WebHookConfig `yaml:"webhook"`
KeyFile string `yaml:"key_file"`
Keys map[string]string `yaml:"keys"`
LogLevel string `yaml:"log_level"`
@@ -99,6 +100,12 @@ type TURNConfig struct {
UDPPort int `yaml:"udp_port"`
}
type WebHookConfig struct {
URLs []string `yaml:"urls"`
// key to use for webhook
APIKey string `yaml:"api_key"`
}
func NewConfig(confString string, c *cli.Context) (*Config, error) {
// start with defaults
conf := &Config{
+1 -1
View File
@@ -15,7 +15,7 @@ func (conf *Config) determineIP() (string, error) {
if conf.RTC.UseExternalIP {
stunServers := conf.RTC.StunServers
if len(stunServers) == 0 {
stunServers = DEFAULT_STUN_SERVERS
stunServers = DefaultStunServers
}
ip, err := GetExternalIP(stunServers)
if err == nil {