package mocks

import "github.com/libp2p/go-libp2p/p2p/discovery/mocks"

Index

Types

type MockDiscoveryClient

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

func NewDiscoveryClient

func NewDiscoveryClient(h host.Host, server *MockDiscoveryServer) *MockDiscoveryClient

func (*MockDiscoveryClient) Advertise

func (d *MockDiscoveryClient) Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error)

func (*MockDiscoveryClient) FindPeers

func (d *MockDiscoveryClient) FindPeers(ctx context.Context, ns string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

type MockDiscoveryServer

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

func NewDiscoveryServer

func NewDiscoveryServer(clock clock) *MockDiscoveryServer

func (*MockDiscoveryServer) Advertise

func (s *MockDiscoveryServer) Advertise(ns string, info peer.AddrInfo, ttl time.Duration) (time.Duration, error)

func (*MockDiscoveryServer) FindPeers

func (s *MockDiscoveryServer) FindPeers(ns string, limit int) (<-chan peer.AddrInfo, error)

Source Files

mocks.go

Version
v0.41.1 (latest)
Published
Mar 24, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
3 weeks ago

Tools for package owners.