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

server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package server implements acurl serve: a local web UI and JSON API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRequest

type CheckRequest struct {
	URL        string   `json:"url"`
	Categories []string `json:"categories,omitempty"`
	Agents     []string `json:"agents,omitempty"`
	Render     bool     `json:"render,omitempty"`
}

CheckRequest is the body of POST /api/check.

type Options

type Options struct {
	// Base options for every check. Profiles are filtered per request.
	Check acurl.Options
	// MaxConcurrent limits simultaneous checks. Default 4.
	MaxConcurrent int
	Version       string
	// AllowedHosts are the host names (without port) the server answers to,
	// besides localhost. Requests for any other Host are refused, which stops
	// DNS rebinding.
	AllowedHosts []string
}

Options configures the server.

type Server

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

Server serves the UI and API.

func New

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

New returns a Server. Callers should set Check.BlockPrivate unless the server is only reachable by trusted users.

func (*Server) ServeHTTP

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

ServeHTTP implements http.Handler with Host, Origin and content-type checks in front of the routes, and basic security headers.

Jump to

Keyboard shortcuts

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