blackbox

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package blackbox implements public-HTTP test support without database access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL       string
	Token     string
	Authority string
	Agent     string
	HTTP      *http.Client
	Observe   func(Prepared, Response, error)
	// contains filtered or unexported fields
}

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params map[string]any) (Response, error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, p Prepared) (result Response, callErr error)

func (*Client) Prepare

func (c *Client) Prepare(method string, input map[string]any) (Prepared, error)

type Clock

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

Clock is a controlled test-host clock; it is not a production RPC.

func NewClock

func NewClock(now time.Time) *Clock

func (*Clock) Advance

func (c *Clock) Advance(d time.Duration)

func (*Clock) Now

func (c *Clock) Now() time.Time

func (*Clock) Set

func (c *Clock) Set(now time.Time)

type Gate

type Gate struct {
	Point, Method, Key string
	// contains filtered or unexported fields
}

Gate pauses a single matching request outside the daemon write transaction. Await makes race ordering observable rather than relying on sleeps.

func NewGate

func NewGate(point, method, key string) *Gate

func (*Gate) Await

func (g *Gate) Await(ctx context.Context) error

func (*Gate) Hook

func (g *Gate) Hook(point, method, key string)

func (*Gate) Release

func (g *Gate) Release()

type Prepared

type Prepared struct {
	ID     string
	Method string
	// contains filtered or unexported fields
}

Prepared contains immutable encoded request bytes, allowing exact-key replay. Its bytes can contain a lease credential and must not be logged as evidence.

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Kind    string         `json:"kind"`
		Retry   string         `json:"retry"`
		Details map[string]any `json:"details"`
	} `json:"data"`
}

type Response

type Response struct {
	Status        int
	Header        http.Header
	ID            string
	Data          map[string]any
	Replayed      bool
	Error         *RPCError
	TransportCode string
}

Jump to

Keyboard shortcuts

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