Back to godoc.org
github.com/mpetavy/common

Package common

v1.1.79
Latest Go to latest

The highest tagged major version is .

Published: today | License: Apache-2.0 | Module: github.com/mpetavy/common

Index

Constants

const (
	APACHE string = "https://www.apache.org/licenses/LICENSE-2.0.html"
	GPL2   string = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"
)
const (
	FlagNameService         = "service"
	FlagNameServiceUsername = "service.username"
	FLagNameServicePassword = "service.password"
	FlagNameServiceTimeout  = "service.timeout"
)
const (
	MaxUint = ^uint(0)
	MinUint = 0
	MaxInt  = int(MaxUint >> 1)
	MinInt  = -MaxInt - 1
)
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 = " "
)
const (
	DEFAULT_LANGUAGE = "en"

	FlagNameLanguage = "language"
)
const (
	// DB level
	LEVEL_FILE = iota
	// LEVEL_DEBUG level
	LEVEL_DEBUG
	// LEVEL_INFO level
	LEVEL_INFO
	// LEVEL_ERROR level
	LEVEL_WARN
	// LEVEL_ERROR level
	LEVEL_ERROR
)
const (
	FlagNameLogFileName = "log.file"
	FlagNameLogFileSize = "log.filesize"
	FlagNameLogVerbose  = "log.verbose"
	FlagNameLogIO       = "log.io"
	FlagNameLogJson     = "log.json"
	FlagNameLogSys      = "log.sys"
)
const (
	LOCALHOST_IP4 = "127.0.0.1"
	LOCALHOST_IP6 = "::1"
)
const (
	FlagNameTlsP12File = "tls.p12file"
	FlagNameTlsP12     = "tls.p12"
)
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"
)
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_MEGALINE      = "megaline"
	OPTION_NOLABEL       = "nolabel"
	OPTION_EXPERTVIEW    = "expertview"
	OPTION_NOPLACEHOLDER = "noplaceholder"

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

	CSS_DIALOG_CONTENT     = "css-dialog-content pure-controls"
	CSS_DEFAULT_CONTENT    = "css-default-content pure-controls"
	CSS_ERROR_BOX          = "css-error-box blink"
	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_COLOR_OFF = "#CFCFCF"
	CSS_COLOR_ON  = "MediumSeaGreen"

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

	COOKIE_PASSWORD = "password"
	COOKIE_EXPIRE   = "expire"

	FLASH_TIMEOUT = time.Second
)
const (
	FlagNameTlsInsecure = "tls.insecure"
)
const (
	MimetypeHeaderLen = 1024
)
const UNKNOWN = "unknwon"

Variables

var (
	FlagService             *string
	FlagServiceUser         *string
	FlagServicePassword     *string
	FlagServiceStartTimeout *int
	FlagUsage               *bool
	FlagNoBanner            *bool
)
var (
	FlagCfgReset *bool
	FlagCfgFile  *string
)
var (
	ReadOnlyFileMode = FileMode(true, true, false)
	DefaultFileMode  = FileMode(true, true, false)
	DefaultDirMode   = FileMode(true, true, true)
	FlagCountBackups *int
)
var (
	FlagLogVerbose  *bool
	FlagLogIO       *bool
	FlagLogFileName *string
	FlagLogFileSize *int64
	FlagLogJson     *bool
	FlagLogSys      *bool
)
var (
	FlagTlsP12File *string
	FlagTlsP12     *string
)
var DateMask = Day + DateSeparator + Month + DateSeparator + Year

DateMask parses only for date values

var DateMaskFilename = Year + "-" + Month + "-" + Day

DateMaskFilena,e parses for date value for file names

var DateTimeMask = DateMask + Separator + TimeMask

DateTimeMask parses for date and time values

var DateTimeMilliMask = DateMask + Separator + TimeMask + Msec

DateTimeMask parses for date and time values

var (
	FlagLanguage *string
)
var (
	FlagTlsInsecure *bool
)
var (
	MEMORY_UNITS = []string{"Bytes", "KB", "MB", "GB", "TB"}
)
var Mimetypes []MimetypeExtension
var TimeMask = Hour + TimeSeparator + Minute + TimeSeparator + Second

TimeMask parses only for time values

func AESDecrypt

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

func AESEncrypt

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

func AddShutdownHook

func AddShutdownHook(f func())

func App

func App() *application

