util

package
v0.0.0-...-91c0e42 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfValidLink(url string, httpsOnly bool) error

CheckIfValidLink checks an URL if it is a valid link. So first, it checks if it starts with 'http'. If httpsOnly is set, it will be checked if the link starts with https. Then, a http request is executed to the link. If this fails or responds with an status code >= 400, the link is invalid and an error will be returned. The link is qualified as valid if the returned error is nil.

func CheckIfValidShort

func CheckIfValidShort(sl, reserved string, allowedRx *regexp.Regexp) error

CheckIfValidShort checks if the short link is contained in the reserved string or if the short link does not single-result match the allowedRx. The short link is qualified as valid if the returned error is nil.

func GetRandString

func GetRandString(n int) string

GetRandString returnes a random stirng of the defined length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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