commands

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package commands holds types and functions common across all ACMEShell commands.

Index

Constants

View Source
const (
	// The base prompt used for shell commands
	BasePrompt = "[ ACME ] > "
	// The ishell context key that we store a client instance under.
	ClientKey = "client"
	// The ishell context key that we store a challenge response server instance
	// under.
	ChallSrvKey = "challsrv"
)

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(shell *ishell.Shell, client *acmeclient.Client)

func ClientTemplate

func ClientTemplate(c *acmeclient.Client, input string) (string, error)

func DirectoryAutocompleter

func DirectoryAutocompleter(c *acmeclient.Client) func(args []string) []string

func EvalTemplate

func EvalTemplate(templateStr string, ctx TemplateCtx) (string, error)

func FindAuthzURL

func FindAuthzURL(ctx *ishell.Context, orderURL string, identifier string) (string, error)

func FindChallengeURL

func FindChallengeURL(ctx *ishell.Context, authzURL string, challType string) (string, error)

func FindOrderURL

func FindOrderURL(ctx *ishell.Context, leftovers []string, orderIndex int) (string, error)

func FindURL

func FindURL(c *acmeclient.Client, leftovers []string) (string, error)

func GetClient

func GetClient(c shellContext) *acmeclient.Client

GetClient reads a *acmeclient.Client from the shellContext or panics.

func OkURL

func OkURL(urlStr string) bool

func ParseFlagSetArgs added in v0.0.2

func ParseFlagSetArgs(args []string, flagSet *flag.FlagSet) ([]string, error)

ParseFlagSetArgs parses the given args with the flagSet. If there is no error then (leftovers []string, nil) is returned where "leftovers" is the result of flagSet.Args() after parsing. If there is an err (including flag.ErrHelp) then (nil, err) is returned. Most callers will want to simply bail out of the command if there is an error because the flag package will have already printed the cause to stdout.

func PickAuthz

func PickAuthz(c *ishell.Context, order *resources.Order) (*resources.Authorization, error)

func PickAuthzURL

func PickAuthzURL(c *ishell.Context, order *resources.Order) (string, error)

func PickChall

func PickChall(c *ishell.Context, authz *resources.Authorization) (*resources.Challenge, error)

func PickOrder

func PickOrder(c *ishell.Context) (*resources.Order, error)

func PickOrderURL

func PickOrderURL(c *ishell.Context) (string, error)

func PrintJSON

func PrintJSON(ob interface{}) (string, error)

func ReadJSON

func ReadJSON(c *ishell.Context) string

func RegisterCommand

func RegisterCommand(
	cmd *ishell.Cmd,
	completerFunc NewCommandAutocompleter)

Types

type ChallengeServer

type ChallengeServer interface {
	// Start/stop the challenge server
	Run()
	Shutdown()

	// HTTP-01 challenge add/remove
	AddHTTPOneChallenge(token string, keyAuth string)
	DeleteHTTPOneChallenge(token string)

	// DNS-01 challenge add/remove
	AddDNSOneChallenge(host string, keyAuth string)
	DeleteDNSOneChallenge(host string)

	// TLS-ALPN-01 challenge add/remove
	AddTLSALPNChallenge(host string, keyAuth string)
	DeleteTLSALPNChallenge(host string)

	// Default IPv4/IPv6
	SetDefaultDNSIPv4(addr string)
	SetDefaultDNSIPv6(addr string)

	// Mock DNS A records
	AddDNSARecord(host string, addresses []string)
	DeleteDNSARecord(host string)

	// Mock DNS AAAA records
	AddDNSAAAARecord(host string, addresses []string)
	DeleteDNSAAAARecord(host string)
}

ChallengeServer is an interface for the parts of github.com/letsencrypt/challtestsrv.ChallengeServer that acmeshell uses.

func GetChallSrv

func GetChallSrv(c shellContext) ChallengeServer

GetChallSrv reads a challengeServer from the shellContext or panics.

func NewRemoteChallengeServer

func NewRemoteChallengeServer(addr string) (ChallengeServer, error)

type NewCommandAutocompleter

type NewCommandAutocompleter func(c *acmeclient.Client) func(args []string) []string

type TemplateCtx

type TemplateCtx struct {
	Acct   *resources.Account
	Client *acmeclient.Client
}

Directories

Path Synopsis
Package post implements an ACMEShell command for POSTing requests to an ACME server.
Package post implements an ACMEShell command for POSTing requests to an ACME server.

Jump to

Keyboard shortcuts

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