package
0.31.5
Repository: https://github.com/rnssolution/prism.git
Documentation: pkg.go.dev

# README

p2p

The p2p package provides an abstraction around peer-to-peer communication.

Docs:

  • Connection for details on how connections and multiplexing work
  • Peer for details on peer ID, handshakes, and peer exchange
  • Node for details about different types of nodes and how they should work
  • Pex for details on peer discovery and exchange
  • Config for details on some config option

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Taken from taipei-torrent.

# Functions

No description provided by the author
ConnDuplicateIPFilter resolves and keeps all ips for an incoming connection and refuses new ones if they come from a known ip.
Connect2Switches will connect switches i and j via net.Pipe().
No description provided by the author
No description provided by the author
FuzzConn creates a new FuzzedConnection.
FuzzConnAfter creates a new FuzzedConnection.
FuzzConnAfterFromConfig creates a new FuzzedConnection from a config.
FuzzConnFromConfig creates a new FuzzedConnection from a config.
IDAddressString returns id@hostPort.
No description provided by the author
LoadOrGenNodeKey attempts to load the NodeKey from the given filePath.
MakeConnectedSwitches returns n switches, connected according to the connect func.
MakePoWTarget returns the big-endian encoding of 2^(targetBits - difficulty) - 1.
No description provided by the author
Max size of the NodeInfo struct.
MConnConfig returns an MConnConfig with fields updated from the P2PConfig.
MultiplexTransportConnFilters sets the filters for rejection new connections.
MultiplexTransportFilterTimeout sets the timeout waited for filter calls to return.
MultiplexTransportResolver sets the Resolver used for ip lokkups, defaults to net.DefaultResolver.
No description provided by the author
NewConnSet returns a ConnSet implementation.
NewMultiplexTransport returns a tcp connected multiplexed peer.
NewNetAddress returns a new NetAddress using the provided TCP address.
NewNetAddressIPPort returns a new NetAddress using the provided IP and port number.
NewNetAddressString returns a new NetAddress using the provided address in the form of "ID@IP:Port".
NewNetAddressStrings returns an array of NetAddress'es build using the provided strings.
NewNetAddressStringWithOptionalID returns a new NetAddress using the provided address in the form of "ID@IP:Port", where the ID is optional.
NewPeerSet creates a new peerSet with a list of initial capacity of 256 items.
NewProtocolVersion returns a fully populated ProtocolVersion.
NewSwitch creates a new Switch with the given config.
NopMetrics returns no-op Metrics.
No description provided by the author
PrometheusMetrics returns Metrics build using Prometheus client library.
PubKeyToID returns the ID corresponding to the given PubKey.
StartSwitches calls sw.Start() for each given switch.
SwitchFilterTimeout sets the timeout used for peer filters.
SwitchPeerFilters sets the filters for rejection of new peers.
WithMetrics sets the metrics.

# Constants

IDByteLength is the length of a crypto.Address.
MetricsSubsystem is a subsystem shared by all metrics exposed by this package.
No description provided by the author

# Structs

No description provided by the author
DefaultNodeInfo is the basic node information exchanged between two peers during the Tendermint P2P handshake.
DefaultNodeInfoOther is the misc.
ErrCurrentlyDialingOrExistingAddress indicates that we're currently dialing this address or it belongs to an existing peer.
ErrFilterTimeout indicates that a filter operation timed out.
No description provided by the author
No description provided by the author
No description provided by the author
ErrRejected indicates that a Peer was rejected carrying additional information as to the reason.
No description provided by the author
ErrSwitchConnectToSelf to be raised when trying to connect to itself.
ErrSwitchDuplicatePeerID to be raised when a peer is connecting with a known ID.
ErrSwitchDuplicatePeerIP to be raised whena a peer is connecting with a known IP.
ErrTransportClosed is raised when the Transport has been closed.
FuzzedConnection wraps any net.Conn and depending on the mode either delays reads/writes or randomly drops reads/writes/connections.
Metrics contains metrics exposed by this package.
MultiplexTransport accepts and dials tcp connections and upgrades them to multiplexed peers.
NetAddress defines information about a peer on the network including its ID, IP address, and port.
NodeKey is the persistent peer key.
PeerSet is a special structure for keeping a table of peers.
ProtocolVersion contains the protocol versions for the software.
Switch handles peer connections and exposes an API to receive incoming messages on `Reactors`.

# Interfaces

An AddrBook represents an address book from the pex package, which is used to store peer addresses.
ConnSet is a lookup table for connections and all their ips.
IPeerSet has a (immutable) subset of the methods of PeerSet.
IPResolver is a behaviour subset of net.Resolver.
NodeInfo exposes basic info of a node and determines if we're compatible.
Peer is an interface representing a peer connected on a reactor.
No description provided by the author
Transport emits and connects to Peers.

# Type aliases

No description provided by the author
No description provided by the author
ConnFilterFunc to be implemented by filter hooks after a new connection has been established.
ID is a hex-encoded crypto.Address.
MultiplexTransportOption sets an optional parameter on the MultiplexTransport.
PeerFilterFunc to be implemented by filter hooks after a new Peer has been fully setup.
No description provided by the author
SwitchOption sets an optional parameter on the Switch.