common

package module
v1.7.12 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 74 Imported by: 50

README

COMMON

Project description of COMMON

This is the automatic generated project description of COMMON. Stay tuned for updates :-)

License

All software is copyright and protected by the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0

Documentation

Index

Constants

View Source
const (
	APACHE string = "https://www.apache.org/licenses/LICENSE-2.0.html"

	SERVICE_SIMULATE  = "simulate"
	SERVICE_START     = "start"
	SERVICE_STOP      = "stop"
	SERVICE_RESTART   = "restart"
	SERVICE_INSTALL   = "install"
	SERVICE_UNINSTALL = "uninstall"
)
View Source
const (
	FlagNameAppProduct      = "app.product"
	FlagNameAppTicker       = "app.ticker"
	FlagNameService         = "service"
	FlagNameServiceUsername = "service.username"
	FlagNameServicePassword = "service.password"
	FlagNameServiceTimeout  = "service.timeout"
	FlagNameUsage           = "h"
	FlagNameUsageMd         = "hmd"
	FlagNameNoBanner        = "nb"
)
View Source
const (
	FlagNameCfgFile   = "cfg.file"
	FlagNameCfgReset  = "cfg.reset"
	FlagNameCfgCreate = "cfg.create"
)
View Source
const (
	//Year parse mask
	Year = "2006"
	//Month parse mask
	Month = "01"
	//Day parse mask
	Day = "02"
	//Hour parse mask
	Hour = "15"
	//Minute parse mask
	Minute = "04"
	//Second parse mask
	Second = "05"
	//Milli parse mask
	Msec = ".000"
	//DateSeparator parse mask
	DateSeparator = "."
	//TimeSeparator parse mask
	TimeSeparator = ":"
	//Separator parse mask
	Separator = " "
)
View Source
const (
	DEFAULT_LANGUAGE = "en"

	FlagNameAppLanguage = "app.language"
)
View Source
const (
	FlagNameLogFileName = "log.file"
	FlagNameLogFileSize = "log.filesize"
	FlagNameLogVerbose  = "log.verbose"
	FlagNameLogIO       = "log.io"
	FlagNameLogJson     = "log.json"
	FlagNameLogSys      = "log.sys"
	FlagNameLogCount    = "log.count"
	FlagNameLogBreak    = "log.break"
	FlagNameLogGap      = "log.gap"
)
View Source
const (
	LevelDebug = "DEBUG"
	LevelInfo  = "INFO"
	LevelWarn  = "WARN"
	LevelError = "ERROR"
	LevelFatal = "FATAL"
)
View Source
const (
	LOCALHOST_IP4 = "127.0.0.1"
	LOCALHOST_IP6 = "::1"
)
View Source
const (
	FlagNameIoNetworkIface     = "io.network.iface"
	FlagNameIoNetworkTimeout   = "io.network.timeout"
	FlagNameIoConnectTimeout   = "io.connect.timeout"
	FlagNameIoReadwriteTimeout = "io.readwrite.timeout"
)
View Source
const (
	NONE = iota
	LEFT
	CENTER
	RIGHT
)
View Source
const (
	FlagNameTlsInsecure    = "tls.insecure"
	FlagNameTlsVerify      = "tls.verify"
	FlagNameTlsServername  = "tls.servername"
	FlagNameTlsMinVersion  = "tls.minversion"
	FlagNameTlsMaxVersion  = "tls.maxversion"
	FlagNameTlsCiphers     = "tls.ciphers"
	FlagNameTlsPassword    = "tls.password"
	FlagNameTlsCertificate = "tls.certificate"
	FlagNameTlsMutual      = "tls.mutual"
	FlagNameTlsKeylen      = "tls.keylen"
)
View Source
const (
	TlsVersion10 = "TLS1.0"
	TlsVersion11 = "TLS1.1"
	TlsVersion12 = "TLS1.2"
	TlsVersion13 = "TLS1.3"
)
View Source
const (
	BIG5        = "big5"
	IBM437      = "ibm437"
	IBM850      = "ibm850"
	IBM866      = "ibm866"
	ISO_8859_1  = "iso-8859-1"
	ISO_8859_10 = "iso-8859-10"

	ISO_8859_2   = "iso-8859-2"
	ISO_8859_3   = "iso-8859-3"
	ISO_8859_4   = "iso-8859-4"
	ISO_8859_5   = "iso-8859-5"
	ISO_8859_6   = "iso-8859-6"
	ISO_8859_7   = "iso-8859-7"
	ISO_8859_8   = "iso-8859-8"
	ISO_8859_9   = "iso-8859-9"
	KOI8_R       = "koi8-r"
	US_ASCII     = "us-ascii"
	UTF_16       = "utf-16"
	UTF_16BE     = "utf-16be"
	UTF_16LE     = "utf-16le"
	UTF_8        = "utf-8"
	WINDOWS_1250 = "windows-1250"
	WINDOWS_1251 = "windows-1251"
	WINDOWS_1252 = "windows-1252"
)
View Source
const (
	SchemeSep       = "://"
	OpaqueSep       = ":"
	CredentialSep   = "@"
	CredentialSplit = ":"
	CidrSep         = "/"
	CidrSplit       = ":"
	CidrSplitV6     = "]:"
)
View Source
const (
	OPTION_FILE             = "file"
	OPTION_HIDDEN           = "hidden"
	OPTION_SELECT           = "select"
	OPTION_MULTISELECT      = "multiselect"
	OPTION_DATALIST         = "datalist"
	OPTION_PASSWORD         = "password"
	OPTION_AUTOFOCUS        = "autofocus"
	OPTION_REQUIRED         = "required"
	OPTION_READONLY         = "readonly"
	OPTION_MULTILINE        = "multiline"
	OPTION_WIDE             = "wide"
	OPTION_MEGALINE         = "megaline"
	OPTION_NO_LABEL         = "no_label"
	OPTION_EXPERTVIEW       = "expertview"
	OPTION_NO_DEFAULTBUTTON = "no_defaultbutton"
	OPTION_CODE             = "code"

	INPUT_WIDTH_NORMAL = "pure-input-1-4"
	INPUT_WIDTH_WIDE   = "pure-input-1-2"

	CSS_DIALOG_CONTENT     = "css-dialog-content pure-controls"
	CSS_DEFAULT_CONTENT    = "css-default-content pure-controls"
	CSS_ERROR_BOX          = "css-error-box"
	CSS_WARNING_BOX        = "css-warning-box blink"
	CSS_SUCCESS_BOX        = "css-success-box"
	CSS_VERTICAL_DIV       = "css-vertical-div"
	CSS_LOGVIEWER          = "css-logviewer"
	CSS_CONTENT            = "css-content"
	CSS_CHECKLIST          = "css-checklist"
	CSS_CHECKLIST_CHECKBOX = "css-checklist-checkbox"
	CSS_CHECKBOX           = "css-checkbox"
	CSS_BUTTON_GROUP       = "css-button-group"
	CSS_BORDER             = "css-border"
	CSS_CODE               = "css-code"

	CSS_COLOR_OFF = "#CFCFCF"
	CSS_COLOR_ON  = "MediumSeaGreen"

	MAX_INPUT_LENGTH = "10240"

	FLASH_WARNING = "warning-flash"
	FLASH_ERROR   = "error-flash"
	FLASH_SUCCESS = "success-flash"

	COOKIE_PASSWORD = "password"
	COOKIE_EXPIRE   = "expire"

	FLASH_TIMEOUT   = time.Second
	REFRESH_TIMEOUT = time.Second * 30
)
View Source
const (
	FlagNameIoFileBackups = "io.file.backups"
)
View Source
const (
	MimetypeHeaderLen = 1024
)
View Source
const UNKNOWN = "unknwon"

Variables

