headerutils

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFieldLength denotes p2p.Header having malformed field length in bytes
	ErrFieldLength = errors.New("field length error")
	// ErrNoIndexHeader denotes p2p.Header lacking specified field
	ErrNoIndexHeader = errors.New("no index header")
	// ErrNoTargetHeader denotes p2p.Header lacking specified field
	ErrNoTargetHeader = errors.New("no target header")
	// ErrNoPriceHeader denotes p2p.Header lacking specified field
	ErrNoPriceHeader = errors.New("no price header")
)

Functions

func MakePricingHeaders

func MakePricingHeaders(chunkPrice uint64, addr swarm.Address) (p2p.Headers, error)

func MakePricingResponseHeaders

func MakePricingResponseHeaders(chunkPrice uint64, addr swarm.Address, index uint8) (p2p.Headers, error)

func ParseIndexHeader

func ParseIndexHeader(receivedHeaders p2p.Headers) (uint8, error)

func ParsePriceHeader

func ParsePriceHeader(receivedHeaders p2p.Headers) (uint64, error)

func ParsePricingHeaders

func ParsePricingHeaders(receivedHeaders p2p.Headers) (swarm.Address, uint64, error)

ParsePricingHeaders used by responder to read address and price from stream headers Returns an error if no target field attached or the contents of it are not readable

func ParsePricingResponseHeaders

func ParsePricingResponseHeaders(receivedHeaders p2p.Headers) (swarm.Address, uint64, uint8, error)

ParsePricingResponseHeaders used by requester to read address, price and index from response headers Returns an error if any fields are missing or target is unreadable

func ParseTargetHeader

func ParseTargetHeader(receivedHeaders p2p.Headers) (swarm.Address, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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