testcoord

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testcoord serves the coordination operations over HTTP for module tests. It authenticates each request with a signed principal header that the test supplies, so it fits no deployment and is never exported outside the module.

Index

Constants

View Source
const Header = "X-Test-Principal"

Header carries a principal signed by Sign.

Variables

This section is empty.

Functions

func New

func New(s *server.Server, r *server.Region, secret []byte, opts ...Option) http.Handler

New returns a handler for POST /registration, GET /netmap and the WebSocket GET /signal. Each route refuses a request without a valid signed principal with 401, and a principal the server does not authorize the same way.

func Sign

func Sign(secret []byte, p server.Principal) string

Sign returns the Header value that authenticates p to a handler built with the same secret.

Types

type Option

type Option func(*handler)

Option changes how New builds the handler.

func WithAccepted

func WithAccepted(f func(p server.Principal, c net.Conn) net.Conn) Option

WithAccepted passes each accepted signaling connection through f before the region serves it, so a test can observe the bytes the region reads, at the time it reads them. f receives the authorized principal and returns the connection the region serves; the region closes that connection, so a wrapper must close the one it wraps. A nil f serves the connection as is.

Jump to

Keyboard shortcuts

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