Source File
icetransportpolicy.go
Belonging Package
github.com/pion/webrtc/v4
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage webrtcimport ()// ICETransportPolicy defines the ICE candidate policy surface the// permitted candidates. Only these candidates are used for connectivity checks.type ICETransportPolicy int// ICEGatherPolicy is the ORTC equivalent of ICETransportPolicy.type ICEGatherPolicy = ICETransportPolicyconst (// ICETransportPolicyAll indicates any type of candidate is used.ICETransportPolicyAll ICETransportPolicy = iota// ICETransportPolicyRelay indicates only media relay candidates such// as candidates passing through a TURN server are used.ICETransportPolicyRelay)// This is done this way because of a linter.const (iceTransportPolicyRelayStr = "relay"iceTransportPolicyAllStr = "all")// NewICETransportPolicy takes a string and converts it to ICETransportPolicy.func ( string) ICETransportPolicy {switch {case iceTransportPolicyRelayStr:return ICETransportPolicyRelaydefault:return ICETransportPolicyAll}}func ( ICETransportPolicy) () string {switch {case ICETransportPolicyRelay:return iceTransportPolicyRelayStrcase ICETransportPolicyAll:return iceTransportPolicyAllStrdefault:return ErrUnknownType.Error()}}// UnmarshalJSON parses the JSON-encoded data and stores the result.func ( *ICETransportPolicy) ( []byte) error {var stringif := json.Unmarshal(, &); != nil {return}* = NewICETransportPolicy()return nil}// MarshalJSON returns the JSON encoding.func ( ICETransportPolicy) () ([]byte, error) {return json.Marshal(.String())}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |