utils

package
v0.0.0-...-d323686 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrlRegex = `https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`
)

Variables

This section is empty.

Functions

func Base10Version

func Base10Version(hex int) int64

Base10Version Version as a base-10 number. Used by monitoring.

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to string.

func FileExist

func FileExist(name string) bool

func FirstUpper

func FirstUpper(s string) string

func Fn

func Fn(public interface{}) string

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

func GetFunctionName

func GetFunctionName(i interface{}) string

func GetRemoteAddr

func GetRemoteAddr(req *http.Request) string

GetRemoteAddr Obtain IP address of the client.

func HasHan

func HasHan(txt string) bool

func InStringSlice

func InStringSlice(x []string, find string) bool

func IsNullValue

func IsNullValue(i any) bool

IsNullValue Check if the interface contains a string with a single Unicode Del control character.

func IsRoutableIP

func IsRoutableIP(ipStr string) bool

func IsUnixAddr

func IsUnixAddr(addr string) bool

IsUnixAddr Check if specified address is a unix socket like "unix:/run/flowbot.sock".

func IsUrl

func IsUrl(text string) bool

func MD5

func MD5(txt string) string

func MarkdownTitle

func MarkdownTitle(txt string) string

func Masker

func Masker(input string, start int) string

func Max

func Max(a, b int) int

func MergeMaps

func MergeMaps(dst, src map[string]any) (map[string]any, bool)

MergeMaps Deep copy maps.

func NetListener

func NetListener(addr string) (net.Listener, error)

NetListener creates net.Listener for tcp and unix domains: if addr is in the form "unix:/run/flowbot.sock" it's a unix socket, otherwise TCP host:port.

func NewUUID

func NewUUID() string

func ParseFunctionName

func ParseFunctionName(name string) (string, string)

func ParseTLSConfig

func ParseTLSConfig(tlsEnabled bool, conf config.TLSConfig) (*tls.Config, error)

func ParseVersion

func ParseVersion(vers string) int

ParseVersion Parses semantic version string in the following formats:

1.2, 1.2abc, 1.2.3, 1.2.3-abc, v0.12.34-rc5

Unparceable values are replaced with zeros.

func ParseVersionPart

func ParseVersionPart(vers string) int

ParseVersionPart Parse one component of a semantic version string.

func SHA1

func SHA1(txt string) string

func SameStringSlice

func SameStringSlice(x, y []string) bool

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts string to byte slice.

func ToAbsolutePath

func ToAbsolutePath(base, path string) string

ToAbsolutePath Convert relative filepath to absolute.

func VersionCompare

func VersionCompare(v1, v2 int) int

VersionCompare Returns > 0 if v1 > v2; zero if equal; < 0 if v1 < v2 Only Major and Minor parts are compared, the trailer is ignored.

Types

This section is empty.

Directories

Path Synopsis
Package reexec facilitates the busybox style reexec of the docker binary that we require because of the forking limitations of using Go.
Package reexec facilitates the busybox style reexec of the docker binary that we require because of the forking limitations of using Go.

Jump to

Keyboard shortcuts

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