Documentation ¶
Index ¶
- Constants
- Variables
- func AnonymizeIp(ip []byte) []byte
- func CopyBytes(input []byte) []byte
- func CreateDirectory(path string, perm fs.FileMode) (string, error)
- func CreateDirectoryFromFile(path string, perm fs.FileMode) (string, error)
- func CreateFile(path string, flags int, dirMode, mode fs.FileMode) (file *os.File, err error)
- func CreateLogFile(path string) (file *os.File, err error)
- func FileExists(path string) bool
- func GetAbsolutePath(path string) (string, error)
- func GetLocalIP() string
- func GetLocalIPs() []string
- func GetRequestId() (string, error)
- func Getenv(env string, def ...string) string
- func IsInt(s string) bool
- func IsSuccess(status int) bool
- func RandomString(n int32) string
- func TruncateUrl(value []byte) []byte
- func UnsafeBytes(s string) []byte
- func UnsafeString(b []byte) string
Constants ¶
const ( // RequestIdLength RequestIdLength = 32 // MaxEncodedLength MaxEncodedLength = (RequestIdLength*8 + 5) / 6 )
const (
UnknownIp = "UNKNOWN IP"
)
Variables ¶
Functions ¶
func AnonymizeIp ¶
Slices IP address byte slice and writes 0 to last octet Example: AnonymizeIp([]byte{'1','9','2','.','1','7','2','.','9','0','.','7','0'}) Returns []byte{'1','9','2','.','1','7','2','.','9','0','.','0'}
func CreateDirectory ¶
Provides a way of creating directory with permissions for a given path Returns string path of created directory and error if fails
func CreateDirectoryFromFile ¶
Provides a way of creating a directory from a path Returns created directory path and error if fails
func CreateFile ¶
Creates file for given directory with flags and permissions for directory and file Returns file instance and error if it fails
func CreateLogFile ¶
Creates write only appendable file with permission 0o744 for directory and file for given path
func FileExists ¶
Provides a way of checking if file exists. Returns bool
func GetAbsolutePath ¶
Returns absolute path string for a given directory and error if directory doesent exist
func GetLocalIP ¶
func GetLocalIP() string
Returns IP address of local machine, empty string if fails
func IsInt ¶
Provides a way of testing if type is integer Returns bool value depending if its integer or not
func UnsafeBytes ¶
#nosec G103 Returns a byte pointer without allocation
func UnsafeString ¶
#nosec G103 Returns a string pointer without allocation
Types ¶
This section is empty.