Documentation ¶
Index ¶
- Variables
- func BroadcastAddr(n *net.IPNet) net.IP
- 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 GetCleanAuthToken(c *gin.Context) string
- func GetIpFromCidr(cidr string) (string, error)
- func GetNetworkAddress(cidr string) (string, error)
- func IsIPv6(address string) bool
- func IsValidCidr(cidr string) bool
- func IsValidIp(ip string) bool
- func RandomString(n int) (string, error)
- func ReadFile(path string) (bytes []byte, err error)
- func WriteFile(path string, bytes []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( // AuthTokenHeaderName http header for token transport AuthTokenHeaderName = "Authorization" // 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])?)*$") )
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
func GetCleanAuthToken ¶
func GetNetworkAddress ¶
GetNetworkAddress gets the valid start of a subnet
func RandomString ¶
RandomString returns a 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.
Types ¶
This section is empty.