-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.go
52 lines (38 loc) · 796 Bytes
/
lib.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
package lib
import (
"github.com/monaco-io/lib/assert"
"github.com/monaco-io/lib/ip"
"github.com/monaco-io/lib/retry"
"github.com/monaco-io/lib/sys"
)
// network
var (
// ExternalIPv4 get public ipv4
ExternalIPv4 = ip.ExternalV4
// InternalIPv4 get local ipv4
InternalIPv4 = ip.InternalV4
// IPAtoI ip string to int
IPAtoI = ip.AtoI
// IPItoA ip int to string
IPItoA = ip.ItoA
)
// assert
var (
// OK assert and fatal
OK = assert.OK
// Equal a == b
Equal = assert.Equal
// DeepEqual a deepequal b
DeepEqual = assert.DeepEqual
)
// sys
var (
// ExitGrace exec callback functions before exit (SIGINT/SIGQUIT/SIGTERM)
ExitGrace = sys.ExitGrace
// Recover recover panic and log
Recover = sys.Recover
)
var (
// Retry retry when there is error
Retry = retry.Do
)