Documentation ¶
Index ¶
- func BidirectCopy(left io.ReadWriteCloser, right io.ReadWriteCloser) (int, int, error)
- func ByteCountIEC(b int) string
- func Checksum(r io.Reader) ([]byte, error)
- func ConfigPath(name string) string
- func Confirm(message string) bool
- func CreateIfNotExists(path string, perm os.FileMode) error
- func CreateMemPool() sync.Pool
- func GetEnvBool(name string) bool
- func GetSlice(pool *sync.Pool, size int) []byte
- func GetTermSize(fd int) (width, height int, err error)
- func MkdirIfNotExists(path string, perm os.FileMode) error
- func RandStr(length int) string
- func RandomBytes(n int) ([]byte, error)
- func RandomString(n int) (string, error)
- func RandomStringURLSafe(n int) (string, error)
- func RecvJSON(r *http.Request, data interface{}) error
- func SendJSON(w http.ResponseWriter, jsonObject interface{}) error
- func SendJSONError(w http.ResponseWriter, err string, code int)
- type Broadcaster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BidirectCopy ¶
func BidirectCopy(left io.ReadWriteCloser, right io.ReadWriteCloser) (int, int, error)
BidirectCopy is a helper which spawns two goroutines. Each goroutine copies data from left to right and right to left respectively.
func ByteCountIEC ¶
func ConfigPath ¶
func CreateMemPool ¶
func GetEnvBool ¶
func GetTermSize ¶
func RandomBytes ¶
RandomBytes 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 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.
func RandomStringURLSafe ¶
RandomStringURLSafe 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 SendJSON ¶
func SendJSON(w http.ResponseWriter, jsonObject interface{}) error
func SendJSONError ¶
func SendJSONError(w http.ResponseWriter, err string, code int)