Documentation ¶
Index ¶
- func B2S(b []byte) string
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func Int64Pointer(i int64) *int64
- func IsPowerOfTwo(n int64) bool
- func OrPanic(args ...interface{}) []interface{}
- func S2B(s string) (b []byte)
- func StringPointer(s string) *string
- func TlsConfig(pubkey string) *tls.Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func B2S ¶
b2s converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
Note it may break if string and/or slice header will change in the future go versions.
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
func Int64Pointer ¶
func S2B ¶
S2B converts string to a byte slice without memory allocation.
Note it may break if string and/or slice header will change in the future go versions. Warning: Writing data into the array is not a good idea, as this will result in a segfault This is really bad do not writing or modity the data in the array which is returned.
func StringPointer ¶
Types ¶
This section is empty.