validatorpeer

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package validatorpeer is an in-process mock OCM peer for validator tests.

Index

Constants

View Source
const (

	// HostName is the advertised peer hostname in Peer.URL and Peer.Host.
	HostName = "validator-peer.test"
)

Variables

This section is empty.

Functions

func DialHosts

func DialHosts() map[string]string

DialHosts returns the test-only hostname-to-IP map for the shared outbound client so advertised HostName requests reach the httptest listener.

Types

type Options

type Options struct {
	// FailDiscovery makes /.well-known/ocm return HTTP 500.
	FailDiscovery bool
}

Options configures a mock peer.

type Peer

type Peer struct {
	URL    string
	Host   string
	Signer *crypto.RFC9421Signer
	Hits   atomic.Int32
	// contains filtered or unexported fields
}

Peer is a TLS mock OCM peer with discovery and JWKS.

func Start

func Start(t *testing.T, opts Options) *Peer

Start launches a mock peer and registers cleanup on t.

func (*Peer) Close

func (p *Peer) Close()

Close shuts down the mock peer listener.

func (*Peer) HTTPClient

func (p *Peer) HTTPClient() *http.Client

HTTPClient returns a client that trusts this peer's TLS certificate.

Jump to

Keyboard shortcuts

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