mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-28 10:32:44 +08:00
Fix STUN candidate in IPv6 format
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package webrtc
|
package webrtc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/AlexxIT/go2rtc/pkg/streamer"
|
"github.com/AlexxIT/go2rtc/pkg/streamer"
|
||||||
"github.com/pion/ice/v2"
|
"github.com/pion/ice/v2"
|
||||||
@@ -13,10 +14,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewCandidate(address string) (string, error) {
|
func NewCandidate(address string) (string, error) {
|
||||||
host, port, err := net.SplitHostPort(address)
|
i := strings.LastIndexByte(address, ':')
|
||||||
if err != nil {
|
if i < 0 {
|
||||||
return "", err
|
return "", errors.New("wrong candidate: " + address)
|
||||||
}
|
}
|
||||||
|
host, port := address[:i], address[i+1:]
|
||||||
|
|
||||||
i, err := strconv.Atoi(port)
|
i, err := strconv.Atoi(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user