git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Casey Dahlin <cdahlin@redhat.com>
To: Luke Kenneth Casson Leighton <luke.leighton@gmail.com>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>, git <git@vger.kernel.org>
Subject: Re: [RFC PATCH] Introduce git-hive
Date: Tue, 31 Aug 2010 11:52:00 -0400	[thread overview]
Message-ID: <20100831155159.GD16034@foucault.redhat.com> (raw)
In-Reply-To: <AANLkTinF1o0RZSKYEL9Qc=uwXx6fBBXh6wRx2CTULBSE@mail.gmail.com>

On Tue, Aug 31, 2010 at 04:08:03PM +0100, Luke Kenneth Casson Leighton wrote:
> On Tue, Aug 31, 2010 at 3:38 PM, Casey Dahlin <cdahlin@redhat.com> wrote:
> 
> >        nguyen@host_b$ git config --add hive.uri http://myproject.org
> >        nguyen@host_b$ git hive start host_a.com:21121
> >
> > So from host_b we specify host_a's address and listen port, and we join the
> > network. From here on out anyone who also connects to host_a will get host_b's
> > (randomly selected) listen port automatically and be able to connect to it as
> > well.
> >
> > So now our two peers can see each other.
> 
>  ok - this only works if the two peers can see each other's ip
> addresses.  i.e. if the two machines are either on a local subnet or
> if the two machines are directly on the public internet.  ( or if
> you've forced people to set up a firewall rule and/or UPnP rule, but
> even then UPnP doesn't solve the entire problem - only one part of it)
> 
>  ... unless (and i haven't reviewed the code closely, i admit) you're
> using the following protocol:
> 
>  * make tcp connection
>  * send dedicated specific message "please tell me my public IP and port"
>  * far end does sockaddr lookup of the incoming socket
>  * far end returns IP and port as response to requestor
> 

Its a bit more primitive right now (a bit broken even) but that's the eventual
plan.

Piece you missed though is that the port on the connect end isn't the same as
the listen port. Connecting back to it would do no good.

> in this way, requestors can determine what the "apparent" IP address
> is as far as having been NAT'd through half a ton of ISP layers
> performing NAT, local routers performing NAT, laptops such as mine
> doing NAT sharing of a 3G connection over a netgear router and so on.
> 

You can't get back through all those anyway unless they've all been set up to
allow it. I don't know what magic you've seen torrent clients do, but the
procedure for the ones I always used was:

1) Check to see if it can receive connections on the port it wants.
2) Bitch at user if it can't.

Bittorrent has the luxury of being able to proxy for the poor firewall-bound
users since as long as there's one peer exposed to the internet you can have
any two other peers connect to him and give him the data they want to exchange,
to the benefit of all 3. Git won't work that way because not everyone in the
swarm wants all chunks of data, so if you found a proxy node, you might have to
make him carry data (possibly lots of data) that he has no personal interest
in.

> so, answering the question you were asking earlier: i believe that you
> really do need to consider taking the closest c-based bittorrent
> library/application apart, and use it as the basis for git-hive.  if
> you don't, you will be here forever, reinventing everything that these
> fileshare-app-writers have spent nearly a decade perfecting.
> 

The thing avahi was going to provide was bootstrapping. Bittorrent DHT handles
this by having a list of known-good peers stashed away somewhere
(bittorrent.org hosts one). Essentially a non-p2p solution to joining the p2p
network. That's pretty much the only WAN solution. Local networks on the same
subnet have the option of UDP multicast. Avahi can do that. I'd be willing to
do it manually or with something else. But yes, for your WAN case its useless.

--CJD

  reply	other threads:[~2010-08-31 15:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 19:59 [RFC PATCH] Introduce git-hive cdahlin
2010-08-30 21:17 ` Luke Kenneth Casson Leighton
2010-08-31  1:29   ` Nguyen Thai Ngoc Duy
2010-08-31 14:38     ` Casey Dahlin
2010-08-31 15:08       ` Luke Kenneth Casson Leighton
2010-08-31 15:52         ` Casey Dahlin [this message]
2010-08-31 16:47           ` Luke Kenneth Casson Leighton
2010-08-31 17:20             ` Casey Dahlin
     [not found]           ` <815C806E-E7DC-4B7D-9B45-4C9B289DFEEF@sb.org>
2010-08-31 19:19             ` Casey Dahlin
2010-08-31 19:21               ` Kevin Ballard
2010-08-31 19:25                 ` Casey Dahlin
2010-09-05 20:08                   ` Tomas Carnecky
2010-09-06  2:28                     ` Casey Dahlin
2010-08-31 19:23           ` Kevin Ballard
2010-09-01  3:56       ` Ilari Liusvaara
2010-09-01  4:07         ` Casey Dahlin
2010-09-05 19:48       ` Giuseppe Bilotta
     [not found]       ` <20100905194810.5940F384096@mbox.dmi.unict.it>
2010-09-06  2:25         ` Casey Dahlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100831155159.GD16034@foucault.redhat.com \
    --to=cdahlin@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=luke.leighton@gmail.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).