exechc

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 9 Imported by: 0

README

exechc

GitHub Workflow Status Go Report Card

Command EXECution Health Check

A simple HTTP server which returns a 200 or 500 based on the output of a specified command. Useful for applications such as health checks for supporting UDP-based load balancer targets.

This was inspried by usage for Wireguard as inspiried by this post: https://www.procustodibus.com/blog/2021/10/ha-wireguard-site-to-site/

Documentation

Overview

Package exechc health check from command execution

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must(err error)

Must panics with err if err is not nil

Types

type Checker

type Checker interface {
	Check() (bool, error)
}

Checker performs actual check for health

func NewChecker

func NewChecker(cfg *Runtime) Checker

NewChecker constructs a checker

type Runtime

type Runtime struct {
	// Port is the port number to listen on
	Port int
	// Host is the hostname to listen on
	Host string
	// CheckCmd is the static command line to execute
	CheckCmd string
	// CheckExpression is the CEL expression to run against the Output struct of the result
	CheckExpression string
}

Runtime contains the main runtime configuration

type Server

type Server interface {
	Start() error
	Shutdown() error
}

Server handles stop and starting of server processes

func NewServer

func NewServer(cfg *Runtime, chk Checker) Server

NewServer constructs a server

Directories

Path Synopsis
Package main runner for app
Package main runner for app

Jump to

Keyboard shortcuts

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