Documentation ¶
Index ¶
- Constants
- Variables
- func ListenForUdp()
- func SendKeepAlive(peer Peer) error
- func SendKeepAlives(params []interface{})
- type Alarm
- type AlarmFn
- type Message
- type MessageBlock
- type MessageBlockCommon
- type MessageConfirmAck
- type MessageConfirmReq
- type MessageHeader
- type MessageKeepAlive
- type MessagePublish
- type MessageVote
- type Peer
Constants ¶
View Source
const ( Message_invalid byte = iota Message_not_a_type Message_keepalive Message_publish Message_confirm_req Message_confirm_ack Message_bulk_pull Message_bulk_push Message_frontier_req )
Non-idiomatic constant names to keep consistent with reference implentation
View Source
const ( BlockType_invalid byte = iota BlockType_not_a_block BlockType_send BlockType_receive BlockType_open BlockType_change )
View Source
const VersionMax = 0x05
View Source
const VersionMin = 0x04
View Source
const VersionUsing = 0x05
Variables ¶
View Source
var DefaultPeer = Peer{ net.ParseIP("::ffff:192.168.0.70"), 7075, nil, }
View Source
var MagicNumber = [2]byte{'R', 'C'}
View Source
var PeerList = []Peer{DefaultPeer}
View Source
var PeerSet = map[string]bool{DefaultPeer.String(): true}
Functions ¶
func ListenForUdp ¶
func ListenForUdp()
func SendKeepAlive ¶
func SendKeepAlives ¶
func SendKeepAlives(params []interface{})
Types ¶
type MessageBlock ¶
type MessageBlock struct { Type byte SourceOrPrevious [32]byte // Source for open, previous for others RepDestOrSource [32]byte // Rep for open/change, dest for send, source for receive Account [32]byte // Account for open Balance [16]byte // Balance for send MessageBlockCommon }
func (*MessageBlock) Read ¶
func (m *MessageBlock) Read(messageBlockType byte, buf *bytes.Buffer) error
func (*MessageBlock) ToBlock ¶
func (m *MessageBlock) ToBlock() blocks.Block
type MessageBlockCommon ¶
func (*MessageBlockCommon) ReadCommon ¶
func (m *MessageBlockCommon) ReadCommon(buf *bytes.Buffer) error
func (*MessageBlockCommon) WriteCommon ¶
func (m *MessageBlockCommon) WriteCommon(buf *bytes.Buffer) error
type MessageConfirmAck ¶
type MessageConfirmAck struct { MessageHeader MessageVote }
type MessageConfirmReq ¶
type MessageConfirmReq struct { MessageHeader MessageBlock }
type MessageHeader ¶
type MessageHeader struct { MagicNumber [2]byte VersionMax byte VersionUsing byte VersionMin byte MessageType byte Extensions byte BlockType byte }
func (*MessageHeader) ReadHeader ¶
func (m *MessageHeader) ReadHeader(buf *bytes.Buffer) error
func (*MessageHeader) WriteHeader ¶
func (m *MessageHeader) WriteHeader(buf *bytes.Buffer) error
type MessageKeepAlive ¶
type MessageKeepAlive struct { MessageHeader Peers []Peer }
func CreateKeepAlive ¶
func CreateKeepAlive(peers []Peer) *MessageKeepAlive
func (*MessageKeepAlive) Handle ¶
func (m *MessageKeepAlive) Handle() error
type MessagePublish ¶
type MessagePublish struct { MessageHeader MessageBlock }
type MessageVote ¶
type MessageVote struct { Account [32]byte Signature [64]byte Sequence [8]byte MessageBlock }
func (*MessageVote) Hash ¶
func (m *MessageVote) Hash() []byte
Click to show internal directories.
Click to hide internal directories.