web

package
v0.1.2-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAddr is the default listen address for the web server.
	DefaultAddr = "127.0.0.1:8788"
)

Variables

This section is empty.

Functions

func IsLoopbackAddr

func IsLoopbackAddr(addr string) bool

IsLoopbackAddr reports whether the listen address is bound only to loopback.

func NewHandler

func NewHandler(opts HandlerOptions) http.Handler

NewHandler creates the web server handler.

func PublicURL

func PublicURL(addr string) string

PublicURL converts an effective listener address to a browser URL.

Types

type HandlerOptions

type HandlerOptions struct {
	ConfigPath       string
	InitialProfile   string
	AllowPlaintext   bool
	SkipHostKeyCheck bool
	AuthRequired     bool
	AuthToken        string
	Assets           fs.FS
}

HandlerOptions configures the web HTTP handlers.

type Server

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

Server wraps an HTTP server plus its listener.

func NewServer

func NewServer(listener net.Listener, handler http.Handler) *Server

NewServer creates a server for the provided listener and handler.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the effective listen address.

func (*Server) Serve

func (s *Server) Serve() error

Serve starts serving HTTP requests.

func (*Server) Shutdown

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

Shutdown gracefully stops the server.

Jump to

Keyboard shortcuts

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