protocol

package
v0.0.0-...-7de8d3f Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ETH   = "eth"
	OTHER = "_"
)

Functions

This section is empty.

Types

type Protocol

type Protocol struct {
	// Name should contain the official protocol name,
	// often a three-letter word.
	Name string

	// Version should contain the version number of the protocol.
	Version uint

	// Length should contain the number of message codes used
	// by the protocol.
	Length uint64

	// Run is called in a new goroutine when the protocol has been
	// negotiated with a ethPeer. It should read and write messages from
	// rw. The Payload for each message must be fully consumed.
	//
	// The ethPeer connection is closed when Start returns. It should return
	// any protocol-level error (such as an I/O error) that is
	// encountered.
	RunFunc func(peer IPeer)

	CloseFunc func(peer IPeer)
}

Protocol represents a P2P subprotocol implementation.

func (*Protocol) Close

func (p *Protocol) Close(peer IPeer)

func (*Protocol) GetName

func (p *Protocol) GetName() string

func (*Protocol) Run

func (p *Protocol) Run(peer IPeer)

func (*Protocol) String

func (p *Protocol) String() string

Jump to

Keyboard shortcuts

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