util

package
v0.51.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalAddr

func CanonicalAddr(host string, port int) (addr string)

func CanonicalHost

func CanonicalHost(host string) (string, error)

canonicalHost strips port from host if present and returns the canonicalized host name.

func ConstantTimeEqString added in v0.51.1

func ConstantTimeEqString(a, b string) bool

func GenerateResponseErrorString

func GenerateResponseErrorString(summary string, err error, detailed bool) string

func GetAuthKey

func GetAuthKey(token string, timestamp int64) (key string)

func OkResponse

func OkResponse() *http.Response

func ParseBasicAuth added in v0.45.1

func ParseBasicAuth(auth string) (username, password string, ok bool)

func ParseRangeNumbers

func ParseRangeNumbers(rangeStr string) (numbers []int64, err error)

func ProxyUnauthorizedResponse added in v0.45.1

func ProxyUnauthorizedResponse() *http.Response

func RandID

func RandID() (id string, err error)

RandID return a rand string used in frp.

func RandIDWithLen

func RandIDWithLen(idLen int) (id string, err error)

RandIDWithLen return a rand string with idLen length.

func RandIDWithRandLen added in v0.51.1

func RandIDWithRandLen(start, end int) (id string, err error)

RandIDWithRandLen return a rand string with length between [start, end).

func RandomSleep added in v0.45.1

func RandomSleep(duration time.Duration, minRatio, maxRatio float64) time.Duration

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL