I have a subversion working copy on my laptop, and the corresponding repository on my NAS. When I am away from home, I update and commit over the internet over an encrypted connection to an domain name which resolves to my external IP. When I am at home and connected through my home network, I would like to update and commit over an unencrypted connection to my internal (home network) IP.

I would prefer not to use encryption or my external IP address when I at home, because both slow down the connection speed (10 MB/s without encryption and with internal IP, 1 MB/s with encryption and internal IP, and 0.5 MB/s with or without encryption and with external IP).

Is there any way I can let my working copy refer to a different URL depending on whether I am or not connected to my home network? Or is there another way to solve the speed problem?

link|improve this question
feedback

2 Answers

Some options:

  • If this is through ssh (svn+ssh://...), then you can edit your .ssh/config to specify aliases for hosts. You could then write a script that edits this configuration file on network change so that the alias points to the right hostname.
  • If it isn't (through http or something), you could run a local DNS server that resolves a special domain name that you can make up to the IP of the correct domain name depending on which network the computer is on
  • (Probably less insane than the previous one) Run a TCP relay on your local computer on some port, and have it point to either server depending on the network you are on. For example, you could make it bind to localhost:8080 and have that be forwarded to myserver:80 when on network 1, publicserver:80 when on network 2. Then you could need to do a checkout from that address (svn checkout http://localhost:8080/...).

Just some random ideas, all of them feel like workarounds though. Maybe there's an easier way.

Or you may want to switch to a distributed version control system like git, which will allow you to push to the remote you want (git push -u someremote branchname, where someremote refers to one of the servers).

link|improve this answer
I would say the second approach is actually the most practical. It is not very difficult to setup a DNS server and most home routers allow you to specify the address of the DNS server given out in DHCP replies. You can easily create a DNS split horizon system this way. – billc.cn Jan 29 at 4:05
feedback

I hope, you know about relocate command. You can use it by hand. If you'll use hostnames for internal and external access, which resolve only one in one location respectively, svn error on any repo-related operation remind to to relocate

Another (dirty) idea is to use VPN-connection in external nets for securing access to server and use common insecure protocol for repository access - in home net you just doesn't up VPN-link. Advantages of this way are: single URL, security on demand, error-proof simplicity

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.