asset

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: BSD-3-Clause, GPL-3.0, MIT, + 1 more Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine handles rule ingestion, HTML injection, and asset resolution.

func NewEngine

func NewEngine(assetServerPort int) (*Engine, error)

NewEngine constructs an Engine with default bundles and stores.

func (*Engine) AddRule

func (e *Engine) AddRule(rule string, filterListTrusted bool) (handled bool, err error)

AddRule attempts to add a non-network rule. Returns handled=true if consumed.

func (*Engine) Inject

func (e *Engine) Inject(_ *http.Request, res *http.Response) error

Inject appends asset tags for the matching hostname into HTML responses.

type Server

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

Server hosts asset resources over HTTPS.

func NewServer

func NewServer(port int, engine *Engine, certGenerator certGenerator) (*Server, error)

NewServer creates a new HTTPS asset server bound to [host].

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the HTTPS server and begins listening for requests.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Stop

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

Stop gracefully shuts down the HTTPS server.

Jump to

Keyboard shortcuts

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