seedlist

package
v0.0.0-...-69e5406 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

*

  • Description:
  • Author: Yihen.Liu
  • Create: 2019-07-31

*

  • Description:
  • Author: Yihen.Liu
  • Create: 2019-08-01

Index

Constants

View Source
const ClientVersion = "go-p2p-node/0.0.1"

node client version

Variables

This section is empty.

Functions

func AuthenticateMessage

func AuthenticateMessage(message proto.Message, data *wire.MessageData) bool

Authenticate incoming p2p message message: a protobufs go data object data: common p2p message data

func NewMessageData

func NewMessageData(n *SeedNode, messageId string, gossip bool) *wire.MessageData

helper method - generate message data shared between all node's p2p protocols messageId: unique for requests, copied from request for responses

func SendProtoMessage

func SendProtoMessage(data proto.Message, s core.Stream) bool

helper method - writes a protobuf go data object to a network stream data: reference of protobuf go data object to send (not the object itself) s: network stream to write the data to

func SignData

func SignData(n *SeedNode, data []byte) ([]byte, error)

sign binary data using the local node's private key

func SignProtoMessage

func SignProtoMessage(n *SeedNode, message proto.Message) ([]byte, error)

sign an outgoing p2p message payload

func VerifyData

func VerifyData(data []byte, signature []byte, peerId peer.ID, pubKeyData []byte) bool

Verify incoming p2p message data integrity data: data to verify signature: author signature provided in the message payload peerId: author peer id from the message payload pubKeyData: author public key from the message payload

Types

type Seed

type Seed struct {
	Hash      string
	Host      string //ip:port
	Timestamp time.Time
}

type SeedListProtocol

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

func NewSeedListProtocol

func NewSeedListProtocol(node *SeedNode, done chan struct{}) *SeedListProtocol

func (*SeedListProtocol) RequestSeedList

func (seed *SeedListProtocol) RequestSeedList(pid peer.ID) bool

func (*SeedListProtocol) StartSeedlistGossipPubSub

func (*SeedListProtocol) StartSeedlistGossipPubSub(ctx context.Context, host core.Host)

type SeedNode

type SeedNode struct {
	core.Host         // lib-p2p host
	*SeedListProtocol // seedlist protocol impl
}

Node type - a p2p host implementing one or more p2p protocols

func NewSeedNode

func NewSeedNode(host core.Host, done chan struct{}) *SeedNode

Create a new node with its implemented protocols

Jump to

Keyboard shortcuts

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