Source File
iceprotocol.go
Belonging Package
github.com/pion/webrtc/v4
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage webrtcimport ()// ICEProtocol indicates the transport protocol type that is used in the// ice.URL structure.type ICEProtocol intconst (// ICEProtocolUnknown is the enum's zero-value.ICEProtocolUnknown ICEProtocol = iota// ICEProtocolUDP indicates the URL uses a UDP transport.ICEProtocolUDP// ICEProtocolTCP indicates the URL uses a TCP transport.ICEProtocolTCP)// This is done this way because of a linter.const (iceProtocolUDPStr = "udp"iceProtocolTCPStr = "tcp")// NewICEProtocol takes a string and converts it to ICEProtocol.func ( string) (ICEProtocol, error) {switch {case strings.EqualFold(iceProtocolUDPStr, ):return ICEProtocolUDP, nilcase strings.EqualFold(iceProtocolTCPStr, ):return ICEProtocolTCP, nildefault:return ICEProtocolUnknown, fmt.Errorf("%w: %s", errICEProtocolUnknown, )}}func ( ICEProtocol) () string {switch {case ICEProtocolUDP:return iceProtocolUDPStrcase ICEProtocolTCP:return iceProtocolTCPStrdefault:return ErrUnknownType.Error()}}
![]() |
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. |