diff options
author | Kenny Root <kenny@the-b.org> | 2013-04-11 21:01:32 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2013-04-11 21:01:32 -0700 |
commit | d8e49ec3f297f9ba0991762eb2cddbc00ed634d2 (patch) | |
tree | aac59c707c980e90202241c7a9c306ab9d278a1c /src/net/sourceforge/jsocks/Socks4Proxy.java | |
parent | 847af5046fb7d2dbcc668cecf81f1726b7c48bd9 (diff) | |
download | connectbot-d8e49ec3f297f9ba0991762eb2cddbc00ed634d2.tar.gz connectbot-d8e49ec3f297f9ba0991762eb2cddbc00ed634d2.tar.bz2 connectbot-d8e49ec3f297f9ba0991762eb2cddbc00ed634d2.zip |
Fix line endings
Diffstat (limited to 'src/net/sourceforge/jsocks/Socks4Proxy.java')
-rw-r--r-- | src/net/sourceforge/jsocks/Socks4Proxy.java | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/src/net/sourceforge/jsocks/Socks4Proxy.java b/src/net/sourceforge/jsocks/Socks4Proxy.java index f920b75..9a17fc2 100644 --- a/src/net/sourceforge/jsocks/Socks4Proxy.java +++ b/src/net/sourceforge/jsocks/Socks4Proxy.java @@ -1,107 +1,107 @@ -package net.sourceforge.jsocks;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-/**
- Proxy which describes SOCKS4 proxy.
-*/
-
-public class Socks4Proxy extends Proxy implements Cloneable{
-
-//Data members
- String user;
-
-//Public Constructors
-//====================
-
- /**
- Creates the SOCKS4 proxy
- @param p Proxy to use to connect to this proxy, allows proxy chaining.
- @param proxyHost Address of the proxy server.
- @param proxyPort Port of the proxy server
- @param user User name to use for identification purposes.
- @throws UnknownHostException If proxyHost can't be resolved.
- */
- public Socks4Proxy(String proxyHost,int proxyPort,String user)
- throws UnknownHostException{
- super(proxyHost,proxyPort);
- this.user = new String(user);
- version = 4;
- }
-
- /**
- Creates the SOCKS4 proxy
- @param p Proxy to use to connect to this proxy, allows proxy chaining.
- @param proxyIP Address of the proxy server.
- @param proxyPort Port of the proxy server
- @param user User name to use for identification purposes.
- */
- public Socks4Proxy(Proxy p,InetAddress proxyIP,int proxyPort,String user){
- super(p,proxyIP,proxyPort);
- this.user = new String(user);
- version = 4;
- }
-
- /**
- Creates the SOCKS4 proxy
- @param proxyIP Address of the proxy server.
- @param proxyPort Port of the proxy server
- @param user User name to use for identification purposes.
- */
- public Socks4Proxy(InetAddress proxyIP,int proxyPort,String user){
- this(null,proxyIP,proxyPort,user);
- }
-
-//Public instance methods
-//========================
-
- /**
- * Creates a clone of this proxy. Changes made to the clone should not
- * affect this object.
- */
- public Object clone(){
- Socks4Proxy newProxy = new Socks4Proxy(proxyIP,proxyPort,user);
- newProxy.chainProxy = chainProxy;
- return newProxy;
- }
-
-
-//Public Static(Class) Methods
-//==============================
-
-
-//Protected Methods
-//=================
-
- protected Proxy copy(){
- Socks4Proxy copy = new Socks4Proxy(proxyIP,proxyPort,user);
- copy.chainProxy = chainProxy;
- return copy;
- }
-
- protected ProxyMessage formMessage(int cmd,InetAddress ip,int port){
- switch(cmd){
- case SOCKS_CMD_CONNECT:
- cmd = Socks4Message.REQUEST_CONNECT;
- break;
- case SOCKS_CMD_BIND:
- cmd = Socks4Message.REQUEST_BIND;
- break;
- default:
- return null;
- }
- return new Socks4Message(cmd,ip,port,user);
- }
- protected ProxyMessage formMessage(int cmd,String host,int port)
- throws UnknownHostException{
- return formMessage(cmd,InetAddress.getByName(host),port);
- }
- protected ProxyMessage formMessage(InputStream in)
- throws SocksException,
- IOException{
- return new Socks4Message(in,true);
- }
-
-}
+package net.sourceforge.jsocks; +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + Proxy which describes SOCKS4 proxy. +*/ + +public class Socks4Proxy extends Proxy implements Cloneable{ + +//Data members + String user; + +//Public Constructors +//==================== + + /** + Creates the SOCKS4 proxy + @param p Proxy to use to connect to this proxy, allows proxy chaining. + @param proxyHost Address of the proxy server. + @param proxyPort Port of the proxy server + @param user User name to use for identification purposes. + @throws UnknownHostException If proxyHost can't be resolved. + */ + public Socks4Proxy(String proxyHost,int proxyPort,String user) + throws UnknownHostException{ + super(proxyHost,proxyPort); + this.user = new String(user); + version = 4; + } + + /** + Creates the SOCKS4 proxy + @param p Proxy to use to connect to this proxy, allows proxy chaining. + @param proxyIP Address of the proxy server. + @param proxyPort Port of the proxy server + @param user User name to use for identification purposes. + */ + public Socks4Proxy(Proxy p,InetAddress proxyIP,int proxyPort,String user){ + super(p,proxyIP,proxyPort); + this.user = new String(user); + version = 4; + } + + /** + Creates the SOCKS4 proxy + @param proxyIP Address of the proxy server. + @param proxyPort Port of the proxy server + @param user User name to use for identification purposes. + */ + public Socks4Proxy(InetAddress proxyIP,int proxyPort,String user){ + this(null,proxyIP,proxyPort,user); + } + +//Public instance methods +//======================== + + /** + * Creates a clone of this proxy. Changes made to the clone should not + * affect this object. + */ + public Object clone(){ + Socks4Proxy newProxy = new Socks4Proxy(proxyIP,proxyPort,user); + newProxy.chainProxy = chainProxy; + return newProxy; + } + + +//Public Static(Class) Methods +//============================== + + +//Protected Methods +//================= + + protected Proxy copy(){ + Socks4Proxy copy = new Socks4Proxy(proxyIP,proxyPort,user); + copy.chainProxy = chainProxy; + return copy; + } + + protected ProxyMessage formMessage(int cmd,InetAddress ip,int port){ + switch(cmd){ + case SOCKS_CMD_CONNECT: + cmd = Socks4Message.REQUEST_CONNECT; + break; + case SOCKS_CMD_BIND: + cmd = Socks4Message.REQUEST_BIND; + break; + default: + return null; + } + return new Socks4Message(cmd,ip,port,user); + } + protected ProxyMessage formMessage(int cmd,String host,int port) + throws UnknownHostException{ + return formMessage(cmd,InetAddress.getByName(host),port); + } + protected ProxyMessage formMessage(InputStream in) + throws SocksException, + IOException{ + return new Socks4Message(in,true); + } + +} |