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
38 lines
900 B
Go
38 lines
900 B
Go
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package webrtc
|
|
|
|
import "fmt"
|
|
|
|
// ICECandidatePair represents an ICE Candidate pair.
|
|
type ICECandidatePair struct {
|
|
statsID string
|
|
Local *ICECandidate
|
|
Remote *ICECandidate
|
|
}
|
|
|
|
func newICECandidatePairStatsID(localID, remoteID string) string {
|
|
return fmt.Sprintf("%s-%s", localID, remoteID)
|
|
}
|
|
|
|
func (p *ICECandidatePair) String() string {
|
|
if p == nil {
|
|
return "<nil>"
|
|
}
|
|
|
|
return fmt.Sprintf("(local) %s <-> (remote) %s", p.Local, p.Remote)
|
|
}
|
|
|
|
// NewICECandidatePair returns an initialized *ICECandidatePair
|
|
// for the given pair of ICECandidate instances.
|
|
func NewICECandidatePair(local, remote *ICECandidate) *ICECandidatePair {
|
|
statsID := newICECandidatePairStatsID(local.statsID, remote.statsID)
|
|
|
|
return &ICECandidatePair{
|
|
statsID: statsID,
|
|
Local: local,
|
|
Remote: remote,
|
|
}
|
|
}
|