httpserver

package
v0.1.16-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Config     config.HTTPConfig
	Authorizer *auth.Authorizer
}

Options configure the HTTP server.

type Server

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

Server manages the main API HTTP server with bearer token authentication.

func NewServer

func NewServer(opts Options) (*Server, error)

NewServer constructs a new HTTP server.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the listener address if the server is running.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the underlying HTTP handler (ServeMux) used by the server. This is primarily intended for tests that need to exercise the registered routes without starting a real listener.

func (*Server) RegisterRoute

func (s *Server) RegisterRoute(pattern string, handler http.Handler, roles ...auth.Role)

RegisterRoute registers a handler for the given pattern with optional middleware. The authorizer middleware will be applied if roles are provided.

func (*Server) RegisterRouteFunc

func (s *Server) RegisterRouteFunc(pattern string, handlerFunc http.HandlerFunc, roles ...auth.Role)

RegisterRouteFunc registers a handler function for the given pattern with optional middleware. The authorizer middleware will be applied if roles are provided.

func (*Server) RegisterRouteFuncAllowQueryToken

func (s *Server) RegisterRouteFuncAllowQueryToken(pattern string, handlerFunc http.HandlerFunc, roles ...auth.Role)

RegisterRouteFuncAllowQueryToken registers a handler that also accepts auth_token query parameters for authentication. This is intended for GET endpoints serving downloadable content (logs, diffs, specs) where browser/OSC8 links cannot set Authorization headers.

func (*Server) Start

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

Start begins serving HTTP(S) requests.

func (*Server) Stop

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

Stop gracefully stops the HTTP server.

Jump to

Keyboard shortcuts

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