webserver

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ValidHTTPStatusCodes is a list of valid status codes for the web server.

Functions

This section is empty.

Types

type ErrorCacheItem added in v0.3.2

type ErrorCacheItem struct {
	URL  string
	Code int
}

ErrorCacheItem is the structure for the WebServer cache item.

type WebServer

type WebServer struct {
	Host                  string
	Port                  int
	Hallucinator          *hallucinator.Hallucinator
	Statistics            *statistics.Statistics
	HTTPOkProbability     float64
	Uncertainty           float64
	HTTPResponseCache     []ErrorCacheItem
	HTTPResponseCacheSize int
	HTTPResponseCacheLock sync.Mutex
	HTTPBaseURL           url.URL
	ServeMux              *http.ServeMux
	Logger                *slog.Logger
	MaxPageDeliveryDelay  time.Duration
}

WebServer is the structure for the WebServer.

func NewWebServer

func NewWebServer(ctx context.Context, logger *slog.Logger, host string, port int,
	hallucinator *hallucinator.Hallucinator, statistics *statistics.Statistics, baseURL url.URL, httpOkProbability,
	uncertainty float64, errorCacheSize int, maxPageDeliveryDelay time.Duration,
) *WebServer

NewWebServer creates a new WebServer instance.

func (*WebServer) Serve

func (ws *WebServer) Serve(ctx context.Context) error

Serve starts the web server.

Jump to

Keyboard shortcuts

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