internal

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentsAreText added in v1.6.0

func ContentsAreText(fpath string) bool

func JoinDefaultPort added in v1.1.0

func JoinDefaultPort(address string, port string) string

JoinDefaultPort appends ":<port>" iff the address does not already contain a port.

func ListUsersWithHomeSubdir added in v1.3.0

func ListUsersWithHomeSubdir(subdir string, required_perms os.FileMode) ([]string, error)

ListUsersWithHomeSubdir provides a list of user names on the current host.

The users returned will only be those with a specifically named subdirectory of their home dir, which has the given permission bits.

func MediaType added in v1.6.0

func MediaType(fpath string) string

Types

type PathTree

type PathTree[V any] struct {
	// contains filtered or unexported fields
}

func (*PathTree[V]) Add

func (pt *PathTree[V]) Add(pattern string, value V)

func (PathTree[V]) Match

func (pt PathTree[V]) Match(path string) (*V, map[string]string)

func (PathTree[V]) Routes

func (pt PathTree[V]) Routes() []Route[V]

type Route

type Route[V any] struct {
	Pattern string
	Value   V
}

type Server

type Server struct {
	Ctx         context.Context
	Cancel      context.CancelFunc
	Wg          *sync.WaitGroup
	Listener    net.Listener
	HandleConn  connHandler
	ErrorLog    logging.Logger
	Host        string
	NetworkAddr net.Addr
}

func NewServer

func NewServer(
	ctx context.Context,
	hostname string,
	network string,
	address string,
	baseLog logging.Logger,
	handleConn connHandler,
) (Server, error)

func (*Server) Address

func (s *Server) Address() string

func (*Server) Close

func (s *Server) Close()

func (*Server) Closed

func (s *Server) Closed() bool

func (*Server) Hostname

func (s *Server) Hostname() string

func (*Server) LogError

func (s *Server) LogError(keyvals ...any) error

func (*Server) Network

func (s *Server) Network() string

func (*Server) Port

func (s *Server) Port() string

func (*Server) Serve

func (s *Server) Serve() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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