use of com.github.jh3nd3rs0n.jargyle.server.Routes in project jargyle by jh3nd3rs0n.
the class ClientRoutingRule method applyTo.
@Override
public void applyTo(final Rule.Context context) {
String routeId = this.getRouteIdSelector().select();
if (routeId == null) {
return;
}
Context cntxt = (Context) context;
Routes routes = cntxt.getRoutes();
Route route = routes.get(routeId);
if (route == null) {
return;
}
cntxt.setRoute(route);
LogAction logAction = this.getLogAction();
if (logAction == null) {
return;
}
String clientAddress = cntxt.getClientAddress();
logAction.invoke(String.format("Client route '%s' for %s is selected from the following " + "routing rule and context: %s, %s", routeId, clientAddress, this, context));
}
use of com.github.jh3nd3rs0n.jargyle.server.Routes in project jargyle by jh3nd3rs0n.
the class Socks5RequestRoutingRule method applyTo.
@Override
public void applyTo(final Rule.Context context) {
String routeId = this.getRouteIdSelector().select();
if (routeId == null) {
return;
}
Context cntxt = (Context) context;
Routes routes = cntxt.getRoutes();
Route route = routes.get(routeId);
if (route == null) {
return;
}
cntxt.setRoute(route);
LogAction logAction = this.getLogAction();
if (logAction == null) {
return;
}
String clientAddress = cntxt.getClientAddress();
MethodSubnegotiationResults methSubnegotiationResults = cntxt.getMethodSubnegotiationResults();
String user = methSubnegotiationResults.getUser();
String possibleUser = (user != null) ? String.format(" (%s)", user) : "";
logAction.invoke(String.format("SOCKS5 request route '%s' for %s%s is selected from the " + "following routing rule and context: %s, %s", routeId, clientAddress, possibleUser, this, context));
}
Aggregations