Search in sources :

Example 1 with Socks5ReplyFirewallRules

use of com.github.jh3nd3rs0n.jargyle.server.rules.impl.Socks5ReplyFirewallRules in project jargyle by jh3nd3rs0n.

the class Socks5RequestWorkerContext method canAllowSocks5Reply.

public final boolean canAllowSocks5Reply(final Object worker, final FirewallRule.Context context, final Logger logger) {
    Socks5ReplyFirewallRules socks5ReplyFirewallRules = this.getSettings().getLastValue(Socks5SettingSpecConstants.SOCKS5_SOCKS5_REPLY_FIREWALL_RULES);
    socks5ReplyFirewallRules.applyTo(context);
    if (FirewallRuleAction.ALLOW.equals(context.getFirewallRuleAction())) {
        return true;
    }
    Socks5Reply rep = Socks5Reply.newFailureInstance(Reply.CONNECTION_NOT_ALLOWED_BY_RULESET);
    this.sendSocks5Reply(worker, rep, logger);
    return false;
}
Also used : Socks5ReplyFirewallRules(com.github.jh3nd3rs0n.jargyle.server.rules.impl.Socks5ReplyFirewallRules) Socks5Reply(com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply)

Example 2 with Socks5ReplyFirewallRules

use of com.github.jh3nd3rs0n.jargyle.server.rules.impl.Socks5ReplyFirewallRules in project jargyle by jh3nd3rs0n.

the class BindCommandWorker method canAllowSecondSocks5Reply.

private boolean canAllowSecondSocks5Reply(final FirewallRule.Context context) {
    Socks5ReplyFirewallRules socks5ReplyFirewallRules = this.settings.getLastValue(Socks5SettingSpecConstants.SOCKS5_ON_BIND_SECOND_SOCKS5_REPLY_FIREWALL_RULES);
    socks5ReplyFirewallRules.applyTo(context);
    if (FirewallRuleAction.ALLOW.equals(context.getFirewallRuleAction())) {
        return true;
    }
    Socks5Reply rep = Socks5Reply.newFailureInstance(Reply.CONNECTION_NOT_ALLOWED_BY_RULESET);
    this.commandWorkerContext.sendSocks5Reply(this, rep, LOGGER);
    return false;
}
Also used : Socks5ReplyFirewallRules(com.github.jh3nd3rs0n.jargyle.server.rules.impl.Socks5ReplyFirewallRules) Socks5Reply(com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply)

Aggregations

Socks5ReplyFirewallRules (com.github.jh3nd3rs0n.jargyle.server.rules.impl.Socks5ReplyFirewallRules)2 Socks5Reply (com.github.jh3nd3rs0n.jargyle.transport.socks5.Socks5Reply)2