FileDocCategorySizeDatePackage
AESocksProxyAddressImpl.javaAPI DocAzureus 3.0.3.42622Thu Feb 09 19:42:52 GMT 2006com.aelitis.azureus.core.proxy.socks.impl

AESocksProxyAddressImpl

public class AESocksProxyAddressImpl extends Object implements com.aelitis.azureus.core.proxy.socks.AESocksProxyAddress
author
parg

Fields Summary
protected String
unresolved_address
protected InetAddress
address
protected int
port
Constructors Summary
protected AESocksProxyAddressImpl(String _unresolved_address, InetAddress _address, int _port)

		unresolved_address	= _unresolved_address;
		address				= _address;
		port				= _port;
		
		if ( address == null ){
			
				// see if we've been passed an IP address as unresolved
				// TODO: IPV6 one day?
			
			int			dots 	= 0;
			boolean		ok		= true;
			
			for (int i=0;i<unresolved_address.length();i++){
				
				char	c = unresolved_address.charAt(i);
				
				if ( c == '." ){
					
					dots++;
					
					if ( dots>3 ){
						
						ok	= false;
						
						break;
					}
				}else if ( !Character.isDigit( c )){
					
					ok = false;
					
					break;
					
				}else{
					
						// nnn.nnn.nnn.nnn
					
					if ( i > 15 ){
						
						ok = false;
						
						break;
					}
				}
			}
			
			if ( ok && dots == 3 ){
			
				try{
					address = HostNameToIPResolver.syncResolve( unresolved_address );
					
				}catch( Throwable e ){
					
					Debug.printStackTrace(e);
				}
			}
		}
	
Methods Summary
public java.net.InetAddressgetAddress()

		return( address );
	
public intgetPort()

		return( port );
	
public java.lang.StringgetUnresolvedAddress()

		return( unresolved_address );