Documentation
¶
Index ¶
- Variables
- func NewSeededRand(seed int64) *rand.Rand
- func RandLocalTCPAddress() ma.Multiaddr
- func RandPeerID() (peer.ID, error)
- func RandPeerIDFatal(t testing.TB) peer.ID
- func RandTestKeyPair(bits int) (ci.PrivKey, ci.PubKey, error)
- func SeededTestKeyPair(seed int64) (ci.PrivKey, ci.PubKey, error)
- func ThreadSafeCloserMapDatastore() ds2.ThreadSafeDatastoreCloser
- type Identity
- type LatencyConfig
- func (c LatencyConfig) AllInstantaneous() LatencyConfig
- func (c LatencyConfig) Blockstore7200RPM() LatencyConfig
- func (c LatencyConfig) BlockstoreFastSSD2014() LatencyConfig
- func (c LatencyConfig) BlockstoreSlowSSD2014() LatencyConfig
- func (c LatencyConfig) NetworkIntraDatacenter2014() LatencyConfig
- func (c LatencyConfig) NetworkNYtoSF() LatencyConfig
- func (c LatencyConfig) RoutingSlow() LatencyConfig
- type LockedRandSource
- type PeerNetParams
Constants ¶
This section is empty.
Variables ¶
var SeededRand *rand.Rand
var ZeroLocalTCPAddress ma.Multiaddr
ZeroLocalTCPAddress is the "zero" tcp local multiaddr. This means:
/ip4/127.0.0.1/tcp/0
Functions ¶
func NewSeededRand ¶
func NewSeededRand(seed int64) *rand.Rand
func RandLocalTCPAddress ¶
func RandLocalTCPAddress() ma.Multiaddr
RandLocalTCPAddress returns a random multiaddr. it suppresses errors for nice composability-- do check the address isn't nil.
Note: for real network tests, use ZeroLocalTCPAddress so the kernel assigns an unused TCP port. otherwise you may get clashes. This function remains here so that p2p/net/mock (which does not touch the real network) can assign different addresses to peers.
func RandPeerID ¶
func RandPeerID() (peer.ID, error)
RandPeerID generates random "valid" peer IDs. it does not NEED to generate keys because it is as if we lost the key right away. fine to read randomness and hash it. to generate proper keys and corresponding PeerID, use:
sk, pk, _ := testutil.RandKeyPair() id, _ := peer.IDFromPublicKey(pk)
func RandPeerIDFatal ¶
func RandPeerIDFatal(t testing.TB) peer.ID
func RandTestKeyPair ¶
func RandTestKeyPair(bits int) (ci.PrivKey, ci.PubKey, error)
func SeededTestKeyPair ¶
func SeededTestKeyPair(seed int64) (ci.PrivKey, ci.PubKey, error)
func ThreadSafeCloserMapDatastore ¶
func ThreadSafeCloserMapDatastore() ds2.ThreadSafeDatastoreCloser
Types ¶
type Identity ¶
type Identity interface {
Address() ma.Multiaddr
ID() peer.ID
PrivateKey() ci.PrivKey
PublicKey() ci.PubKey
}
func RandIdentity ¶
func RandIdentity() (Identity, error)
func RandIdentityOrFatal ¶
func RandIdentityOrFatal(t *testing.T) Identity
type LatencyConfig ¶
type LatencyConfig struct {
BlockstoreLatency time.Duration
NetworkLatency time.Duration
RoutingLatency time.Duration
}
func (LatencyConfig) AllInstantaneous ¶ added in v0.3.6
func (c LatencyConfig) AllInstantaneous() LatencyConfig
func (LatencyConfig) Blockstore7200RPM ¶ added in v0.3.6
func (c LatencyConfig) Blockstore7200RPM() LatencyConfig
func (LatencyConfig) BlockstoreFastSSD2014 ¶ added in v0.3.6
func (c LatencyConfig) BlockstoreFastSSD2014() LatencyConfig
func (LatencyConfig) BlockstoreSlowSSD2014 ¶ added in v0.3.6
func (c LatencyConfig) BlockstoreSlowSSD2014() LatencyConfig
func (LatencyConfig) NetworkIntraDatacenter2014 ¶ added in v0.3.6
func (c LatencyConfig) NetworkIntraDatacenter2014() LatencyConfig
func (LatencyConfig) NetworkNYtoSF ¶ added in v0.3.6
func (c LatencyConfig) NetworkNYtoSF() LatencyConfig
func (LatencyConfig) RoutingSlow ¶ added in v0.3.6
func (c LatencyConfig) RoutingSlow() LatencyConfig
type LockedRandSource ¶
type LockedRandSource struct {
// contains filtered or unexported fields
}
type PeerNetParams ¶
type PeerNetParams struct {
ID peer.ID
PrivKey ci.PrivKey
PubKey ci.PubKey
Addr ma.Multiaddr
}
PeerNetParams is a struct to bundle together the four things you need to run a connection with a peer: id, 2keys, and addr.
func RandPeerNetParams ¶
func RandPeerNetParams() (*PeerNetParams, error)
func RandPeerNetParamsOrFatal ¶
func RandPeerNetParamsOrFatal(t *testing.T) PeerNetParams
Directories
¶
Path | Synopsis |
---|---|
Package ci implements some helper functions to use during tests.
|
Package ci implements some helper functions to use during tests. |
travis
Package travis implements some helper functions to use during tests.
|
Package travis implements some helper functions to use during tests. |