lib

package
v0.0.0-...-6f9b56e Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Checkchan = make(chan struct{})
View Source
var LastChecked time.Time
View Source
var Services []Service

Functions

func CheckDataDir

func CheckDataDir()

func CheckGET

func CheckGET(s Service, url string) (bool, int)

func CheckHTTP

func CheckHTTP(s Service) (bool, int)

func CheckHTTPS

func CheckHTTPS(s Service) (bool, int)

func CheckRemoved

func CheckRemoved()

func CheckService

func CheckService(s Service) (bool, int)

func CheckTCP

func CheckTCP(s Service, useTls bool) (bool, int)

func GetInterval

func GetInterval() time.Duration

func LoadData

func LoadData()

func Loop

func Loop()

func SaveData

func SaveData()

func SaveResult

func SaveResult(service Service, t int, ok bool)

Types

type Config

type Config struct {
	// all the config options
	Reset    int       `json:"reset"`
	ShowTime bool      `json:"time"`
	Title    string    `json:"title"`
	Address  string    `json:"address"`
	Contact  string    `json:"contact"`
	Interval string    `json:"interval"`
	Services []Service `json:"services"`
}

func GetConfig

func GetConfig() Config

type Data

type Data struct {
	Services []Service `json:"services"`
}

data is just a json list containing all the services as well as check results

type Result

type Result struct {
	Time    int       `json:"time"`
	Success bool      `json:"success"`
	Stamp   time.Time `json:"stamp"`
}

type Rule

type Rule struct {
	// rules for a service
	Contains    string `json:"contains"`
	NotContains string `json:"not_contains"`
}

type Service

type Service struct {
	// results are not set in the config,
	// they are loaded/dumped to the data file
	Results []Result `json:"results"`

	// these are also not set in the config
	// just stores the last connection time
	// and the success status for quick access
	LastTime    int  `json:"last_time"`
	LastSuccess bool `json:"last_success"`

	Name    string `json:"name"`
	Address string `json:"address"`
	Type    string `json:"type"`
	Data    string `json:"data"`
	Link    string `json:"link"`
	Rule    Rule   `json:"rule"`
}

func GetServices

func GetServices() []Service

Jump to

Keyboard shortcuts

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