func AppFilename

func AppFilename(newExt string) string

func AppRestart

func AppRestart()

func AuthenticateCookie

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

func BindForm

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

func CalcFileMode

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

func Capitalize

func Capitalize(txt string) string

Capitalize the first letter

func CertificateInfoFromConnection

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

func CertificateInfoFromX509

func CertificateInfoFromX509(certs []*x509.Certificate) (string, error)

func CleanPath

func CleanPath(path string) string

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

func ClearDate

func ClearDate(v time.Time) time.Time

ClearDate returns only time part, date part set to 0

func ClearTime

func ClearTime(v time.Time) time.Time

ClearTime returns only date part, time part set to 0

func CmdToString

func CmdToString(cmd *exec.Cmd) string

func CompareDate

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

EqualDateTime checks for equality of parts

func CompareIgnoreCase

func CompareIgnoreCase(s0 string, s1 string) bool

CompareIgnoreCase compares strings for equality ignoring case

func CompareTime

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

EqualTime checks for equality of time

func ContainsWildcard

func ContainsWildcard(s string) bool

func ConvertToOSspecificLF

func ConvertToOSspecificLF(s string) string

func CopyWithContext

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

func CountRunes

func CountRunes(s string) int

func CreateI18nFile

func CreateI18nFile(path string, objs ...interface{}) 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 DeadlineByDuration

func DeadlineByDuration(duration time.Duration) time.Time

func DeadlineByMsec

func DeadlineByMsec(msec int) time.Time

func Debug

func Debug(t string, arg ...interface{})

Debug prints out the information

func DebugError

func DebugError(err error) bool

DebugError prints out the error

func DebugFunc

func DebugFunc(arg ...interface{})

DebugFunc prints out the current executon func

func DebugTlsConnectionInfo

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

func DecryptString

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

func DeepCopy

func DeepCopy(dst interface{}, src interface{}) error

func DefaultConsoleEncoding

func DefaultConsoleEncoding() string

func DefaultEncoding

func DefaultEncoding() string

func DisableCookie

func DisableCookie(context echo.Context) error

func Discover

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

func Done

func Done()

Exit exist app and run all registered shutdown hooks

func DurationToMillisecond

func DurationToMillisecond(d time.Duration) int

func EncryptString

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

func EqualWildcards

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

func Error

func Error(err error) bool

Error prints out the error

func ErrorReturn

func ErrorReturn(err error) error

func Eval

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

func Exit

func Exit(code int)

func ExitOrError

func ExitOrError(err error) error

func ExportRsaPrivateKeyAsPemStr

func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string

func ExportRsaPublicKeyAsPemStr

func ExportRsaPublicKeyAsPemStr(pubkey *rsa.PublicKey) (string, error)

func ExtractNumber

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

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

FileDate does ... guess what :-)

func FileDelete

func FileDelete(filename string) error

FileDelete does ... guess what :-)

func FileExists

func FileExists(filename string) (bool, error)

FileExists does ... guess what :-)

func FileMode

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

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

func FindFreePort

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

func FormatMemory

func FormatMemory(mem int64) string

func GenerateRandomBytes

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

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string.

func GetConfigurationBuffer

func GetConfigurationBuffer() []byte

func GetHost

func GetHost() (string, string, error)

func GetHostAddrs

func GetHostAddrs(inclLocalhost bool, remote net.IP) ([]hostAddress, error)

func GetHostInterface

func GetHostInterface(ip string) (*net.Interface, net.Addr, error)

func GetLanguages

func GetLanguages() ([]string, error)

GetLanguages lists all available languages

func GetResource

func GetResource(name string) []byte

func GetSystemLanguage

func GetSystemLanguage() (string, error)

GetSystemLanguage return BCP 47 standard language name

func GoogleTranslate

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

func Hack4BrowserUpdate

func Hack4BrowserUpdate() string

func Ignore

func Ignore(arg ...interface{}) bool

Ignore just ignores the error

func IndexOf

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

func Info

func Info(t string, arg ...interface{})

Info prints out the information

func Init

func Init(isService bool, version string, git string, date string, description string, developer string, homepage string, license string, startFunc func() error, stopFunc func() error, runFunc func() error, runTime time.Duration)

func InitTesting

func InitTesting(v goTesting)

func IsCertificateSelfSigned

func IsCertificateSelfSigned(cert *x509.Certificate) bool

