Documentation ¶
Index ¶
- func BuildLink(r *http.Request, path string, query map[string]string) *url.URL
- func CreateCipher(key []byte) (cipher.AEAD, error)
- func Decrypt(aeadCipher cipher.AEAD, msg []byte) ([]byte, error)
- func DecryptString(aeadCipher cipher.AEAD, msg string) (string, error)
- func Encrypt(aeadCipher cipher.AEAD, msg []byte) []byte
- func EncryptString(aeadCipher cipher.AEAD, msg string) string
- func GenerateCertificate(host, organization string) (string, string)
- func GenerateKey() string
- func GeneratePlaceholders(start, end uint) string
- func GetPublicKey(key *rsa.PrivateKey) string
- func MarshalPrivateKey(key *rsa.PrivateKey) []byte
- func RandomSecret(length int) string
- func RandomString(length int) string
- func RedirectDestination(r *http.Request) string
- func ResponseBodyToString(r *http.Response) string
- func SetContext(r *http.Request, key, value interface{}) *http.Request
- func StringSliceToInterfaceSlice(s []string) []interface{}
- func StripTerminalColorCodes(s string) string
- func TestServerAddress() string
- func UUIDSliceToInterface(s []uuid.UUID) []interface{}
- func UnmarshalPrivateKey(key []byte) *rsa.PrivateKey
- type ResponseWriterWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCertificate ¶
GenerateCertificate generates a cerificate for a host.
The first return value is the ceritificate, the second is the key. Both are PEM encoded.
func GenerateKey ¶
func GenerateKey() string
GenerateKey generates an RSA key (2048 bit) and encodes it using PEM.
func GeneratePlaceholders ¶
GeneratePlaceholders generates placeholders from start to end for an SQL query.
func GetPublicKey ¶
func GetPublicKey(key *rsa.PrivateKey) string
GetPublicKey gets the public part of a private key in OpenSSL format.
func MarshalPrivateKey ¶
func MarshalPrivateKey(key *rsa.PrivateKey) []byte
MarshalPrivateKey converts a private key to a PEM encoded string.
func RandomSecret ¶
RandomSecret generates a random secret of length bytes long.
The returned data will be hex encoded, so it will be length*2 characters.
func RandomString ¶
RandomString generates a random string of a given length.
func RedirectDestination ¶
RedirectDestination constucts an URL to the redirect destination.
The redirect destination is read from the destination URL parameter.
func ResponseBodyToString ¶
ResponseBodyToString reads the whole response body and converts it to a string.
func SetContext ¶
SetContext sets a value in the context of *http.Request, and returns a new one with the updated context.
func StringSliceToInterfaceSlice ¶
func StringSliceToInterfaceSlice(s []string) []interface{}
StringSliceToInterfaceSlice converts a string slice into an interface{} slice.
func StripTerminalColorCodes ¶
func TestServerAddress ¶
func TestServerAddress() string
func UUIDSliceToInterface ¶
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(key []byte) *rsa.PrivateKey
UnmarshalPrivateKey converts a PEM encoded string into a private key.
Returns nil on failure.
Types ¶
type ResponseWriterWrapper ¶
type ResponseWriterWrapper struct {
http.ResponseWriter
}
func (ResponseWriterWrapper) Flush ¶
func (w ResponseWriterWrapper) Flush()
func (ResponseWriterWrapper) Hijack ¶
func (w ResponseWriterWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (ResponseWriterWrapper) Push ¶
func (w ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error