Documentation
¶
Index ¶
- type Header
- type Object
- type OutlineTransaction
- type RPCDiscoverIP
- type RPCRelayHeader
- type RPCRelayTransactionSet
- type RPCRelayV2BlockOutline
- type RPCRelayV2Header
- type RPCRelayV2TransactionSet
- type RPCSendBlk
- type RPCSendBlocks
- type RPCSendBlocksMoreAvailable
- type RPCSendCheckpoint
- type RPCSendTransactions
- type RPCSendV2Blocks
- type RPCShareNodes
- type Stream
- func (s *Stream) Close() error
- func (s *Stream) ReadID() (id types.Specifier, err error)
- func (s *Stream) ReadRequest(r Object) error
- func (s *Stream) ReadResponse(r Object) error
- func (s *Stream) SetDeadline(t time.Time) error
- func (s *Stream) WriteID(r Object) error
- func (s *Stream) WriteRequest(r Object) error
- func (s *Stream) WriteResponse(r Object) error
- type Transport
- type UniqueID
- type V2BlockOutline
- func (bo *V2BlockOutline) Complete(cs consensus.State, txns []types.Transaction, v2txns []types.V2Transaction) (types.Block, []types.Hash256)
- func (bo V2BlockOutline) ID(cs consensus.State) types.BlockID
- func (bo V2BlockOutline) Missing() (missing []types.Hash256)
- func (bo *V2BlockOutline) RemoveTransactions(txns []types.Transaction, v2txns []types.V2Transaction)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Header ¶
A Header contains various peer metadata which is exchanged during the gateway handshake.
type Object ¶ added in v0.2.1
type Object interface {
// contains filtered or unexported methods
}
An Object can be sent or received via RPC.
func ObjectForID ¶ added in v0.2.1
ObjectForID returns the object type corresponding to the given RPC ID.
type OutlineTransaction ¶ added in v0.1.12
type OutlineTransaction struct { Hash types.Hash256 Transaction *types.Transaction V2Transaction *types.V2Transaction }
An OutlineTransaction identifies a transaction by its full hash. The actual transaction data may or may not be present.
type RPCDiscoverIP ¶
type RPCDiscoverIP struct { IP string // contains filtered or unexported fields }
RPCDiscoverIP requests the caller's externally-visible IP address.
type RPCRelayHeader ¶
type RPCRelayHeader struct { Header types.BlockHeader // contains filtered or unexported fields }
RPCRelayHeader relays a header.
type RPCRelayTransactionSet ¶
type RPCRelayTransactionSet struct { Transactions []types.Transaction // contains filtered or unexported fields }
RPCRelayTransactionSet relays a transaction set.
type RPCRelayV2BlockOutline ¶ added in v0.1.12
type RPCRelayV2BlockOutline struct { Block V2BlockOutline // contains filtered or unexported fields }
RPCRelayV2BlockOutline relays a v2 block outline.
type RPCRelayV2Header ¶ added in v0.1.12
type RPCRelayV2Header struct { Header types.BlockHeader // contains filtered or unexported fields }
RPCRelayV2Header relays a v2 block header.
type RPCRelayV2TransactionSet ¶ added in v0.1.12
type RPCRelayV2TransactionSet struct { Index types.ChainIndex Transactions []types.V2Transaction // contains filtered or unexported fields }
RPCRelayV2TransactionSet relays a v2 transaction set.
type RPCSendBlk ¶
RPCSendBlk requests a single block.
type RPCSendBlocks ¶
RPCSendBlocks requests a set of blocks.
type RPCSendBlocksMoreAvailable ¶ added in v0.2.1
type RPCSendBlocksMoreAvailable struct { MoreAvailable bool // contains filtered or unexported fields }
RPCSendBlocksMoreAvailable indicates whether more blocks are available.
type RPCSendCheckpoint ¶ added in v0.1.12
RPCSendCheckpoint requests a checkpoint.
type RPCSendTransactions ¶ added in v0.1.12
type RPCSendTransactions struct { Index types.ChainIndex Hashes []types.Hash256 Transactions []types.Transaction V2Transactions []types.V2Transaction }
RPCSendTransactions requests a subset of a block's transactions.
type RPCSendV2Blocks ¶ added in v0.1.12
type RPCSendV2Blocks struct { History []types.BlockID Max uint64 Blocks []types.Block Remaining uint64 }
RPCSendV2Blocks requests a set of blocks.
type RPCShareNodes ¶
type RPCShareNodes struct { // contains filtered or unexported fields }
RPCShareNodes requests a list of potential peers.
type Stream ¶ added in v0.2.1
type Stream struct {
// contains filtered or unexported fields
}
A Stream provides a multiplexed stream for the Sia gateway protocol.
func (*Stream) ReadRequest ¶ added in v0.2.1
ReadRequest reads a request from the stream into r.
func (*Stream) ReadResponse ¶ added in v0.2.1
ReadResponse reads a response from the stream into r.
func (*Stream) SetDeadline ¶ added in v0.2.1
SetDeadline implements net.Conn.
func (*Stream) WriteRequest ¶ added in v0.2.1
WriteRequest writes the request field of r to the stream.
func (*Stream) WriteResponse ¶ added in v0.2.1
WriteResponse writes the response field of r to the stream.
type Transport ¶ added in v0.2.1
type Transport struct { UniqueID UniqueID Version string Addr string // contains filtered or unexported fields }
A Transport provides a multiplexing transport for the Sia gateway protocol.
func (*Transport) AcceptStream ¶ added in v0.2.1
AcceptStream accepts an incoming multiplexed stream.
func (*Transport) DialStream ¶ added in v0.2.1
DialStream opens a new multiplexed stream.
func (*Transport) SupportsV2 ¶ added in v0.2.1
SupportsV2 returns true if the transport supports v2 RPCs.
type UniqueID ¶
type UniqueID [8]byte
A UniqueID is a randomly-generated nonce that helps prevent self-connections and double-connections.
func GenerateUniqueID ¶
func GenerateUniqueID() (id UniqueID)
GenerateUniqueID returns a random UniqueID.
type V2BlockOutline ¶ added in v0.1.12
type V2BlockOutline struct { Height uint64 ParentID types.BlockID Nonce uint64 Timestamp time.Time MinerAddress types.Address Transactions []OutlineTransaction }
A V2BlockOutline represents a Block with one or more transactions omitted. The original block can be reconstructed by matching the transaction hashes to transactions present in the txpool, or requesting them from peers.
func OutlineBlock ¶ added in v0.1.12
func OutlineBlock(b types.Block, txns []types.Transaction, v2txns []types.V2Transaction) V2BlockOutline
OutlineBlock returns a block outline for b that omits the specified transactions.
func (*V2BlockOutline) Complete ¶ added in v0.1.12
func (bo *V2BlockOutline) Complete(cs consensus.State, txns []types.Transaction, v2txns []types.V2Transaction) (types.Block, []types.Hash256)
Complete attempts to reconstruct the original block using the supplied transactions. If the block cannot be fully reconstructed, it returns the hashes of the missing transactions.
func (V2BlockOutline) ID ¶ added in v0.1.12
func (bo V2BlockOutline) ID(cs consensus.State) types.BlockID
ID returns a hash that uniquely identifies the block.
func (V2BlockOutline) Missing ¶ added in v0.1.12
func (bo V2BlockOutline) Missing() (missing []types.Hash256)
Missing returns the hashes of transactions that are missing from the block.
func (*V2BlockOutline) RemoveTransactions ¶ added in v0.1.12
func (bo *V2BlockOutline) RemoveTransactions(txns []types.Transaction, v2txns []types.V2Transaction)
RemoveTransactions removes the specified transactions from the block.