Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream relaying #478

Merged
merged 21 commits into from
Jan 4, 2015
Merged

Stream relaying #478

merged 21 commits into from
Jan 4, 2015

Conversation

jbenet
Copy link
Member

@jbenet jbenet commented Dec 28, 2014

This PR introduces stream relaying. This is a precursor to NAT traversal.
The RelayService should some day affect things like bitswap ledgers, but
for now it'll just be used for assisting NAT traversal (and possibly DHT
queries).

This PR also moves the inet.Network implementation into its own package.
More thinking on this suggests that there should be a distinction
between inet.Network, and some inet.NetworkBackend (or a 'peernet' pkg)
which provides the actual {stream, connection, address, peer} manager
impls (swarm, mock, etc) but leaves all the Protocol/Mux/Service stuff
to inet.Network.

@whyrusleeping
Copy link
Member

👍 to separating the transport layer from the service layer at some point in the future.

@jbenet
Copy link
Member Author

jbenet commented Jan 1, 2015

the latest changes introduce (yet another) large change to the network: moving everything under a p2p package, and the introduction of Host (which is thing2 as described above). The network code was simplified quite a bit. So was the interface for clients (which now use Host). Though Connect may still be a bit clunky.

(note: want feedback, though not yet ready for merge. other things need to be merged first (#456 and #484), and interface should settle)

jbenet added 21 commits January 2, 2015 08:46
I needed the network implementation in its own
package, because I'll be writing several services that
will plug into _it_ that shouldn't be part of the core net
package. and then there were dependency conflicts. yay.
mux + identify are good examples of what i mean.
this is the leadup into NAT traversal.
note: doesn't work yet. hangs the test.
swarmnet is a better name for the package, because
it's just a Network implemented with a Swarm.
(ipfsnet will be something slightly different).
These services should all be added separately, in a function
that is Network impl independent. The interfaces need to be
massaged a bit (split inet.Network in two), so will do when
needed. For now this is fine.
I think it's time to move a lot of the peer-to-peer networking
but-not-ipfs-specific things into its own package: p2p.
This could in the future be split off into its own library.
The first thing to go is the peer.
The crypto package moves into p2p. Nothing in it so far is ipfs
specific; everything is p2p-general.
The net package is the next to move. It will be massaged
a bit still to fix the Network / "NetworkBackend" conflict.
remove comment about spdystream. this is now
superceded by go-peerstream interface.
using a placeholder net2 package so tests continue to pass.
Will be swapped atomically into main code.
The separation of work in the p2p pkg is as follows:

- net implements the Swarm and connectivity
- protocol has muxer and header protocols
- host implements protocol muxing + services
- identify took over handshake completely! yay.
- p2p package works as a whole
This commit makes all network tests use ZeroLocalTCPAddress
as the initial peer address, and then relies on
net.ListenAddresses()

This should get rid of the tcp addr clash problems.
not sure how it wasnt an error
@jbenet jbenet self-assigned this Jan 2, 2015
@jbenet
Copy link
Member Author

jbenet commented Jan 2, 2015

#456 and #484 are merged. I want to merge this in sooner. @whyrusleeping or @maybebtc can you check it out and lmk thoughts? (can also merge and fix things brought up afterward)

@maybebtc the refactor fixes the issue you brought up re: separation of net + services.

@jbenet
Copy link
Member Author

jbenet commented Jan 2, 2015

@briantigerchow*

@jbenet
Copy link
Member Author

jbenet commented Jan 4, 2015

@briantigerchow @whyrusleeping do either of you want to take a look at this? else I'll merge.

@jbenet
Copy link
Member Author

jbenet commented Jan 4, 2015

Ok merging. do read up on how the network changed. in particular the move to p2p/ and the Host abstraction.

jbenet added a commit that referenced this pull request Jan 4, 2015
@jbenet jbenet merged commit 12549ca into master Jan 4, 2015
@jbenet jbenet removed the status/in-progress In progress label Jan 4, 2015
@jbenet jbenet deleted the relay branch January 4, 2015 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants