-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Stream relaying #478
Conversation
👍 to separating the transport layer from the service layer at some point in the future. |
the latest changes introduce (yet another) large change to the network: moving everything under a (note: want feedback, though not yet ready for merge. other things need to be merged first (#456 and #484), and interface should settle) |
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
#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. |
@briantigerchow* |
@briantigerchow @whyrusleeping do either of you want to take a look at this? else I'll merge. |
Ok merging. do read up on how the network changed. in particular the move to |
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.