utils

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const EmbedServerPort = "5678"

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 CheckSingleton added in v0.13.1

func CheckSingleton()

func EmbedServer added in v0.13.1

func EmbedServer()

func FileAndLine

func FileAndLine() string

func FileExist

func FileExist(name string) bool

func FindOne added in v0.18.1

func FindOne[T any](slice []T, filter func(*T) bool) (element *T)

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 Html2Text added in v0.18.9

func Html2Text(html string) (string, error)

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 PortAvailable added in v0.13.1

func PortAvailable(port string) bool

func PrettyPrintJsonStyle added in v0.18.1

func PrettyPrintJsonStyle(data any)

func PrettyPrintYamlStyle added in v0.18.1

func PrettyPrintYamlStyle(data any)

func SHA1

func SHA1(txt string) string

func SameStringSlice

func SameStringSlice(x, y []string) bool

func SignalHandler added in v0.18.1

func SignalHandler() <-chan 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 ValidImageContentType

func ValidImageContentType(ct string) bool

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