Refine ipv6 support (#4352)
* Refine ipv6 support * go mod * check ipv4 is set in turn
This commit is contained in:
@@ -22,7 +22,7 @@ require (
|
|||||||
github.com/jellydator/ttlcache/v3 v3.4.0
|
github.com/jellydator/ttlcache/v3 v3.4.0
|
||||||
github.com/jxskiss/base62 v1.1.0
|
github.com/jxskiss/base62 v1.1.0
|
||||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
|
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
|
||||||
github.com/livekit/mediatransportutil v0.0.0-20260113174415-2e8ba344fca3
|
github.com/livekit/mediatransportutil v0.0.0-20260309115634-0e2e24b36ee8
|
||||||
github.com/livekit/protocol v1.45.1-0.20260306195537-8d130a7700dc
|
github.com/livekit/protocol v1.45.1-0.20260306195537-8d130a7700dc
|
||||||
github.com/livekit/psrpc v0.7.1
|
github.com/livekit/psrpc v0.7.1
|
||||||
github.com/mackerelio/go-osstat v0.2.6
|
github.com/mackerelio/go-osstat v0.2.6
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ github.com/lithammer/shortuuid/v4 v4.2.0 h1:LMFOzVB3996a7b8aBuEXxqOBflbfPQAiVzkI
|
|||||||
github.com/lithammer/shortuuid/v4 v4.2.0/go.mod h1:D5noHZ2oFw/YaKCfGy0YxyE7M0wMbezmMjPdhyEFe6Y=
|
github.com/lithammer/shortuuid/v4 v4.2.0/go.mod h1:D5noHZ2oFw/YaKCfGy0YxyE7M0wMbezmMjPdhyEFe6Y=
|
||||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 h1:9x+U2HGLrSw5ATTo469PQPkqzdoU7be46ryiCDO3boc=
|
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 h1:9x+U2HGLrSw5ATTo469PQPkqzdoU7be46ryiCDO3boc=
|
||||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
|
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
|
||||||
github.com/livekit/mediatransportutil v0.0.0-20260113174415-2e8ba344fca3 h1:v1Xc/q/547TjLX7Nw5y2vXNnmV0XYFAbhTJrtErQeDA=
|
github.com/livekit/mediatransportutil v0.0.0-20260309115634-0e2e24b36ee8 h1:coWig9fKxdb/nwOaIoGUUAogso12GblAJh/9SA9hcxk=
|
||||||
github.com/livekit/mediatransportutil v0.0.0-20260113174415-2e8ba344fca3/go.mod h1:QBx/KHV6Vv00ggibg/WrOlqrkTciEA2Hc9DGWYr3Q9U=
|
github.com/livekit/mediatransportutil v0.0.0-20260309115634-0e2e24b36ee8/go.mod h1:RCd46PT+6sEztld6XpkCrG1xskb0u3SqxIjy4G897Ss=
|
||||||
github.com/livekit/protocol v1.45.1-0.20260306195537-8d130a7700dc h1:UggX1s3nghwMuwmHvnF1ZONWSxjOUILLyhaC4pTyCNA=
|
github.com/livekit/protocol v1.45.1-0.20260306195537-8d130a7700dc h1:UggX1s3nghwMuwmHvnF1ZONWSxjOUILLyhaC4pTyCNA=
|
||||||
github.com/livekit/protocol v1.45.1-0.20260306195537-8d130a7700dc/go.mod h1:63AUi0vQak6Y6gPqSBHLc+ExYTUwEqF/m4b2IRW1iO0=
|
github.com/livekit/protocol v1.45.1-0.20260306195537-8d130a7700dc/go.mod h1:63AUi0vQak6Y6gPqSBHLc+ExYTUwEqF/m4b2IRW1iO0=
|
||||||
github.com/livekit/psrpc v0.7.1 h1:ms37az0QTD3UXIWuUC5D/SkmKOlRMVRsI261eBWu/Vw=
|
github.com/livekit/psrpc v0.7.1 h1:ms37az0QTD3UXIWuUC5D/SkmKOlRMVRsI261eBWu/Vw=
|
||||||
|
|||||||
@@ -796,7 +796,7 @@ func (conf *Config) updateFromCLI(c *cli.Command, baseFlags []cli.Flag) error {
|
|||||||
conf.TURN.KeyFile = c.String("turn-key")
|
conf.TURN.KeyFile = c.String("turn-key")
|
||||||
}
|
}
|
||||||
if c.IsSet("node-ip") {
|
if c.IsSet("node-ip") {
|
||||||
conf.RTC.NodeIP = c.String("node-ip")
|
conf.RTC.NodeIP.UnmarshalString(c.String("node-ip"))
|
||||||
}
|
}
|
||||||
if c.IsSet("udp-port") {
|
if c.IsSet("udp-port") {
|
||||||
conf.RTC.UDPPort.UnmarshalString(c.String("udp-port"))
|
conf.RTC.UDPPort.UnmarshalString(c.String("udp-port"))
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@ type LocalNodeImpl struct {
|
|||||||
|
|
||||||
func NewLocalNode(conf *config.Config) (*LocalNodeImpl, error) {
|
func NewLocalNode(conf *config.Config) (*LocalNodeImpl, error) {
|
||||||
nodeID := guid.New(utils.NodePrefix)
|
nodeID := guid.New(utils.NodePrefix)
|
||||||
if conf != nil && conf.RTC.NodeIP == "" {
|
if conf != nil && conf.RTC.NodeIP.IsEmpty() {
|
||||||
return nil, ErrIPNotSet
|
return nil, ErrIPNotSet
|
||||||
}
|
}
|
||||||
nowUnix := time.Now().Unix()
|
nowUnix := time.Now().Unix()
|
||||||
@@ -65,7 +65,7 @@ func NewLocalNode(conf *config.Config) (*LocalNodeImpl, error) {
|
|||||||
}
|
}
|
||||||
var nsc *config.NodeStatsConfig
|
var nsc *config.NodeStatsConfig
|
||||||
if conf != nil {
|
if conf != nil {
|
||||||
l.node.Ip = conf.RTC.NodeIP
|
l.node.Ip = conf.RTC.NodeIP.PrimaryIP()
|
||||||
l.node.Region = conf.Region
|
l.node.Region = conf.Region
|
||||||
|
|
||||||
nsc = &conf.NodeStats
|
nsc = &conf.NodeStats
|
||||||
|
|||||||
+4
-1
@@ -53,6 +53,9 @@ func NewTurnServer(conf *config.Config, authHandler turn.AuthHandler, standalone
|
|||||||
if turnConf.TLSPort <= 0 && turnConf.UDPPort <= 0 {
|
if turnConf.TLSPort <= 0 && turnConf.UDPPort <= 0 {
|
||||||
return nil, errors.New("invalid TURN ports")
|
return nil, errors.New("invalid TURN ports")
|
||||||
}
|
}
|
||||||
|
if conf.RTC.NodeIP.V4 == "" {
|
||||||
|
return nil, errors.New("invalid node IPv4 for relay")
|
||||||
|
}
|
||||||
|
|
||||||
serverConfig := turn.ServerConfig{
|
serverConfig := turn.ServerConfig{
|
||||||
Realm: LivekitRealm,
|
Realm: LivekitRealm,
|
||||||
@@ -60,7 +63,7 @@ func NewTurnServer(conf *config.Config, authHandler turn.AuthHandler, standalone
|
|||||||
LoggerFactory: pionlogger.NewLoggerFactory(logger.GetLogger()),
|
LoggerFactory: pionlogger.NewLoggerFactory(logger.GetLogger()),
|
||||||
}
|
}
|
||||||
var relayAddrGen turn.RelayAddressGenerator = &turn.RelayAddressGeneratorPortRange{
|
var relayAddrGen turn.RelayAddressGenerator = &turn.RelayAddressGeneratorPortRange{
|
||||||
RelayAddress: net.ParseIP(conf.RTC.NodeIP),
|
RelayAddress: net.ParseIP(conf.RTC.NodeIP.V4),
|
||||||
Address: "0.0.0.0",
|
Address: "0.0.0.0",
|
||||||
MinPort: turnConf.RelayPortRangeStart,
|
MinPort: turnConf.RelayPortRangeStart,
|
||||||
MaxPort: turnConf.RelayPortRangeEnd,
|
MaxPort: turnConf.RelayPortRangeEnd,
|
||||||
|
|||||||
Reference in New Issue
Block a user