Documentation ¶
Index ¶
- func DivulgeAddresses(a, b network.Network)
- func GenSwarm(t testing.TB, opts ...Option) *swarm.Swarm
- func GenUpgrader(t testing.TB, n *swarm.Swarm, connGater connmgr.ConnectionGater, ...) transport.Upgrader
- type MockConnectionGater
- func (m *MockConnectionGater) InterceptAccept(c network.ConnMultiaddrs) (allow bool)
- func (m *MockConnectionGater) InterceptAddrDial(p peer.ID, addr ma.Multiaddr) (allow bool)
- func (m *MockConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)
- func (m *MockConnectionGater) InterceptSecured(d network.Direction, p peer.ID, c network.ConnMultiaddrs) (allow bool)
- func (m *MockConnectionGater) InterceptUpgraded(tc network.Conn) (allow bool, reason control.DisconnectReason)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DivulgeAddresses ¶
DivulgeAddresses adds swarm a's addresses to swarm b's peerstore.
Types ¶
type MockConnectionGater ¶
type MockConnectionGater struct { Dial func(p peer.ID, addr ma.Multiaddr) bool PeerDial func(p peer.ID) bool Accept func(c network.ConnMultiaddrs) bool Secured func(network.Direction, peer.ID, network.ConnMultiaddrs) bool Upgraded func(c network.Conn) (bool, control.DisconnectReason) }
MockConnectionGater is a mock connection gater to be used by the tests.
func DefaultMockConnectionGater ¶
func DefaultMockConnectionGater() *MockConnectionGater
func (*MockConnectionGater) InterceptAccept ¶
func (m *MockConnectionGater) InterceptAccept(c network.ConnMultiaddrs) (allow bool)
func (*MockConnectionGater) InterceptAddrDial ¶
func (*MockConnectionGater) InterceptPeerDial ¶
func (m *MockConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)
func (*MockConnectionGater) InterceptSecured ¶
func (m *MockConnectionGater) InterceptSecured(d network.Direction, p peer.ID, c network.ConnMultiaddrs) (allow bool)
func (*MockConnectionGater) InterceptUpgraded ¶
func (m *MockConnectionGater) InterceptUpgraded(tc network.Conn) (allow bool, reason control.DisconnectReason)
type Option ¶
Option is an option that can be passed when constructing a test swarm.
OptDialOnly prevents the test swarm from listening.
OptDisableQUIC disables QUIC.
OptDisableReuseport disables reuseport in this test swarm.
OptDisableTCP disables TCP.
func OptConnGater ¶
func OptConnGater(cg connmgr.ConnectionGater) Option
OptConnGater configures the given connection gater on the test
func OptPeerPrivateKey ¶
OptPeerPrivateKey configures the peer private key which is then used to derive the public key and peer ID.
func WithClock ¶ added in v0.21.0
func WithClock(clock clock) Option
WithClock sets the clock to use for this swarm
func WithSwarmOpts ¶ added in v0.23.0
Click to show internal directories.
Click to hide internal directories.