Documentation ¶
Overview ¶
ap a package for go utils
Index ¶
- Constants
- Variables
- func B2S(b []byte) string
- func GetCurrentExecDir() (string, error)
- func GetCurrentPath() (string, error)
- func GetLocalIP() ([]string, error)
- func GetNetMeta() (string, int64, error)
- func GetOutboundIP() (string, error)
- func GetPublicIP() (string, error)
- func IP4String(ipInt int64) string
- func IP4toInt(IPv4Addr net.IP) int64
- func IPStringToInt(s string) (int64, error)
- func Int64ToMac(ipInt int64) (string, error)
- func Mac2Int64(s string) (int64, error)
- func MeasureTime(process string) func()
- func PerformanceMonitor(log *logger.Logger, name, url string) error
- func S2B(s string) (b []byte)
- func SaveTOML(v interface{}, filename string) error
- func Sleep(min, m int)
- func SliceByteToString(b []byte) string
- func StrBuilder(args ...string) string
- func StringToSliceByte(s string) []byte
- func SubString(str string, begin, length int) (substr string)
- func SyncLogger(log *logger.Logger, quit <-chan os.Signal)
- func WriteToFile(c []byte, filename string) error
Constants ¶
const (
MacFull = 281474976710655
)
Variables ¶
Functions ¶
func B2S ¶
B2S converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
Note it may break if string and/or slice header will change in the future go versions. nolint
func GetCurrentPath ¶
GetCurrentPath get current path of commend running
func GetLocalIP ¶
GetLocalIP get all your local ipv4 address (except 127.0.0.1)
func GetOutboundIP ¶
GetOutboundIP get the out bound ip, especially useful when you have multi local ipv4 ip and you want figure out which one is been used
func IPStringToInt ¶
IPStringToInt converts a string to a ip address
func Int64ToMac ¶
Int64ToMac converts a ip address to a string
func PerformanceMonitor ¶
PerformanceMonitor 监控
func S2B ¶
S2B converts string to a byte slice without memory allocation.
Note it may break if string and/or slice header will change in the future go versions. nolint
func SliceByteToString ¶
SliceByteToString transfer byte to string
func StringToSliceByte ¶
StringToSliceByte transfer string to byte
func SyncLogger ¶
SyncLogger sync logger to disk storage
func WriteToFile ¶
WriteToFile write []byte to file
Types ¶
This section is empty.