amoffat / focus

Prevents you from being on reddit or facebook all day
306 stars 19 forks source link

Use Interface Name for Fail IP #14

Open grahamc opened 12 years ago

grahamc commented 12 years ago

Here's some example source that allows it: http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/

Nifty side effect: I can set it to bind to eth0, setup domain_dev() to fail, and it will automatically look up my IP address, and then I can expose my DNS servers to other people (or VMs) and then "foo.dev" automatically resolves to my internal network IP.

amoffat commented 12 years ago

Can you (or anyone) confirm that the example code works on mac?

Also, you'll have to break down your 2nd paragraph a little bit for me. Didn't all register :)

grahamc commented 12 years ago

Absolutely :) sorry.

When working with a VM to develop web applications, I have to continuously edit my hosts file to point my domain to the current external IP address of eth0. I'm using Focus to that extent already, but I have to manually edit the configuration each time (simpler, but still a pain in the butt.)

Regarding the sample code, no it doesn't seem to work. I'm looking further.