web

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package web serves ndscan's optional browser interface: a JSON API over the same scan engine the CLI and TUI use, plus an embedded single-page frontend.

The server binds to loopback by default and deliberately makes exposing it beyond that an explicit choice. A network scanner reachable over the network is a remote-controlled scanner, which is a materially different security proposition from a local tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server holds the scan state shared between HTTP handlers.

func NewServer

func NewServer(version string) *Server

NewServer returns a Server ready to be mounted with Handler.

The OUI database is loaded once here rather than per scan: it holds ~39k prefixes, and resolving vendor names is the difference between a map of bare IPs and one that tells you a host is a Ubiquiti AP or an Apple laptop.

func (*Server) Handler

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

Handler returns the HTTP routes: the JSON API plus the embedded frontend, wrapped in the Host/Origin guard. addr is the bind address, which determines which Host headers are acceptable.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context, addr string) error

ListenAndServe starts the HTTP server on addr until ctx is cancelled.

Jump to

Keyboard shortcuts

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