forked from notedit/sdp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirection.go
57 lines (50 loc) · 788 Bytes
/
direction.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package sdp
type Direction uint8
const (
SENDRECV Direction = iota + 1
SENDONLY
RECVONLY
INACTIVE
)
func DirectionbyValue(direction string) Direction {
switch direction {
case "sendrecv":
return SENDRECV
case "sendonly":
return SENDONLY
case "recvonly":
return RECVONLY
case "inactive":
return INACTIVE
default:
return 0
}
}
func (d Direction) Reverse() Direction {
switch d {
case SENDRECV:
return SENDRECV
case SENDONLY:
return RECVONLY
case RECVONLY:
return SENDONLY
case INACTIVE:
return INACTIVE
default:
return 0
}
}
func (d Direction) String() string {
switch d {
case SENDRECV:
return "sendrecv"
case SENDONLY:
return "sendonly"
case RECVONLY:
return "recvonly"
case INACTIVE:
return "inactive"
default:
return ""
}
}