On Thu, Mar 8, 2012 at 2:21 PM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote: > Date: Mon, 6 Jun 2011 04:46:20 -0500 > > SRV records are an extra layer of indirection on top of A/AAAA records > mapping from domain names and service types to the hostnames of > machines that offer that service. That has a couple of nice effects: > > - a single domain can use different hosts for different services > - a single domain can use multiple hosts for one service > > Teach git to perform a SRV lookup whenever resolving a git:// URL. > This means: > > - if your git server was previously the same machine as your wesnoth > server, you can move it to a separate machine without forcing > everyone to update their links to the old URLs > > - if you have a primary git server and a backup machine that should > be used when the primary server goes down, the client can > automatically take care of it > > - if you have multiple git servers and would like to spread load > between them, the client can automatically take care of it > > That is, SRV records let us ask the client to carry out various tasks > that would require a proxy on the server side with traditional DNS. > The client performs a SRV query to _git._tcp.<domain name> to receive > its instructions. RFC 2782 has details. > > Ideally reaping these benefits would just involve passing a special > flag to getaddrinfo(). Since we don't live in such a world, this > patch uses the BIND 8 API provided by libresolv to parse the response > for ourselves. > > RFC 2782 requires some non-determinism in the order of hosts > contacted; this patch uses drand48() for that. To avoid causing > trouble for platforms that lack the libbind ns_* functions or > drand48(), the SRV support is only provided when requested by setting > the USE_SRV_RR compile-time option. > > git servers must ensure that they can also be reached by a plain > A/AAAA lookup to support git clients without SRV support, for example > by proxying connections to an appropriate server: > > # in inetd.conf > git stream tcp nowait.400 nobody /usr/sbin/tcpd \ > /bin/nc -q0 gitserver.example.com git > > Regression: this uglifies error messages for connection errors a > little. It would probably be better to leave out the connection count > when we are not trying more than one server. > > Based on a patch by Julien Cristau <jcristau@xxxxxxxxxx>. > > Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> > --- > As I mentioned at the gittogether, I think this would be a valuable > feature in git. You can test it out (though this is only the simple > case, no load balancing or failover) by doing > > git clone git://git.debian.org/~jrnieder-guest/git.git > > and watching what happens with wireshark. > > The patch needs documentation. Maybe a howto and an addendum to the > protocol docs would do. Anyway, I hope it's at least entertaining in > the current state. It's an interesting feature, but I'm a little bit worried if this promotes non-portable setups; won't these repos be unreachable (at least without manually redirecting or also keeping a copy on the advertised URL) on machines where libresolv is unavailable? I'm mainly thinking about the "a single domain can use different hosts for different services"-benefit you mentioned. Multiple hosts for one service would probably be done by simply advertising one of the URLs, and get some load-balancing from the clients that DOES have libresolv... -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html