bot

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination interface {
	// Init attempts to initialize this destination for use. Init should be
	// idempotent and may write informational log messages if resources are
	// created.
	// This must be called before Read or Write.
	Init(ctx context.Context, subdirs []string) error

	// Verify is run before renewals to check for any potential problems with
	// the destination. These errors may be informational (logged warnings) or
	// return an error that may potentially terminate the process.
	Verify(keys []string) error

	// Write stores data to the destination with the given name.
	Write(ctx context.Context, name string, data []byte) error

	// Read fetches data from the destination with a given name.
	Read(ctx context.Context, name string) ([]byte, error)

	// TryLock attempts to lock a destination. This is non-blocking, and will
	// return an error if it is not possible to lock the destination.
	// TryLock should be used to lock a destination so it cannot be used by
	// multiple processes of tbot concurrently.
	TryLock() (func() error, error)

	// CheckAndSetDefaults validates the configuration and sets any defaults.
	//
	// This must be called before other methods on Destination can be called.
	CheckAndSetDefaults() error

	// MarshalYAML enables the yaml package to correctly marshal the Destination
	// as YAML including the type header.
	MarshalYAML() (interface{}, error)
}

Destination can persist renewable certificates.

type OneShotService

type OneShotService interface {
	Service
	// OneShot runs the service once and then exits. It should return a nil
	// error if the service exits successfully and an error if it is unable
	// to proceed. It should exit gracefully if the context is canceled.
	OneShot(ctx context.Context) error
}

OneShotService is a Service that offers a mode in which it runs a single time and then exits. This aligns with the `--oneshot` mode of tbot.

type Service

type Service interface {
	// String returns a human-readable name for the service that can be used
	// in logging. It should identify the type of the service and any top
	// level configuration that could distinguish it from a same-type service.
	String() string
	// Run starts the service and blocks until the service exits. It should
	// return a nil error if the service exits successfully and an error
	// if it is unable to proceed. It should exit gracefully if the context
	// is canceled.
	Run(ctx context.Context) error
}

Service is a long-running sub-component of tbot.

Jump to

Keyboard shortcuts

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