-
Notifications
You must be signed in to change notification settings - Fork 20
/
icmp_type.go
57 lines (50 loc) · 1.47 KB
/
icmp_type.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 cmd
import (
"strings"
"github.com/fatih/camelcase"
)
//go:generate stringer -type=icmpType
type icmpType uint8
// nolint
const (
echoReply icmpType = 0
destinationUnreachable icmpType = 3
sourceQuench icmpType = 4
redirect icmpType = 5
alternateHostAddress icmpType = 6
echo icmpType = 8
routerAdvertisement icmpType = 9
routerSelection icmpType = 10
timeExceeded icmpType = 11
parameterProblem icmpType = 12
timestamp icmpType = 13
timestampReply icmpType = 14
informationRequest icmpType = 15
informationReply icmpType = 16
addressMaskRequest icmpType = 17
addressMaskReply icmpType = 18
traceroute icmpType = 30
datagramConversionError icmpType = 31
mobileHostRedirect icmpType = 32
ipv6WhereAreYou icmpType = 33
ipv6IAmHere icmpType = 34
mobileRegistrationRequest icmpType = 35
mobileRegistrationReply icmpType = 36
domainNameRequest icmpType = 37
domainNameReply icmpType = 38
skip icmpType = 39
photuris icmpType = 40
echoRequest icmpType = 128
)
func (i icmpType) StringFormatted() string {
splitted := camelcase.Split(i.String())
res := ""
for i, v := range splitted {
if i == 0 {
res += v
continue
}
res += " " + v
}
return strings.Title(res)
}