View Source
var (
	FlagService         = flag.String(FlagNameService, "", "Service operation ("+strings.Join([]string{SERVICE_SIMULATE, SERVICE_START, SERVICE_STOP, SERVICE_RESTART, SERVICE_INSTALL, SERVICE_UNINSTALL}, ",")+")")
	FlagServiceUser     = flag.String(FlagNameServiceUsername, "", "Service user")
	FlagServicePassword = flag.String(FlagNameServicePassword, "", "Service password")
	FlagServiceTimeout  = flag.Int(FlagNameServiceTimeout, 1000, "Service timeout")
	FlagUsage           = flag.Bool(FlagNameUsage, false, "show flags description and usage")
	FlagUsageMd         = flag.Bool(FlagNameUsageMd, false, "show flags description and usage in markdown format")
	FlagNoBanner        = flag.Bool(FlagNameNoBanner, false, "no copyright banner")

	FlagAppProduct *string
	FlagAppTicker  *int
)
View Source
var (
	ReadOnlyFileMode = FileMode(true, false, false)
	DefaultFileMode  = FileMode(true, true, false)
	DefaultDirMode   = FileMode(true, true, true)

	FlagIoFileBackups *int
)
View Source
var (
	FlagLogFileName = flag.String(FlagNameLogFileName, "", "filename to log file")
	FlagLogFileSize = flag.Int(FlagNameLogFileSize, 5*1024*1024, "max log file size")
	FlagLogVerbose  = flag.Bool(FlagNameLogVerbose, false, "verbose logging")
	FlagLogIO       = flag.Bool(FlagNameLogIO, false, "trace logging")
	FlagLogJson     = flag.Bool(FlagNameLogJson, false, "JSON output")
	FlagLogSys      = flag.Bool(FlagNameLogSys, false, "Use OS system logger")
	FlagLogCount    = flag.Int(FlagNameLogCount, 1000, "log count")
	FlagLogBreak    = flag.Bool(FlagNameLogBreak, false, "break on error")
	FlagLogGap      = flag.Int(FlagNameLogGap, 100, "time gap after show a separator")

	LogDebug *log.Logger = log.New(rw, prefix(LevelDebug), 0)
	LogInfo  *log.Logger = log.New(rw, prefix(LevelInfo), 0)
	LogWarn  *log.Logger = log.New(rw, prefix(LevelWarn), 0)
	LogError *log.Logger = log.New(os.Stderr, prefix(LevelError), 0)
	LogFatal *log.Logger = log.New(os.Stderr, prefix(LevelFatal), 0)
)
View Source
var (
	MimetypeApplicationDicom                                                     = registerMimeType("application/dicom", "dcm")
	MimetypeApplicationEpubZip                                                   = registerMimeType("application/epub+zip", "epub")
	MimetypeApplicationGeoJson                                                   = registerMimeType("application/geo+json", "geojson")
	MimetypeApplicationGmlXml                                                    = registerMimeType("application/gml+xml", "gml")
	MimetypeApplicationGpxXml                                                    = registerMimeType("application/gpx+xml", "gpx")
	MimetypeApplicationGzip                                                      = registerMimeType("application/gzip", "gz")
	MimetypeApplicationJar                                                       = registerMimeType("application/jar", "jar")
	MimetypeApplicationJavascript                                                = registerMimeType("application/javascript", "js")
	MimetypeApplicationJson                                                      = registerMimeType("application/json", "json")
	MimetypeApplicationMsword                                                    = registerMimeType("application/msword", "doc")
	MimetypeApplicationOctetStream                                               = registerMimeType("application/octet-stream", "bin")
	MimetypeApplicationOgg                                                       = registerMimeType("application/ogg", "ogg")
	MimetypeApplicationPdf                                                       = registerMimeType("application/pdf", "pdf")
	MimetypeApplicationPostscript                                                = registerMimeType("application/postscript", "ps")
	MimetypeApplicationVndGarminTcxXml                                           = registerMimeType("application/vnd.garmin.tcx+xml", "tcx")
	MimetypeApplicationVndGoogleEarthKmlXml                                      = registerMimeType("application/vnd.google-earth.kml+xml", "kml")
	MimetypeApplicationVndMsExcel                                                = registerMimeType("application/vnd.ms-excel", "xls")
	MimetypeApplicationVndMsPowerpoint                                           = registerMimeType("application/vnd.ms-powerpoint", "ppt")
	MimetypeApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation = registerMimeType("application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx")
	MimetypeApplicationVndOpenxmlformatsOfficedocumentSpreadsheetmlSheet         = registerMimeType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx")
	MimetypeApplicationVndOpenxmlformatsOfficedocumentWordprocessingmlDocument   = registerMimeType("application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx")
	MimetypeApplicationWasm                                                      = registerMimeType("application/wasm", "wasm")
	MimetypeApplicationX7ZCompressed                                             = registerMimeType("application/x-7z-compressed", "7z")
	MimetypeApplicationXChromeExtension                                          = registerMimeType("application/x-chrome-extension", "crx")
	MimetypeApplicationXJavaApplet                                               = registerMimeType("application/x-java-applet; charset=binary", "class")
	MimetypeApplicationXPhotoshop                                                = registerMimeType("application/x-photoshop", "psd")
	MimetypeApplicationXPython                                                   = registerMimeType("application/x-python", "py")
	MimetypeApplicationXShockwaveFlash                                           = registerMimeType("application/x-shockwave-flash", "swf")
	MimetypeApplicationXTar                                                      = registerMimeType("application/x-tar", "tar")
	MimetypeApplicationZip                                                       = registerMimeType("application/zip", "zip")
	MimetypeAudioAiff                                                            = registerMimeType("audio/aiff", "aiff")
	MimetypeAudioAmr                                                             = registerMimeType("audio/amr", "amr")
	MimetypeAudioApe                                                             = registerMimeType("audio/ape", "ape")
	MimetypeAudioBasic                                                           = registerMimeType("audio/basic", "au")
	MimetypeAudioFlac                                                            = registerMimeType("audio/flac", "flac")
	MimetypeAudioMidi                                                            = registerMimeType("audio/midi", "midi")
	MimetypeAudioMp4                                                             = registerMimeType("audio/mp4", "mp4")
	MimetypeAudioMpeg                                                            = registerMimeType("audio/mpeg", "mp3")
	MimetypeAudioMusepack                                                        = registerMimeType("audio/musepack", "mpc")
	MimetypeAudioWav                                                             = registerMimeType("audio/wav", "wav")
	MimetypeAudioXM4A                                                            = registerMimeType("audio/x-m4a", "m4a")
	MimetypeFontWoff                                                             = registerMimeType("font/woff", "woff")
	MimetypeFontWoff2                                                            = registerMimeType("font/woff2", "woff2")
	MimetypeImageBmp                                                             = registerMimeType("image/bmp", "bmp")
	MimetypeImageGif                                                             = registerMimeType("image/gif", "gif")
	MimetypeImageJpeg                                                            = registerMimeType("image/jpeg", "jpg")
	MimetypeImagePng                                                             = registerMimeType("image/png", "png")
	MimetypeImageSvgXml                                                          = registerMimeType("image/svg+xml", "svg")
	MimetypeImageTiff                                                            = registerMimeType("image/tiff", "tiff")
	MimetypeImageWebp                                                            = registerMimeType("image/webp", "webp")
	MimetypeImageXIcon                                                           = registerMimeType("image/x-icon", "ico")
	MimetypeModelVndColladaXml                                                   = registerMimeType("model/vnd.collada+xml", "dae")
	MimetypeModelX3DXml                                                          = registerMimeType("model/x3d+xml", "x3d")
	MimetypeTextHtml                                                             = registerMimeType("text/html; charset=utf-8", "html")
	MimetypeTextCss                                                              = registerMimeType("text/css", "css")
	MimetypeTextPlain                                                            = registerMimeType("text/plain", "txt")
	MimetypeTextRtf                                                              = registerMimeType("text/rtf", "rtf")
	MimetypeTextXml                                                              = registerMimeType("text/xml; charset=utf-8", "xml")
	MimetypeTextXLua                                                             = registerMimeType("text/x-lua", "lua")
	MimetypeTextXPerl                                                            = registerMimeType("text/x-perl", "pl")
	MimetypeTextXPhp                                                             = registerMimeType("text/x-php; charset=utf-8", "php")
	MimetypeTextXTcl                                                             = registerMimeType("text/x-tcl", "tcl")
	MimetypeVideo3GPP                                                            = registerMimeType("video/3gpp", "3gp")
	MimetypeVideo3GPP2                                                           = registerMimeType("video/3gpp2", "3g2")
	MimetypeVideoMp4                                                             = registerMimeType("video/mp4", "mp4")
	MimetypeVideoMpeg                                                            = registerMimeType("video/mpeg", "mpeg")
	MimetypeVideoQuicktime                                                       = registerMimeType("video/quicktime", "mov")
	MimetypeVideoWebm                                                            = registerMimeType("video/webm", "webm")
	MimetypeVideoXFlv                                                            = registerMimeType("video/x-flv", "flv")
	MimetypeVideoXMatroska                                                       = registerMimeType("video/x-matroska", "mkv")
	MimetypeVideoXMsvideo                                                        = registerMimeType("video/x-msvideo", "avi")
)
View Source
var (
	FlagIoPrimaryIface     = flag.String(FlagNameIoNetworkIface, "", "primary ethernet interface")
	FlagIoNetworkTimeout   = flag.Int(FlagNameIoNetworkTimeout, 10*1000, "network ready timeout")
	FlagIoConnectTimeout   = flag.Int(FlagNameIoConnectTimeout, 3*1000, "network server and client dial timeout")
	FlagIoReadwriteTimeout = flag.Int(FlagNameIoReadwriteTimeout, 30*60*1000, "network read/write timeout")
)
View Source
var (
	FlagTlsInsecure    *bool
	FlagTlsVerify      *bool
	FlagTlsServername  *string
	FlagTlsMinVersion  *string
	FlagTlsMaxVersion  *string
	FlagTlsCiphers     *string
	FlagTlsPassword    *string
	FlagTlsCertificate *string
	FlagTlsMutual      *string
	FlagTlsKeyLen      *int
)
View Source
var (
	SessionStore *memstore.MemStore
	CookieTitle  = uuid.New().String()
)
View Source
var DateTimeMask = DateMask + Separator + TimeMask
View Source
var DateTimeMilliMask = DateMask + Separator + TimeMask + Msec
View Source
var (
	Events = NewEventManager()
)
View Source
var (
	FlagLanguage *string
)
View Source
var (
	MEMORY_UNITS = []string{"Bytes", "KB", "MB", "GB", "TB"}
)
View Source
var Mimetypes = make(map[string]MimetypeExtension)
View Source
var SortedDateMask = Year + DateSeparator + Month + DateSeparator + Day
View Source
var SortedDateTimeMilliMask = SortedDateMask + Separator + TimeMask + Msec

