ssh

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortError

func AbortError(handler ssh.Handler, session ssh.Session, err error)

func Abortf

func Abortf(handler ssh.Handler, session ssh.Session, f string, args ...any)

func ErrorHandler

func ErrorHandler(handler ssh.Handler) ssh.Handler

func NewCommandsHandler

func NewCommandsHandler(params *CommandsHandlerParams) wish.Middleware

func NewLoggerMiddleware

func NewLoggerMiddleware(lg zerolog.Logger) wish.Middleware

func PanicHandler

func PanicHandler(handler ssh.Handler) ssh.Handler

Types

type CommandsHandlerParams

type CommandsHandlerParams struct {
	Logger           zerolog.Logger
	PublicKeyService service.PublicKeyService
	WireGuardService service.WireGuardService
}

type Context

type Context struct {
	context.Context
	// contains filtered or unexported fields
}

type PublicKeyCmd

type PublicKeyCmd struct {
	Add struct {
		Key string `arg:"" help:"Public key to be added."`
	} `cmd:"" help:"Add public key."`

	Rm struct {
		Key string `arg:"" help:"Public key to be removed."`
	} `cmd:"" help:"Remove public key."`

	Ls struct{} `cmd:"" help:"List public keys."`
}

func (*PublicKeyCmd) HandleAdd

func (cmd *PublicKeyCmd) HandleAdd(ctx *Context) (err error)

func (*PublicKeyCmd) HandleLs

func (*PublicKeyCmd) HandleLs(ctx *Context) (err error)

func (*PublicKeyCmd) HandleRm

func (cmd *PublicKeyCmd) HandleRm(ctx *Context) (err error)

func (*PublicKeyCmd) Run

func (cmd *PublicKeyCmd) Run(ctx *Context) (err error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(params *ServerParams) (srv *Server, err error)

func (*Server) Run

func (s *Server) Run() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type ServerParams

type ServerParams struct {
	Logger           zerolog.Logger
	Port             int
	HostKeyPath      string
	PublicKeyService service.PublicKeyService
	WireGuardService service.WireGuardService
}

type WireGuardCmd

type WireGuardCmd struct {
	Add struct {
		Name                string      `arg:"" help:"Client's name."`
		Address             null.String `optional:"" short:"a" placeholder:"ADDR" help:"Client's address."`
		DNS                 []string    `optional:"" short:"d" help:"Client's DNS list."`
		AllowedIPs          []string    `optional:"" short:"i" name:"ips" placeholder:"IP" help:"Client's allowed IPs."`
		PersistentKeepalive null.Int    `optional:"" short:"k" name:"keepalive" placeholder:"SECONDS" help:"Client's persistent keepalive."`
		QR                  bool        `optional:"" name:"qr" help:"Print QR code."`
	} `cmd:"" help:"Add client."`

	Get struct {
		Name string `arg:"" help:"Client's name."`
		QR   bool   `optional:"" name:"qr" help:"Print QR code."`
	} `cmd:"" help:"Get client config."`

	Rm struct {
		Name string `arg:"" help:"Client's name."`
	} `cmd:"" help:"Remove client."`

	Reload struct{} `cmd:"" help:"Reload server."`

	Ls struct{} `cmd:"" help:"List clients."`
}

func (*WireGuardCmd) HandleAdd

func (cmd *WireGuardCmd) HandleAdd(ctx *Context) (err error)

func (*WireGuardCmd) HandleGet

func (cmd *WireGuardCmd) HandleGet(ctx *Context) (err error)

func (*WireGuardCmd) HandleLs

func (*WireGuardCmd) HandleLs(ctx *Context) (err error)

func (*WireGuardCmd) HandleReload

func (*WireGuardCmd) HandleReload(ctx *Context) (err error)

func (*WireGuardCmd) HandleRm

func (cmd *WireGuardCmd) HandleRm(ctx *Context) (err error)

func (*WireGuardCmd) Run

func (cmd *WireGuardCmd) Run(ctx *Context) (err error)

Jump to

Keyboard shortcuts

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