Help us shape the future of Go! Take the 2026 Go Developer Survey

web

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogEntry

type LogEntry struct {
	Host        string
	UserIp      string
	Method      string
	URL         string
	Status      int
	Size        int
	UserAgent   string
	RequestTime int
	Rid         string
}

type WebController

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

func NewController

func NewController(ctx context.Context, pu *processor.Unit, sink trace.Sink) *WebController

func (*WebController) BasicAuth

func (web *WebController) BasicAuth(handler http.HandlerFunc, username, password, realm string) http.HandlerFunc

BasicAuth wraps a handler requiring HTTP basic auth for it using the given username and password and the specified realm, which shouldn't contain quotes.

Most web browser display a dialog with something like:

The website says: "<realm>"

Which is really stupid so you may want to set the realm to a message rather than an actual realm.

func (*WebController) CtxMiddleware

func (web *WebController) CtxMiddleware(next http.Handler) http.Handler

add ctx to pass things to logging

func (*WebController) Log

func (web *WebController) Log(entry LogEntry)

func (*WebController) LogFromRequest

func (web *WebController) LogFromRequest(crw *contextResponseWriter, r *http.Request, rt int)

func (*WebController) LoggingMiddleware

func (web *WebController) LoggingMiddleware(next http.Handler) http.Handler

simple logging

func (*WebController) MountDAV added in v0.2.26

func (web *WebController) MountDAV(wellKnown, prefix string, h http.Handler)

MountDAV mounts a DAV personality's handler on prefix (no trailing slash) and on its well-known path. Call before Start. The handler answers from its own store and never runs a stack for a read; it bypasses the operator BasicAuth wrapper (it has its own account-table Basic auth) exactly as the AI gateway does. Two mounts must not share a prefix (app.go refuses to start when they do).

func (*WebController) MountHost added in v0.2.31

func (web *WebController) MountHost(match func(host string) bool, h http.Handler)

MountHost sends EVERY request whose Host satisfies match to h, whatever the path, and none whose Host does not. It exists for a protocol that has a hostname of its own rather than a path on everyone's: the ipp head answers on `ipp.<zone>` and nowhere else, so a tenant's own `/p/…` routes on its ordinary hostnames are untouched. Call before Start.

match runs on every web request, so it must be a pure, allocation-light predicate over the Host header — no lookups. Like a DAV mount the handler bypasses the operator BasicAuth wrapper (it authenticates itself) and the envelope path entirely: the request body is never buffered by the web head, which is the point for a protocol whose body is a document.

func (*WebController) SetCalendar added in v0.2.26

func (web *WebController) SetCalendar(h http.Handler, prefix string)

SetCalendar mounts the calendar personality's handler on prefix and on /.well-known/caldav (MountDAV with the CalDAV well-known path).

func (*WebController) SetCapGateway added in v0.2.33

func (web *WebController) SetCapGateway(h http.HandlerFunc)

SetCapGateway wires the capability inlet's handler onto POST /v1/cap/{name}. Call before Start.

func (*WebController) SetLLMGateway added in v0.2.21

func (web *WebController) SetLLMGateway(messages, countTokens http.HandlerFunc)

SetLLMGateway wires the AI-gateway inlet's handlers onto POST /v1/messages (stack-processed) and /v1/messages/count_tokens (stackless transparent forward). Call before Start.

func (*WebController) SetSignedHandler added in v0.2.31

func (web *WebController) SetSignedHandler(h http.HandlerFunc)

SetSignedHandler wires the signed-URL endpoint onto GET/HEAD /_txc/signed/<token>. Call before Start. The token is the whole authorization, so the route bypasses the operator BasicAuth wrapper and the opstack bus like the continuation callback does; the access log redacts the token (redactURI).

func (*WebController) SetTLSConfig added in v0.2.4

func (web *WebController) SetTLSConfig(c *tls.Config)

SetTLSConfig wires the bundled cert manager's TLS config into the web head, enabling the HTTPS listener. Call before Start. No-op effect unless --web-tls-addr is also set.

func (*WebController) SetWebSocket added in v0.2.26

func (web *WebController) SetWebSocket(c *websocketp.Controller)

SetWebSocket wires the websocket personality's controller into the web head. Call before Start. Inert unless the controller is enabled.

func (*WebController) Start

func (web *WebController) Start()

func (*WebController) Stop

func (web *WebController) Stop()

Jump to

Keyboard shortcuts

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