public interface ServerAuthenticator
Modifier and Type | Method and Description |
---|---|
boolean |
checkRequest(DatagramPacket dp,
boolean out)
This method is called when datagram is received by the server.
|
boolean |
checkRequest(ProxyMessage msg)
This method is called when a request have been read.
|
void |
endSession()
This method is called when session is completed.
|
InputStream |
getInputStream()
This method should return input stream which should be used on the
accepted socket.
|
OutputStream |
getOutputStream()
This method should return output stream to use to write to the accepted
socket.
|
UDPEncapsulation |
getUdpEncapsulation()
This method should return UDPEncapsulation, which should be used
on the datagrams being send in/out.
|
ServerAuthenticator |
startSession(Socket s)
This method is called when a new connection accepted by the server.
|
ServerAuthenticator startSession(Socket s) throws IOException
At this point no data have been extracted from the connection. It is responsibility of this method to ensure that the next byte in the stream after this method have been called is the first byte of the socks request message. For SOCKSv4 there is no authentication data and the first byte in the stream is part of the request. With SOCKSv5 however there is an authentication data first. It is expected that implementaions will process this authentication data.
If authentication was successful an instance of ServerAuthentication should be returned, it later will be used by the server to perform authorization and some other things. If authentication fails null should be returned, or an exception may be thrown.
s
- Accepted Socket.IOException
InputStream getInputStream()
SOCKSv5 allows to have multiple authentication methods, and these methods might require some kind of transformations being made on the data.
This method is called on the object returned from the startSession function.
OutputStream getOutputStream()
SOCKSv5 allows to have multiple authentication methods, and these methods might require some kind of transformations being made on the data.
This method is called on the object returned from the startSession function.
UDPEncapsulation getUdpEncapsulation()
If no transformation should be done on the datagrams, this method should return null.
This method is called on the object returned from the startSession function.
boolean checkRequest(ProxyMessage msg)
Implementation should decide wether to grant request or not. Returning true implies granting the request, false means request should be rejected.
This method is called on the object returned from the startSession function.
msg
- Request message.boolean checkRequest(DatagramPacket dp, boolean out)
Implementaions should decide wether it should be forwarded or dropped. It is expecteed that implementation will use datagram address and port information to make a decision, as well as anything else. Address and port of the datagram are always correspond to remote machine. It is either destination or source address. If out is true address is destination address, else it is a source address, address of the machine from which datagram have been received for the client.
Implementaions should return true if the datagram is to be forwarded, and false if the datagram should be dropped.
This method is called on the object returned from the startSession function.
out
- If true the datagram is being send out(from the client),
otherwise it is an incoming datagram.void endSession()
This method is called on the object returned from the startSession function.
Copyright © 2024. All rights reserved.