handler

package
v0.0.0-...-767fa57 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommonFlagConnect         = "connect"
	CommonFlagConnectP        = "c"
	CommonFlagListen          = "listen"
	CommonFlagListenP         = "l"
	CommonFlagMaxConn         = "max-conn"
	CommonFlagMaxConnP        = "C"
	CommonFlagConnDelay       = "conn-delay"
	CommonFlagConnDelayP      = "D"
	CommonFlagPassword        = "passwd"
	CommonFlagPasswordP       = "w"
	CommonFlagPasswordPrompt  = "prompt-passwd"
	CommonFlagPasswordPromptP = "W"
	CommonFlagSecret          = "secret"
	CommonFlagSecretP         = "s"
	CommonFlagSecretPrompt    = "prompt-secret"
	CommonFlagSecretPromptP   = "S"
	CommonFlagTrustPubHex     = "pub"
	CommonFlagTrustPubHexP    = "p"
	CommonFlagTrustPubPath    = "pub-path"
	CommonFlagTrustPubPathP   = "P"
	CommonFlagKeyHex          = "key"
	CommonFlagKeyHexP         = "k"
	CommonFlagKeyPath         = "key-path"
	CommonFlagKeyPathP        = "K"
	CommonFlagUseRaw          = "use-raw"
	CommonFlagUseRawP         = "r"
	CommonFlagVerbose         = "verbose"
	CommonFlagVerboseP        = "v"
)
View Source
const (
	ClientFlagNoTTY = "notty"
)

Variables

This section is empty.

Functions

func CheckClientFlags

func CheckClientFlags(cmd *cobra.Command, args []string) error

func CheckCommonFlags

func CheckCommonFlags(cmd *cobra.Command, args []string) error

func CheckServerFlags

func CheckServerFlags(cmd *cobra.Command, args []string) (err error)

func ClientHandler

func ClientHandler(ctx context.Context, rwc io.ReadWriteCloser) error

func ClientMain

func ClientMain(cmd *cobra.Command, args []string)

func ClientStart

func ClientStart(ctx context.Context, opts *ClientOpts) error

func Connect

func Connect(ctx context.Context, endpoint string, handler Handler, connInt time.Duration) error

func InitClientFlags

func InitClientFlags(cmd *cobra.Command)

func InitCommonFlags

func InitCommonFlags(cmd *cobra.Command)

func InitServerFlags

func InitServerFlags(cmd *cobra.Command)

func Listen

func Listen(ctx context.Context, endpoint string, handler Handler, maxConn int) error

func ServerHandler

func ServerHandler(ctx context.Context, rwc io.ReadWriteCloser) error

func ServerMain

func ServerMain(cmd *cobra.Command, args []string)

func ServerStart

func ServerStart(ctx context.Context, opts *ServerOpts) error

Types

type ClientOpts

type ClientOpts struct {
	*CommonOpts
	IsTTY bool
	Args  []string
}

func GetClientOpts

func GetClientOpts(cmd *cobra.Command, args []string) (*ClientOpts, error)

type CommonOpts

type CommonOpts struct {
	Mode               string
	Endpoint           string
	MaxConnIfListen    int
	ConnDelayIfConnect time.Duration
	PasswordHash       []byte
	SecretHash         []byte
	PrivateKey         ed25519.PrivateKey
	TrustedPublicKeys  []ed25519.PublicKey
	UseRaw             bool
}

func GetCommonOpts

func GetCommonOpts(cmd *cobra.Command, args []string) (*CommonOpts, error)

type Handler

type Handler = func(ctx context.Context, rwc io.ReadWriteCloser) error

func BindInitializers

func BindInitializers(h Handler, inits ...initializer.Initializer) Handler

type ServerOpts

type ServerOpts struct {
	*CommonOpts
}

func GetServerOpts

func GetServerOpts(cmd *cobra.Command, args []string) (*ServerOpts, error)

Jump to

Keyboard shortcuts

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