forked from florianl/go-tc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
converter.go
146 lines (119 loc) · 1.7 KB
/
converter.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package tc
import "net"
func netIPPtr(v net.IP) *net.IP {
return &v
}
func netIPValue(v *net.IP) net.IP {
if v != nil {
return *v
}
return net.IP{}
}
func netHardwareAddrPtr(v net.HardwareAddr) *net.HardwareAddr {
return &v
}
func netHardwareAddrValue(v *net.HardwareAddr) net.HardwareAddr {
if v != nil {
return *v
}
return net.HardwareAddr{}
}
func bytesPtr(v []byte) *[]byte {
return &v
}
func bytesValue(v *[]byte) []byte {
if v != nil {
return *v
}
return []byte{}
}
func boolPtr(v bool) *bool {
return &v
}
func boolValue(v *bool) bool {
if v != nil {
return *v
}
return false
}
func stringPtr(v string) *string {
return &v
}
func stringValue(v *string) string {
if v != nil {
return *v
}
return ""
}
func uint8Ptr(v uint8) *uint8 {
return &v
}
func uint8Value(v *uint8) uint8 {
if v != nil {
return *v
}
return 0
}
func uint16Ptr(v uint16) *uint16 {
return &v
}
func uint16Value(v *uint16) uint16 {
if v != nil {
return *v
}
return 0
}
func uint32Ptr(v uint32) *uint32 {
return &v
}
func uint32Value(v *uint32) uint32 {
if v != nil {
return *v
}
return 0
}
func uint64Ptr(v uint64) *uint64 {
return &v
}
func uint64Value(v *uint64) uint64 {
if v != nil {
return *v
}
return 0
}
func int8Ptr(v int8) *int8 {
return &v
}
func int8Value(v *int8) int8 {
if v != nil {
return *v
}
return 0
}
func int16Ptr(v int16) *int16 {
return &v
}
func int16Value(v *int16) int16 {
if v != nil {
return *v
}
return 0
}
func int32Ptr(v int32) *int32 {
return &v
}
func int32Value(v *int32) int32 {
if v != nil {
return *v
}
return 0
}
func int64Ptr(v int64) *int64 {
return &v
}
func int64Value(v *int64) int64 {
if v != nil {
return *v
}
return 0
}