Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

remove deprecated types #73

Merged
merged 1 commit into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions deprecated.go

This file was deleted.

10 changes: 5 additions & 5 deletions routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/libp2p/go-libp2p-core/discovery"
"time"

cid "github.com/ipfs/go-cid"
"github.com/ipfs/go-cid"

"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/routing"
Expand All @@ -23,8 +23,8 @@ func NewRoutingDiscovery(router routing.ContentRouting) *RoutingDiscovery {
return &RoutingDiscovery{router}
}

func (d *RoutingDiscovery) Advertise(ctx context.Context, ns string, opts ...Option) (time.Duration, error) {
var options Options
func (d *RoutingDiscovery) Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error) {
var options discovery.Options
err := options.Apply(opts...)
if err != nil {
return 0, err
Expand Down Expand Up @@ -56,8 +56,8 @@ func (d *RoutingDiscovery) Advertise(ctx context.Context, ns string, opts ...Opt
return ttl, nil
}

func (d *RoutingDiscovery) FindPeers(ctx context.Context, ns string, opts ...Option) (<-chan peer.AddrInfo, error) {
var options Options
func (d *RoutingDiscovery) FindPeers(ctx context.Context, ns string, opts ...discovery.Option) (<-chan peer.AddrInfo, error) {
var options discovery.Options
err := options.Apply(opts...)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestRoutingDiscovery(t *testing.T) {
t.Fatal(err)
}

pis, err := FindPeers(ctx, d2, "/test", Limit(20))
pis, err := FindPeers(ctx, d2, "/test", discovery.Limit(20))
if err != nil {
t.Fatal(err)
}
Expand Down
5 changes: 3 additions & 2 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"time"

"github.com/libp2p/go-libp2p-core/discovery"
"github.com/libp2p/go-libp2p-core/peer"

logging "github.com/ipfs/go-log"
Expand All @@ -12,7 +13,7 @@ import (
var log = logging.Logger("discovery")

// FindPeers is a utility function that synchronously collects peers from a Discoverer.
func FindPeers(ctx context.Context, d Discoverer, ns string, opts ...Option) ([]peer.AddrInfo, error) {
func FindPeers(ctx context.Context, d discovery.Discoverer, ns string, opts ...discovery.Option) ([]peer.AddrInfo, error) {
var res []peer.AddrInfo

ch, err := d.FindPeers(ctx, ns, opts...)
Expand All @@ -28,7 +29,7 @@ func FindPeers(ctx context.Context, d Discoverer, ns string, opts ...Option) ([]
}

// Advertise is a utility function that persistently advertises a service through an Advertiser.
func Advertise(ctx context.Context, a Advertiser, ns string, opts ...Option) {
func Advertise(ctx context.Context, a discovery.Advertiser, ns string, opts ...discovery.Option) {
go func() {
for {
ttl, err := a.Advertise(ctx, ns, opts...)
Expand Down