Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s
29 lines
911 B
Go
29 lines
911 B
Go
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
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
|
|
}
|