peer

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingKey when a key is not passed
	ErrMissingKey = errors.New("missing key")
	// ErrECDSAPrivateKeyRequired when a key is not an ECDSA key
	ErrECDSAPrivateKeyRequired = errors.New(
		"network currently requires an ecdsa private key")
)

Functions

This section is empty.

Types

type Addresses

type Addresses []string

type CryptoPublicKeySyncList added in v0.5.0

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

CryptoPublicKeySyncList -

func NewCryptoPublicKeyValueTypeSyncMap added in v0.5.0

func NewCryptoPublicKeyValueTypeSyncMap() *CryptoPublicKeySyncList

NewCryptoPublicKeyValueTypeSyncMap constructs a new SyncMap

func (*CryptoPublicKeySyncList) Delete added in v0.5.0

Delete -

func (*CryptoPublicKeySyncList) Exists added in v0.5.0

Exists -

func (*CryptoPublicKeySyncList) Put added in v0.5.0

Put -

func (*CryptoPublicKeySyncList) Range added in v0.5.0

func (m *CryptoPublicKeySyncList) Range(i func(k crypto.PublicKey) bool)

Range -

type LocalPeer

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

func NewLocalPeer

func NewLocalPeer(
	hostname string,
	peerPrivateKey crypto.PrivateKey,
) (*LocalPeer, error)

func (*LocalPeer) AddAddress

func (p *LocalPeer) AddAddress(protocol string, addrs []string)

func (*LocalPeer) AddContentHash

func (p *LocalPeer) AddContentHash(hashes ...object.Hash)

AddContentHash that should be published with the peer info

func (*LocalPeer) AddContentTypes added in v0.5.0

func (p *LocalPeer) AddContentTypes(types ...string)

func (*LocalPeer) AddIdentityKey

func (p *LocalPeer) AddIdentityKey(identityPrivateKey crypto.PrivateKey) error

func (*LocalPeer) AddRelays added in v0.5.0

func (p *LocalPeer) AddRelays(relayPeer crypto.PublicKey)

func (*LocalPeer) GetAddresses

func (p *LocalPeer) GetAddresses() []string

func (*LocalPeer) GetCertificates added in v0.5.0

func (p *LocalPeer) GetCertificates() []*object.Certificate

GetCertificate returns the peer's certificate

func (*LocalPeer) GetContentHashes

func (p *LocalPeer) GetContentHashes() []object.Hash

func (*LocalPeer) GetContentTypes added in v0.5.0

func (p *LocalPeer) GetContentTypes() []string

func (*LocalPeer) GetHostname

func (p *LocalPeer) GetHostname() string

func (*LocalPeer) GetIdentityPrivateKey added in v0.5.0

func (p *LocalPeer) GetIdentityPrivateKey() crypto.PrivateKey

func (*LocalPeer) GetIdentityPublicKey added in v0.5.0

func (p *LocalPeer) GetIdentityPublicKey() crypto.PublicKey

func (*LocalPeer) GetPeerPrivateKey added in v0.5.0

func (p *LocalPeer) GetPeerPrivateKey() crypto.PrivateKey

func (*LocalPeer) GetPeerPublicKey added in v0.5.0

func (p *LocalPeer) GetPeerPublicKey() crypto.PublicKey

func (*LocalPeer) GetSignedPeer

func (p *LocalPeer) GetSignedPeer() *Peer

GetSignedPeer returns the local peer info

func (*LocalPeer) OnAddressesUpdated

func (p *LocalPeer) OnAddressesUpdated(h OnAddressesUpdated)

func (*LocalPeer) OnContentHashesUpdated

func (p *LocalPeer) OnContentHashesUpdated(h OnContentHashesUpdated)

func (*LocalPeer) RemoveContentHash

func (p *LocalPeer) RemoveContentHash(hashes ...object.Hash)

RemoveContentHash from the peer info

type LookupFilter added in v0.5.0

type LookupFilter func(*Peer) bool

LookupOptions

type LookupOption added in v0.5.0

type LookupOption func(*LookupOptions)

LookupOptions

func LookupByCertificateSigner added in v0.5.0

func LookupByCertificateSigner(certSigner crypto.PublicKey) LookupOption

LookupByCertificateSigner matches certificate signers

func LookupByContentHash added in v0.5.0

func LookupByContentHash(hash object.Hash) LookupOption

LookupByContentHash matches content hashes

func LookupByContentType added in v0.5.0

func LookupByContentType(contentType string) LookupOption

LookupByContentType matches content hashes

func LookupByOwner added in v0.5.0

func LookupByOwner(keys ...crypto.PublicKey) LookupOption

LookupByOwner matches the peer key

func LookupOnlyLocal added in v0.5.0

func LookupOnlyLocal() LookupOption

LookupOnlyLocal forces the discoverer to only look at its cache

