peer

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerInfoRequestType = "/peer.request"
)
View Source
const (
	PeerInfoType = "/peer"
)

Variables

View Source
var (
	// ErrNotFound is returned wheh a requqested item in the collection does
	// not exist
	ErrNotFound = errors.New("peer not found")
)

Functions

This section is empty.

Types

type PeerInfo

type PeerInfo struct {
	Addresses    []string          `json:"addresses"`
	Protocols    []string          `json:"protocols"`
	ContentIDs   []string          `json:"contentIDs"`
	ContentTypes []string          `json:"contentTypes"`
	Signature    *crypto.Signature `json:"@signature"`
}

PeerInfo holds the information exchange needs to connect to a remote peer

func (*PeerInfo) Address

func (pi *PeerInfo) Address() string

Address of the peer

func (*PeerInfo) Fingerprint

func (pi *PeerInfo) Fingerprint() crypto.Fingerprint

Fingerprint of signer

func (*PeerInfo) FromObject

func (s *PeerInfo) FromObject(o *object.Object) error

FromObject populates the struct from a f12n object

func (PeerInfo) GetType

func (s PeerInfo) GetType() string

GetType returns the object's type

func (PeerInfo) ToObject

func (s PeerInfo) ToObject() *object.Object

ToObject returns a f12n object

type PeerInfoCollection

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

PeerInfoCollection allows concurrent access to peerinfos

func (*PeerInfoCollection) All

func (c *PeerInfoCollection) All() ([]*PeerInfo, error)

All returns all items in the collection

func (*PeerInfoCollection) Get

func (c *PeerInfoCollection) Get(fingerprint string) (*PeerInfo, error)

Get retuns a single item from the collection given its id

func (*PeerInfoCollection) Put

func (c *PeerInfoCollection) Put(peerInfo *PeerInfo) error

Put adds or overwrites an item in the collection

type PeerInfoRequest

type PeerInfoRequest struct {
	Keys         []crypto.Fingerprint
	Protocols    []string
	ContentIDs   []string
	ContentTypes []string
}

PeerInfoRequest is a request for a peer info

func (*PeerInfoRequest) FromObject

func (s *PeerInfoRequest) FromObject(o *object.Object) error

FromObject populates the struct from a f12n object

func (PeerInfoRequest) GetType

func (s PeerInfoRequest) GetType() string

GetType returns the object's type

func (PeerInfoRequest) ToObject

func (s PeerInfoRequest) ToObject() *object.Object

ToObject returns a f12n object

Jump to

Keyboard shortcuts

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