func IsCookieAuthenticated

func IsCookieAuthenticated(context echo.Context, login string, hashFunc func(string) string) bool

func IsDirectory

func IsDirectory(path string) (bool, error)

IsDirectory checks if the path leads to a directory

func IsErrNetClosing

func IsErrNetClosing(err error) bool

func IsErrUnexpectedEOF

func IsErrUnexpectedEOF(err error) bool

func IsFile

func IsFile(path string) (bool, error)

IsDirectory checks if the path leads to a directory

func IsFileReadOnly

func IsFileReadOnly(path string) (result bool, err error)

IsFileReadOnly checks if a file is read only

func IsImageMimeType

func IsImageMimeType(s string) bool

func IsLinuxOS

func IsLinuxOS() bool

IsLinuxOS reports true if underlying OS is Linux

func IsLocalhost

func IsLocalhost(ip string) bool

func IsMacOS

func IsMacOS() bool

IsMacOS reports true if underlying OS is MacOS

func IsOneTimeFlag

func IsOneTimeFlag(n string) bool

func IsPortAvailable

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

func IsPrivateIP

func IsPrivateIP(ip string) (bool, error)

func IsRunningAsExecutable

func IsRunningAsExecutable() bool

func IsRunningAsService

func IsRunningAsService() bool

func IsRunningInteractive

func IsRunningInteractive() bool

func IsStringEnrypted

func IsStringEnrypted(password string) bool

func IsSuppressedError

func IsSuppressedError(err error) bool

func IsSuppressedErrorMessage

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

IsSymbolicLink checks if the path leads to symbolic link

func IsWindowsOS

func IsWindowsOS() bool

IsWindowsOS reports true if underlying OS is MS Windows

func IterateStruct

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

func Join

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

func Logs

func Logs(w io.Writer) error

func LogsAvailable

func LogsAvailable() bool

func Max

func Max(v ...int) int

func MillisecondToDuration

func MillisecondToDuration(msec int) time.Duration

func Min

func Min(v ...int) int

func MultiRunner

func MultiRunner(runners []Runner) error

func NewButton

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

func NewDeadlineReader

func NewDeadlineReader(reader io.Reader, timeout time.Duration) io.Reader

func NewEchoLogger

func NewEchoLogger() echoLogger

func NewForm

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

func NewLineBuffer

func NewLineBuffer(count int, f func(string) string) *lineBuffer

func NewMenu

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

func NewRentrantMutex

func NewRentrantMutex() reentrantmutex

func NewTable

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

func NewThrottledReader

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

func NewThrottledWriter

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

func NewTimeoutOperation

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

func ParseDateTime

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

ParseDateTime parses only date, but no time

func ParseJsonDateTime

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

ParseJsonDateTime parses only date, but no time

func ParseMemory

func ParseMemory(txt string) (int64, error)

func ParseRsaPrivateKeyFromPemStr

func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)

func ParseRsaPublicKeyFromPemStr

func ParseRsaPublicKeyFromPemStr(pubPEM string) (*rsa.PublicKey, error)

func PullFlash

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

func PushFlash

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

func ReadHeader

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

func ReadJsonFile

func ReadJsonFile(filename string, v interface{}) error

func ReflectStructField

func ReflectStructField(Iface interface{}, FieldName string) (*reflect.Value, error)

func ReflectStructMethod

func ReflectStructMethod(Iface interface{}, MethodName string) (*reflect.Value, error)

func RefreshCookie

func RefreshCookie(context echo.Context, timeout time.Duration) error

func RegisterResourceLoader

func RegisterResourceLoader(r resourceloader)

func RemoveJsonComments

func RemoveJsonComments(s string) string

func ResetConfiguration

func ResetConfiguration() error

func Rnd

func Rnd(max int) int

func Run

func Run(mandatoryFlags []string)

Run struct for copyright information

func Rune

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

func ScanLinesWithLF

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

func SetConfiguration

func SetConfiguration(cfg interface{}) error

func SetFileReadOnly

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

SetFileReadOnly sets file READ-ONLY yes or false

func SetLanguage

func SetLanguage(lang string) error

SetLanguage sets the language file to translation

func SetTime

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

func Shortener

func Shortener(s string, max int) string

func SortStringsCaseInsensitive

func SortStringsCaseInsensitive(strs []string)

func SplitWithQuotation

