utils

package
Version: v1.2.21-0...-c0ededa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsInvalidChars

func ContainsInvalidChars(charset, s string) error

ContainsInvalidChars returns error if the provided string contains characters outside of the allowed character set.

func ContainsValidCharset

func ContainsValidCharset(charset, s string) error

ContainsValidCharset returns error if the provided string contains characters outside of the provided character set.

func GetCodeURI

func GetCodeURI(opts map[string]interface{}) (string, error)

GetCodeURI returns TOTP/HOTP Key URI

func GetContentType

func GetContentType(r *http.Request) string

GetContentType returns requested content type.

func GetCurrentBaseURL

func GetCurrentBaseURL(r *http.Request) string

GetCurrentBaseURL returns current base URL

func GetCurrentURL

func GetCurrentURL(r *http.Request) string

GetCurrentURL returns current URL

func GetRandomString

func GetRandomString(i int) string

GetRandomString returns X character long random string.

func GetRandomStringFromRange

func GetRandomStringFromRange(a, b int) string

GetRandomStringFromRange generates random string of a random length. The random lenght is bounded by a and b.

func GetSourceAddress

func GetSourceAddress(r *http.Request) string

GetSourceAddress returns the IP address of the request.

func NewLogger

func NewLogger() *zap.Logger

NewLogger returns an instance of logger

func ParseCredentials

func ParseCredentials(r *http.Request) (map[string]string, error)

ParseCredentials extracts credentials from HTTP request.

func ReadCertFile

func ReadCertFile(filePath string) (string, error)

ReadCertFile return certificate content as a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL