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
Then flip the HasPrefix order? Right now, omastr is a full address including port, no?

—
Sent from Mailbox

On Sun, Nov 2, 2014 at 5:08 PM, Jeromy Johnson <notifications@github.com>
wrote:

>>  	return nil
>>  }
>> +
>> +func CheckNAT(obsaddr string) (bool, error) {
>> +	oma, err := ma.NewMultiaddr(obsaddr)
>> +	if err != nil {
>> +		return false, err
>> +	}
>> +	addrs, err := u.GetLocalAddresses()
>> +	if err != nil {
>> +		return false, err
>> +	}
>> +
>> +	omastr := oma.String()
>> +	for _, addr := range addrs {
>> +		if strings.HasPrefix(addr.String(), omastr) {
> The prefix ensures we ignore the port, and local addresses are portless
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jbenet/go-ipfs/pull/253/files#r19716979