public class ServerAuthenticatorNone extends Object implements ServerAuthenticator
Warning!!
Should not be
used on machines which are not behind the firewall.
It is only provided to make implementing other authentication schemes
easier.
For Example:
class MyAuth extends socks.server.ServerAuthenticator{
...
public ServerAuthenticator startSession(java.net.Socket s){
if(!checkHost(s.getInetAddress()) return null;
return super.startSession(s);
}
boolean checkHost(java.net.Inetaddress addr){
boolean allow;
//Do it somehow
return allow;
}
}
Constructor and Description |
---|
ServerAuthenticatorNone()
Creates new instance of the ServerAuthenticatorNone.
|
ServerAuthenticatorNone(InputStream in,
OutputStream out)
Constructs new ServerAuthenticatorNone object suitable for returning
from the startSession function.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkRequest(DatagramPacket dp,
boolean out)
Allways returns true.
|
boolean |
checkRequest(ProxyMessage msg)
Allways returns true.
|
void |
endSession()
Does nothing.
|
InputStream |
getInputStream()
Get input stream.
|
OutputStream |
getOutputStream()
Get output stream.
|
UDPEncapsulation |
getUdpEncapsulation()
Allways returns null.
|
static boolean |
selectSocks5Authentication(InputStream in,
OutputStream out,
int methodId)
Convinience routine for selecting SOCKSv5 authentication.
|
ServerAuthenticator |
startSession(Socket s)
Grants access to everyone.Removes authentication related bytes from
the stream, when a SOCKS5 connection is being made, selects an
authentication NONE.
|
public ServerAuthenticatorNone()
public ServerAuthenticatorNone(InputStream in, OutputStream out)
in
- Input stream to return from getInputStream method.out
- Output stream to return from getOutputStream method.public ServerAuthenticator startSession(Socket s) throws IOException
startSession
in interface ServerAuthenticator
s
- Accepted Socket.IOException
public InputStream getInputStream()
getInputStream
in interface ServerAuthenticator
public OutputStream getOutputStream()
getOutputStream
in interface ServerAuthenticator
public UDPEncapsulation getUdpEncapsulation()
getUdpEncapsulation
in interface ServerAuthenticator
public boolean checkRequest(ProxyMessage msg)
checkRequest
in interface ServerAuthenticator
msg
- Request message.public boolean checkRequest(DatagramPacket dp, boolean out)
checkRequest
in interface ServerAuthenticator
out
- If true the datagram is being send out(from the client),
otherwise it is an incoming datagram.public void endSession()
endSession
in interface ServerAuthenticator
public static boolean selectSocks5Authentication(InputStream in, OutputStream out, int methodId) throws IOException
This method reads in authentication methods that client supports, checks wether it supports given method. If it does, the notification method is written back to client, that this method have been chosen for authentication. If given method was not found, authentication failure message is send to client ([5,FF]).
in
- Input stream, version byte should be removed from the stream
before calling this method.out
- Output stream.methodId
- Method which should be selected.IOException
Copyright © 2024. All rights reserved.