webserver

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package webserver is the optional rfscope web console backend: a self-contained HTTP server that stages an uploaded IQ capture, runs the rfscope segmentation + analyzers over it, and returns the structured Scene (plus a cryptolab `ks` frames file for any unknown payloads). It is the browser counterpart to the `rfscope` CLI/TUI, modeled on the cryptolab and siglab web consoles.

It depends only on the rfscope package and the standard library, and is imported only by the `rfscope serve` command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Assets is the embedded SPA file system (served at /). Nil serves the API
	// only with a short placeholder at /.
	Assets fs.FS
	// TempDir stages uploads. Empty ⇒ a fresh temp dir the server owns and
	// removes on Close.
	TempDir string
	// MaxUploadBytes bounds one upload. 0 ⇒ 512 MiB.
	MaxUploadBytes int64
	// AnalyzeTimeout bounds one analysis. 0 ⇒ 120s.
	AnalyzeTimeout time.Duration
	// Logger receives server-level logs. Nil ⇒ slog.Default.
	Logger *slog.Logger
}

Options configure a Server.

type Server

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

Server is the rfscope web console HTTP handler.

func New

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

New constructs a Server. The staging temp directory is created lazily on the first upload, so merely registering the routes costs nothing on disk.

func (*Server) Close

func (s *Server) Close() error

Close removes the temp directory if the server created it.

func (*Server) Handler

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

Handler returns a standalone HTTP mux: the rfscope API plus the embedded SPA at /. Used by `rfscope serve`.

func (*Server) RegisterAPI

func (s *Server) RegisterAPI(mux *http.ServeMux, gate func(http.HandlerFunc) http.HandlerFunc)

RegisterAPI mounts the /api/v1/rfscope/* routes onto mux. Mutating routes are wrapped with gate when non-nil so a daemon can apply the same auth middleware; the standalone server passes nil.

Jump to

Keyboard shortcuts

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