moved stun server to configuration
This commit is contained in:
@@ -14,6 +14,9 @@ type Config struct {
|
||||
// multi-node configuration,
|
||||
MultiNode bool `yaml:"multi_node"`
|
||||
Development bool `yaml:"development"`
|
||||
|
||||
// Stun server
|
||||
StunServer string `yaml:"stun_server"`
|
||||
}
|
||||
|
||||
func NewConfig(confString string) (*Config, error) {
|
||||
@@ -23,6 +26,7 @@ func NewConfig(confString string) (*Config, error) {
|
||||
RTCPort: 7881,
|
||||
UDPRangeStart: 10000,
|
||||
UDPRangeEnd: 11000,
|
||||
StunServer: "stun.l.google.com:19302",
|
||||
}
|
||||
if confString != "" {
|
||||
yaml.Unmarshal([]byte(confString), conf)
|
||||
|
||||
+4
-4
@@ -9,14 +9,13 @@ import (
|
||||
"github.com/livekit/livekit-server/proto/livekit"
|
||||
)
|
||||
|
||||
const (
|
||||
googleStunServer = "stun.l.google.com:19302"
|
||||
)
|
||||
const ()
|
||||
|
||||
var NodeSet = wire.NewSet(NewLocalNode)
|
||||
|
||||
type Node struct {
|
||||
livekit.Node
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
type NodeStats struct {
|
||||
@@ -37,6 +36,7 @@ func NewLocalNode(conf *config.Config) (*Node, error) {
|
||||
Id: id.String(),
|
||||
RtcPort: conf.RTCPort,
|
||||
},
|
||||
config: conf,
|
||||
}
|
||||
if err = n.DiscoverNetworkInfo(); err != nil {
|
||||
return nil, err
|
||||
@@ -45,7 +45,7 @@ func NewLocalNode(conf *config.Config) (*Node, error) {
|
||||
}
|
||||
|
||||
func (n *Node) DiscoverNetworkInfo() error {
|
||||
c, err := stun.Dial("udp", googleStunServer)
|
||||
c, err := stun.Dial("udp", n.config.StunServer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user