mock

package
v0.5.5-jatov2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	MockPeerID peer.ID
}

func (Conn) Close

func (m Conn) Close() error

func (Conn) ConnState

func (m Conn) ConnState() libp2pnetwork.ConnectionState

func (Conn) GetStreams

func (m Conn) GetStreams() []libp2pnetwork.Stream

func (Conn) ID

func (m Conn) ID() string

func (Conn) IsClosed

func (m Conn) IsClosed() bool

func (Conn) LocalMultiaddr

func (m Conn) LocalMultiaddr() ma.Multiaddr

func (Conn) LocalPeer

func (m Conn) LocalPeer() peer.ID

func (Conn) LocalPrivateKey

func (m Conn) LocalPrivateKey() crypto.PrivKey

func (Conn) NewStream

func (m Conn) NewStream(ctx context.Context) (libp2pnetwork.Stream, error)

func (Conn) RemoteMultiaddr

func (m Conn) RemoteMultiaddr() ma.Multiaddr

func (Conn) RemotePeer

func (m Conn) RemotePeer() peer.ID

func (Conn) RemotePublicKey

func (m Conn) RemotePublicKey() crypto.PubKey

func (Conn) Scope

func (m Conn) Scope() libp2pnetwork.ConnScope

func (Conn) Stat

func (m Conn) Stat() libp2pnetwork.ConnStats

type IDService

type IDService struct {
	MockIdentifyWait chan struct{}
}

func (IDService) Close

func (m IDService) Close() error

func (IDService) IdentifyConn

func (m IDService) IdentifyConn(conn libp2pnetwork.Conn)

func (IDService) IdentifyWait

func (m IDService) IdentifyWait(conn libp2pnetwork.Conn) <-chan struct{}

func (IDService) ObservedAddrsFor

func (m IDService) ObservedAddrsFor(local ma.Multiaddr) []ma.Multiaddr

func (IDService) OwnObservedAddrs

func (m IDService) OwnObservedAddrs() []ma.Multiaddr

func (IDService) Start

func (m IDService) Start()

type Net

type Net struct {
	MockPeerstore peerstore.Peerstore
}

func (Net) Close

func (m Net) Close() error

func (Net) ClosePeer

func (m Net) ClosePeer(id peer.ID) error

func (Net) Connectedness

func (m Net) Connectedness(id peer.ID) libp2pnetwork.Connectedness

func (Net) Conns

func (m Net) Conns() []libp2pnetwork.Conn

func (Net) ConnsToPeer

func (m Net) ConnsToPeer(p peer.ID) []libp2pnetwork.Conn

func (Net) DialPeer

func (m Net) DialPeer(ctx context.Context, id peer.ID) (libp2pnetwork.Conn, error)

func (Net) InterfaceListenAddresses

func (m Net) InterfaceListenAddresses() ([]ma.Multiaddr, error)

func (Net) Listen

func (m Net) Listen(multiaddr ...ma.Multiaddr) error

func (Net) ListenAddresses

func (m Net) ListenAddresses() []ma.Multiaddr

func (Net) LocalPeer

func (m Net) LocalPeer() peer.ID

func (Net) NewStream

func (m Net) NewStream(ctx context.Context, id peer.ID) (libp2pnetwork.Stream, error)

func (Net) Notify

func (m Net) Notify(notifiee libp2pnetwork.Notifiee)

func (Net) Peers

func (m Net) Peers() []peer.ID

func (Net) Peerstore

func (m Net) Peerstore() peerstore.Peerstore

func (Net) ResourceManager

func (m Net) ResourceManager() libp2pnetwork.ResourceManager

func (Net) SetStreamHandler

func (m Net) SetStreamHandler(handler libp2pnetwork.StreamHandler)

func (Net) StopNotify

func (m Net) StopNotify(notifiee libp2pnetwork.Notifiee)

type NodeInfoIndex

type NodeInfoIndex struct {
	MockNodeInfo   *records.NodeInfo
	MockSelfSealed []byte
}

func (NodeInfoIndex) NodeInfo