func SplitWithQuotation(txt string) []string

SplitWithQuotation splits a sequented string by spaces and respects quotation

func StillAlive

func StillAlive(pid int) bool

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

func Title() string

func TitleVersion

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

func TlsCipherSuiteToInfo

func TlsCipherSuiteToInfo(cs *tls.CipherSuite) string

func TlsCipherSuites

func TlsCipherSuites() []*tls.CipherSuite

func TlsIdToCipherSuite

func TlsIdToCipherSuite(id uint16) *tls.CipherSuite

func TlsIdToVersion

func TlsIdToVersion(id uint16) string

func TlsInfoToCipherSuite

func TlsInfoToCipherSuite(name string) *tls.CipherSuite

func TlsInfosToCipherSuites

func TlsInfosToCipherSuites(s string) []uint16

func TlsVersionToId

func TlsVersionToId(s string) uint16

func TlsVersions

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 Translate

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

Translate a message to the current set language

func TranslateFor

func TranslateFor(language, msg string) string

func Trim4Path

func Trim4Path(path string) string

Trim4Path trims given path to be usefully as filename

func TruncateTime

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

func URLGet

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

func Unzip

func Unzip(dest, src string) error

func VerifyCertificate

func VerifyCertificate(cert *x509.Certificate) error

func VerifyP12

func VerifyP12(p12 []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error)

func Version

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

func WalkFilepath

func WalkFilepath(filemask string, recursive bool, walkFunc func(path string) error) error

func Warn

func Warn(t string, arg ...interface{})

Warn prints out the information

func WarnError

func WarnError(err error) bool

func WatchdogCmd

func WatchdogCmd(cmd *exec.Cmd, timeout time.Duration) error

func WatchdogFunc

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

func WriteJsonFile

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

func Zip

func Zip(filename string, files []string) error

type ActionItem

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

type AllEvents

type AllEvents struct{}

type ChannelError

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

func (*ChannelError) Add

func (c *ChannelError) Add(err error)

func (*ChannelError) Exists

func (c *ChannelError) Exists() bool

func (*ChannelError) Get

func (c *ChannelError) Get() error

func (*ChannelError) GetAll

func (c *ChannelError) GetAll() []error

type Configuration

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

func GetConfiguration

func GetConfiguration() *Configuration

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) GetFlag

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

func (*Configuration) SetFlag

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

type DeadlineReader

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

func (*DeadlineReader) Read

func (this *DeadlineReader) Read(p []byte) (int, error)

type DiscoverServer

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

func NewDiscoverServer

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

func (*DiscoverServer) Start

func (server *DiscoverServer) Start() error

func (*DiscoverServer) Stop

func (server *DiscoverServer) Stop() error

type ErrExit

type ErrExit struct {
}

func (*ErrExit) Error

func (e *ErrExit) Error() string

type ErrFileNotFound

type ErrFileNotFound struct {
	FileName string
}

func (*ErrFileNotFound) Error

func (e *ErrFileNotFound) Error() string

type ErrInvalidType

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

func (*ErrInvalidType) Error

func (e *ErrInvalidType) Error() string

type ErrWatchdog

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

func (*ErrWatchdog) Error

func (e *ErrWatchdog) Error() string

type Event

type Event interface{}

type EventAppRestart

type EventAppRestart struct {
}

type EventChan

type EventChan chan Event

type EventConfigurationReset

type EventConfigurationReset struct {
	Cfg *bytes.Buffer
}

type EventFlagsParsed

type EventFlagsParsed struct {
}

type EventFlagsSet

type EventFlagsSet struct {
}

type EventFunc

type EventFunc func(Event)

type EventManager

type EventManager struct {
	// contains filtered or unexported fields
}
var (
	Events *EventManager
)

func NewEventManager

func NewEventManager() *EventManager

func (*EventManager) DestroyChanReceiver

func (this *EventManager) DestroyChanReceiver(eventChan EventChan)

DestroyFuncReceiver removes an event listener from the Dog struct instance

func (*EventManager) DestroyFuncReceiver

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

DestroyFuncReceiver removes an event listener from the Dog struct instance

func (*EventManager) Emit

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

Emit emits an event on the Dog struct instance

func (*EventManager) NewChanReceiver

func (this *EventManager) NewChanReceiver(event interface{}) EventChan

NewChanReceiver adds an event listener to the Dog struct instance

