peer

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2016 License: ISC Imports: 16 Imported by: 0

Documentation

Overview

P2P client/server system for bitmarkd

This used RPC to send message to connected peers using the bilateralrpc module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectTo

func ConnectTo(publicKey string, address string) error

initiate a connection

func ConnectionCount

func ConnectionCount() int

count of active connections

func Finalise

func Finalise() error

finialise - stop all background tasks

func Initialise

func Initialise(addresses []string, networkName string, publicKey string, privateKey string) error

start up the peer communications system

Types

type Asset

type Asset struct {
	// contains filtered or unexported fields
}

func (*Asset) Get

func (t *Asset) Get(arguments *AssetGetArguments, reply *AssetGetReply) error

read a specific asset

type AssetGetArguments

type AssetGetArguments struct {
	AssetIndex transaction.AssetIndex
}

type AssetGetReply

type AssetGetReply struct {
	Digest     transaction.Link
	AssetIndex transaction.AssetIndex
	Data       []byte
}

type Block

type Block struct {
	// contains filtered or unexported fields
}

func (*Block) Get

func (t *Block) Get(arguments *BlockGetArguments, reply *BlockGetReply) error

read a specific block

func (*Block) Number

func (t *Block) Number(arguments *BlockNumberArguments, reply *BlockNumberReply) error

fetch the highest block number available

func (*Block) Put

func (t *Block) Put(arguments *BlockPutArguments, reply *BlockPutReply) error

new incoming block

type BlockGetArguments

type BlockGetArguments struct {
	Number uint64
}

type BlockGetReply

type BlockGetReply struct {
	Data []byte
}

type BlockGetResult

type BlockGetResult struct {
	From  string
	Reply BlockGetReply
	Err   error
}

type BlockNumberArguments

type BlockNumberArguments struct {
}

type BlockNumberReply

type BlockNumberReply struct {
	Number uint64
}

type BlockNumberResult

type BlockNumberResult struct {
	From  string
	Reply BlockNumberReply
	Err   error
}

type for returned block numbers

type BlockPair

type BlockPair struct {
	// contains filtered or unexported fields
}

type to hold the broadcast block

type BlockPutArguments

type BlockPutArguments struct {
	Bilateral_SENDER string // magick field
	Block            block.Packed
}

type BlockPutReply

type BlockPutReply struct {
	Duplicate bool
}

type ByBlockNumber

type ByBlockNumber []BlockNumberResult

ByBlockNumber implements sort.Interface for []BlockNumberReply based on the Reply.Number field.

func (ByBlockNumber) Len

func (a ByBlockNumber) Len() int

sort interface Note: need '>' to get highest block first

func (ByBlockNumber) Less

func (a ByBlockNumber) Less(i, j int) bool

func (ByBlockNumber) Swap

func (a ByBlockNumber) Swap(i, j int)

type Certificate

type Certificate struct {
	// contains filtered or unexported fields
}

type to hold Certificate

func (*Certificate) Get

func (t *Certificate) Get(arguments *GetCertificateArguments, reply *GetCertificateReply) error

func (*Certificate) Put

func (t *Certificate) Put(arguments *PutCertificateArguments, reply *PutCertificateReply) error

type GetCertificateArguments

type GetCertificateArguments struct {
	Fingerprint util.FingerprintBytes
}

type GetCertificateReply

type GetCertificateReply struct {
	Certificate []byte
}

type NeighbourArguments

type NeighbourArguments struct {
	Start *gnomon.Cursor
	Count int
}

type NeighbourReply

type NeighbourReply struct {
	Peers     []announce.RecentData
	NextStart *gnomon.Cursor
}

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

type to hold Peer

func (*Peer) List

func (t *Peer) List(arguments *NeighbourArguments, reply *NeighbourReply) error

func (*Peer) Put

func (t *Peer) Put(arguments *PeerArguments, reply *PeerReply) error

func (*Peer) RPCs

func (t *Peer) RPCs(arguments *NeighbourArguments, reply *NeighbourReply) error

type PeerArguments

type PeerArguments struct {
	Address     string
	Fingerprint util.FingerprintBytes
}

type PeerReply

type PeerReply struct {
	Added           bool
	NeedCertificate bool
}

type PutCertificateArguments

type PutCertificateArguments struct {
	Certificate []byte
}

type PutCertificateReply

type PutCertificateReply struct {
}

type RPCs

type RPCs struct {
	// contains filtered or unexported fields
}

type to hold RPCs

func (*RPCs) List

func (t *RPCs) List(arguments *RpcListArguments, reply *RpcListReply) error

func (*RPCs) Put

func (t *RPCs) Put(arguments *RpcPutArguments, reply *RpcPutReply) error

type RpcListArguments

type RpcListArguments struct {
	Start *gnomon.Cursor
	Count int
}

type RpcListReply

type RpcListReply struct {
	Peers     []announce.RecentData
	NextStart *gnomon.Cursor
}

type RpcPutArguments

type RpcPutArguments struct {
	Address     string
	Fingerprint util.FingerprintBytes
}

type RpcPutReply

type RpcPutReply struct {
	Added           bool
	NeedCertificate bool
}

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func (*Transaction) Get

func (t *Transaction) Get(arguments *TransactionGetArguments, reply *TransactionGetReply) error

read a specific transaction

func (*Transaction) Put

func (t *Transaction) Put(arguments *TransactionPutArguments, reply *TransactionPutReply) error

new incoming transaction

type TransactionGetArguments

type TransactionGetArguments struct {
	TxId transaction.Link
}

type TransactionGetReply

type TransactionGetReply struct {
	State transaction.State
	Data  []byte
}

type TransactionGetResult

type TransactionGetResult struct {
	From  string
	Reply TransactionGetReply
	Err   error
}

for getting transactions

type TransactionPutArguments

type TransactionPutArguments struct {
	Bilateral_SENDER string // magick field
	Tx               transaction.Packed
}

type TransactionPutReply

type TransactionPutReply struct {
	Duplicate bool
}

type TransactionPutResult

type TransactionPutResult struct {
	From  string
	Reply TransactionPutReply
	Err   error
}

for putting transactions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL