Skip to content

Commit

Permalink
rename the discovery package to mdns
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Aug 18, 2021
1 parent 81c5b23 commit a2627b9
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/chat-with-mdns/mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
discovery "github.com/libp2p/go-libp2p/p2p/discovery_legacy"
discovery "github.com/libp2p/go-libp2p/p2p/mdns_legacy"
)

type discoveryNotifee struct {
Expand Down
4 changes: 2 additions & 2 deletions examples/ipfs-camp-2019/06-Pubsub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
mplex "github.com/libp2p/go-libp2p-mplex"
tls "github.com/libp2p/go-libp2p-tls"
yamux "github.com/libp2p/go-libp2p-yamux"
"github.com/libp2p/go-libp2p/p2p/discovery"
"github.com/libp2p/go-libp2p/p2p/mdns"
"github.com/libp2p/go-tcp-transport"
ws "github.com/libp2p/go-ws-transport"
"github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -101,7 +101,7 @@ func main() {
fmt.Println("Connected to", targetInfo.ID)
}

mdns := discovery.NewMdnsService(host, "")
mdns := mdns.NewMdnsService(host, "")
notifee := &discoveryNotifee{h: host, ctx: ctx}
mdns.RegisterNotifee(notifee)

Expand Down
4 changes: 2 additions & 2 deletions examples/ipfs-camp-2019/07-Messaging/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
tls "github.com/libp2p/go-libp2p-tls"
yamux "github.com/libp2p/go-libp2p-yamux"
"github.com/libp2p/go-libp2p/p2p/discovery"
"github.com/libp2p/go-libp2p/p2p/mdns"
"github.com/libp2p/go-tcp-transport"
ws "github.com/libp2p/go-ws-transport"
"github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -109,7 +109,7 @@ func main() {

fmt.Println("Connected to", targetInfo.ID)

mdns := discovery.NewMdnsService(host, "")
mdns := mdns.NewMdnsService(host, "")
mdns.RegisterNotifee(&mdnsNotifee{h: host, ctx: ctx})

err = dht.Bootstrap(ctx)
Expand Down
4 changes: 2 additions & 2 deletions examples/ipfs-camp-2019/08-End/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
tls "github.com/libp2p/go-libp2p-tls"
yamux "github.com/libp2p/go-libp2p-yamux"
"github.com/libp2p/go-libp2p/p2p/discovery"
"github.com/libp2p/go-libp2p/p2p/mdns"
"github.com/libp2p/go-tcp-transport"
ws "github.com/libp2p/go-ws-transport"
"github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -108,7 +108,7 @@ func main() {

fmt.Println("Connected to", targetInfo.ID)

mdns := discovery.NewMdnsService(host, "")
mdns := mdns.NewMdnsService(host, "")
mdns.RegisterNotifee(&mdnsNotifee{h: host, ctx: ctx})

err = dht.Bootstrap(ctx)
Expand Down
4 changes: 2 additions & 2 deletions examples/pubsub/chat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

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

"github.com/libp2p/go-libp2p-core/host"

Expand Down Expand Up @@ -107,7 +107,7 @@ func (n *discoveryNotifee) HandlePeerFound(pi peer.AddrInfo) {
// This lets us automatically discover peers on the same LAN and connect to them.
func setupDiscovery(ctx context.Context, h host.Host) error {
// setup mDNS discovery to find local peers
disc := discovery.NewMdnsService(h, DiscoveryServiceTag)
disc := mdns.NewMdnsService(h, DiscoveryServiceTag)

n := discoveryNotifee{h: h}
disc.RegisterNotifee(&n)
Expand Down
2 changes: 1 addition & 1 deletion p2p/discovery/mdns.go → p2p/mdns/mdns.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package discovery
package mdns

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion p2p/discovery/mdns_test.go → p2p/mdns/mdns_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package discovery
package mdns

import (
"context"
Expand Down
8 changes: 4 additions & 4 deletions p2p/discovery_legacy/mdns.go → p2p/mdns_legacy/mdns.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package discovery_legacy
package mdns_legacy

import (
"context"
Expand All @@ -9,7 +9,7 @@ import (

"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/p2p/discovery"
"github.com/libp2p/go-libp2p/p2p/mdns"

logging "github.com/ipfs/go-log/v2"
ma "github.com/multiformats/go-multiaddr"
Expand All @@ -26,8 +26,8 @@ var log = logging.Logger("mdns_legacy")

const ServiceTag = "_ipfs-discovery._udp"

type Service = discovery.Service
type Notifee = discovery.Notifee
type Service = mdns.Service
type Notifee = mdns.Notifee

type mdnsService struct {
server *mdns.Server
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package discovery_legacy
package mdns_legacy

import (
"context"
Expand Down

0 comments on commit a2627b9

Please sign in to comment.