-
Notifications
You must be signed in to change notification settings - Fork 9
/
const.go
90 lines (81 loc) · 1.9 KB
/
const.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//go:build windows
// +build windows
package divert
type Layer int
func (l Layer) String() string {
switch l {
case LayerNetwork:
return "WINDIVERT_LAYER_NETWORK"
case LayerNetworkForward:
return "WINDIVERT_LAYER_NETWORK_FORWARD"
case LayerFlow:
return "WINDIVERT_LAYER_FLOW"
case LayerSocket:
return "WINDIVERT_LAYER_SOCKET"
case LayerReflect:
return "WINDIVERT_LAYER_REFLECT"
//case LayerEthernet:
// return "WINDIVERT_LAYER_ETHERNET"
default:
return ""
}
}
type Event int
func (e Event) String() string {
switch e {
case EventNetworkPacket:
return "WINDIVERT_EVENT_NETWORK_PACKET"
case EventFlowEstablished:
return "WINDIVERT_EVENT_FLOW_ESTABLISHED"
case EventFlowDeleted:
return "WINDIVERT_EVENT_FLOW_DELETED"
case EventSocketBind:
return "WINDIVERT_EVENT_SOCKET_BIND"
case EventSocketConnect:
return "WINDIVERT_EVENT_SOCKET_CONNECT"
case EventSocketListen:
return "WINDIVERT_EVENT_SOCKET_LISTEN"
case EventSocketAccept:
return "WINDIVERT_EVENT_SOCKET_ACCEPT"
case EventSocketClose:
return "WINDIVERT_EVENT_SOCKET_CLOSE"
case EventReflectOpen:
return "WINDIVERT_EVENT_REFLECT_OPEN"
case EventReflectClose:
return "WINDIVERT_EVENT_REFLECT_CLOSE"
//case EventEthernetFrame:
// return "WINDIVERT_EVENT_ETHERNET_FRAME"
default:
return ""
}
}
type Shutdown int
func (s Shutdown) String() string {
switch s {
case ShutdownRecv:
return "WINDIVERT_SHUTDOWN_RECV"
case ShutdownSend:
return "WINDIVERT_SHUTDOWN_SEND"
case ShutdownBoth:
return "WINDIVERT_SHUTDOWN_BOTH"
default:
return ""
}
}
type Param int
func (p Param) String() string {
switch p {
case QueueLength:
return "WINDIVERT_PARAM_QUEUE_LENGTH"
case QueueTime:
return "WINDIVERT_PARAM_QUEUE_TIME"
case QueueSize:
return "WINDIVERT_PARAM_QUEUE_SIZE"
case VersionMajor:
return "WINDIVERT_PARAM_VERSION_MAJOR"
case VersionMinor:
return "WINDIVERT_PARAM_VERSION_MINOR"
default:
return ""
}
}