forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtcicetransportpolicy.go
42 lines (36 loc) · 1.14 KB
/
rtcicetransportpolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package webrtc
// RTCIceTransportPolicy defines the ICE candidate policy surface the
// permitted candidates. Only these candidates are used for connectivity checks.
type RTCIceTransportPolicy int
const (
// RTCIceTransportPolicyRelay indicates only media relay candidates such
// as candidates passing through a TURN server are used.
RTCIceTransportPolicyRelay RTCIceTransportPolicy = iota + 1
// RTCIceTransportPolicyAll indicates any type of candidate is used.
RTCIceTransportPolicyAll
)
// This is done this way because of a linter.
const (
rtcIceTransportPolicyRelayStr = "relay"
rtcIceTransportPolicyAllStr = "all"
)
func newRTCIceTransportPolicy(raw string) RTCIceTransportPolicy {
switch raw {
case rtcIceTransportPolicyRelayStr:
return RTCIceTransportPolicyRelay
case rtcIceTransportPolicyAllStr:
return RTCIceTransportPolicyAll
default:
return RTCIceTransportPolicy(Unknown)
}
}
func (t RTCIceTransportPolicy) String() string {
switch t {
case RTCIceTransportPolicyRelay:
return rtcIceTransportPolicyRelayStr
case RTCIceTransportPolicyAll:
return rtcIceTransportPolicyAllStr
default:
return ErrUnknownType.Error()
}
}