func (*EventManager) NewFuncReceiver

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

NewFuncReceiver adds an event listener to the Dog struct instance

type EventType

type EventType reflect.Type

type FilePermission

type FilePermission struct {
	Read    bool
	Write   bool
	Execute bool
}

type FuncFieldIterator

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

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 MimetypeExtension

type MimetypeExtension struct {
	MimeType, Ext string
}
var (
	MimetypeApplicationDicom,
	MimetypeApplicationEpubZip,
	MimetypeApplicationGeoJson,
	MimetypeApplicationGmlXml,
	MimetypeApplicationGpxXml,
	MimetypeApplicationGzip,
	MimetypeApplicationJar,
	MimetypeApplicationJavascript,
	MimetypeApplicationJson,
	MimetypeApplicationMsword,
	MimetypeApplicationOctetStream,
	MimetypeApplicationOgg,
	MimetypeApplicationPdf,
	MimetypeApplicationPostscript,
	MimetypeApplicationVndGarminTcxXml,
	MimetypeApplicationVndGoogleEarthKmlXml,
	MimetypeApplicationVndMsExcel,
	MimetypeApplicationVndMsPowerpoint,
	MimetypeApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation,
	MimetypeApplicationVndOpenxmlformatsOfficedocumentSpreadsheetmlSheet,
	MimetypeApplicationVndOpenxmlformatsOfficedocumentWordprocessingmlDocument,
	MimetypeApplicationWasm,
	MimetypeApplicationX7ZCompressed,
	MimetypeApplicationXChromeExtension,
	MimetypeApplicationXJavaApplet,
	MimetypeApplicationXPhotoshop,
	MimetypeApplicationXPython,
	MimetypeApplicationXShockwaveFlash,
	MimetypeApplicationXTar,
	MimetypeApplicationZip,
	MimetypeAudioAiff,
	MimetypeAudioAmr,
	MimetypeAudioApe,
	MimetypeAudioBasic,
	MimetypeAudioFlac,
	MimetypeAudioMidi,
	MimetypeAudioMp4,
	MimetypeAudioMpeg,
	MimetypeAudioMusepack,
	MimetypeAudioWav,
	MimetypeAudioXM4A,
	MimetypeFontWoff,
	MimetypeFontWoff2,
	MimetypeImageBmp,
	MimetypeImageGif,
	MimetypeImageJpeg,
	MimetypeImagePng,
	MimetypeImageSvgXml,
	MimetypeImageTiff,
	MimetypeImageWebp,
	MimetypeImageXIcon,
	MimetypeModelVndColladaXml,
	MimetypeModelX3DXml,
	MimetypeTextHtml,
	MimetypeTextCss,
	MimetypeTextPlain,
	MimetypeTextRtf,
	MimetypeTextXml,
	MimetypeTextXLua,
	MimetypeTextXPerl,
	MimetypeTextXPhp,
	MimetypeTextXTcl,
	MimetypeVideo3GPP,
	MimetypeVideo3GPP2,
	MimetypeVideoMp4,
	MimetypeVideoMpeg,
	MimetypeVideoQuicktime,
	MimetypeVideoWebm,
	MimetypeVideoXFlv,
	MimetypeVideoXMatroska,
	MimetypeVideoXMsvideo MimetypeExtension
)

func DetectMimeType

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

type ModuleInfo

type ModuleInfo struct {
	Module  string
	Version string
	Require []require
}

func CreateModuleInfo

func CreateModuleInfo() (*ModuleInfo, error)

type MultiValueFlag

type MultiValueFlag []string

func (*MultiValueFlag) Set

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

func (*MultiValueFlag) String

func (this *MultiValueFlag) String() string

type Notice

type Notice struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func AppLifecycle

func AppLifecycle() *Notice

func NewNotice

func NewNotice() *Notice

func (*Notice) Channel

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

func (*Notice) Dec

func (this *Notice) Dec() int

func (*Notice) Inc

func (this *Notice) Inc() int

func (*Notice) IncAndReached

func (this *Notice) IncAndReached(v int) bool

func (*Notice) IsSet

func (this *Notice) IsSet() bool

func (*Notice) Reset

func (this *Notice) Reset()

func (*Notice) ResetWithoutLock

func (this *Notice) ResetWithoutLock()

func (*Notice) Set

func (this *Notice) Set() bool

func (*Notice) Unset