Functions

func AESDecrypt added in v1.1.15

func AESDecrypt(key []byte, securemess string) (decodedmess string, err error)

func AESEncrypt added in v1.1.15

func AESEncrypt(key []byte, message string) (encmess string, err error)

func App

func App() *application

func AppFilename added in v1.1.15

func AppFilename(newExt string) string

func AppRestart added in v1.1.15

func AppRestart()

func AuthenticateCookie added in v1.1.15

func AuthenticateCookie(context echo.Context, password string) error

func BindForm added in v1.1.15

func BindForm(context echo.Context, data interface{}, bodyLimit int) error

func CalcDeadline added in v1.6.13

func CalcDeadline(t time.Time, d time.Duration) time.Time

func CalcFileMode added in v1.1.15

func CalcFileMode(owner FilePermission, group FilePermission, public FilePermission) os.FileMode

func CanSetReadTimeout added in v1.5.49

func CanSetReadTimeout(reader io.Reader) bool

func CanSetWriteTimeout added in v1.5.49

func CanSetWriteTimeout(writer io.Writer) bool

func Capitalize

func Capitalize(txt string) string

Capitalize the first letter

func Catch added in v1.5.56

func Catch(fn func() error) (err error)

func CertificateAsPEM added in v1.1.84

func CertificateAsPEM(tlsCertificate *tls.Certificate) []byte

func CertificateInfoFromConnection added in v1.1.15

func CertificateInfoFromConnection(con *tls.Conn) (string, error)

func CheckCookieAuthenticated added in v1.2.26

func CheckCookieAuthenticated(context echo.Context, password string) error

func CleanPath

func CleanPath(path string) string

CleanPath cleans the given path and also replace to OS specific separators

func Clear added in v1.2.2

func Clear(v interface{}) error

func ClearDate

func ClearDate(v time.Time) time.Time

ClearDate returns only time part, date part set to 0

func ClearLogs added in v1.2.45

func ClearLogs()

func ClearTime

func ClearTime(v time.Time) time.Time

ClearTime returns only date part, time part set to 0

func Clone added in v1.5.52

func Clone[T any](t T) (T, error)

func CmdToString added in v1.1.20

func CmdToString(cmd *exec.Cmd) string

func Compare added in v1.5.27

func Compare[T constraints.Ordered](a, b T) int

func CompareDate

func CompareDate(t1 time.Time, t2 time.Time) time.Duration

EqualDateTime checks for equality of parts

func CompareTime

func CompareTime(t1 time.Time, t2 time.Time) time.Duration

EqualTime checks for equality of time

func Contains added in v1.2.42

func Contains(slice interface{}, search interface{}) bool

func ContainsWildcard

func ContainsWildcard(s string) bool

func CopyBuffer added in v1.1.104

func CopyBuffer(ctx context.Context, cancel context.CancelFunc, name string, writer io.Writer, reader io.Reader, bufferSize int) (int64, error)

func CreateI18nFile added in v1.1.15

func CreateI18nFile(path string, objs ...interface{}) error

func CreateTTYOptions added in v1.4.15

func CreateTTYOptions(device string, mode *serial.Mode) (string, error)

func CreateTempDir

func CreateTempDir() (string, error)

CreateTempDir creates a temporary file

func CreateTempFile

func CreateTempFile() (file *os.File, err error)

CreateTempFile creates a temporary file

func CreateTlsConfig added in v1.1.84

func CreateTlsConfig(keylen int, password string) (*tls.Config, error)

func DataTransfer added in v1.2.44

func DataTransfer(ctx context.Context, cancel context.CancelFunc, leftName string, left io.ReadWriter, rightName string, right io.ReadWriter)

func Debug

func Debug(format string, args ...any)

func DebugError

func DebugError(err error) bool

func DebugErrorIndex added in v1.6.13

func DebugErrorIndex(index int, err error) bool

func DebugFunc

func DebugFunc(args ...any)

func DebugIndex added in v1.6.13

func DebugIndex(index int, format string, args ...any)

func DecryptString added in v1.1.15

func DecryptString(key []byte, txt string) (string, error)

func DefaultConsoleEncoding

func DefaultConsoleEncoding() string

func DefaultEncoding

func DefaultEncoding() string

func DisableCookie added in v1.1.21

func DisableCookie(context echo.Context) error

func Discover added in v1.1.15

func Discover(address string, timeout time.Duration, uid string) ([]string, error)

func DurationToMillisecond added in v1.1.55

func DurationToMillisecond(d time.Duration) int

func EncryptString added in v1.1.15

func EncryptString(key []byte, txt string) (string, error)

func EqualWildcards

func EqualWildcards(s, mask string) (bool, error)

func Error

func Error(err error) bool

func Eval

func Eval(b bool, trueFunc interface{}, falseFunc interface{}) interface{}

func Exit

func Exit(code int)

func ExitOrError added in v1.1.15

func ExitOrError(err error) error

func ExtractNumber added in v1.1.15

func ExtractNumber(txt string) (float64, error)

func FileBackup

func FileBackup(filename string) error

FileBackup creates backup of files

func FileCopy

func FileCopy(src string, dst string) error

FileCopy does ... guess what :-)

func FileDate added in v1.1.15

func FileDate(filename string) (time.Time, error)

FileDate does ... guess what :-)

func FileDelete added in v1.1.0

func FileDelete(filename string) error

FileDelete does ... guess what :-)

func FileExists

func FileExists(filename string) bool

FileExists does ... guess what :-)

func FileExists_ added in v1.4.20

func FileExists_(filename string) bool

func FileMode added in v1.1.15

func FileMode(read, write, execute bool) os.FileMode

func FileName

func FileName(filename string) string

Returns the complete filename "test.txt"

func FileNameExt

func FileNameExt(filename string) string

Returns the filename extension without part "test.txt" -> ".txt"

func FileNamePart

func FileNamePart(filename string) string

Returns the filename part without extension "test.txt" -> "test"

func FileSize

func FileSize(filename string) (int64, error)

FileSize does ... guess what :-)

func FileStore

func FileStore(filename string, r io.Reader) error

FileStore creates backup of files

func FillString added in v1.1.15

func FillString(txt string, length int, asPrefix bool, add string) string

