server

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUsers         = errors.New("no users created")
	ErrUnauthenticated = errors.New("request not authenticated")
)

Functions

func AbsoluteURL added in v0.49.0

func AbsoluteURL(r *http.Request, u string, params url.Values) string

func Authenticator added in v0.44.0

func Authenticator(ds model.DataStore) func(next http.Handler) http.Handler

func Index added in v0.49.0

func Index(ds model.DataStore, fs fs.FS) http.HandlerFunc

func IndexWithShare added in v0.49.0

func IndexWithShare(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.HandlerFunc

func JWTRefresher added in v0.44.0

func JWTRefresher(next http.Handler) http.Handler

JWTRefresher updates the expiry date of the received JWT token, and add the new one to the Authorization Header

func URLParamsMiddleware added in v0.49.0

func URLParamsMiddleware(next http.Handler) http.Handler

URLParamsMiddleware is a middleware function that decodes the query string of the incoming HTTP request, adds the URL parameters from the routing context, and re-encodes the modified query string.

func UsernameFromConfig added in v0.44.0

func UsernameFromConfig(r *http.Request) string

func UsernameFromReverseProxyHeader added in v0.44.0

func UsernameFromReverseProxyHeader(r *http.Request) string

func UsernameFromToken added in v0.44.0

func UsernameFromToken(r *http.Request) string

Types

type Server

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

func New

func New(ds model.DataStore, broker events.Broker) *Server

func (*Server) MountRouter

func (s *Server) MountRouter(description, urlPath string, subRouter http.Handler)

func (*Server) Run

func (s *Server) Run(ctx context.Context, addr string, port int, tlsCert string, tlsKey string) error

Run starts the server with the given address, and if specified, with TLS enabled.

Directories

Path Synopsis
Package events based on https://thoughtbot.com/blog/writing-a-server-sent-events-server-in-go
Package events based on https://thoughtbot.com/blog/writing-a-server-sent-events-server-in-go

Jump to

Keyboard shortcuts

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