org.lastbamboo.common.stun.client
Class PublicIpAddress

java.lang.Object
  extended by org.lastbamboo.common.stun.client.PublicIpAddress
All Implemented Interfaces:
org.littleshoot.util.PublicIp

public class PublicIpAddress
extends Object
implements org.littleshoot.util.PublicIp

Generalized class that uses various techniques to obtain a public IP address. TODO: We need to add new methods for this -- Apache lookups and IRC lookups. Google: Use https://encrypted.google.com/ inurl:"server-status" "Apache Server Status for" IRC: perl -MIO -e'$x=IO::Socket::INET->new("$ARGV[0]:6667");print $x "USER x x x x\nNICK testip$$\nWHOIS testip$$\n";while(<$x>){if(/PING (\S+)/){print $x "PONG $1\n"}elsif(/^\S+ 378 .* (\S+)/){die$1}}' irc.freenode.org Many thanks to Samy Kamkar!!


Constructor Summary
PublicIpAddress()
           
PublicIpAddress(long cacheTime)
           
 
Method Summary
 InetAddress getPublicIpAddress()
          Determines the public IP address of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicIpAddress

public PublicIpAddress()

PublicIpAddress

public PublicIpAddress(long cacheTime)
Method Detail

getPublicIpAddress

public InetAddress getPublicIpAddress()
Determines the public IP address of this node.

Specified by:
getPublicIpAddress in interface org.littleshoot.util.PublicIp
Returns:
The public IP address for this node.


Copyright © 2013 LittleShoot. All Rights Reserved.