dcrd/peer
Dave Collins 55fb28cbbd
txscript: Prepare v4.0.0.
This updates the txscript module dependencies, the copyright year in the
files modified since the previous release, and serves as a base for
txscript/v4.0.0.

The updated direct dependencies in this commit are as follows:

- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/chaincfg/v3@v3.1.0
- github.com/decred/dcrd/dcrec/edwards/v2@v2.0.2
- github.com/decred/dcrd/dcrec/secp256k1/v4@v4.0.1
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0

The full list of updated direct dependencies since the previous
txscript/v3.0.0 release are as follows:

- github.com/dchest/siphash@v1.2.2
- github.com/decred/base58@v1.0.3
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/chaincfg/v3@v3.1.0
- github.com/decred/dcrd/crypto/blake256@v1.0.0
- github.com/decred/dcrd/dcrec/edwards/v2@v2.0.2
- github.com/decred/dcrd/dcrec/secp256k1/v4@v4.0.1
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0

The following direct dependencies are no longer required as compared to
the previous txscript/v3.0.0 release:

- github.com/decred/dcrd/dcrutil/v3

Finally, all modules in the repository that depend on txscript are
tidied to ensure they are updated to use the latest versions hoisted
forward as a result.
2021-11-18 23:14:01 -06:00
..
doc.go peer: Remove unneeded PushRejectMsg. 2021-02-08 16:11:15 -06:00
example_test.go peer: Remove deprecated onversion reject return. 2021-02-08 16:09:34 -06:00
go.mod txscript: Prepare v4.0.0. 2021-11-18 23:14:01 -06:00
go.sum txscript: Prepare v4.0.0. 2021-11-18 23:14:01 -06:00
log.go peer: Remove deprecated DisableLog. 2021-09-10 07:46:15 -05:00
peer_test.go peer: Remove unneeded PushRejectMsg. 2021-02-08 16:11:15 -06:00
peer.go peer: Offset ping interval from idle timeout. 2021-11-10 15:47:09 -06:00
README.md multi: Update README.md files for go modules. 2021-01-22 14:39:23 -06:00

peer

Build Status ISC License Doc

Package peer provides a common base for creating and managing Decred network peers.

This package has intentionally been designed so it can be used as a standalone package for any projects needing a full featured Decred peer base to build on.

Overview

This package builds upon the wire package, which provides the fundamental primitives necessary to speak the Decred wire protocol, in order to simplify the process of creating fully functional peers. In essence, it provides a common base for creating concurrent safe fully validating nodes, Simplified Payment Verification (SPV) nodes, proxies, etc.

A quick overview of the major features peer provides are as follows:

  • Provides a basic concurrent safe Decred peer for handling Decred communications via the peer-to-peer protocol
  • Full duplex reading and writing of Decred protocol messages
  • Automatic handling of the initial handshake process including protocol version negotiation
  • Asynchronous message queueing of outbound messages with optional channel for notification when the message is actually sent
  • Flexible peer configuration
    • Caller is responsible for creating outgoing connections and listening for incoming connections so they have flexibility to establish connections as they see fit (proxies, etc)
    • User agent name and version
    • Decred network
    • Service support signalling (full nodes, etc)
    • Maximum supported protocol version
    • Ability to register callbacks for handling Decred protocol messages
  • Inventory message batching and send trickling with known inventory detection and avoidance
  • Automatic periodic keep-alive pinging and pong responses
  • Random nonce generation and self connection detection
  • Snapshottable peer statistics such as the total number of bytes read and written, the remote address, user agent, and negotiated protocol version
  • Helper functions pushing addresses, getblocks, getheaders, and reject messages
    • These could all be sent manually via the standard message output function, but the helpers provide additional nice functionality such as duplicate filtering and address randomization
  • Ability to wait for shutdown/disconnect
  • Comprehensive test coverage

Installation and Updating

This package is part of the github.com/decred/dcrd/peer/v2 module. Use the standard go tooling for working with modules to incorporate it.

Examples

  • New Outbound Peer Example Demonstrates the basic process for initializing and creating an outbound peer. Peers negotiate by exchanging version and verack messages. For demonstration, a simple handler for the version message is attached to the peer.

License

Package peer is licensed under the copyfree ISC License.