forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtciceprotocol.go
41 lines (35 loc) · 892 Bytes
/
rtciceprotocol.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
package webrtc
// RTCIceProtocol indicates the transport protocol type that is used in the
// ice.URL structure.
type RTCIceProtocol int
const (
// RTCIceProtocolUDP indicates the URL uses a UDP transport.
RTCIceProtocolUDP RTCIceProtocol = iota + 1
// RTCIceProtocolTCP indicates the URL uses a TCP transport.
RTCIceProtocolTCP
)
// This is done this way because of a linter.
const (
rtcIceProtocolUDPStr = "udp"
rtcIceProtocolTCPStr = "tcp"
)
func newRTCIceProtocol(raw string) RTCIceProtocol {
switch raw {
case rtcIceProtocolUDPStr:
return RTCIceProtocolUDP
case rtcIceProtocolTCPStr:
return RTCIceProtocolTCP
default:
return RTCIceProtocol(Unknown)
}
}
func (t RTCIceProtocol) String() string {
switch t {
case RTCIceProtocolUDP:
return rtcIceProtocolUDPStr
case RTCIceProtocolTCP:
return rtcIceProtocolTCPStr
default:
return ErrUnknownType.Error()
}
}