servermux

package module
v0.0.0-...-b6c9be7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 11 Imported by: 5

README

Server Mux

This package allows one to wrap multiple servers, currently only HTTP and SSH under one interface.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MuxFn

type MuxFn func(*mux) error

func GracefulWait

func GracefulWait(g time.Duration) MuxFn

func WithServer

func WithServer(s Server) MuxFn

func WriteWait

func WriteWait(d time.Duration) MuxFn

type SSHSetFn

type SSHSetFn = ssh.Option

type Server

type Server interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

func HttpServer

func HttpServer(setters ...SetFn) (Server, error)

HttpServer initializes an http.Server object with values set using SetFn() functions

func Mux

func Mux(setters ...MuxFn) (Server, error)

func SSHServer

func SSHServer(setters ...SSHSetFn) (Server, error)

type SetFn

type SetFn func(*httpServer) error

func Handler

func Handler(h http.Handler) SetFn

func OnSocket

func OnSocket(s string) SetFn

func OnSystemd

func OnSystemd() SetFn

func OnTCP

func OnTCP(addr string) SetFn

func WithTLSCert

func WithTLSCert(cert, key string) SetFn

Jump to

Keyboard shortcuts

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