cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "ccheck",
	Short: "X509 certificate checker",
	Long: `Simple SSL certificate expiration checker.

Diagnostics are sent to STDERR. Certificates that pass the given
check criteria are printed on STDOUT. Listing can be suppressed
to support scripting applications.

Certificates to check can be specified as the filename of the PEM-encoded
container for the X.509 certificate or a <host:port> tuple resembling a
Go dial string.`,
	Args: cobra.MinimumNArgs(0),
	Run: func(cmd *cobra.Command, args []string) {
		setupRootFile()
		setupClientCertificates()
		setupProtocol()

		if os.Getenv("MUNIN_VERSION") != "" {
			muninRoot(args)
		}

		if jsonRequested && tapRequested {
			fmt.Fprintf(os.Stderr, "only one of --tap and --json can be specified\n")
			os.Exit(2)
		}

		defaultRoot(args)
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type CertResult

type CertResult struct {
	// Spec is the certificate specification evaluated.
	Spec string `json:"spec"`
	// Result is a pointer to the evaluation result
	Result *cert.Result `json:"result"`
	// Err contains any error found during evaluation
	Err error `json:"error"`
	// ErrString contains a stringified error message
	ErrString string `json:"error_string"`
	// Timestamp for the result
	Timestamp string `json:"timestamp"`
	// Accumulator points to the array where results should be placed
	Accumulator *[]CertResult `json:"-"`
	// WG is used for synchronization
	WG *sync.WaitGroup `json:"-"`
}

CertResult holds a processed evaluation of a Spec

type Consumer

type Consumer func(<-chan CertResult)

Consumer is a function that consume CertResult objects via an input channel

type Spec

type Spec struct {
	Value       string        `json:"value"`
	Protocol    cert.Protocol `json:"protocol"`
	Accumulator *[]CertResult `json:"-"`
	// WG is used for synchronization
	WG *sync.WaitGroup `json:"-"`
}

Spec holds a spec along with the location of a slice where the result of the evaluation must be stored.

Jump to

Keyboard shortcuts

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