feat: support UDP in TURN (#61)
1. Add UDP option to TURN 2. GetLocalIPAddress default to IPv4
This commit is contained in:
@@ -91,6 +91,7 @@ type TURNConfig struct {
|
||||
CertFile string `yaml:"cert_file"`
|
||||
KeyFile string `yaml:"key_file"`
|
||||
TLSPort int `yaml:"tls_port"`
|
||||
UDPPort int `yaml:"udp_port"`
|
||||
}
|
||||
|
||||
func NewConfig(confString string, c *cli.Context) (*Config, error) {
|
||||
@@ -135,6 +136,7 @@ func NewConfig(confString string, c *cli.Context) (*Config, error) {
|
||||
TURN: TURNConfig{
|
||||
Enabled: false,
|
||||
TLSPort: 3478,
|
||||
UDPPort: 3478,
|
||||
},
|
||||
Keys: map[string]string{},
|
||||
}
|
||||
|
||||
+5
-2
@@ -41,12 +41,15 @@ func GetLocalIPAddress() (string, error) {
|
||||
var ip net.IP
|
||||
switch v := addr.(type) {
|
||||
case *net.IPNet:
|
||||
ip = v.IP
|
||||
ip = v.IP.To4()
|
||||
case *net.IPAddr:
|
||||
ip = v.IP
|
||||
ip = v.IP.To4()
|
||||
default:
|
||||
continue
|
||||
}
|
||||
if ip == nil {
|
||||
continue
|
||||
}
|
||||
if ip.IsLoopback() {
|
||||
loopBack = ip.String()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user