Use proxy only on one network

Brandon Allbery allbery.b at gmail.com
Tue Aug 19 18:00:48 PDT 2014


On Tue, Aug 19, 2014 at 8:16 PM, Ryan Schmidt <ryandesign at macports.org>
wrote:

> I'm experimenting with running a proxy server on my network, which I would
> like MacPorts to use while on that network, while not interfering with my
> ability to use MacPorts while connected to other networks. What's the best
> way to do this in an automated way? Editing macports.conf proxy settings
> every time I switch networks is cumbersome. Similarly manually setting and
> unsetting environment variables. I'm currently thinking of wrapping the
> "port" command in a shell function (which I already do) and using the IP
> address or AirPort network name to determine whether I'm on the home
> network and setting the environment variables accordingly. I'm also dimly
> aware of OS X's network locations feature, but way back when those were
> introduced I remember you had to manually select which location you wanted
> to use.
>

A more clever setup might use the NetworkState key in the launchd KeepAlive
dictionary to launch a script that writes appropriate proxy values into a
file somewhere based on the default route / IP address / whatever, then
sleep and remove or save defaults in that file on SIGTERM. (Conceivably
that file might be macports.conf itself....)

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20140819/3ba7cfd8/attachment.html>


More information about the macports-users mailing list