github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/peer/README.md (about)

     1  peer
     2  ====
     3  
     4  [![Build Status](http://img.shields.io/travis/dashpay/godash.svg)]
     5  (https://travis-ci.org/dashpay/godash) [![ISC License]
     6  (http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
     7  [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)]
     8  (http://godoc.org/github.com/dashpay/godash/peer)
     9  
    10  Package peer provides a common base for creating and managing bitcoin network
    11  peers.
    12  
    13  This package has intentionally been designed so it can be used as a standalone
    14  package for any projects needing a full featured bitcoin peer base to build on.
    15  
    16  ## Overview
    17  
    18  This package builds upon the wire package, which provides the fundamental
    19  primitives necessary to speak the bitcoin wire protocol, in order to simplify
    20  the process of creating fully functional peers.  In essence, it provides a
    21  common base for creating concurrent safe fully validating nodes, Simplified
    22  Payment Verification (SPV) nodes, proxies, etc.
    23  
    24  A quick overview of the major features peer provides are as follows:
    25  
    26   - Provides a basic concurrent safe bitcoin peer for handling bitcoin
    27     communications via the peer-to-peer protocol
    28   - Full duplex reading and writing of bitcoin protocol messages
    29   - Automatic handling of the initial handshake process including protocol
    30     version negotiation
    31   - Asynchronous message queueing of outbound messages with optional channel for
    32     notification when the message is actually sent
    33   - Flexible peer configuration
    34     - Caller is responsible for creating outgoing connections and listening for
    35       incoming connections so they have flexibility to establish connections as
    36       they see fit (proxies, etc)
    37     - User agent name and version
    38     - Bitcoin network
    39     - Service support signalling (full nodes, bloom filters, etc)
    40     - Maximum supported protocol version
    41     - Ability to register callbacks for handling bitcoin protocol messages
    42   - Inventory message batching and send trickling with known inventory detection
    43     and avoidance
    44   - Automatic periodic keep-alive pinging and pong responses
    45   - Random nonce generation and self connection detection
    46   - Proper handling of bloom filter related commands when the caller does not
    47     specify the related flag to signal support
    48     - Disconnects the peer when the protocol version is high enough
    49     - Does not invoke the related callbacks for older protocol versions
    50   - Snapshottable peer statistics such as the total number of bytes read and
    51     written, the remote address, user agent, and negotiated protocol version
    52   - Helper functions pushing addresses, getblocks, getheaders, and reject
    53     messages
    54     - These could all be sent manually via the standard message output function,
    55       but the helpers provide additional nice functionality such as duplicate
    56       filtering and address randomization
    57   - Ability to wait for shutdown/disconnect
    58   - Comprehensive test coverage
    59  
    60  ## Installation and Updating
    61  
    62  ```bash
    63  $ go get -u github.com/dashpay/godash/peer
    64  ```
    65  
    66  ## Examples
    67  
    68  * [New Outbound Peer Example]
    69    (https://godoc.org/github.com/dashpay/godash/peer#example-package--NewOutboundPeer)  
    70    Demonstrates the basic process for initializing and creating an outbound peer.
    71    Peers negotiate by exchanging version and verack messages.  For demonstration,
    72    a simple handler for the version message is attached to the peer.
    73  
    74  ## License
    75  
    76  Package peer is licensed under the [copyfree](http://copyfree.org) ISC License.