Nicepipe is netcat's p2p buddy
Nicepipe is netcat for p2p connections.
It allows you to setup a network connection between two peers even if they are behind a NAT and uses your SSH keypairs to secure the connection.
nicepipe
solves two problems two problems that usually occur when you want to connect two computers somewhere on the planet:
nicepipe
uses exchange_provider scripts to exchange IPs of the hosts
nicepipe
uses STUN/ICE to circumvent your NAT and so you don't have to modify your firewall configuration.
nicepipe requires glib
, libnice
, socat
and your SSH RSA key pairs ($HOME/.ssh/id_rsa
).
To compile just run make
.
nicepipe
uses your SSH key pairs ($HOME/.ssh/id_rsa
) to setup a secure connection between the two peers.
Currently a file hosting service like Dropbox or Ubuntu One setup (MUST be the same account OR MUST be a shared folder of two accounts (both need write permission)) on each peers.
ssh-keygen
).alice
and bob
), e.g.# This is Alice's machine | # This is Bob's machine
alice$ cd ~/Dropbox | bob$ cd ~/Dropbox
alice ~/Dropbox$ echo Hello Bob! | ./nicepipe pipe -c 1 -H bob | bob ~/Dropbox$ echo Hello Alice! | ./nicepipe pipe -c 0 -H alice
Hello Alice! | Hello Bob!
alice ~/Dropbox$ sudo ./nicepipe vpn -c 1 -H bob | bob ~/Dropbox$ sudo ./nicepipe vpn -c 0 -H alice
Creating new network interface with IP# 10.0.1.2/24 | Creating new network interface with IP# 10.0.1.1/24
Then you can connect from one machine to the other:
alice $ echo Hello Bob! | nc -l 10.0.1.2 10000 | bob $ echo Hello Alice! | nc 10.0.1.2 10000
Hello Alice! | Hello Bob!
Either the address is really still in use (look at netstat -nl
) or your previous session did not end gracefully. In the latter case, wait some seconds and try again
Remove $HOME/Dropbox/.nice*
and try again or add the argument -s stunserver.org
.
Just implement another exchange provider. They take two arguments:
0
if it's the caller (client) and 1
if it's the callee (server).
If the second argument is publish
then the stdin
MUST be written where the other peer finds it.
If the second argument is lookup
then the data published by the other peer MUST be written to stdout
.
If the second argument is unpublish
then the data previously published SHOULD be unpublished (optional).
e.g.
alice$ ./exchange_providers/dummy 1 publish # writes stdin to a file where bob can find it
GPL
Terms MAY, MUST, SHOULD etc. according to RFC 2119.