Documentation ¶
Index ¶
- Variables
- func BroadcastAddr(n *net.IPNet) net.IP
- func CheckError(message string, err error)
- func DirectoryExists(name string) bool
- func FileExists(name string) bool
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func GetAvailableIP(cidr string, reserved []string) (string, error)
- func GetIPFromCidr(cidr string) (string, error)
- func IsIPv6(address string) bool
- func IsValidCidr(cidr string) bool
- func IsValidIP(ip string) bool
- func LogError(message string, err error)
- func ReadFile(path string) (bytes []byte, err error)
- func WriteFile(path string, bytes []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( // RegexpEmail check valid email RegexpEmail = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") )
var StandardFields = log.Fields{
"hostname": "host-server",
"appname": "erebrus",
}
StandardFields for logger
var StandardFieldsGRPC = log.Fields{
"hostname": hostname,
"appname": "erebrus",
"service": "gRPC",
}
var Version = "1.0"
Erebrus Version
Functions ¶
func BroadcastAddr ¶
BroadcastAddr returns the last address in the given network, or the broadcast address.
func DirectoryExists ¶
DirectoryExists check if directory exists
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GetAvailableIP ¶
GetAvailableIP search for an available ip in cidr against a list of reserved ips
Types ¶
This section is empty.