func (this *Notice) Unset() bool

type OrderedMap

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

func NewOrderedMap

func NewOrderedMap(m ...interface{}) *OrderedMap

func (*OrderedMap) Clear

func (o *OrderedMap) Clear() *OrderedMap

func (*OrderedMap) Delete

func (o *OrderedMap) Delete(key interface{}) *OrderedMap

func (*OrderedMap) Get

func (o *OrderedMap) Get(key interface{}) (interface{}, bool)

func (*OrderedMap) Keys

func (o *OrderedMap) Keys() []interface{}

func (*OrderedMap) Len

func (o *OrderedMap) Len() int

func (*OrderedMap) Set

func (o *OrderedMap) Set(key interface{}, value interface{}) *OrderedMap

func (*OrderedMap) SetMap

func (o *OrderedMap) SetMap(m ...interface{}) *OrderedMap

type Quantum

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

func NewQuantum

func NewQuantum() *Quantum

func ParseQuantum

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

func (*Quantum) Add

func (q *Quantum) Add(v int)

func (*Quantum) AddQuantum

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

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

func (q *Quantum) RemoveAll()

func (*Quantum) RemoveQuantum

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

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

func NewRandomReader

func NewRandomReader() *RandomReader

func (RandomReader) Read

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

type Runner

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

func NewRunner

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

type RuntimeInfo

type RuntimeInfo struct {
	Dir, Pack, File, Fn, Stack string
	Line                       int
}

func GetRuntimeInfo

func GetRuntimeInfo(pos int) RuntimeInfo

func (RuntimeInfo) Filename

func (r RuntimeInfo) Filename() string

func (RuntimeInfo) String

func (r RuntimeInfo) String() string

type SystemInfo

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

func GetSystemInfo

func GetSystemInfo() (*SystemInfo, error)

type TCPClient

type TCPClient struct {
	Conn net.Conn
	// contains filtered or unexported fields
}

func NewTCPClient

func NewTCPClient(useTls bool, useTlsVerify bool, address string) *TCPClient

func (*TCPClient) Connect

func (this *TCPClient) Connect() (io.ReadWriter, error)

type TCPServer

type TCPServer struct {
	Hash hash.Hash
	Conn net.Conn
	// contains filtered or unexported fields
}

func NewTCPServer

func NewTCPServer(useTls bool, useTlsVerify bool, address string) *TCPServer

func (*TCPServer) Serve

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

type TimeoutError

type TimeoutError error

func NewTimeoutError

func NewTimeoutError(maxDuration time.Duration) TimeoutError

type TimeoutReader

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

func NewTimeoutReader

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

func (*TimeoutReader) Read

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

type TimeoutSocketReader

type TimeoutSocketReader struct {
	ReadTimeout time.Duration
	Socket      net.Conn
}

func (TimeoutSocketReader) Read

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

type TimeoutSocketWriter

type TimeoutSocketWriter struct {
	WriteTimeout time.Duration
	Socket       net.Conn
}

func (TimeoutSocketWriter) Write

func (this TimeoutSocketWriter) Write(p []byte) (n int, err error)

type TlsPackage

type TlsPackage struct {
	CertificateAsPem, PrivateKeyAsPem []byte
	Certificate                       *x509.Certificate
	PrivateKey                        interface{}
	CaCerts                           []*x509.Certificate
	P12                               []byte
	Info                              string
	Config                            tls.Config
}

func CreateTlsPackage

func CreateTlsPackage() (*TlsPackage, error)

func GetTlsPackage

func GetTlsPackage() (*TlsPackage, error)

func TLSConfigFromP12File

func TLSConfigFromP12File(p12File string) (*TlsPackage, error)

the priority on entities inside p12 must be honored 1st private key 2nd computer certificate 3d..n CA certificates (will be ignored by app)

func TLSConfigFromPem

func TLSConfigFromPem(certAsPem []byte, keyAsPem []byte) (*TlsPackage, error)

func TlsConfigFromP12Buffer

func TlsConfigFromP12Buffer(ba []byte) (*TlsPackage, error)

type Webpage

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

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

func NewRefreshPage

func NewRefreshPage(name string, url string) (*Webpage, error)

func (*Webpage) HTML

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

type ZeroReader

type ZeroReader struct {
}

func NewZeroReader

func NewZeroReader() *ZeroReader

func (ZeroReader) Read

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier