lib

package
v0.0.0-...-2b6bb91 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Alive bool

*******_____*_***********************_*_**********************************

  • / ____| | /\ | (_)
  • | (___ | |_ __ _ _ _ / \ | |___ _____
  • \___ \| __/ _` | | | | / /\ \ | | \ \ / / _ \
  • ____) | || (_| | |_| |/ ____ \| | |\ V / __/
  • |_____/ \__\__,_|\__, /_/ \_\_|_| \_/ \___|
  • __/ |
  • |___/
  • Call this routine to stay alive, but check for break condition to exit.
  • Paramter is a clean up function to call.
View Source
var (
	DebugLevel string
)

Functions

func CheckConnect

func CheckConnect(host string, port string) bool

---------------------------------------------------------------------------------

 _____ _               _     _____                            _   _
/ ____| |             | |   / ____|                          | | (_)

| | | |__ ___ ___| | _| | ___ _ __ _ __ ___ ___| |_ _ ___ _ __ | | | '_ \ / _ \/ __| |/ / | / _ \| '_ \| '_ \ / _ \/ __| __| |/ _ \| '_ \ | |____| | | | __/ (__| <| |___| (_) | | | | | | | __/ (__| |_| | (_) | | | | \_____|_| |_|\___|\___|_|\_\\_____\___/|_| |_|_| |_|\___|\___|\__|_|\___/|_| |_|

func CheckDbErr

func CheckDbErr(err error, db *sql.DB, msg ...interface{}) (isErr bool)

-------------------------------------------------

  ___ _           _  DB ___
 / __| |_  ___ __| |__ | __|_ _ _ _ ___ _ _
| (__| ' \/ -_) _| / / | _|| '_| '_/ _ \ '_|
 \___|_||_\___\__|_\_\ |___|_| |_| \___/_|

func CheckErr

func CheckErr(err error) (isErr bool)

-------------------------------------------------

  ___ _           _     ___
 / __| |_  ___ __| |__ | __|_ _ _ _ ___ _ _
| (__| ' \/ -_) _| / / | _|| '_| '_/ _ \ '_|
 \___|_||_\___\__|_\_\ |___|_| |_| \___/_|

func Crit

func Crit(msg ...interface{})

func Debug

func Debug(msg ...interface{})

*** _ _ _ _

  • | | | | | | | |
  • | | ___ __ _| |__| | ___| |_ __ ___ _ __ ___
  • | |/ _ \ / _` | __ |/ _ \ | '_ \ / _ \ '__/ __|
  • | | (_) | (_| | | | | __/ | |_) | __/ | \__ \
  • |_|\___/ \__, |_| |_|\___|_| .__/ \___|_| |___/
  • __/ | | |
  • |___/ |_|

func DeferClose

func DeferClose(c io.Closer)
      _
     | |
  ___| | ___  ___  ___
 / __| |/ _ \/ __|/ _ \
| (__| | (_) \__ \  __/
 \___|_|\___/|___/\___|

Safe close routine

func Error

func Error(msg ...interface{})

func Exists

func Exists(filePath string) (exists bool)

---___--_--_------------___-------_------_-----------

| __|(_)| | ___  ___ | __|__ __(_) ___| |_  ___
| _| | || |/ -_)|___|| _| \ \ /| |(_-<|  _|(_-<
|_|  |_||_|\___|     |___|/_\_\|_|/__/ \__|/__/

func GetImagePath

func GetImagePath(html string) string

func IfThenElse

func IfThenElse(condition bool, a interface{}, b interface{}) interface{}

****************************************************************

  • _ __ _______ _ ______ _
  • (_)/ _|__ __| | | ____| |
  • _| |_ | | | |__ ___ _ __ | |__ | |___ ___
  • | | _| | | | '_ \ / _ \ '_ \| __| | / __|/ _ \
  • | | | | | | | | | __/ | | | |____| \__ \ __/
  • |_|_| |_| |_| |_|\___|_| |_|______|_|___/\___|
  • --------------------------------------------------------------
  • IfThenElse evaluates a condition, if true returns the first
  • parameter otherwise the second
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

func Info

func Info(msg ...interface{})

func LogInit

func LogInit(level string, name string)

** _ _ _

  • (_) (_) |
  • _ _ __ _| |_
  • | | '_ \| | __|
  • | | | | | | |_
  • |_|_| |_|_|\__| * *

func NextHeartBeat

func NextHeartBeat(heartBeat int) (nextHeartBeat int)

------------_---_---_-----------------_---_----------------_----------

          | | | | | |               | | | |              | |
 __ _  ___| |_| |_| | ___  __ _ _ __| |_| |__   ___  __ _| |_
/ _` |/ _ \ __|  _  |/ _ \/ _` | '__| __| '_ \ / _ \/ _` | __|

| (_| | __/ |_| | | | __/ (_| | | | |_| |_) | __/ (_| | |_

\__, |\___|\__\_| |_/\___|\__,_|_|   \__|_.__/ \___|\__,_|\__|
 __/ |
|___/

func NilString

func NilString(s string) string

************************************************

  • _ _ _____ _ _
  • (_) |/ ____| | (_)
  • _ __ _| | (___ | |_ _ __ _ _ __ __ _
  • | '_ \| | |\___ \| __| '__| | '_ \ / _` |
  • | | | | | |____) | |_| | | | | | | (_| |
  • |_| |_|_|_|_____/ \__|_| |_|_| |_|\__, |
  • __/ |
  • |___/
  • * * * * * * * * * * * * * * * * * * * * * * * *
  • prevents a nil string from infecting data
  • ---------------------------------------------

func RandomRange

func RandomRange(min int, max int) (randomRange int)

----------------------------------------------------------------------------

    ____                  __                   ____
   / __ \____ _____  ____/ /___  ____ ___     / __ \____ _____  ____ ____
  / /_/ / __ `/ __ \/ __  / __ \/ __ `__ \   / /_/ / __ `/ __ \/ __ `/ _ \
 / _, _/ /_/ / / / / /_/ / /_/ / / / / / /  / _, _/ /_/ / / / / /_/ /  __/
/_/ |_|\__,_/_/ /_/\__,_/\____/_/ /_/ /_/  /_/ |_|\__,_/_/ /_/\__, /\___/
                                                             /____/

func SendMail

func SendMail(mail Mail)

func StayAlive

func StayAlive(fn func())

func ThrottleAllow

func ThrottleAllow(ip string, timeout int) (retVal bool)

func TrimLen

func TrimLen(str string, size int) (splited string)

****************************************************

  • _ _ _
  • | | (_) | |
  • | |_ _ __ _ _ __ ___ | | ___ _ __
  • | __| '__| | '_ ` _ \| | / _ \ '_ \
  • | |_| | | | | | | | | |___| __/ | | |
  • \__|_| |_|_| |_| |_|______\___|_| |_|
  • * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Trim the length of a string based on the max length
  • --------------------------------------------------

func Warn

func Warn(msg ...interface{})

func WatchFileAndRun

func WatchFileAndRun(filePath string, fn func())

*******************************************************************************************

  • _ _ ______ _ _ _ _____
  • | | | | | ____(_) | /\ | | __ \
  • __ ____ _| |_ ___| |__ | |__ _| | ___ / \ _ __ __| | |__) | _ _ __
  • \ \ /\ / / _` | __/ __| '_ \| __| | | |/ _ \ / /\ \ | '_ \ / _` | _ / | | | '_ \
  • \ V V / (_| | || (__| | | | | | | | __// ____ \| | | | (_| | | \ \ |_| | | | |
  • \_/\_/ \__,_|\__\___|_| |_|_| |_|_|\___/_/ \_\_| |_|\__,_|_| \_\__,_|_| |_|
  • ------------------------------------------------------------------------------------------
  • Watches for a file change and if it change returns nil
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Types

type Mail

type Mail struct {
	HOST    string
	PORT    int
	FROM    string
	PASS    string
	TO      string
	SUBJECT string
	BODY    string
	FILES   []string
}

************************************************

  • _ __ __ _ _
  • | | \/ | (_) |
  • ___ ___ _ __ __| | \ / | __ _ _| |
  • / __|/ _ \ '_ \ / _` | |\/| |/ _` | | |
  • \__ \ __/ | | | (_| | | | | (_| | | |
  • |___/\___|_| |_|\__,_|_| |_|\__,_|_|_|
  • -----------------------------------------------
  • Sends an email based on config values
  • * * * * * * * * * * * * * * * * * * * * * * *

type Services

type Services struct {
	Service  string `json:"service"`
	Dns      string `json:"dns"`
	Ip       string `json:"ip"`
	Port     string `json:"port"`
	Cb       string `json:"callback"`
	Expected string `json:"expected"`
	Deps     string `json:"deps"`
	Meta     string `json:"meta"`
}

***************************************************************************************

  • _ _______ _____ _
  • | |__ __| | __ \ (_)
  • _ __ ___ _ __ ___ _ __| |_ | | ___ | | | | ___ _ __ ___ __ _ _ _ __
  • | '__/ _ \ '_ \ / _ \| '__| __|| |/ _ \| | | |/ _ \| '_ ` _ \ / _` | | '_ \
  • | | | __/ |_) | (_) | | | |_ | | (_) | |__| | (_) | | | | | | (_| | | | | |
  • |_| \___| .__/ \___/|_| \__||_|\___/|_____/ \___/|_| |_| |_|\__,_|_|_| |_|
  • | |
  • |_|
  • --------------------------------------------------------------------------------------
  • Function to report to domains, this will require paramters, since we can not predict
  • how each application is managing its configuration control.
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Jump to

Keyboard shortcuts

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