func (m NodeInfoIndex) NodeInfo(id peer.ID) *records.NodeInfo

func (NodeInfoIndex) Self

func (m NodeInfoIndex) Self() *records.NodeInfo

func (NodeInfoIndex) SelfSealed

func (m NodeInfoIndex) SelfSealed(sender, recipient peer.ID, permissioned bool, operatorPrivateKey *rsa.PrivateKey) ([]byte, error)

func (NodeInfoIndex) SetNodeInfo

func (m NodeInfoIndex) SetNodeInfo(id peer.ID, node *records.NodeInfo)

func (NodeInfoIndex) UpdateSelfRecord

func (m NodeInfoIndex) UpdateSelfRecord(newInfo *records.NodeInfo)

type NodeStorage

type NodeStorage struct {
	MockGetPrivateKey               *rsa.PrivateKey
	RegisteredOperatorPublicKeyPEMs []string
}

func (NodeStorage) BumpNonce

func (m NodeStorage) BumpNonce(owner common.Address) error

func (NodeStorage) CleanRegistryData

func (m NodeStorage) CleanRegistryData() error

func (NodeStorage) DeleteOperatorData

func (m NodeStorage) DeleteOperatorData(id spectypes.OperatorID) error

func (NodeStorage) DeleteRecipientData

func (m NodeStorage) DeleteRecipientData(owner common.Address) error

func (NodeStorage) GetEventData

func (m NodeStorage) GetEventData(txHash common.Hash) (*registrystorage.EventData, bool, error)

func (NodeStorage) GetEventsPrefix

func (m NodeStorage) GetEventsPrefix() []byte

func (NodeStorage) GetNextNonce

func (m NodeStorage) GetNextNonce(owner common.Address) (registrystorage.Nonce, error)

func (NodeStorage) GetOperatorData

func (NodeStorage) GetOperatorDataByPubKey

func (m NodeStorage) GetOperatorDataByPubKey(logger *zap.Logger, operatorPublicKeyPEM []byte) (*registrystorage.OperatorData, bool, error)

func (NodeStorage) GetOperatorsPrefix

func (m NodeStorage) GetOperatorsPrefix() []byte

func (NodeStorage) GetPrivateKey

func (m NodeStorage) GetPrivateKey() (*rsa.PrivateKey, bool, error)

func (NodeStorage) GetRecipientData

func (m NodeStorage) GetRecipientData(owner common.Address) (*registrystorage.RecipientData, bool, error)

func (NodeStorage) GetRecipientDataMany

func (m NodeStorage) GetRecipientDataMany(logger *zap.Logger, owners []common.Address) (map[common.Address]bellatrix.ExecutionAddress, error)

func (NodeStorage) GetRecipientsPrefix

func (m NodeStorage) GetRecipientsPrefix() []byte

func (NodeStorage) GetSyncOffset

func (m NodeStorage) GetSyncOffset() (*eth1.SyncOffset, bool, error)

func (NodeStorage) ListOperators

func (m NodeStorage) ListOperators(logger *zap.Logger, from uint64, to uint64) ([]registrystorage.OperatorData, error)

func (NodeStorage) SaveEventData

func (m NodeStorage) SaveEventData(txHash common.Hash) error

func (NodeStorage) SaveOperatorData

func (m NodeStorage) SaveOperatorData(logger *zap.Logger, operatorData *registrystorage.OperatorData) (bool, error)

func (NodeStorage) SaveRecipientData

func (m NodeStorage) SaveRecipientData(recipientData *registrystorage.RecipientData) (*registrystorage.RecipientData, error)

func (NodeStorage) SaveSyncOffset

func (m NodeStorage) SaveSyncOffset(offset *eth1.SyncOffset) error

func (NodeStorage) SetupPrivateKey

func (m NodeStorage) SetupPrivateKey(logger *zap.Logger, operatorKeyBase64 string, generateIfNone bool) ([]byte, error)

func (NodeStorage) Shares

func (m NodeStorage) Shares() registrystorage.Shares

type Peerstore

type Peerstore struct {
	ExistingPIDs               []peer.ID
	MockFirstSupportedProtocol libp2p_protocol.ID
}

