mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-14 12:15:18 +00:00
28 lines
745 B
Go
28 lines
745 B
Go
|
// Package discovery provides service advertisement and peer discovery interfaces for libp2p.
|
||
|
package discovery
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
|
||
|
"github.com/libp2p/go-libp2p/core/peer"
|
||
|
)
|
||
|
|
||
|
// Advertiser is an interface for advertising services
|
||
|
type Advertiser interface {
|
||
|
// Advertise advertises a service
|
||
|
Advertise(ctx context.Context, ns string, opts ...Option) (time.Duration, error)
|
||
|
}
|
||
|
|
||
|
// Discoverer is an interface for peer discovery
|
||
|
type Discoverer interface {
|
||
|
// FindPeers discovers peers providing a service
|
||
|
FindPeers(ctx context.Context, ns string, opts ...Option) (<-chan peer.AddrInfo, error)
|
||
|
}
|
||
|
|
||
|
// Discovery is an interface that combines service advertisement and peer discovery
|
||
|
type Discovery interface {
|
||
|
Advertiser
|
||
|
Discoverer
|
||
|
}
|