router

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("you are not authorized to access this resource")

ErrUnauthorized represents an unauthorized access error.

Functions

This section is empty.

Types

type Handler

type Handler func(sess ssh.Session, arg string) error

Handler defines a function type to handle SSH sessions.

type Middleware

type Middleware func(next Handler) Handler

Middleware defines a function type for middleware.

func Logging

func Logging(log *slog.Logger) Middleware

Logging returns a middleware that logs incoming session details, and closed connections, as well as any error that may have caused the connection to close.

type Router

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

Router manages routing and middleware for SSH sessions.

func New

func New() *Router

New creates and returns a new Router instance.

func (*Router) Handle

func (r *Router) Handle(name, pattern string, h Handler) error

Handle registers a new route with the given name and pattern.

func (*Router) Handler

func (r *Router) Handler(sess ssh.Session)

Handler handles an SSH session, routing it to the appropriate handler.

func (*Router) Use

func (r *Router) Use(m Middleware)

Use adds a middleware to the router.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