Help us shape the future of Go! Take the 2026 Go Developer Survey

dmsgtest

package
v1.3.104 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package dmsgtest pkg/dmsg/dmsgtest/env.go c1-net-dmsg

Index

Constants

View Source
const DefaultTimeout = time.Minute

DefaultTimeout is the recommended timeout for the Env.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

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

Env can run an entire local dmsg environment inclusive of a mock discovery, dmsg servers and clients.

func NewEnv

func NewEnv(t *testing.T, timeout time.Duration) *Env

NewEnv creates a new dmsg environment. The inputs 't' and 'timeout' are optional. If 't' is specified, some log messages are displayed via 't.Log()'. If 'timeout' is not '0', starting entities (such as servers and clients) must complete in the given duration,

otherwise it will fail.

func (*Env) AllClients

func (env *Env) AllClients() []*dmsg.Client

AllClients returns all the clients of the Env.

func (*Env) AllServers

func (env *Env) AllServers() []*dmsg.Server

AllServers returns all the servers of the Env.

func (*Env) ClientOfPK

func (env *Env) ClientOfPK(pk cipher.PubKey) (*dmsg.Client, bool)

ClientOfPK returns client of a given public key.

func (*Env) CloseAllClients

func (env *Env) CloseAllClients()

CloseAllClients closes all clients of the Env.

func (*Env) CloseAllServers

func (env *Env) CloseAllServers()

CloseAllServers closes all servers of the Env.

func (*Env) Discovery

func (env *Env) Discovery() disc.APIClient

Discovery returns the discovery client.

func (*Env) NewClient

func (env *Env) NewClient(conf *dmsg.Config) (*dmsg.Client, error)

NewClient runs a new client.

func (*Env) NewClientWithKeys

func (env *Env) NewClientWithKeys(pk cipher.PubKey, sk cipher.SecKey, conf *dmsg.Config) (*dmsg.Client, error)

NewClientWithKeys runs a new client with specified keys.

func (*Env) NewServer

func (env *Env) NewServer(updateInterval time.Duration) (*dmsg.Server, error)

NewServer runs a new server.

func (*Env) Shutdown

func (env *Env) Shutdown()

Shutdown closes all servers and clients of the Env.

func (*Env) Startup

func (env *Env) Startup(entryTimeout time.Duration, servers, clients int, conf *dmsg.Config) error

Startup runs the specified number of dmsg servers and clients. The input 'conf' is optional, and is passed when creating clients.

Jump to

Keyboard shortcuts

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