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

mDNS example #2

Closed
wants to merge 3 commits into from
Closed

mDNS example #2

wants to merge 3 commits into from

Conversation

gpestana
Copy link

Was playing around with libp2p mDNS implementation and decided to create this example. Feedback is welcome :)

@upperwal
Copy link
Contributor

I think this repo should not depend on gx. People should directly go get libp2p and use these examples.

@zigo101
Copy link

zigo101 commented Jul 30, 2018

Ok, moved from libp2p/go-libp2p#379 to here.

I made small modifications on this PR so that I can run two different instances on two machines in the same local network. It looks the two peer instances can discover each other but couldn't connect to each other.

The modified version: https://play.golang.org/p/eMeQ0Gh33aA

Output on one machine:

$ ./go-p2p 

host QmP4wqKpfv3fWsFZymccG66jsiLTwGe9qF2pVYWG6d6CWZ knows:
 >> QmP4wqKpfv3fWsFZymccG66jsiLTwGe9qF2pVYWG6d6CWZ

host <peer.ID P4wqKp> connecting to <peer.ID XwzNjE>... (blocking)
Error when connecting peers: dial attempt failed: <peer.ID P4wqKp> --> <peer.ID XwzNjE> dial attempt failed: connection refused

host QmP4wqKpfv3fWsFZymccG66jsiLTwGe9qF2pVYWG6d6CWZ knows:
 >> QmP4wqKpfv3fWsFZymccG66jsiLTwGe9qF2pVYWG6d6CWZ
 >> QmXwzNjEsTnExHjWD39M8oSbG4iKKU5WSapJGayV5QmrPk

Output on the other machine

$ ./go-p2p -port=8001

host QmXwzNjEsTnExHjWD39M8oSbG4iKKU5WSapJGayV5QmrPk knows:
 >> QmXwzNjEsTnExHjWD39M8oSbG4iKKU5WSapJGayV5QmrPk

host <peer.ID XwzNjE> connecting to <peer.ID P4wqKp>... (blocking)
Error when connecting peers: dial attempt failed: <peer.ID XwzNjE> --> <peer.ID P4wqKp> dial attempt failed: context deadline exceeded

host <peer.ID XwzNjE> connecting to <peer.ID P4wqKp>... (blocking)
Error when connecting peers: dial backoff

host QmXwzNjEsTnExHjWD39M8oSbG4iKKU5WSapJGayV5QmrPk knows:
 >> QmXwzNjEsTnExHjWD39M8oSbG4iKKU5WSapJGayV5QmrPk
 >> QmP4wqKpfv3fWsFZymccG66jsiLTwGe9qF2pVYWG6d6CWZ

Any mistakes in my modified version? Or the peer hosts need more options?

@Stebalien
Copy link
Member

Possibly a firewall issue?

@gpestana
Copy link
Author

@upperwal yes, sounds reasonable. I will remove the gx setup and update the PR.

@go101 connection refused seems like something is blocking the connections?

@zigo101
Copy link

zigo101 commented Jul 31, 2018

@Stebalien @gpestana
No firewalls are installed on both machines.
does it run well in your network environments?

@anacrolix
Copy link
Contributor

I'll close this due to age. I just merged #33, which also deals with mDNS, FWIW. Please re-open if there's renewed interest in getting this in.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants