utils

package
v1.4.16 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsInvalidChars added in v1.0.16

func ContainsInvalidChars(charset, s string) error

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

func ContainsValidCharset added in v1.0.16

func ContainsValidCharset(charset, s string) error

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

func GetBaseURL added in v1.4.7

func GetBaseURL(r *http.Request, s string) (string, string)

GetBaseURL returns base path based on some match.

func GetContentType added in v1.2.4

func GetContentType(r *http.Request) string

GetContentType returns requested content type.

func GetCurrentBaseURL added in v1.1.5

func GetCurrentBaseURL(r *http.Request) string

GetCurrentBaseURL returns current base URL.

func GetCurrentURL added in v1.1.5

func GetCurrentURL(r *http.Request) string

GetCurrentURL returns current URL.

func GetRandomEncodedStringFromRange added in v1.3.4

func GetRandomEncodedStringFromRange(a, b int) string

GetRandomEncodedStringFromRange return the number returned by GetRandomStringFromRange() and encoded with Base32

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 GetRandomStringFromRangeWithCharset added in v1.4.3

func GetRandomStringFromRangeWithCharset(a, b int, cs string) string

GetRandomStringFromRangeWithCharset generates random string of a random length. The random lenght is bounded by a and b. The charset is provided.

func GetRelativeURL added in v1.4.7

func GetRelativeURL(r *http.Request, orig, repl string) string

GetRelativeURL returns relative path to current URL.

func GetRequestID added in v1.4.7

func GetRequestID(r *http.Request) string

GetRequestID returns request ID.

func GetSourceAddress added in v1.2.4

func GetSourceAddress(r *http.Request) string

GetSourceAddress returns the IP address of the request.

func NewLogger added in v1.0.17

func NewLogger() *zap.Logger

NewLogger returns an instance of logger

func ParseCredentials added in v1.2.4

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

ParseCredentials extracts credentials from HTTP request.

func ReadCertFile added in v1.1.3

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
y or Y : Canonical URL