use of com.github.jh3nd3rs0n.jargyle.common.net.SocketSettings in project jargyle by jh3nd3rs0n.
the class WorkerContextFactory method configureClientFacingSocket.
private void configureClientFacingSocket(final Socket clientFacingSock, final Configuration config) throws SocketException {
Settings settings = config.getSettings();
SocketSettings socketSettings = settings.getLastValue(GeneralSettingSpecConstants.CLIENT_FACING_SOCKET_SETTINGS);
socketSettings.applyTo(clientFacingSock);
}
use of com.github.jh3nd3rs0n.jargyle.common.net.SocketSettings in project jargyle by jh3nd3rs0n.
the class SocksClient method configureInternalSocket.
protected void configureInternalSocket(final Socket internalSocket) throws SocketException {
SocketSettings socketSettings = this.properties.getValue(GeneralPropertySpecConstants.INTERNAL_SOCKET_SETTINGS);
socketSettings.applyTo(internalSocket);
}
use of com.github.jh3nd3rs0n.jargyle.common.net.SocketSettings in project jargyle by jh3nd3rs0n.
the class ConnectCommandWorker method configureServerFacingSocket.
private boolean configureServerFacingSocket(final Socket serverFacingSocket) {
SocketSettings socketSettings = this.settings.getLastValue(Socks5SettingSpecConstants.SOCKS5_ON_CONNECT_SERVER_FACING_SOCKET_SETTINGS);
Host bindHost = this.settings.getLastValue(Socks5SettingSpecConstants.SOCKS5_ON_CONNECT_SERVER_FACING_BIND_HOST);
InetAddress bindInetAddress = bindHost.toInetAddress();
try {
socketSettings.applyTo(serverFacingSocket);
serverFacingSocket.bind(new InetSocketAddress(bindInetAddress, 0));
} catch (SocketException e) {
LOGGER.error(ObjectLogMessageHelper.objectLogMessage(this, "Error in setting the server-facing socket"), e);
Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.GENERAL_SOCKS_SERVER_FAILURE);
this.commandWorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
return false;
} catch (IOException e) {
LOGGER.error(ObjectLogMessageHelper.objectLogMessage(this, "Error in binding the server-facing socket"), e);
Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.GENERAL_SOCKS_SERVER_FAILURE);
this.commandWorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
return false;
}
return true;
}
Aggregations