-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.go
More file actions
40 lines (37 loc) · 834 Bytes
/
Copy pathutils.go
File metadata and controls
40 lines (37 loc) · 834 Bytes
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
package connstate
import (
"fmt"
"github.com/vishvananda/netlink"
)
func GetReadableState(state uint8) string {
switch state {
case netlink.TCP_ESTABLISHED:
return "ESTABLISHED"
case netlink.TCP_SYN_SENT:
return "SYN_SENT"
case netlink.TCP_SYN_RECV:
return "SYN_RECV"
case netlink.TCP_FIN_WAIT1:
return "FIN_WAIT1"
case netlink.TCP_FIN_WAIT2:
return "FIN_WAIT2"
case netlink.TCP_TIME_WAIT:
return "TIME_WAIT"
case netlink.TCP_CLOSE:
return "CLOSE"
case netlink.TCP_CLOSE_WAIT:
return "CLOSE_WAIT"
case netlink.TCP_LAST_ACK:
return "LAST_ACK"
case netlink.TCP_LISTEN:
return "LISTEN"
case netlink.TCP_CLOSING:
return "CLOSING"
case netlink.TCP_NEW_SYN_REC:
return "NEW_SYN_REC"
case netlink.TCP_MAX_STATES:
return "MAX_STATES"
default:
return fmt.Sprintf("unknown state %x", state)
}
}