func FindFreePort added in v1.1.15

func FindFreePort(network string, startPort int, excludedPorts []int) (int, error)

func FlagValue added in v1.7.10

func FlagValue(flagname string) string

func FormatIP added in v1.4.15

func FormatIP(ip net.IP) string

func FormatJavascriptCode added in v1.6.24

func FormatJavascriptCode(src string) (string, error)

func FormatMemory added in v1.1.15

func FormatMemory(bytes int64) string

func GetCookie added in v1.3.7

func GetCookie(context echo.Context) (*sessions.Session, error)

func GetLanguages added in v1.1.15

func GetLanguages() ([]string, error)

GetLanguages lists all available languages

func GetLogs added in v1.2.45

func GetLogs() []string

func GetSystemLanguage added in v1.1.15

func GetSystemLanguage() (string, error)

GetSystemLanguage return BCP 47 standard language name

func GoRoutineId added in v1.2.7

func GoRoutineId() uint64

func GoRoutineName added in v1.3.6

func GoRoutineName() string

func GoogleTranslate added in v1.1.15

func GoogleTranslate(googleApiKey string, text string, foreignLanguage string) (string, error)

func Hack4BrowserUpdate added in v1.1.15

func Hack4BrowserUpdate() string

func IgnoreError added in v1.6.27

func IgnoreError(err error) bool

func IndexNth added in v1.6.46

func IndexNth(str string, substr string, count int) int

func IndexOf

func IndexOf(slice interface{}, search interface{}) int

func Info

func Info(format string, args ...any)

func Init added in v1.1.15

func Init(title string, version string, git string, build string, description string, developer string, homepage string, license string, resources *embed.FS, startFunc func() error, stopFunc func() error, runFunc func() error, runTime time.Duration)

func InitTesting added in v1.1.21

func InitTesting(t *testing.T)

func IsCertificateSelfSigned added in v1.1.19

func IsCertificateSelfSigned(cert *x509.Certificate) bool

func IsCmdlineOnlyFlag added in v1.2.34

func IsCmdlineOnlyFlag(flagName string) bool

func IsCookieAuthenticated added in v1.1.15

func IsCookieAuthenticated(context echo.Context, password string) bool

func IsDirectory

func IsDirectory(path string) bool

IsDirectory checks if the path leads to a directory

func IsErrExit added in v1.1.84

func IsErrExit(err error) bool

func IsErrNetClosed added in v1.5.10

func IsErrNetClosed(err error) bool

func IsErrNetOperation added in v1.5.10

func IsErrNetOperation(err error) bool

func IsErrTimeout added in v1.2.53

func IsErrTimeout(err error) bool

func IsErrUnexpectedEOF added in v1.1.20

func IsErrUnexpectedEOF(err error) bool

func IsFile

func IsFile(path string) bool

IsDirectory checks if the path leads to a directory

func IsFileReadOnly

func IsFileReadOnly(path string) bool

IsFileReadOnly checks if a file is read only

func IsFlagProvided added in v1.6.44

func IsFlagProvided(flagname string) bool

func IsIPv4 added in v1.6.6

func IsIPv4(ip net.IP) bool

func IsImageMimeType added in v1.1.0

func IsImageMimeType(s string) bool

func IsLinkConnected added in v1.5.3

func IsLinkConnected(nic string) (bool, error)

func IsLinkUp added in v1.5.3

func IsLinkUp(nic string) (bool, error)

func IsLinux added in v1.6.6

func IsLinux() bool

IsLinuxOS reports true if underlying OS is Linux

func IsLocalhost added in v1.1.20

func IsLocalhost(ip net.IP) bool

func IsLogFileEnabled added in v1.7.6

func IsLogFileEnabled() bool

func IsLogInit added in v1.7.6

func IsLogInit() bool

func IsLogJsonEnabled added in v1.7.6

func IsLogJsonEnabled() bool

func IsLogVerboseEnabled added in v1.7.6

func IsLogVerboseEnabled() bool

func IsMac added in v1.6.6

func IsMac() bool

IsMacOS reports true if underlying OS is MacOS

func IsPortAvailable added in v1.1.15

func IsPortAvailable(network string, port int) (available bool)

func IsPrivateIP added in v1.1.69

func IsPrivateIP(ip net.IP) bool

func IsRunningAsExecutable added in v1.1.15

func IsRunningAsExecutable() bool

func IsRunningAsService added in v1.1.15

func IsRunningAsService() bool

func IsRunningInteractive added in v1.1.15

func IsRunningInteractive() bool

func IsStringEnrypted added in v1.1.15

func IsStringEnrypted(password string) bool

func IsSuppressedError added in v1.1.21

func IsSuppressedError(err error) bool

func IsSuppressedErrorMessage added in v1.1.21

func IsSuppressedErrorMessage(err string) bool
func IsSymbolicLink(path string) bool

IsSymbolicLink checks if the path leads to symbolic link

func IsTTYDevice added in v1.1.106

func IsTTYDevice(device string) bool

func IsWindows added in v1.6.6

func IsWindows() bool

IsWindowsOS reports true if underlying OS is MS Windows

func IterateStruct added in v1.1.15

func IterateStruct(data interface{}, fieldFunc func(path string, fieldType reflect.StructField, fieldValue reflect.Value) error) error

func Join added in v1.1.21

func Join(strs []string, sep string) string

func ListFiles added in v1.5.54

func ListFiles(filemask string, recursive bool) ([]string, error)

func LoadConfigurationFile added in v1.3.11

func LoadConfigurationFile() ([]byte, error)

func Lowerlize added in v1.6.30

func Lowerlize(txt string) string

Capitalize the first letter

func MillisecondToDuration added in v1.1.15

func MillisecondToDuration(msec int) time.Duration

func MultiWriter added in v1.6.46

func MultiWriter(writers ...io.Writer) io.Writer

func NewButton added in v1.1.15

func NewButton(parent *etree.Element, primary bool, actionItem ActionItem) *etree.Element

func NewEchoLogger added in v1.1.19

func NewEchoLogger() echoLogger

func NewEndpoint added in v1.1.106

func NewEndpoint(device string, isClient bool, tlsConfig *tls.Config) (Endpoint, EndpointConnector, error)

func NewForm added in v1.1.15

func NewForm(parent *etree.Element, caption string, data interface{}, defaultData interface{}, method string, formAction string, actions []ActionItem, readOnly bool, isExpertViewAvailable bool, funcFieldIterator FuncFieldIterator) (*etree.Element, *etree.Element, error)

func NewMenu added in v1.1.15

func NewMenu(page *Webpage, menuItems []ActionItem, selectedTitle string, disableMenues bool)

func NewSeparatorSplitFunc added in v1.5.27

func NewSeparatorSplitFunc(prefix []byte, suffix []byte, remove bool) (bufio.SplitFunc, error)

func NewSizedReader added in v1.2.43

func NewSizedReader(reader io.Reader, size int64) io.Reader

func NewTable added in v1.1.15

func NewTable(parent *etree.Element, cells [][]string) *etree.Element

func NewThrottledReader added in v1.1.15

func NewThrottledReader(reader io.Reader, bytesPerSeconds int) io.Reader

func NewThrottledWriter added in v1.1.15

func NewThrottledWriter(writer io.Writer, bytesPerSeconds int) io.Writer

func NewTimeoutOperation added in v1.1.30

func NewTimeoutOperation(checkDuration time.Duration, maxDuration time.Duration, fn func() error) error

func NewTlsConfig added in v1.1.84

func NewTlsConfig(
	certificateVerify bool,
	serverName string,
	minVersion string,
	maxVersion string,
	ciphers string,
	password string,
	certificate string,
	mutual string,
	keylen int) (*tls.Config, error)

func NewTlsConfigFromFlags added in v1.1.84

func NewTlsConfigFromFlags() (*tls.Config, error)

func NewWatchdogCmd added in v1.3.4

func NewWatchdogCmd(cmd *exec.Cmd, timeout time.Duration) ([]byte, error)

func NewWatchdogFunc added in v1.3.4

func NewWatchdogFunc(msg string, fn func() error, timeout time.Duration) error

func Panic added in v1.1.89

func Panic(err error)

func ParseDateTime

func ParseDateTime(mask string, v string) (time.Time, error)

ParseDateTime parses only date, but no time

