NAT detect

Adds in some methods that determine if you are behind a NAT when connecting to a remote peer. Also prevents connection to loopback addresses
Yep will do. Just leave it working here and I'll make those changes later

—
Sent from Mailbox

On Sun, Nov 2, 2014 at 5:20 PM, Jeromy Johnson <notifications@github.com>
wrote:

>> @@ -107,3 +111,46 @@ func GetenvBool(name string) bool {
>>  	v := strings.ToLower(os.Getenv(name))
>>  	return v == "true" || v == "t" || v == "1"
>>  }
>> +
>> +func IsLoopbackAddr(addr string) bool {
>> +	loops := []string{"/ip4/127.0.0.1", "/ip6/::1", "/ip4/0.0.0.0"}
>> +	for _, loop := range loops {
>> +		if strings.HasPrefix(addr, loop) {
>> +			return true
>> +		}
>> +	}
>> +	return false
>> +}
> It might be easier for you to do it, since you can push direct to the repo. Maybe even make it take a multiaddr instead of a string
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jbenet/go-ipfs/pull/253/files#r19717070