public class ProxyServer extends Object implements Runnable
In order to use it you will need to implement ServerAuthenticator interface. There is an implementation of this interface which does no authentication ServerAuthenticatorNone, but it is very dangerous to use, as it will give access to your local network to anybody in the world. One should never use this authentication scheme unless one have pretty good reason to do so. There is a couple of other authentication schemes in socks.server package.
socks.socks.server.ServerAuthenticator
Constructor and Description |
---|
ProxyServer(ServerAuthenticator auth,
SshClient agent)
Creates a proxy server with given Authentication scheme.
|
Modifier and Type | Method and Description |
---|---|
static Proxy |
getProxy()
Get proxy.
|
void |
run() |
static void |
setAcceptTimeout(int timeout)
Sets the timeout for BIND command, how long the server should
wait for the incoming connection.
Zero timeout implies infinity. Default timeout is 3 minutes. |
static void |
setDatagramSize(int size)
Sets the size of the datagrams used in the UDPRelayServer.
Default size is 64K, a bit more than maximum possible size of the datagram. |
static void |
setIddleTimeout(int timeout)
Sets the timeout for connections, how long shoud server wait
for data to arrive before dropping the connection.
Zero timeout implies infinity. Default timeout is 3 minutes. |
static void |
setLog(OutputStream out)
Set the logging stream.
|
static void |
setProxy(Proxy p)
Set proxy.
|
static void |
setUDPTimeout(int timeout)
Sets the timeout for UDPRelay server.
Zero timeout implies infinity. Default timeout is 3 minutes. |
void |
start(int port)
Start the Proxy server at given port.
This methods blocks. |
void |
start(int port,
int backlog,
InetAddress localIP)
Create a server with the specified port, listen backlog, and local
IP address to bind to.
|
void |
stop()
Stop server operation.It would be wise to interrupt thread running the
server afterwards.
|
public ProxyServer(ServerAuthenticator auth, SshClient agent)
auth
- Authentication scheme to be used.public static void setLog(OutputStream out)
public static void setProxy(Proxy p)
Allows Proxy chaining so that one Proxy server is connected to another and so on. If proxy supports SOCKSv4, then only some SOCKSv5 requests can be handled, UDP would not work, however CONNECT and BIND will be translated.
p
- Proxy which should be used to handle user requests.public static Proxy getProxy()
public static void setIddleTimeout(int timeout)
public static void setAcceptTimeout(int timeout)
public static void setUDPTimeout(int timeout)
public static void setDatagramSize(int size)
public void start(int port)
public void start(int port, int backlog, InetAddress localIP)
public void stop()
Copyright © 2024. All rights reserved.