mockrouting

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 6 modules, 7 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 mockrouting provides a virtual routing server. To use it, create a virtual routing server and use the Client() method to get a routing client (Routing). The server quacks like a DHT but is really a local in-memory hash table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	routing.Routing
}

Client implements Routing

type DelayConfig

type DelayConfig struct {
	// ValueVisibility is the time it takes for a value to be visible in the network
	// FIXME there _must_ be a better term for this
	ValueVisibility delay.D

	// Query is the time it takes to receive a response from a routing query
	Query delay.D
}

DelayConfig can be used to configured the fake delays of a mock server. Use with NewServerWithDelay().

type MockValidator

type MockValidator struct{}

MockValidator is a record validator that always returns success.

func (MockValidator) Select

func (MockValidator) Select(_ string, _ [][]byte) (int, error)

func (MockValidator) Validate

func (MockValidator) Validate(_ string, _ []byte) error

type Server

type Server interface {
	Client(p tnet.Identity) Client
	ClientWithDatastore(context.Context, tnet.Identity, ds.Datastore) Client
}

Server provides mockrouting Clients

func NewServer

func NewServer() Server

NewServer returns a mockrouting Server

func NewServerWithDelay

func NewServerWithDelay(conf DelayConfig) Server

NewServerWithDelay returns a mockrouting Server with a delay!

Jump to

Keyboard shortcuts

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