Documentation ¶
Index ¶
- func AddTrailingSlashToPath(path string) string
- func CopyDir(source string, dest string) (err error)
- func CopyFile(source string, dest string) (err error)
- func CopyFileIfNotExists(source string, dest string) (err error)
- func Debounce(delay time.Duration, f func()) func()
- func DecryptXorBase64(key string, s string) (string, error)
- func EncryptDomId(key string, s string) (hash string)
- func EncryptXorBase64(key string, s string) string
- func ErrorBox(err string, vars ...interface{}) template.HTML
- func EscapeJS(data string) string
- func Exists(path string) (bool, error)
- func Fields(s string) ([]string, error)
- func IsDir(path string) (bool, error)
- func LimitLen(s string, max int) string
- func MkDirIfNotExists(path string) error
- func RandomString(n int) string
- func RemoteAddress(r *http.Request) (string, bool)
- func RemovePortFromRemoteAddr(remoteAddr string) string
- func Sha256Sum(s string) string
- func ToPath(path string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTrailingSlashToPath ¶
func CopyDir ¶
Recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist.
func CopyFileIfNotExists ¶
func DecryptXorBase64 ¶
DecryptXorBase64 is a simple XOR decryption
func EncryptDomId ¶
EncryptDomId calculates a short unique DOM ID hash
func EncryptXorBase64 ¶
EncryptXorBase64 is a simple XOR encryption
func ErrorBox ¶
ErrorBox returns a styled div error box. One optional argument can be passed to show a detailed error code. This error code is only shown to the user if the sessions is authenticated as developer.
func EscapeJS ¶
EscapeJS escapes a string to be send over the SendCommand method. This method escapes all backslaches, simple quotes and new lines.
func Fields ¶
Fields splits a string between spaces, but skips spaces in quotes. nil is returned, if the string is empty or if it only contains empty spaces.
func MkDirIfNotExists ¶
MkDirIfNotExists creates a directory if it doesn't exists
func RandomString ¶
RandomString generates a random string with a length of n
func RemoteAddress ¶
RemoteAddress returns the IP address of the request. If the X-Forwarded-For or X-Real-Ip http headers are set, then they are used to obtain the remote address. The boolean is true, if the remote address is obtained using the request RemoteAddr() method.
func RemovePortFromRemoteAddr ¶
RemovePortFromRemoteAddr removes the port if present from the remote address.
Types ¶
This section is empty.