locators

package
v0.0.0-...-97b9ebb Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package locators represents node identities, it's hash function representing in Multihash format: https://multiformats.io/multihash/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrUnsupportedVersion

type ErrUnsupportedVersion struct {
	// contains filtered or unexported fields
}

ErrUnsupportedVersion error if binary versio is not supported

func (*ErrUnsupportedVersion) Error

func (e *ErrUnsupportedVersion) Error() string

func (*ErrUnsupportedVersion) Version

func (e *ErrUnsupportedVersion) Version() []byte

Version which is not supported

type Node

type Node struct {
	ID      mh.Multihash
	PubKey  []byte
	PrivKey []byte
}

Node core identities

func FromKeys

func FromKeys(pub, priv []byte) (*Node, error)

FromKeys creates new Node struct from public and private keys by generating node id as multihash of SHA1 of public key

func (*Node) GoString

func (n *Node) GoString() string

GoString returns debug information for `%#v` format option

func (*Node) MarshalBinary

func (n *Node) MarshalBinary() ([]byte, error)

MarshalBinary is a binary encoding implementation

func (*Node) String

func (n *Node) String() string

func (*Node) UnmarshalBinary

func (n *Node) UnmarshalBinary(data []byte) error

UnmarshalBinary is a binary decoding implementation

type UnsupportedHashError

type UnsupportedHashError struct {
	// Name of hash algorithm
	Name string
}

UnsupportedHashError if hashing algorithm specified is not supported

func (*UnsupportedHashError) Error

func (e *UnsupportedHashError) Error() string

Jump to

Keyboard shortcuts

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