func ParseJsonDateTime added in v1.1.21

func ParseJsonDateTime(v string) (time.Time, error)

ParseJsonDateTime parses only date, but no time

func ParseMemory added in v1.1.15

func ParseMemory(txt string) (int64, error)

func ParseTTYOptions added in v1.4.15

func ParseTTYOptions(device string) (string, *serial.Mode, error)

func PrintBytes added in v1.5.57

func PrintBytes(ba []byte, breakOnLineEndings bool) string

func PrivateKeyAsPEM added in v1.1.84

func PrivateKeyAsPEM(privateKey *ecdsa.PrivateKey) ([]byte, error)

func PullFlash added in v1.1.15

func PullFlash(context echo.Context, flashName string) []string

func PushFlash added in v1.1.15

func PushFlash(context echo.Context, flashName string, flash string) error

func ReadFully added in v1.5.64

func ReadFully(r io.Reader, p []byte) (int, error)

func ReadHeader added in v1.1.0

func ReadHeader(path string) ([]byte, error)

func ReadResource added in v1.1.96

func ReadResource(filename string) ([]byte, string, error)

func ReadWithTimeout added in v1.5.47

func ReadWithTimeout(reader io.Reader, timeout time.Duration, ba []byte) (int, error)

func RegisterGoRoutine added in v1.1.108

func RegisterGoRoutine(index int) int

func RegisteredGoRoutines added in v1.1.108

func RegisteredGoRoutines(f func(id int, ri RuntimeInfo))

func RemoveJsonComments added in v1.1.15

func RemoveJsonComments(s string) string

func ResetConfiguration added in v1.1.15

func ResetConfiguration() error

func ResourcesDirectory added in v1.1.96

func ResourcesDirectory() string

func ReverseSlice added in v1.5.41

func ReverseSlice[T any](original []T) []T

func Rnd

func Rnd(max int) int

func RndBytes added in v1.4.23

func RndBytes(n int) ([]byte, error)

func RndString added in v1.4.23

func RndString(l int) (string, error)

func Run

func Run(mandatoryFlags []string)

func Rune added in v1.1.15

func Rune(s string, index int) (rune, error)

func SaveConfiguration added in v1.3.11

func SaveConfiguration(cfg interface{}) error

func SaveConfigurationFile added in v1.3.11

func SaveConfigurationFile(ba []byte) error

func ScanLinesWithLF added in v1.1.0

func ScanLinesWithLF(data []byte, atEOF bool) (advance int, token []byte, err error)

func SessionId added in v1.2.19

func SessionId(context echo.Context) string

func SetCookie added in v1.5.4

func SetCookie(context echo.Context, cookie *sessions.Session, timeout time.Duration) error

func SetFileReadOnly

func SetFileReadOnly(path string, readonly bool) (err error)

SetFileReadOnly sets file READ-ONLY yes or false

func SetLanguage added in v1.1.15

func SetLanguage(lang string) error

SetLanguage sets the language file to translation

func SetReadTimeout added in v1.5.47

func SetReadTimeout(reader io.Reader, timeout time.Duration) error

func SetTime

func SetTime(t time.Time, f string, v int) time.Time

func SetWriteTimeout added in v1.5.47

func SetWriteTimeout(writer io.Writer, timeout time.Duration) error

func Sleep added in v1.5.15

func Sleep(d time.Duration)

func SliceAppend added in v1.6.14

func SliceAppend[S ~[]E, E any](s S, e ...E) S

func SliceClone added in v1.6.15

func SliceClone[S ~[]E, E any](s S) S

func SliceContains added in v1.6.15

func SliceContains[S ~[]E, E comparable](s S, e E) bool

func SliceDelete added in v1.6.14

func SliceDelete[S ~[]E, E any](s S, index int) S

func SliceDeleteRange added in v1.6.15

func SliceDeleteRange[S ~[]E, E any](s S, index0 int, index1 int) S

func SliceIndex added in v1.6.14

func SliceIndex[S ~[]E, E comparable](s S, e E) int

func SliceIndexFunc added in v1.6.15

func SliceIndexFunc[S ~[]E, E any](s S, fn func(E) bool) int

func SliceInsert added in v1.6.14

func SliceInsert[S ~[]E, E any](s S, index int, e ...E) S

func SliceRemove added in v1.6.14

func SliceRemove[S ~[]E, E comparable](s S, e E) S

func SortStringsCaseInsensitive added in v1.1.15

func SortStringsCaseInsensitive(strs []string)

func Split added in v1.5.53

func Split(s string, sep string) []string

func SplitCmdline added in v1.6.43

func SplitCmdline(cmdline string) []string

func SplitHost added in v1.2.31

func SplitHost(addr string) (string, error)

func SurroundWith

func SurroundWith(str []string, prefixSuffix string) []string

func TempDir

func TempDir() string

TempDir returns the private temporary directory of the app

func Title added in v1.1.12

func Title() string

func TitleVersion added in v1.1.15

func TitleVersion(major bool, minor bool, patch bool) string

func TlsCertificateInfos added in v1.1.84

func TlsCertificateInfos(tlsConfig *tls.Config) (string, error)

func TlsCipherDescription added in v1.1.84

func TlsCipherDescription(cs *tls.CipherSuite) string

func TlsCipherNames added in v1.1.84

func TlsCipherNames(ciphers []*tls.CipherSuite) []string

func TlsCipherSelectionsToIds added in v1.1.84

func TlsCipherSelectionsToIds(s string) []uint16

func TlsCiphersIds added in v1.1.84

func TlsCiphersIds(ciphers []*tls.CipherSuite) []uint16

func TlsConfigFromP12 added in v1.7.12

func TlsConfigFromP12(ba []byte, password string) (*tls.Config, error)

func TlsConfigFromPEM added in v1.1.84

func TlsConfigFromPEM(certPEM []byte, keyPEM []byte, password string) (*tls.Config, error)

func TlsConfigToP12 added in v1.1.84

func TlsConfigToP12(tlsConfig *tls.Config, password string) ([]byte, error)

func TlsDebugConnection added in v1.1.84

func TlsDebugConnection(typ string, tlsConn *tls.Conn)

func TlsDefaultCiphers added in v1.1.84

func TlsDefaultCiphers() []*tls.CipherSuite

func TlsDescriptionToCipher added in v1.1.84

func TlsDescriptionToCipher(name string) *tls.CipherSuite

func TlsIdToCipher added in v1.1.84

func TlsIdToCipher(id uint16) *tls.CipherSuite

func TlsIdToVersion added in v1.1.21

func TlsIdToVersion(id uint16) string

func TlsToX509Certificate added in v1.1.84

func TlsToX509Certificate(certificate []byte) (*x509.Certificate, error)

func TlsVersionToId added in v1.1.21

func TlsVersionToId(s string) uint16

func TlsVersions added in v1.1.21

func TlsVersions() []string

func ToBool

func ToBool(s string) bool

ToBool reports if value indicates "true"

func ToStrings

func ToStrings(slice interface{}) ([]string, error)

func ToTime

func ToTime(v asDateTime) time.Time

func ToUTF8

func ToUTF8(r io.Reader, cs string) ([]byte, error)

func ToUTF8String

func ToUTF8String(s string, cs string) (string, error)

func TraceError added in v1.5.36

func TraceError(err error) error

func Translate

func Translate(msg string, args ...interface{}) string

Translate a message to the current set language

func TranslateFor added in v1.1.15

func TranslateFor(language, msg string) string

func Trim4Path

func Trim4Path(path string) string

Trim4Path trims given path to be usefull as filename

func TruncateTime

func TruncateTime(t time.Time, f string) time.Time

func URLGet added in v1.1.15

func URLGet(url string) ([]byte, error)

func UnregisterGoRoutine added in v1.1.108

func UnregisterGoRoutine(id int)

func Unzip

func Unzip(dest, src string) error

func ValidateJson added in v1.6.21

func ValidateJson(p any, ba []byte, ignoreUnknownFields bool) error

func VerifyP12 added in v1.1.15

func VerifyP12(ba []byte, password string) (privateKey *ecdsa.PrivateKey, certificate *x509.Certificate, caCerts []*x509.Certificate, err error)

func Version added in v1.1.15

func Version(major bool, minor bool, patch bool) string