func (Peerstore) AddAddr

func (p Peerstore) AddAddr(pid peer.ID, addr ma.Multiaddr, ttl time.Duration)

func (Peerstore) AddAddrs

func (p Peerstore) AddAddrs(pid peer.ID, addrs []ma.Multiaddr, ttl time.Duration)

func (Peerstore) AddPrivKey

func (p Peerstore) AddPrivKey(id peer.ID, key crypto.PrivKey) error

func (Peerstore) AddProtocols

func (p Peerstore) AddProtocols(id peer.ID, s ...libp2p_protocol.ID) error

func (Peerstore) AddPubKey

func (p Peerstore) AddPubKey(id peer.ID, key crypto.PubKey) error

func (Peerstore) AddrStream

func (p Peerstore) AddrStream(ctx context.Context, id peer.ID) <-chan ma.Multiaddr

func (Peerstore) Addrs

func (p Peerstore) Addrs(pid peer.ID) []ma.Multiaddr

func (Peerstore) ClearAddrs

func (p Peerstore) ClearAddrs(pid peer.ID)

func (Peerstore) Close

func (p Peerstore) Close() error

func (Peerstore) FirstSupportedProtocol

func (p Peerstore) FirstSupportedProtocol(id peer.ID, s ...libp2p_protocol.ID) (libp2p_protocol.ID, error)

func (Peerstore) Get

func (p Peerstore) Get(pid peer.ID, key string) (interface{}, error)

func (Peerstore) GetProtocols

func (p Peerstore) GetProtocols(id peer.ID) ([]libp2p_protocol.ID, error)

func (Peerstore) LatencyEWMA

func (p Peerstore) LatencyEWMA(id peer.ID) time.Duration

func (Peerstore) PeerInfo

func (p Peerstore) PeerInfo(id peer.ID) peer.AddrInfo

func (Peerstore) Peers

func (p Peerstore) Peers() peer.IDSlice

func (Peerstore) PeersWithAddrs

func (p Peerstore) PeersWithAddrs() peer.IDSlice

func (Peerstore) PeersWithKeys

func (p Peerstore) PeersWithKeys() peer.IDSlice

func (Peerstore) PrivKey

func (p Peerstore) PrivKey(id peer.ID) crypto.PrivKey

func (Peerstore) PubKey

func (p Peerstore) PubKey(id peer.ID) crypto.PubKey

func (Peerstore) Put

func (p Peerstore) Put(pid peer.ID, key string, val interface{}) error

func (Peerstore) RecordLatency

func (p Peerstore) RecordLatency(id peer.ID, duration time.Duration)

func (Peerstore) RemovePeer

func (p Peerstore) RemovePeer(id peer.ID)

func (Peerstore) RemoveProtocols

func (p Peerstore) RemoveProtocols(id peer.ID, s ...libp2p_protocol.ID) error

func (Peerstore) SetAddr

func (p Peerstore) SetAddr(pid peer.ID, addr ma.Multiaddr, ttl time.Duration)

func (Peerstore) SetAddrs

func (p Peerstore) SetAddrs(pid peer.ID, addrs []ma.Multiaddr, ttl time.Duration)

func (Peerstore) SetProtocols

func (p Peerstore) SetProtocols(id peer.ID, s ...libp2p_protocol.ID) error

func (Peerstore) SupportsProtocols

func (p Peerstore) SupportsProtocols(id peer.ID, s ...libp2p_protocol.ID) ([]libp2p_protocol.ID, error)

func (Peerstore) UpdateAddrs

func (p Peerstore) UpdateAddrs(pid peer.ID, oldTTL time.Duration, newTTL time.Duration)

type StreamController

type StreamController struct {
	MockRequest []byte
}

func (StreamController) HandleStream

func (m StreamController) HandleStream(logger *zap.Logger, stream core.Stream) ([]byte, streams.StreamResponder, func(), error)

func (StreamController) Request

func (m StreamController) Request(logger *zap.Logger, peerID peer.ID, protocol protocol.ID, msg []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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