Search in sources :

Example 1 with LogAction

use of com.github.jh3nd3rs0n.jargyle.server.LogAction in project jargyle by jh3nd3rs0n.

the class Socks5ReplyFirewallRule method toString.

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("firewallRuleAction=");
    builder.append(this.getFirewallRuleAction());
    if (this.clientAddressRange != null) {
        builder.append(" clientAddressRange=");
        builder.append(this.clientAddressRange);
    }
    if (this.socksServerAddressRange != null) {
        builder.append(" socksServerAddressRange=");
        builder.append(this.socksServerAddressRange);
    }
    if (this.method != null) {
        builder.append(" method=");
        builder.append(this.method);
    }
    if (this.user != null) {
        builder.append(" user=");
        builder.append(this.user);
    }
    if (this.command != null) {
        builder.append(" command=");
        builder.append(this.command);
    }
    if (this.desiredDestinationAddressRange != null) {
        builder.append(" desiredDestinationAddressRange=");
        builder.append(this.desiredDestinationAddressRange);
    }
    if (this.desiredDestinationPortRange != null) {
        builder.append(" desiredDestinationPortRange=");
        builder.append(this.desiredDestinationPortRange);
    }
    if (this.serverBoundAddressRange != null) {
        builder.append(" serverBoundAddressRange=");
        builder.append(this.serverBoundAddressRange);
    }
    if (this.serverBoundPortRange != null) {
        builder.append(" serverBoundPortRange=");
        builder.append(this.serverBoundPortRange);
    }
    LogAction logAction = this.getLogAction();
    if (logAction != null) {
        builder.append(" logAction=");
        builder.append(logAction);
    }
    return builder.toString();
}
Also used : LogAction(com.github.jh3nd3rs0n.jargyle.server.LogAction)

Example 2 with LogAction

use of com.github.jh3nd3rs0n.jargyle.server.LogAction in project jargyle by jh3nd3rs0n.

the class Socks5RequestFirewallRule method toString.

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("firewallRuleAction=");
    builder.append(this.getFirewallRuleAction());
    if (this.clientAddressRange != null) {
        builder.append(" clientAddressRange=");
        builder.append(this.clientAddressRange);
    }
    if (this.socksServerAddressRange != null) {
        builder.append(" socksServerAddressRange=");
        builder.append(this.socksServerAddressRange);
    }
    if (this.method != null) {
        builder.append(" method=");
        builder.append(this.method);
    }
    if (this.user != null) {
        builder.append(" user=");
        builder.append(this.user);
    }
    if (this.command != null) {
        builder.append(" command=");
        builder.append(this.command);
    }
    if (this.desiredDestinationAddressRange != null) {
        builder.append(" desiredDestinationAddressRange=");
        builder.append(this.desiredDestinationAddressRange);
    }
    if (this.desiredDestinationPortRange != null) {
        builder.append(" desiredDestinationPortRange=");
        builder.append(this.desiredDestinationPortRange);
    }
    LogAction logAction = this.getLogAction();
    if (logAction != null) {
        builder.append(" logAction=");
        builder.append(logAction);
    }
    return builder.toString();
}
Also used : LogAction(com.github.jh3nd3rs0n.jargyle.server.LogAction)

Example 3 with LogAction

use of com.github.jh3nd3rs0n.jargyle.server.LogAction in project jargyle by jh3nd3rs0n.

the class ClientFirewallRule method applyTo.

