headerutils

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: BSD-3-Clause Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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