summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/webrtc/v3/configuration_common.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pion/webrtc/v3/configuration_common.go')
-rw-r--r--vendor/github.com/pion/webrtc/v3/configuration_common.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/pion/webrtc/v3/configuration_common.go b/vendor/github.com/pion/webrtc/v3/configuration_common.go
new file mode 100644
index 0000000..92fc228
--- /dev/null
+++ b/vendor/github.com/pion/webrtc/v3/configuration_common.go
@@ -0,0 +1,24 @@
+package webrtc
+
+import "strings"
+
+// getICEServers side-steps the strict parsing mode of the ice package
+// (as defined in https://tools.ietf.org/html/rfc7064) by copying and then
+// stripping any erroneous queries from "stun(s):" URLs before parsing.
+func (c Configuration) getICEServers() []ICEServer {
+ iceServers := append([]ICEServer{}, c.ICEServers...)
+
+ for iceServersIndex := range iceServers {
+ iceServers[iceServersIndex].URLs = append([]string{}, iceServers[iceServersIndex].URLs...)
+
+ for urlsIndex, rawURL := range iceServers[iceServersIndex].URLs {
+ if strings.HasPrefix(rawURL, "stun") {
+ // strip the query from "stun(s):" if present
+ parts := strings.Split(rawURL, "?")
+ rawURL = parts[0]
+ }
+ iceServers[iceServersIndex].URLs[urlsIndex] = rawURL
+ }
+ }
+ return iceServers
+}