tinder

package
v2.442.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0, MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LocalDiscoveryName is the name of the localdiscovery driver
	LocalDiscoveryName = "localdisc"
)

Variables

View Source
var (
	ErrInvalidLengthRecords        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRecords          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRecords = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrNotSupported = fmt.Errorf("not supported")

Functions

func MockBufferSize added in v2.436.0

func MockBufferSize(size int) discovery.Option

Types

type AddrsFilter added in v2.436.0

type AddrsFilter = bhost.AddrsFactory

type AdvertiseOption added in v2.436.0

type AdvertiseOption func(opts *AdvertiseOptions) error

func StartAdvertisesFilterDrivers added in v2.436.0

func StartAdvertisesFilterDrivers(drivers ...string) AdvertiseOption

type AdvertiseOptions added in v2.436.0

type AdvertiseOptions struct {
	Filters map[string]struct{}
}

type DiscoveryAdaptater added in v2.436.0

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

func NewDiscoveryAdaptater added in v2.436.0

func NewDiscoveryAdaptater(logger *zap.Logger, service *Service) *DiscoveryAdaptater

func (*DiscoveryAdaptater) Advertise added in v2.436.0

func (a *DiscoveryAdaptater) Advertise(_ context.Context, topic string, opts ...discovery.Option) (time.Duration, error)

func (*DiscoveryAdaptater) Close added in v2.436.0

func (a *DiscoveryAdaptater) Close() error

func (*DiscoveryAdaptater) FindPeers added in v2.436.0

func (a *DiscoveryAdaptater) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

type DiscoveryDriver added in v2.436.0

type DiscoveryDriver struct {
	discovery.Discovery
	// contains filtered or unexported fields
}

func (*DiscoveryDriver) Advertise added in v2.436.0

func (d *DiscoveryDriver) Advertise(ctx context.Context, topic string, opts ...discovery.Option) (time.Duration, error)

discovery advertise

func (*DiscoveryDriver) FindPeers added in v2.436.0

func (d *DiscoveryDriver) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

discovery find peers

func (*DiscoveryDriver) Name added in v2.436.0

func (d *DiscoveryDriver) Name() string

func (*DiscoveryDriver) Subscribe added in v2.436.0

func (d *DiscoveryDriver) Subscribe(_ context.Context, _ string, _ ...discovery.Option) (<-chan peer.AddrInfo, error)

func (*DiscoveryDriver) Unregister added in v2.436.0

func (d *DiscoveryDriver) Unregister(_ context.Context, _ string, _ ...discovery.Option) error

type IDriver added in v2.436.0

type IDriver interface {
	Name() string
	Subscribe(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
	Unregister(ctx context.Context, topic string, opts ...discovery.Option) error

	// discovery
	Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error)
	FindPeers(ctx context.Context, ns string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)
}

func NewDiscoveryDriver added in v2.436.0

func NewDiscoveryDriver(name string, disc discovery.Discovery) IDriver

func NewRendezvousDiscovery

func NewRendezvousDiscovery(logger *zap.Logger, host host.Host, rdvPeer peer.ID, rng *mrand.Rand, emitters ...p2p_rp.RendezvousSyncClient) IDriver

func NewRoutingDiscoveryDriver added in v2.436.0

func NewRoutingDiscoveryDriver(name string, routing routing.Routing) IDriver

type LocalDiscovery added in v2.365.0

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

func NewLocalDiscovery added in v2.94.0

func NewLocalDiscovery(logger *zap.Logger, host host.Host, rng *rand.Rand) (*LocalDiscovery, error)

func (*LocalDiscovery) Advertise added in v2.365.0

func (ld *LocalDiscovery) Advertise(ctx context.Context, cid string, opts ...discovery.Option) (time.Duration, error)

func (*LocalDiscovery) Close added in v2.365.0

func (ld *LocalDiscovery) Close() error

func (*LocalDiscovery) FindPeers added in v2.365.0

func (ld *LocalDiscovery) FindPeers(ctx context.Context, cid string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

func (*LocalDiscovery) Name added in v2.436.0

func (ld *LocalDiscovery) Name() string

func (*LocalDiscovery) Subscribe added in v2.436.0

func (ld *LocalDiscovery) Subscribe(ctx context.Context, cid string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

func (*LocalDiscovery) Unregister added in v2.365.0

func (ld *LocalDiscovery) Unregister(ctx context.Context, cid string, _ ...discovery.Option) error

type MockDriverServer

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

func NewMockDriverServer added in v2.436.0

func NewMockDriverServer() *MockDriverServer

func (*MockDriverServer) Advertise

func (s *MockDriverServer) Advertise(topic string, info peer.AddrInfo, ttl time.Duration)

func (*MockDriverServer) Client added in v2.436.0

func (s *MockDriverServer) Client(h host.Host) IDriver

func (*MockDriverServer) Exist added in v2.436.0

func (s *MockDriverServer) Exist(topic string, p peer.ID) (ok bool)

func (*MockDriverServer) FindPeers

func (s *MockDriverServer) FindPeers(topic string, limit int) <-chan peer.AddrInfo

func (*MockDriverServer) Subscribe added in v2.436.0

func (s *MockDriverServer) Subscribe(ctx context.Context, topic string, buffsize int) <-chan peer.AddrInfo

func (*MockDriverServer) Unregister

func (s *MockDriverServer) Unregister(ctx context.Context, topic string, p peer.ID)

func (*MockDriverServer) WaitForPeer added in v2.436.0

func (s *MockDriverServer) WaitForPeer(topic string, p peer.ID, timeout time.Duration) (err error)

type MockIDriverClient added in v2.436.0

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

func (*MockIDriverClient) Advertise added in v2.436.0

func (s *MockIDriverClient) Advertise(ctx context.Context, topic string, opts ...discovery.Option) (time.Duration, error)

func (*MockIDriverClient) FindPeers added in v2.436.0

func (s *MockIDriverClient) FindPeers(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

func (*MockIDriverClient) Name added in v2.436.0

func (s *MockIDriverClient) Name() string

func (*MockIDriverClient) Subscribe added in v2.436.0

func (s *MockIDriverClient) Subscribe(ctx context.Context, topic string, opts ...discovery.Option) (<-chan peer.AddrInfo, error)

func (*MockIDriverClient) Unregister added in v2.436.0

func (s *MockIDriverClient) Unregister(ctx context.Context, topic string, opts ...discovery.Option) error

type NetworkUpdate added in v2.277.0

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

func NewNetworkUpdate added in v2.277.0

func NewNetworkUpdate(logger *zap.Logger, h host.Host) (*NetworkUpdate, error)

func (*NetworkUpdate) Close added in v2.277.0

func (n *NetworkUpdate) Close() (err error)

func (*NetworkUpdate) GetLastUpdatedAddrs added in v2.277.0

func (n *NetworkUpdate) GetLastUpdatedAddrs(ctx context.Context) (addrs []ma.Multiaddr)

func (*NetworkUpdate) WaitForUpdate added in v2.277.0

func (n *NetworkUpdate) WaitForUpdate(ctx context.Context, currentAddrs []ma.Multiaddr) (diff []ma.Multiaddr, ok bool)

type PeersUpdate added in v2.436.0

type PeersUpdate map[peer.ID]time.Time

func (PeersUpdate) HasUpdate added in v2.436.0

func (current PeersUpdate) HasUpdate(tu *topicUpdate) []peer.ID

type Record added in v2.94.0

type Record struct {
	Cid                  string   `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
	Expire               int64    `protobuf:"varint,2,opt,name=expire,proto3" json:"expire,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Record) Descriptor added in v2.94.0

func (*Record) Descriptor() ([]byte, []int)

func (*Record) GetCid added in v2.94.0

func (m *Record) GetCid() string

func (*Record) GetExpire added in v2.94.0

func (m *Record) GetExpire() int64

func (*Record) Marshal added in v2.94.0

func (m *Record) Marshal() (dAtA []byte, err error)

func (*Record) MarshalTo added in v2.94.0

func (m *Record) MarshalTo(dAtA []byte) (int, error)

func (*Record) MarshalToSizedBuffer added in v2.94.0

func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record) ProtoMessage added in v2.94.0

func (*Record) ProtoMessage()

func (*Record) Reset added in v2.94.0

func (m *Record) Reset()

func (*Record) Size added in v2.94.0

func (m *Record) Size() (n int)

func (*Record) String added in v2.94.0

func (m *Record) String() string

func (*Record) Unmarshal added in v2.94.0

func (m *Record) Unmarshal(dAtA []byte) error

func (*Record) XXX_DiscardUnknown added in v2.94.0

func (m *Record) XXX_DiscardUnknown()

func (*Record) XXX_Marshal added in v2.94.0

func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record) XXX_Merge added in v2.94.0

func (m *Record) XXX_Merge(src proto.Message)

func (*Record) XXX_Size added in v2.94.0

func (m *Record) XXX_Size() int

func (*Record) XXX_Unmarshal added in v2.94.0

func (m *Record) XXX_Unmarshal(b []byte) error

type Records added in v2.94.0

type Records struct {
	Records              []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Records) Descriptor added in v2.94.0

func (*Records) Descriptor() ([]byte, []int)

func (*Records) GetRecords added in v2.94.0

func (m *Records) GetRecords() []*Record

func (*Records) Marshal added in v2.94.0

func (m *Records) Marshal() (dAtA []byte, err error)

func (*Records) MarshalTo added in v2.94.0

func (m *Records) MarshalTo(dAtA []byte) (int, error)

func (*Records) MarshalToSizedBuffer added in v2.94.0

func (m *Records) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Records) ProtoMessage added in v2.94.0

func (*Records) ProtoMessage()

func (*Records) Reset added in v2.94.0

func (m *Records) Reset()

func (*Records) Size added in v2.94.0

func (m *Records) Size() (n int)

func (*Records) String added in v2.94.0

func (m *Records) String() string

func (*Records) Unmarshal added in v2.94.0

func (m *Records) Unmarshal(dAtA []byte) error

func (*Records) XXX_DiscardUnknown added in v2.94.0

func (m *Records) XXX_DiscardUnknown()

func (*Records) XXX_Marshal added in v2.94.0

func (m *Records) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Records) XXX_Merge added in v2.94.0

func (m *Records) XXX_Merge(src proto.Message)

func (*Records) XXX_Size added in v2.94.0

func (m *Records) XXX_Size() int

func (*Records) XXX_Unmarshal added in v2.94.0

func (m *Records) XXX_Unmarshal(b []byte) error

type Service

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

func NewService

func NewService(h host.Host, logger *zap.Logger, drivers ...IDriver) (*Service, error)

func (*Service) Close added in v2.436.0

func (s *Service) Close() error

func (*Service) FindPeers added in v2.436.0

func (s *Service) FindPeers(ctx context.Context, topic string) <-chan peer.AddrInfo

func (*Service) GetProcess added in v2.436.0

func (s *Service) GetProcess() uint32

func (*Service) LookupPeers added in v2.436.0

func (s *Service) LookupPeers(ctx context.Context, topic string) error

func (*Service) StartAdvertises added in v2.436.0

func (s *Service) StartAdvertises(ctx context.Context, topic string, opts ...AdvertiseOption) error

StartAdvertises topic on each of service drivers

func (*Service) Subscribe added in v2.436.0

func (s *Service) Subscribe(topic string) *Subscription

func (*Service) Unregister added in v2.436.0

func (s *Service) Unregister(ctx context.Context, topic string) error

Unregister try to unregister topic on each of his driver

func (*Service) WatchPeers added in v2.436.0

func (s *Service) WatchPeers(ctx context.Context, topic string) <-chan peer.AddrInfo

func (*Service) WatchTopic added in v2.436.0

func (s *Service) WatchTopic(ctx context.Context, topic string) (err error)

type Subscription added in v2.436.0

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

func (*Subscription) Close added in v2.436.0

func (s *Subscription) Close() error

func (*Subscription) Out added in v2.436.0

func (s *Subscription) Out() <-chan peer.AddrInfo

func (*Subscription) Pull added in v2.436.0

func (s *Subscription) Pull() error

Jump to

Keyboard shortcuts

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