peer

package
Version: v0.0.0-...-8d1dda0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultP2PPort = "9080"
)

Variables

View Source
var Service = &P2PService{
	ctx: context.Background(),
}

Functions

func GetP2PPort

func GetP2PPort() string

func Routes

func Routes() (router *Router)

Types

type Binding

type Binding = bufio.ReadWriter

A binding to another peer, represented by a rw buffer.

type P2PService

type P2PService struct {
	// The urls under which the peer can be accessed.
	// This variable is set when `Run` is called.
	URLs []url.URL
	// contains filtered or unexported fields
}

func (*P2PService) Broadcast

func (service *P2PService) Broadcast(object interface{})

Broadcast an object to all bound peers and the dashboard. The object will be JSON serialized for transfer.

func (*P2PService) Run

func (service *P2PService) Run(bootstrapHost string)

Initialize the blockchain peer. Use the parameter `bootstrapTarget` to add a target url for the bootstrapping service. Note that this method will never return.

func (*P2PService) SubscribeIncoming

func (service *P2PService) SubscribeIncoming(channel chan []byte)

func (*P2PService) SubscribeOutgoing

func (service *P2PService) SubscribeOutgoing(channel chan []byte)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL