parseURL (iceserver.go)

webrtc · iceserver.go · go · MIT
auth, Auth / Identity

Go struct and methods for parsing and validating ICE server URLs in WebRTC.

// Source: https://github.com/pion/webrtc | License: MIT | Copyright 2026 The Pion community <https://pion.ly>
// Provided via justclaw.it.com; keep this notice with the code.
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT

//go:build !js

package webrtc

import (
	"encoding/json"

	"github.com/pion/stun/v4"
	"github.com/pion/webrtc/v4/pkg/rtcerr"
)

// ICEServer describes a single STUN and TURN server that can be used by
// the ICEAgent to establish a connection with a peer.
type ICEServer struct {
	URLs           []string          `json:"urls"`
	Username       string            `json:"username,omitempty"`
	Credential     any               `json:"credential,omitempty"`
	CredentialType ICECredentialType `json:"credentialType,omitempty"`

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key