@Override
public void applyTo(final Rule.Context context) {
    FirewallRuleAction firewallRuleAction = this.getFirewallRuleAction();
    Context cntxt = (Context) context;
    cntxt.setFirewallRuleAction(firewallRuleAction);
    LogAction logAction = this.getLogAction();
    if (logAction == null) {
        return;
    }
    String clientAddress = cntxt.getClientAddress();
    String socksServerAddress = cntxt.getSocksServerAddress();
    if (firewallRuleAction.equals(FirewallRuleAction.ALLOW)) {
        logAction.invoke(String.format("Client address %s to SOCKS server address %s is allowed " + "based on the following firewall rule and context: %s, " + "%s", clientAddress, socksServerAddress, this, context));
    } else if (firewallRuleAction.equals(FirewallRuleAction.DENY)) {
        logAction.invoke(String.format("Client address %s to SOCKS server address %s is denied " + "based on the following firewall rule and context: %s, " + "%s", clientAddress, socksServerAddress, this, context));
    }
}
Also used : LogAction(com.github.jh3nd3rs0n.jargyle.server.LogAction)

Example 4 with LogAction

use of com.github.jh3nd3rs0n.jargyle.server.LogAction in project jargyle by jh3nd3rs0n.

the class ClientFirewallRule method toString.

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("firewallRuleAction=");
    builder.append(this.getFirewallRuleAction());
    if (this.clientAddressRange != null) {
        builder.append(" clientAddressRange=");
        builder.append(this.clientAddressRange);
    }
    if (this.socksServerAddressRange != null) {
        builder.append(" socksServerAddressRange=");
        builder.append(this.socksServerAddressRange);
    }
    LogAction logAction = this.getLogAction();
    if (logAction != null) {
        builder.append(" logAction=");
        builder.append(logAction);
    }
    return builder.toString();
}
Also used : LogAction(com.github.jh3nd3rs0n.jargyle.server.LogAction)

Example 5 with LogAction

use of com.github.jh3nd3rs0n.jargyle.server.LogAction in project jargyle by jh3nd3rs0n.

the class Socks5RequestRoutingRule method toString.

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("routingRule=");
    if (this.clientAddressRange != null) {
        builder.append(" clientAddressRange=");
        builder.append(this.clientAddressRange);
    }
    if (this.socksServerAddressRange != null) {
        builder.append(" socksServerAddressRange=");
        builder.append(this.socksServerAddressRange);
    }
    if (this.method != null) {
        builder.append(" method=");
        builder.append(this.method);
    }
    if (this.user != null) {
        builder.append(" user=");
        builder.append(this.user);
    }
    if (this.command != null) {
        builder.append(" command=");
        builder.append(this.command);
    }
    if (this.desiredDestinationAddressRange != null) {
        builder.append(" desiredDestinationAddressRange=");
        builder.append(this.desiredDestinationAddressRange);
    }
    if (this.desiredDestinationPortRange != null) {
        builder.append(" desiredDestinationPortRange=");
        builder.append(this.desiredDestinationPortRange);
    }
    List<String> routeIds = this.getRouteIds();
    if (routeIds.size() > 0) {
        for (String routeId : routeIds) {
            builder.append(" routeId=");
            builder.append(routeId);
        }
    }
    SelectionStrategy routeIdSelectionStrategy = this.getRouteIdSelectionStrategy();
    if (routeIdSelectionStrategy != null) {
        builder.append(" routeIdSelectionStrategy=");
        builder.append(routeIdSelectionStrategy);
    }
    LogAction logAction = this.getLogAction();
    if (logAction != null) {
        builder.append(" logAction=");
        builder.append(logAction);
    }
    return builder.toString();
}
Also used : LogAction(com.github.jh3nd3rs0n.jargyle.server.LogAction) SelectionStrategy(com.github.jh3nd3rs0n.jargyle.server.SelectionStrategy)

Aggregations

LogAction (com.github.jh3nd3rs0n.jargyle.server.LogAction)12 MethodSubnegotiationResults (com.github.jh3nd3rs0n.jargyle.server.socks5.MethodSubnegotiationResults)4 Route (com.github.jh3nd3rs0n.jargyle.server.Route)2 Routes (com.github.jh3nd3rs0n.jargyle.server.Routes)2 SelectionStrategy (com.github.jh3nd3rs0n.jargyle.server.SelectionStrategy)2