utils

package
v0.0.0-...-a3a5c94 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvoyTLSSocketName matched with hardcoded built-in Envoy transport name which determines endpoint
	// level tls transport socket configuration
	EnvoyTLSSocketName = "envoy.transport_sockets.tls"
)

Variables

View Source
var (
	ErrNotFound        = errors.New("Record not found.")
	ErrValueMayChanged = errors.New("The value has been changed by others on this time.")

	ErrEmptyJobName        = errors.New("Name of job is empty.")
	ErrEmptyJobCommand     = errors.New("Command of job is empty.")
	ErrIllegalJobId        = errors.New("Invalid id that includes illegal characters such as '/'.")
	ErrIllegalJobGroupName = errors.New("Invalid job group name that includes illegal characters such as '/'.")

	ErrEmptyNodeGroupName = errors.New("Name of node group is empty.")
	ErrIllegalNodeGroupId = errors.New("Invalid node group id that includes illegal characters such as '/'.")

	ErrSecurityInvalidCmd  = errors.New("Security error: the suffix of script file is not on the whitelist.")
	ErrSecurityInvalidUser = errors.New("Security error: the user is not on the whitelist.")
	ErrNilRule             = errors.New("invalid job rule, empty timer.")
)

Functions

func LoadExtendConf

func LoadExtendConf(filePath string, v interface{}) error

LoadExtendConf loads the json (configurable extension field) configuration file

func LocalIP

func LocalIP() (net.IP, error)

LocalIP - Get the first non loopback ip

func LocalMacAddr

func LocalMacAddr() (string, error)

LocalMacAddr

func RandString

func RandString(length int, characters ...byte) string

func SetExtendTag

func SetExtendTag(tag string)

SetExtendTag sets the extension tag, if not set, the default is'@extend:'

func SetPathTag

func SetPathTag(tag string)

SetPathTag sets the current path tag, if not set, the default is'@pwd@' @pwd@ will be replaced with the path of the current file, As to whether it is an absolute path or a relative path, it depends on whether the passed in is an absolute path or a relative path when reading the file

func SetRoot

func SetRoot(r string)

SetRoot -

Types

type APIHandleError

type APIHandleError struct {
	Code int
	Err  error
}

APIHandleError handle create err for api

func CreateAPIHandleError

func CreateAPIHandleError(code int, err error) *APIHandleError

CreateAPIHandleError

func CreateAPIHandleErrorFromDBError

func CreateAPIHandleErrorFromDBError(msg string, err error) *APIHandleError

CreateAPIHandleErrorFromDBError

func (*APIHandleError) Error

func (a *APIHandleError) Error() string

func (*APIHandleError) Handle

func (a *APIHandleError) Handle(r *http.Request, w http.ResponseWriter)

Handle

func (*APIHandleError) String

func (a *APIHandleError) String() string

Jump to

Keyboard shortcuts

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