func WaitUntilNetworkIsAvailable added in v1.2.4

func WaitUntilNetworkIsAvailable(lookupIp net.IP) error

func WalkFiles added in v1.5.54

func WalkFiles(filemask string, recursive bool, ignoreError bool, walkFunc func(path string, fi os.FileInfo) error) error

func Warn

func Warn(format string, args ...any)

func WarnError added in v1.1.0

func WarnError(err error) bool

func WriteFully added in v1.5.64

func WriteFully(w io.Writer, p []byte) (int, error)

func WriteJsonFile added in v1.1.15

func WriteJsonFile(filename string, v interface{}, fileMode os.FileMode) error

func WriteWithTimeout added in v1.5.49

func WriteWithTimeout(writer io.Writer, timeout time.Duration, ba []byte) (int, error)

func X509toTlsCertificate added in v1.1.84

func X509toTlsCertificate(certificate *x509.Certificate, privateKey *ecdsa.PrivateKey) (*tls.Certificate, error)

func Zip

func Zip(filename string, targets []ZipTarget) error

Types

type ActionItem added in v1.1.15

type ActionItem struct {
	Caption  string
	Icon     string
	Action   string
	Download string
	Message  string
	Enabled  bool
	SubItems []ActionItem
}

type Configuration added in v1.1.15

type Configuration struct {
	ApplicationTitle   string    `json:"applicationTitle"`
	ApplicationVersion string    `json:"applicationVersion"`
	Flags              KeyValues `json:"flags"`
}

func LoadConfiguration added in v1.3.11

func LoadConfiguration() (*Configuration, error)

func NewConfiguration added in v1.1.15

func NewConfiguration() *Configuration

func (*Configuration) GetFlag added in v1.1.15

func (this *Configuration) GetFlag(flagName string) (string, error)

func (*Configuration) SetFlag added in v1.1.15

func (this *Configuration) SetFlag(flagName string, flagValue string) error

type DiscoverServer added in v1.1.15

type DiscoverServer struct {
	// contains filtered or unexported fields
}

func NewDiscoverServer added in v1.1.15

func NewDiscoverServer(address string, timeout time.Duration, uid string, info string) (*DiscoverServer, error)

func (*DiscoverServer) Start added in v1.1.15

func (server *DiscoverServer) Start() error

func (*DiscoverServer) Stop added in v1.1.15

func (server *DiscoverServer) Stop() error

type Element added in v1.4.43

type Element struct {
	Name      string
	Text      string
	PlainText bool
	Attrs     *OrderedMap[string, string]
	Elements  []*Element
}

func NewElement added in v1.4.43

func NewElement(name string) *Element

func (*Element) AddAttr added in v1.4.43

func (e *Element) AddAttr(name string, value string) *Element

func (*Element) AddElement added in v1.4.43

func (e *Element) AddElement(element *Element) *Element

func (*Element) AddElementName added in v1.6.16

func (e *Element) AddElementName(name string) *Element

func (*Element) IsTextOnly added in v1.4.43

func (e *Element) IsTextOnly() bool

func (*Element) RemoveAttr added in v1.4.43

func (e *Element) RemoveAttr(name string) *Element

func (*Element) RemoveElement added in v1.4.43

func (e *Element) RemoveElement(element *Element) *Element

func (*Element) String added in v1.4.43

func (e *Element) String() string

type Endpoint added in v1.1.106

type Endpoint interface {
	Start() error
	Stop() error
}

type EndpointConnection added in v1.5.16

type EndpointConnection interface {
	io.ReadWriteCloser

	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
}

type EndpointConnector added in v1.1.106

type EndpointConnector func() (EndpointConnection, error)

type ErrExit added in v1.1.15

type ErrExit struct {
}

func (*ErrExit) Error added in v1.1.15

func (e *ErrExit) Error() string

type ErrFileAlreadyExists added in v1.1.107

type ErrFileAlreadyExists struct {
	FileName string
}

func (*ErrFileAlreadyExists) Error added in v1.1.107

func (e *ErrFileAlreadyExists) Error() string

type ErrFileIsEmpty added in v1.2.4

type ErrFileIsEmpty struct {
	FileName string
}

func (*ErrFileIsEmpty) Error added in v1.2.4

func (e *ErrFileIsEmpty) Error() string

type ErrFileNotFound

type ErrFileNotFound struct {
	FileName string
}

func (*ErrFileNotFound) Error

func (e *ErrFileNotFound) Error() string

type ErrSetTimeout added in v1.5.49

type ErrSetTimeout struct {
	Mode string
}

func (*ErrSetTimeout) Error added in v1.5.49

func (e *ErrSetTimeout) Error() string

type ErrTimeout added in v1.2.5

type ErrTimeout struct {
	Duration time.Duration
	Err      error
}

func (*ErrTimeout) Error added in v1.2.5

func (e *ErrTimeout) Error() string

func (*ErrTimeout) Timeout added in v1.2.18

func (e *ErrTimeout) Timeout() bool

type ErrUnknownFlag added in v1.7.6

type ErrUnknownFlag struct {
	Origin string
	Name   string
}

func (*ErrUnknownFlag) Error added in v1.7.6

func (e *ErrUnknownFlag) Error() string

type ErrWatchdog added in v1.1.3

type ErrWatchdog struct {
	Msg string
}

func (*ErrWatchdog) Error added in v1.1.3

func (e *ErrWatchdog) Error() string

type Event added in v1.1.15

type Event interface{}

type EventConfigurationReset added in v1.1.15

type EventConfigurationReset struct {
	Cfg *bytes.Buffer
}

type EventFlagsParsed added in v1.1.21

type EventFlagsParsed struct {
}

type EventFlagsSet added in v1.1.22

type EventFlagsSet struct {
}

type EventFunc added in v1.1.15

type EventFunc func(Event)

type EventInit added in v1.6.33

type EventInit struct {
}

type EventManager added in v1.1.15

type EventManager struct {
	// contains filtered or unexported fields
}

func NewEventManager added in v1.1.15

func NewEventManager() *EventManager

func (*EventManager) AddListener added in v1.5.52

func (this *EventManager) AddListener(event interface{}, eventFunc EventFunc) *EventFunc

func (*EventManager) Emit added in v1.1.15

func (this *EventManager) Emit(event interface{}, reverse bool)

func (*EventManager) RemoveListener added in v1.5.52

func (this *EventManager) RemoveListener(eventFunc *EventFunc)

type EventShutdown added in v1.5.41

type EventShutdown struct {
}

type EventType added in v1.1.0

type EventType reflect.Type

type FileEntry added in v1.5.56

type FileEntry struct {
	// contains filtered or unexported fields
}

func NewFileEntry added in v1.5.56

func NewFileEntry(path string, fileInfo os.FileInfo) (*FileEntry, error)

type FilePermission added in v1.1.15

type FilePermission struct {
	Read    bool
	Write   bool
	Execute bool
}

type FuncFieldIterator added in v1.1.15

type FuncFieldIterator func(string, reflect.StructField, reflect.Value, *structtag.Tag) (bool, []string)

type HostInfo added in v1.2.51

type HostInfo struct {
	Intf  net.Interface
	IPNet *net.IPNet
}

func GetHostInfos added in v1.2.51

func GetHostInfos() (string, net.IP, []HostInfo, error)

type Jason

type Jason struct {
	// contains filtered or unexported fields
}

func NewJason

func NewJason(s string) (*Jason, error)

func (*Jason) Array

func (jason *Jason) Array(key string, index int) (*Jason, error)

func (*Jason) ArrayCount

func (jason *Jason) ArrayCount(key string) int

func (*Jason) Bool

func (jason *Jason) Bool(key string, def ...bool) (result bool, err error)

func (*Jason) Count

func (jason *Jason) Count() int

func (*Jason) Element

func (jason *Jason) Element(key string) (*Jason, error)

func (*Jason) Elements

func (jason *Jason) Elements() []string

func (*Jason) Exists

func (jason *Jason) Exists(key string) bool

func (*Jason) Int

func (jason *Jason) Int(key string, def ...int) (result int, err error)

func (*Jason) IsArray

func (jason *Jason) IsArray(key string) bool

func (*Jason) IsBool

func (jason *Jason) IsBool(key string) bool

func (*Jason) IsInt

func (jason *Jason) IsInt(key string) bool

