mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00

Add RTCIceRole structure with complete unittests Add RTCIceProtocol structure with unittests Add RTCIceComponent structure with unittests Add RTCIceCandidateType with complete unittests Relates to #83
42 lines
892 B
Go
42 lines
892 B
Go
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()
|
|
}
|
|
}
|