type LookupOptions added in v0.5.0

type LookupOptions struct {
	Local bool
	// Lookups are strings we are looking for, will be used to create a
	// bloom filter when forwarding the lookup request to providers
	Lookups []string
	// filters are the lookups equivalents for matching local peers
	Filters []LookupFilter
}

LookupOptions

func ParseLookupOptions added in v0.5.0

func ParseLookupOptions(opts ...LookupOption) *LookupOptions

func (LookupOptions) Match added in v0.5.0

func (l LookupOptions) Match(p *Peer) bool

type LookupRequest added in v0.5.0

type LookupRequest struct {
	Stream     object.Hash
	Parents    []object.Hash
	Owners     []crypto.PublicKey
	Policy     object.Policy
	Signatures []object.Signature
	Nonce      string
	Bloom      []int64
	// contains filtered or unexported fields
}

func (*LookupRequest) FromObject added in v0.5.0

func (e *LookupRequest) FromObject(o object.Object) error

func (LookupRequest) GetSchema added in v0.5.0

func (e LookupRequest) GetSchema() *object.SchemaObject

func (LookupRequest) GetType added in v0.5.0

func (e LookupRequest) GetType() string

func (LookupRequest) ToObject added in v0.5.0

func (e LookupRequest) ToObject() object.Object

type LookupResponse added in v0.5.0

type LookupResponse struct {
	Stream     object.Hash
	Parents    []object.Hash
	Owners     []crypto.PublicKey
	Policy     object.Policy
	Signatures []object.Signature
	Nonce      string
	Bloom      []int64
	Peers      []*Peer
	// contains filtered or unexported fields
}

func (*LookupResponse) FromObject added in v0.5.0

func (e *LookupResponse) FromObject(o object.Object) error

func (LookupResponse) GetSchema added in v0.5.0

func (e LookupResponse) GetSchema() *object.SchemaObject

func (LookupResponse) GetType added in v0.5.0

func (e LookupResponse) GetType() string

func (LookupResponse) ToObject added in v0.5.0

func (e LookupResponse) ToObject() object.Object

type ObjectHashSyncList added in v0.5.0

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

ObjectHashSyncList -

func NewObjectHashValueTypeSyncMap added in v0.5.0

func NewObjectHashValueTypeSyncMap() *ObjectHashSyncList

NewObjectHashValueTypeSyncMap constructs a new SyncMap

func (*ObjectHashSyncList) Delete added in v0.5.0

func (m *ObjectHashSyncList) Delete(k object.Hash)

Delete -

func (*ObjectHashSyncList) Exists added in v0.5.0

func (m *ObjectHashSyncList) Exists(k object.Hash) bool

Exists -

func (*ObjectHashSyncList) Put added in v0.5.0

func (m *ObjectHashSyncList) Put(k object.Hash)

Put -

func (*ObjectHashSyncList) Range added in v0.5.0

func (m *ObjectHashSyncList) Range(i func(k object.Hash) bool)

Range -

type OnAddressesUpdated

type OnAddressesUpdated func([]string)

type OnContentHashesUpdated

type OnContentHashesUpdated func([]object.Hash)

type Peer

type Peer struct {
	Stream       object.Hash
	Parents      []object.Hash
	Owners       []crypto.PublicKey
	Policy       object.Policy
	Signatures   []object.Signature
	Version      int64
	Addresses    []string
	Bloom        []int64
	ContentTypes []string
	Certificates []*object.Certificate
	Relays       []crypto.PublicKey
	// contains filtered or unexported fields
}

func Unique added in v0.5.0

func Unique(peers []*Peer) []*Peer

func (*Peer) Address

func (pi *Peer) Address() string

Address of the peer

func (*Peer) FromObject

func (e *Peer) FromObject(o object.Object) error

func (Peer) GetSchema added in v0.5.0

func (e Peer) GetSchema() *object.SchemaObject

func (Peer) GetType

func (e Peer) GetType() string

func (*Peer) PublicKey added in v0.5.0

func (pi *Peer) PublicKey() crypto.PublicKey

func (Peer) ToObject

func (e Peer) ToObject() object.Object

type StringAddressesSyncMap

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

StringAddressesSyncMap -

func NewStringAddressesSyncMap

func NewStringAddressesSyncMap() *StringAddressesSyncMap

NewStringAddressesSyncMap constructs a new SyncMap

func (*StringAddressesSyncMap) Delete

func (m *StringAddressesSyncMap) Delete(k string)

Delete -

func (*StringAddressesSyncMap) Get

Get -

func (*StringAddressesSyncMap) Put

func (m *StringAddressesSyncMap) Put(k string, v *Addresses)

Put -

func (*StringAddressesSyncMap) Range

func (m *StringAddressesSyncMap) Range(i func(k string, v *Addresses) bool)

Range -

Jump to

Keyboard shortcuts

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