cmd

package
v0.0.212 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 68 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAbort = errors.New("abort")

ErrAbort - Error generated when application aborts

Functions

func MarshalED25519PrivateKey added in v0.0.172

func MarshalED25519PrivateKey(key ed25519.PrivateKey, comment string) []byte

stolen from `mikesmitty`, thanks, you are a mikesmitty and a scholar

func NewRootCmd added in v0.0.189

func NewRootCmd(client *client.Client) *cobra.Command

func TimeRegions added in v0.0.189

func TimeRegions(ctx *cmdctx.CmdContext, url string, includeNoGateway bool) ([]api.Region, <-chan TimingResponse, error)

Types

type BoolFlagOpts

type BoolFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     bool
	EnvName     string
	Hidden      bool
}

BoolFlagOpts - options for boolean flags

type Command

type Command struct {
	*cobra.Command
}

Command - Wrapper for a cobra command

func BuildCommand

func BuildCommand(parent *Command, fn RunFn, usageText string, shortHelpText string, longHelpText string, client *client.Client, options ...Option) *Command

BuildCommand - builds a functioning Command using all the initializers

func BuildCommandKS added in v0.0.138

func BuildCommandKS(parent *Command, fn RunFn, keystrings docstrings.KeyStrings, client *client.Client, options ...Option) *Command

BuildCommandKS - A wrapper for BuildCommand which takes the docs.KeyStrings bundle instead of the coder having to manually unwrap it

func (*Command) AddBoolFlag

func (c *Command) AddBoolFlag(options BoolFlagOpts)

AddBoolFlag - Add a boolean flag for a command

func (*Command) AddCommand

func (c *Command) AddCommand(commands ...*Command)

AddCommand adds subcommands to this command

func (*Command) AddIntFlag added in v0.0.121

func (c *Command) AddIntFlag(options IntFlagOpts)

AddIntFlag - Add an integer flag to a command

func (*Command) AddStringFlag

func (c *Command) AddStringFlag(options StringFlagOpts)

AddStringFlag - Add a string flag to a command

func (*Command) AddStringSliceFlag added in v0.0.84

func (c *Command) AddStringSliceFlag(options StringSliceFlagOpts)

AddStringSliceFlag - add a string slice flag to a command

type Initializer

type Initializer struct {
	Setup  InitializerFn
	PreRun InitializerFn
}

Initializer - Retains Setup and PreRun functions

type InitializerFn

type InitializerFn func(*cmdctx.CmdContext) error

InitializerFn - A wrapper for an Initializer function that takes a command context

type Instances added in v0.0.183

type Instances struct {
	Labels    []string
	Addresses []string
}

type IntFlagOpts added in v0.0.121

type IntFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     int
	EnvName     string
	Hidden      bool
}

IntFlagOpts - options for integer flags

type Option added in v0.0.135

type Option func(*Command) Initializer

Option - A wrapper for an Initializer function that takes a command

type PeerStatusJson added in v0.0.179

type PeerStatusJson struct {
	Us     string `json:"us"`
	Them   string `json:"them"`
	Pubkey string `json:"key"`
	Error  string `json:"error"`
}

type RunFn added in v0.0.135

type RunFn func(cmdContext *cmdctx.CmdContext) error

RunFn - Run function for commands which takes a command context

type SSHParams added in v0.0.183

type SSHParams struct {
	Ctx    *cmdctx.CmdContext
	Org    *api.Organization
	App    string
	Tunnel *wg.Tunnel
	Cmd    string
}

type StartPeerJson added in v0.0.179

type StartPeerJson struct {
	Name   string `json:"name"`
	Group  string `json:"group"`
	Pubkey string `json:"pubkey"`
	Region string `json:"region"`
}

type StringFlagOpts

type StringFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     string
	EnvName     string
}

StringFlagOpts - options for string flags

type StringSliceFlagOpts added in v0.0.84

type StringSliceFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     []string
	EnvName     string
}

StringSliceFlagOpts - options a string slice flag

type TimingRequest added in v0.0.102

type TimingRequest struct {
	URL    string `json:"url"`
	Region string `json:"region"`
}

TimingRequest - Request to time a curl operation

type TimingResponse added in v0.0.102

type TimingResponse struct {
	Err               error
	HTTPCode          int     `json:"http_code"`
	SpeedDownload     int     `json:"speed_download"`
	TimeTotal         float64 `json:"time_total"`
	TimeNameLookup    float64 `json:"time_namelookup"`
	TimeConnect       float64 `json:"time_connect"`
	TimePreTransfer   float64 `json:"time_pretransfer"`
	TimeAppConnect    float64 `json:"time_appconnect"`
	TimeStartTransfer float64 `json:"time_starttransfer"`
	HTTPVersion       string  `json:"http_version"`
	RemoteIP          string  `json:"remote_ip"`
	Scheme            string  `json:"scheme"`
	Region            string  `json:"region"`
}

TimingResponse - Results from timing a curl operations

type UpdatePeerJson added in v0.0.179

type UpdatePeerJson struct {
	Pubkey string `json:"pubkey"`
}

type WireGuardState added in v0.0.183

type WireGuardState struct {
	Org          string
	Name         string
	Region       string
	LocalPublic  string
	LocalPrivate string
	DNS          string
	Peer         api.CreatedWireGuardPeer
}

func (*WireGuardState) TunnelConfig added in v0.0.183

func (s *WireGuardState) TunnelConfig() *wg.Config

BUG(tqbf): Obviously all this needs to go, and I should just make my code conform to the marshal/unmarshal protocol wireguard-go uses, but in the service of landing this feature, I'm just going to apply a layer of spackle for now.

Notes

Bugs

  • do better

  • can't stay this way

  • Obviously all this needs to go, and I should just make my code conform to the marshal/unmarshal protocol wireguard-go uses, but in the service of landing this feature, I'm just going to apply a layer of spackle for now.

  • for now, we never manage tunnels for different organizations, and while this comment is eating more space than the code I'd need to do this right, it's more fun to type, so we just hardcode.

  • I think this dance just because these needed to parse for Ben's TOML code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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