func (*Jason) IsString

func (jason *Jason) IsString(key string) bool

func (*Jason) Pretty

func (jason *Jason) Pretty() (string, error)

func (*Jason) String

func (jason *Jason) String(key string, def ...string) (string, error)

type KeyValue added in v1.2.16

type KeyValue string

func (KeyValue) Key added in v1.2.16

func (kv KeyValue) Key() string

func (KeyValue) Value added in v1.2.16

func (kv KeyValue) Value() string

type KeyValues added in v1.2.16

type KeyValues []KeyValue

func NewKeyValues added in v1.2.17

func NewKeyValues(list []string) *KeyValues

func (*KeyValues) Add added in v1.2.16

func (kvs *KeyValues) Add(key string, value string) error

func (*KeyValues) Clear added in v1.2.16

func (kvs *KeyValues) Clear()

func (*KeyValues) Contains added in v1.2.16

func (kvs *KeyValues) Contains(key string) bool

func (*KeyValues) Get added in v1.2.16

func (kvs *KeyValues) Get(key string) (string, error)

func (*KeyValues) Index added in v1.2.17

func (kvs *KeyValues) Index(key string) int

func (*KeyValues) Keys added in v1.2.16

func (kvs *KeyValues) Keys() []string

func (*KeyValues) Put added in v1.2.16

func (kvs *KeyValues) Put(key string, value string) error

func (*KeyValues) Remove added in v1.2.16

func (kvs *KeyValues) Remove(key string) (string, error)

func (*KeyValues) Sort added in v1.2.16

func (kvs *KeyValues) Sort()

func (*KeyValues) Values added in v1.2.16

func (kvs *KeyValues) Values() []string

type MimetypeExtension added in v1.1.15

type MimetypeExtension struct {
	MimeType, Ext string
}

func DetectMimeType

func DetectMimeType(filename string, buf []byte) (MimetypeExtension, error)

type ModuleInfo added in v1.1.15

type ModuleInfo struct {
	Disclosure string          `json:"disclosure"`
	Software   string          `json:"software"`
	Version    string          `json:"version"`
	Requires   []ModuleRequire `json:"requires"`
}

func CreateModuleInfo added in v1.1.15

func CreateModuleInfo() (*ModuleInfo, error)

type ModuleRequire added in v1.5.65

type ModuleRequire struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Comment     string `json:"comment"`
	LicenseName string `json:"licenseName"`
	LicenseUrl  string `json:"licenseUrl"`
	LicenseText string `json:"licenseText"`
}

type MultiValueFlag added in v1.1.19

type MultiValueFlag []string

func (*MultiValueFlag) Set added in v1.1.19

func (multiValueFLag *MultiValueFlag) Set(value string) error

func (*MultiValueFlag) String added in v1.1.19

func (multiValueFLag *MultiValueFlag) String() string

type NetworkClient added in v1.1.84

type NetworkClient struct {
	// contains filtered or unexported fields
}

func NewNetworkClient added in v1.1.84

func NewNetworkClient(address string, tlsConfig *tls.Config) (*NetworkClient, error)

func (*NetworkClient) Connect added in v1.1.84

func (networkClient *NetworkClient) Connect() (*NetworkConnection, error)

func (*NetworkClient) Start added in v1.1.84

func (networkClient *NetworkClient) Start() error

func (*NetworkClient) Stop added in v1.1.84

func (networkClient *NetworkClient) Stop() error

type NetworkConnection added in v1.1.84

type NetworkConnection struct {
	EndpointConnection

	Socket net.Conn
	// contains filtered or unexported fields
}

func (*NetworkConnection) Close added in v1.1.84

func (networkConnection *NetworkConnection) Close() error

func (*NetworkConnection) Read added in v1.1.84

func (networkConnection *NetworkConnection) Read(p []byte) (n int, err error)

func (*NetworkConnection) SetDeadline added in v1.5.16

func (networkConnection *NetworkConnection) SetDeadline(t time.Time) error

func (*NetworkConnection) SetReadDeadline added in v1.5.16

func (networkConnection *NetworkConnection) SetReadDeadline(t time.Time) error

func (*NetworkConnection) SetWriteDeadline added in v1.5.16

func (networkConnection *NetworkConnection) SetWriteDeadline(t time.Time) error

func (*NetworkConnection) Write added in v1.1.84

func (networkConnection *NetworkConnection) Write(p []byte) (n int, err error)

type NetworkServer added in v1.1.84

type NetworkServer struct {
	Endpoint
	// contains filtered or unexported fields
}

func NewNetworkServer added in v1.1.84

func NewNetworkServer(address string, tlsConfig *tls.Config) (*NetworkServer, error)

func (*NetworkServer) Connect added in v1.1.84

func (networkServer *NetworkServer) Connect() (*NetworkConnection, error)

func (*NetworkServer) Serve added in v1.1.84

func (this *NetworkServer) Serve() ([]byte, error)

func (*NetworkServer) Start added in v1.1.84

func (networkServer *NetworkServer) Start() error

func (*NetworkServer) Stop added in v1.1.84

func (networkServer *NetworkServer) Stop() error

type Notice added in v1.1.15

type Notice struct {
	// contains filtered or unexported fields
}

func AppLifecycle added in v1.1.15

func AppLifecycle() *Notice

func NewNotice added in v1.1.15

func NewNotice(isSet bool) *Notice

func (*Notice) IsSet added in v1.1.15

func (this *Notice) IsSet() bool

func (*Notice) NewChannel added in v1.1.80

func (this *Notice) NewChannel() chan struct{}

func (*Notice) RemoveChannel added in v1.5.52

func (this *Notice) RemoveChannel(ch chan struct{})

func (*Notice) Set added in v1.1.15

func (this *Notice) Set() bool

func (*Notice) Unset added in v1.1.15

func (this *Notice) Unset() bool

type OrderedMap

type OrderedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewOrderedMap

func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V]

func (*OrderedMap[K, V]) Add added in v1.4.43

func (om *OrderedMap[K, V]) Add(key K, value V) *OrderedMap[K, V]

func (*OrderedMap[K, V]) Clear

func (om *OrderedMap[K, V]) Clear() *OrderedMap[K, V]

func (*OrderedMap[K, V]) Get

func (om *OrderedMap[K, V]) Get(key K) (V, bool)

func (*OrderedMap[K, V]) GetByIndex added in v1.5.52

func (om *OrderedMap[K, V]) GetByIndex(index int) (K, V)

func (*OrderedMap[K, V]) Keys

func (om *OrderedMap[K, V]) Keys() []K

func (*OrderedMap[K, V]) Len

func (om *OrderedMap[K, V]) Len() int

func (*OrderedMap[K, V]) Range added in v1.4.43

func (om *OrderedMap[K, V]) Range(fn func(K, V))

func (*OrderedMap[K, V]) Remove added in v1.4.43

func (om *OrderedMap[K, V]) Remove(key K) V

func (*OrderedMap[K, V]) RemoveByIndex added in v1.5.52

func (om *OrderedMap[K, V]) RemoveByIndex(index int) (K, V)

type Quantum

type Quantum struct {
	// contains filtered or unexported fields
}

func NewQuantum

func NewQuantum() *Quantum

func ParseQuantum added in v1.1.27

func ParseQuantum(txt string) (*Quantum, error)

func (*Quantum) Add

func (q *Quantum) Add(v int)

func (*Quantum) AddQuantum added in v1.1.27

func (q *Quantum) AddQuantum(other *Quantum)

func (*Quantum) AddRange

func (q *Quantum) AddRange(from int, to int)

func (*Quantum) Get

func (q *Quantum) Get(index int) (int, error)

func (*Quantum) IsIncluded added in v1.1.15

func (q *Quantum) IsIncluded(v int) bool

func (*Quantum) Len

func (q *Quantum) Len() int

func (*Quantum) Remove

func (q *Quantum) Remove(v int)

func (*Quantum) RemoveAll added in v1.1.27

func (q *Quantum) RemoveAll()

func (*Quantum) RemoveQuantum added in v1.1.27

func (q *Quantum) RemoveQuantum(other *Quantum)

func (*Quantum) RemoveRange

func (q *Quantum) RemoveRange(from int, to int)

func (*Quantum) String

func (q *Quantum) String() string

func (*Quantum) ToSlice

