Source File
icecredentialtype.go
Belonging Package
github.com/pion/webrtc/v4
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage webrtcimport ()// ICECredentialType indicates the type of credentials used to connect to// an ICE server.type ICECredentialType intconst (// ICECredentialTypePassword describes username and password based// credentials as described in https://tools.ietf.org/html/rfc5389.ICECredentialTypePassword ICECredentialType = iota// ICECredentialTypeOauth describes token based credential as described// in https://tools.ietf.org/html/rfc7635.ICECredentialTypeOauth)// This is done this way because of a linter.const (iceCredentialTypePasswordStr = "password"iceCredentialTypeOauthStr = "oauth")func newICECredentialType( string) (ICECredentialType, error) {switch {case iceCredentialTypePasswordStr:return ICECredentialTypePassword, nilcase iceCredentialTypeOauthStr:return ICECredentialTypeOauth, nildefault:return ICECredentialTypePassword, errInvalidICECredentialTypeString}}func ( ICECredentialType) () string {switch {case ICECredentialTypePassword:return iceCredentialTypePasswordStrcase ICECredentialTypeOauth:return iceCredentialTypeOauthStrdefault:return ErrUnknownType.Error()}}// UnmarshalJSON parses the JSON-encoded data and stores the result.func ( *ICECredentialType) ( []byte) error {var stringif := json.Unmarshal(, &); != nil {return}, := newICECredentialType()if != nil {return fmt.Errorf("%w: (%s)", , )}* =return nil}// MarshalJSON returns the JSON encoding.func ( ICECredentialType) () ([]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. |