use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply in project jargyle by jh3nd3rs0n.
the class Socks5Worker method canAllowSocks5Request.
private boolean canAllowSocks5Request(final FirewallRule.Context context) {
Socks5RequestFirewallRules socks5RequestFirewallRules = this.settings.getLastValue(Socks5SettingSpecConstants.SOCKS5_SOCKS5_REQUEST_FIREWALL_RULES);
socks5RequestFirewallRules.applyTo(context);
if (FirewallRuleAction.ALLOW.equals(context.getFirewallRuleAction())) {
return true;
}
Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.CONNECTION_NOT_ALLOWED_BY_RULESET);
this.socks5WorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
return false;
}
use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply in project jargyle by jh3nd3rs0n.
the class UdpAssociateCommandWorker method newClientFacingDatagramSocket.
private DatagramSocket newClientFacingDatagramSocket() {
Host bindHost = this.settings.getLastValue(Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_CLIENT_FACING_BIND_HOST);
InetAddress bindInetAddress = bindHost.toInetAddress();
DatagramSocket clientFacingDatagramSock = null;
try {
clientFacingDatagramSock = new DatagramSocket(new InetSocketAddress(bindInetAddress, 0));
} catch (SocketException e) {
LOGGER.error(ObjectLogMessageHelper.objectLogMessage(this, "Error in creating the client-facing UDP socket"), e);
Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.GENERAL_SOCKS_SERVER_FAILURE);
this.commandWorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
return null;
}
return clientFacingDatagramSock;
}
use of com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply in project jargyle by jh3nd3rs0n.
the class UdpAssociateCommandWorker method newPeerFacingDatagramSocket.
private DatagramSocket newPeerFacingDatagramSocket() {
Host bindHost = this.settings.getLastValue(Socks5SettingSpecConstants.SOCKS5_ON_UDP_ASSOCIATE_PEER_FACING_BIND_HOST);
InetAddress bindInetAddress = bindHost.toInetAddress();
DatagramSocket peerFacingDatagramSock = null;
try {
peerFacingDatagramSock = this.netObjectFactory.newDatagramSocket(new InetSocketAddress(bindInetAddress, 0));
} catch (SocketException e) {
LOGGER.error(ObjectLogMessageHelper.objectLogMessage(this, "Error in creating the peer-facing UDP socket"), e);
Socks5Reply socks5Rep = Socks5Reply.newFailureInstance(Reply.GENERAL_SOCKS_SERVER_FAILURE);
this.commandWorkerContext.sendSocks5Reply(this, socks5Rep, LOGGER);
return null;
}
return peerFacingDatagramSock;
}
Aggregations