func (q *Quantum) ToSlice() []int

type RandomReader added in v1.1.21

type RandomReader struct {
	// contains filtered or unexported fields
}

func NewRandomReader added in v1.1.21

func NewRandomReader() *RandomReader

func (RandomReader) Read added in v1.1.21

func (this RandomReader) Read(p []byte) (n int, err error)

type ReentrantMutex added in v1.6.0

type ReentrantMutex struct {
	sync.Locker
	// contains filtered or unexported fields
}

func NewRentrantMutex added in v1.1.77

func NewRentrantMutex() ReentrantMutex

func (*ReentrantMutex) Lock added in v1.6.0

func (rm *ReentrantMutex) Lock()

func (*ReentrantMutex) Unlock added in v1.6.0

func (rm *ReentrantMutex) Unlock()

func (*ReentrantMutex) UnlockNow added in v1.6.0

func (rm *ReentrantMutex) UnlockNow()

type Runner added in v1.1.15

type Runner struct {
	Err    error
	Output string
	// contains filtered or unexported fields
}

func NewRunner added in v1.1.15

func NewRunner(cmd *exec.Cmd, timeout time.Duration) *Runner

type RuntimeInfo

type RuntimeInfo struct {
	Dir, Pack, File, Fn, Stack string
	Line                       int
	Timestamp                  time.Time
}

func GetRuntimeInfo added in v1.1.15

func GetRuntimeInfo(pos int) RuntimeInfo

func (RuntimeInfo) Filename added in v1.1.15

func (r RuntimeInfo) Filename() string

func (RuntimeInfo) String added in v1.1.15

func (r RuntimeInfo) String() string

type ScriptEngine added in v1.5.17

type ScriptEngine struct {
	Registry *require.Registry
	VM       *goja.Runtime
	// contains filtered or unexported fields
}

func NewScriptEngine added in v1.5.17

func NewScriptEngine(src string, modulesPath string) (*ScriptEngine, error)

func (*ScriptEngine) Run added in v1.5.17

func (engine *ScriptEngine) Run(timeout time.Duration, funcName string, args any) (goja.Value, error)

type StringTable added in v1.3.21

type StringTable struct {
	Cells    [][]interface{}
	NoHeader bool
	Markdown bool
	Aligment []int
}

func NewStringTable added in v1.3.21

func NewStringTable() *StringTable

func (*StringTable) AddCol added in v1.3.21

func (st *StringTable) AddCol(txt interface{})

func (*StringTable) AddCols added in v1.3.21

func (st *StringTable) AddCols(txts ...interface{})

func (*StringTable) AddRow added in v1.3.21

func (st *StringTable) AddRow()

func (*StringTable) Clear added in v1.3.21

func (st *StringTable) Clear()

func (*StringTable) Rows added in v1.6.29

func (st *StringTable) Rows() int

func (*StringTable) String added in v1.3.21

func (st *StringTable) String() string

type Sync added in v1.6.6

type Sync[T any] struct {
	// contains filtered or unexported fields
}

func NewSync added in v1.6.16

func NewSync[T any]() *Sync[T]

func NewSyncOf added in v1.6.17

func NewSyncOf[T any](t T) *Sync[T]

func (*Sync[T]) Get added in v1.6.6

func (sync *Sync[T]) Get() T

func (*Sync[T]) IsSet added in v1.6.6

func (sync *Sync[T]) IsSet() bool

func (*Sync[T]) Run added in v1.6.6

func (sync *Sync[T]) Run(fn func(T))

func (*Sync[T]) Set added in v1.6.6

func (sync *Sync[T]) Set(value T)

type SystemInfo added in v1.1.15

type SystemInfo struct {
	KernelName    string
	KernelVersion string
	KernelRelease string
	Platform      string
	MemTotal      string
	MemFree       string
}

func GetSystemInfo added in v1.1.15

func GetSystemInfo() (*SystemInfo, error)

type TTY added in v1.1.84

type TTY struct {
	// contains filtered or unexported fields
}

func NewTTY added in v1.1.84

func NewTTY(device string) (*TTY, error)

func (*TTY) Connect added in v1.1.84

func (tty *TTY) Connect() (EndpointConnection, error)

func (*TTY) Start added in v1.1.84

func (tty *TTY) Start() error

func (*TTY) Stop added in v1.1.84

func (tty *TTY) Stop() error

type TTYConnection added in v1.1.84

type TTYConnection struct {
	EndpointConnection
	// contains filtered or unexported fields
}

func (*TTYConnection) Close added in v1.1.84

func (ttyConnection *TTYConnection) Close() error

func (*TTYConnection) Read added in v1.1.84

func (ttyConnection *TTYConnection) Read(p []byte) (n int, err error)

func (*TTYConnection) SetDeadline added in v1.5.16

func (ttyConnection *TTYConnection) SetDeadline(t time.Time) error

func (*TTYConnection) SetReadDeadline added in v1.5.16

func (ttyConnection *TTYConnection) SetReadDeadline(t time.Time) error

func (*TTYConnection) SetWriteDeadline added in v1.5.16

func (ttyConnection *TTYConnection) SetWriteDeadline(t time.Time) error

func (*TTYConnection) Write added in v1.1.84

func (ttyConnection *TTYConnection) Write(p []byte) (n int, err error)

type TimeoutReader added in v1.1.61

type TimeoutReader struct {
	FirstRead time.Time
	// contains filtered or unexported fields
}

func NewTimeoutReader added in v1.1.61

func NewTimeoutReader(reader io.Reader, initialTimeout bool, timeout time.Duration) *TimeoutReader

func (*TimeoutReader) Read added in v1.1.61

func (timeoutReader *TimeoutReader) Read(p []byte) (int, error)

type TimeoutRegister added in v1.5.19

type TimeoutRegister[T comparable] struct {
	// contains filtered or unexported fields
}

func NewTimeoutRegister added in v1.5.19

func NewTimeoutRegister[T comparable](timeout time.Duration) *TimeoutRegister[T]

func (*TimeoutRegister[T]) Close added in v1.6.6

func (tr *TimeoutRegister[T]) Close()

func (*TimeoutRegister[T]) IsRegistered added in v1.5.20

func (tr *TimeoutRegister[T]) IsRegistered(item T) bool

func (*TimeoutRegister[T]) Register added in v1.5.19

func (tr *TimeoutRegister[T]) Register(item T)

type TimeoutWriter added in v1.1.104

type TimeoutWriter struct {
	FirstWrite time.Time
	// contains filtered or unexported fields
}

func NewTimeoutWriter added in v1.1.104

func NewTimeoutWriter(writer io.Writer, initialTimeout bool, timeout time.Duration) *TimeoutWriter

func (*TimeoutWriter) Write added in v1.1.104

func (timeoutWriter *TimeoutWriter) Write(p []byte) (int, error)

type URI added in v1.4.13

type URI struct {
	Scheme   string
	Opaque   string
	Username string
	Password string
	Host     string
	Port     string
	Path     string
}

func (*URI) IsV6 added in v1.4.13

func (uri *URI) IsV6() bool

func (*URI) Parse added in v1.4.13

func (uri *URI) Parse(s string) error

func (*URI) String added in v1.4.13

func (uri *URI) String() string

type Webpage added in v1.1.15

type Webpage struct {
	HtmlRoot          *etree.Element
	HtmlHead          *etree.Element
	HtmlTitle         *etree.Element
	HtmlMenu          *etree.Element
	HtmlBody          *etree.Element
	HtmlScrollContent *etree.Element
	HtmlContent       *etree.Element
	// contains filtered or unexported fields
}

func NewPage added in v1.1.15

func NewPage(context echo.Context, contentStyle string, title string) (*Webpage, error)

func (*Webpage) HTML added in v1.1.15

func (this *Webpage) HTML() (string, error)

func (*Webpage) SetRedirectTimeout added in v1.4.29

func (page *Webpage) SetRedirectTimeout(timeout time.Duration, url string)

type ZeroReader added in v1.1.21

type ZeroReader struct {
}

func NewZeroReader added in v1.1.21

func NewZeroReader() *ZeroReader

func (ZeroReader) Read added in v1.1.21

func (this ZeroReader) Read(p []byte) (n int, err error)

type ZipTarget added in v1.1.109

type ZipTarget struct {
	BaseDir string
	Files   []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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