server

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeadersMiddleware

func AddHeadersMiddleware(next http.Handler, config *cfg.Config) http.Handler

func NewMux

func NewMux(
	cfg *config.Config,
	options *Options,
	log *log.Logger,
	liveReload bool,
) (*http.ServeMux, error)

Types

type FileWatcher

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

func NewFileWatcher

func NewFileWatcher(log *log.Logger, rootDir string) (*FileWatcher, error)

func (FileWatcher) Add added in v0.2.0

func (i FileWatcher) Add(path string) error

func (FileWatcher) AddRecursive

func (i FileWatcher) AddRecursive(from string) error

func (FileWatcher) Start

func (i FileWatcher) Start(callback func(string))

type GlobalHandler added in v0.3.0

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

func (*GlobalHandler) Asset added in v0.3.0

func (g *GlobalHandler) Asset(w http.ResponseWriter, r *http.Request)

func (*GlobalHandler) CombinedSearch added in v0.3.0

func (g *GlobalHandler) CombinedSearch(w http.ResponseWriter, r *http.Request)

func (*GlobalHandler) ManualPage added in v0.3.0

func (g *GlobalHandler) ManualPage(w http.ResponseWriter, r *http.Request)

func (*GlobalHandler) NewSourceHandler added in v0.3.0

func (g *GlobalHandler) NewSourceHandler(source config.Source) *SourceHandler

func (*GlobalHandler) RootOpenSearch added in v0.3.0

func (g *GlobalHandler) RootOpenSearch(w http.ResponseWriter, _ *http.Request)

func (*GlobalHandler) Search added in v0.3.0

func (g *GlobalHandler) Search(source config.Source, w http.ResponseWriter, r *http.Request)

func (*GlobalHandler) StaticFile added in v0.3.0

func (g *GlobalHandler) StaticFile(w http.ResponseWriter, r *http.Request)

type HTTPError

type HTTPError struct {
	Error   error
	Message string
	Code    int
}

type LoggingResponseWriter

type LoggingResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewLoggingResponseWriter

func NewLoggingResponseWriter(w http.ResponseWriter) *LoggingResponseWriter

func (*LoggingResponseWriter) Write

func (lrw *LoggingResponseWriter) Write(b []byte) (int, error)

func (*LoggingResponseWriter) WriteHeader

func (lrw *LoggingResponseWriter) WriteHeader(code int)

type Options

type Options struct {
	ReadIndex      *index.ReadIndex
	ManpagesURLMap *manpages.URLMap
}

type Server

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

func New

func New(
	conf *config.Config,
	options *Options,
	log *log.Logger,
	liveReload bool,
) (*Server, error)

func (*Server) Start

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

func (*Server) Stop

func (s *Server) Stop() chan struct{}

type SourceHandler added in v0.3.0

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

func (*SourceHandler) Detail added in v0.3.0

func (h *SourceHandler) Detail(w http.ResponseWriter, r *http.Request)

func (*SourceHandler) OpenSearchXML added in v0.3.0

func (h *SourceHandler) OpenSearchXML(w http.ResponseWriter, _ *http.Request)

func (*SourceHandler) Search added in v0.3.0

func (h *SourceHandler) Search(w http.ResponseWriter, r *http.Request)

func (*SourceHandler) ServeHTTP added in v0.3.0

func (h *SourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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