daemon

package
v0.0.0-...-fe5d709 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kill

func Kill() error

Kill force-kills the daemon if it's running.

func Reload

func Reload(cfg *config.Config) error

Reload requests that the running daemon reload and use the given config.

func Run

func Run(cfg *config.Config) error

run is the logic that the daemon runs after it is forked. It will loop until it receives a shutdown request, after which the function exits cleanly.

func Start

func Start(cfg *config.Config) error

Start will fork and start the daemon process, which will start the caddy server and the mdns server (if needed) to proxy routes based on the current configuration. It also starts an RPC server that will handle requests to reload the server with a new configuration or stop the servers and exit the daemon.

func Status

func Status() (*os.Process, error)

Status will determine whether or not the daemon process is running. If it is, it returns the non-nil os.Process of that daemon.

func Stop

func Stop() error

Stop requests that the running daemon exit cleanly and shut down.

Types

type RPC

type RPC struct{}

This struct is used to register RPC commands via the `rpc` package. This lets us send specific commands to a running daemon.

func (RPC) Reload

func (d RPC) Reload(cfg *config.Config, _ *string) error

Reload will stop the existing server (both caddy and mdns) and then start them up again with the new config.

func (RPC) Stop

func (d RPC) Stop(*string, *string) error

Stop will use the global `close` channel to signal the existing server (both caddy and mdns) to shut down cleanly.

Jump to

Keyboard shortcuts

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