util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidWSCommand = errors.New("invalid webssocket command")
)

Functions

func MerkleRoot added in v0.2.0

func MerkleRoot(files []v1.File, md []v1.Metadata) (string, error)

MerkleRoot converts the passed in list of files and metadata into SHA256 digests then calculates and returns the merkle root of the digests.

func SubsciptionReqAuth

func SubsciptionReqAuth(cmd string) bool

func ValidSubscription

func ValidSubscription(cmd string) bool

func WSJSON

func WSJSON(cmd, id string, payload interface{}) ([][]byte, error)

WSJSON returns the JSON representation of a wire command. This function must always match WSWrite.

func WSRead

func WSRead(c *websocket.Conn) (string, string, interface{}, error)

func WSWrite

func WSWrite(c *websocket.Conn, cmd, id string, payload interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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