Configuring Websockets connection to pass through a proxy server

Hey, I'm working on making G.V() fully proxy aware, but I can't seem to get websockets connection to pass through a SOCKS/HTTP proxy configuration. I've got all the proxy configuration java system properties set and working for HTTP connections. Is there any specific configuration to add to let the Gremlin driver to use a configured proxy?
gdotv
gdotv86d ago
at a glance it appears the right way of doing it would be to override the websocketchannelizer with a proxy aware implementation but before I code something crazy i'd like to see if that's the way to go and if there's any sample implementation out there. Also curious (if it's not supported) to know if this should be supported by default in gremlin-driver
gdotv
gdotv86d ago
GitHub
tinkerpop/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin...
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
gdotv
gdotv83d ago
@spmallette any ideas on this one?
Kennh
Kennh82d ago
As far as I can tell, gremlin-driver doesn't have support for SOCKS proxies right now. gremlin-driver uses netty as its client library so you would need to add a SOCKS proxy handler to the netty pipeline to support this. Adding something like the Socks4ProxyHandler to https://github.com/apache/tinkerpop/blob/master/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java#L189 might work.
GitHub
tinkerpop/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin...
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
gdotv
gdotv81d ago
makes total sense, is there a way to implement an overriding channelizer for the gremlin driver? can't see anything documented. Also just had some chat with a user who implemented this and it appears just regular HTTP proxy awareness would do, SOCKS is completely over the top here, at least from what i can tell For reference, i'd like to slide in this type of code in the configure method of the WebSocketChannelizer, before all the pipeline.addLast statements:
// Added for G.V(): Proxy Awareness configuration

String proxyHost = null;
String proxyPort = null;
String proxyUsername = System.getProperty("proxy.user");
String proxyPassword = System.getProperty("proxy.password");
HttpProxyHandler proxyHandler = null;
if(System.getProperty("https.proxyHost") != null && System.getProperty("https.proxyPort") != null){
proxyHost = System.getProperty("https.proxyHost");
proxyPort = System.getProperty("https.proxyPort");
}

if(System.getProperty("http.proxyHost") != null && System.getProperty("http.proxyPort") != null){
proxyHost = System.getProperty("http.proxyHost");
proxyPort = System.getProperty("http.proxyPort");
}

if(proxyHost != null && proxyPort != null){
try{
int proxyPortInt = Integer.parseInt(proxyPort);
InetSocketAddress address = new InetSocketAddress(proxyHost, proxyPortInt);
if(proxyUsername != null && proxyPassword != null){
proxyHandler = new HttpProxyHandler(address, proxyUsername, proxyPassword);
}
else{
proxyHandler = new HttpProxyHandler(address);
}
pipeline.addFirst("proxy-handler", proxyHandler);
}
catch(NumberFormatException e){
// Invalid port number, ignore proxy config
}
catch(IllegalArgumentException | SecurityException e){
// Invalid proxyHost/proxyPortInt configuration, again, ignore proxy config
}
}
// Added for G.V(): Proxy Awareness configuration

String proxyHost = null;
String proxyPort = null;
String proxyUsername = System.getProperty("proxy.user");
String proxyPassword = System.getProperty("proxy.password");
HttpProxyHandler proxyHandler = null;
if(System.getProperty("https.proxyHost") != null && System.getProperty("https.proxyPort") != null){
proxyHost = System.getProperty("https.proxyHost");
proxyPort = System.getProperty("https.proxyPort");
}

if(System.getProperty("http.proxyHost") != null && System.getProperty("http.proxyPort") != null){
proxyHost = System.getProperty("http.proxyHost");
proxyPort = System.getProperty("http.proxyPort");
}

if(proxyHost != null && proxyPort != null){
try{
int proxyPortInt = Integer.parseInt(proxyPort);
InetSocketAddress address = new InetSocketAddress(proxyHost, proxyPortInt);
if(proxyUsername != null && proxyPassword != null){
proxyHandler = new HttpProxyHandler(address, proxyUsername, proxyPassword);
}
else{
proxyHandler = new HttpProxyHandler(address);
}
pipeline.addFirst("proxy-handler", proxyHandler);
}
catch(NumberFormatException e){
// Invalid port number, ignore proxy config
}
catch(IllegalArgumentException | SecurityException e){
// Invalid proxyHost/proxyPortInt configuration, again, ignore proxy config
}
}
the issue im running into is trying to extend the WebSocketChannelizer class or implement my own version, i may be daft here but it's unclear how I can do this i could extend the server version of the channelizer just fine but obviously that's no good the end goal is to set the channelizer in the ClusterBuilder to the new overriden class (all Java stuff btw)
Solution
gdotv
gdotv80d ago
GitHub
amazon-neptune-tools/neptune-export/src/main/java/org/apache/tinker...
Tools and utilities to enable loading data and building graph applications with Amazon Neptune. - awslabs/amazon-neptune-tools
Want results from more Discord servers?
Add your server
More Posts
python goblin vs spring-data-goblin for interactions with gremlin serverI want an OGM to interact with my gremlin server. What would be a good choice?Is there any open source version of data visualizer for aws neptune?Is there any open source version of data visualizer for aws neptune. I'll need it since it essentialDynamic select within query not working.Any insights or help would be greatly appreciated. I have to pass a list of lists in the format beAdding multiple properties to a vertex using gremlin-goHello Community, I have a question regarding how multiple properties can be added to a vertex using Is it possible to walk 2 different graphs using custom TraversalStrategy in Gremlin?I have 2 different graphs in 2 different Neptune cluster. Both of them can have few reference verticSideEffect a variable, Use it later after BarrierStep?I seek a query that builds a list and then needs to both sum the list's mapped values and divide theMemory issue on repeatI am traversing all nodes occuring in the same cluster given one of the nodes in that cluster. SurpWhich database should i use for my DJ set planning software?Hi, i want to develop a software that lets DJs plan a set (i.e. playlist) and i'm wondering if graphHow will i add unique values to the vertices or edge properties in NeptuneI can't get a doc regarding adding unique data through gremlin. Is there any way to do it, other thaNot getting result in hasId() but id().is() worksI don't get any response using g.V().hasId(48). But when i use g.V().id().is(48). it shows output. Sdotnet `Enumeration has not started. Call MoveNext` if I try to enumerate over a resultI recently try to use gremlin to created a graph and query this graph. Currently I get it working toI can't create an edge in aws neptune using gremlin. I can create vertices. but not edge.import { driver, process as gremlinProcess, structure } from "gremlin"; async function checkOut() {Iterating over responsesI've got a query akin to this in a python application using `gremlin-python`: ``` t = traversal().wAWS Neptune updating gremlin driver to 3.6.2 introduced many bugs to working queriesAfter updating Amazon Neptune engine version from 1.2.0.2 to 1.2.1.0 and the Gremlin.Net (C# nuget) vertex-label-with-given-name-does-not-existERROR with Janusgraph 0.5.3vertex-label-with-given-name-does-not-exist ERROR with Janusgraph 0.5.3 while adding labels to vertiDocumentation states there should be a mid-traversal .E() step?Just wondering if I'm missing something, or if the docs are mistaken. It's possible to do a mid-travDisabling strategies via string in remote driverIs there a way to disable a strategy in a providers implementation without a reference to the class?LazyBarrierStrategy/NoOpBarrierStep incompatible with path-tracking👋🏻 Hi all! In this JanusGraph post (https://discord.com/channels/981533699378135051/1195313165278Is there a way to store the tinkerpop graph in DynamoDB?AWS provides Neptue graph database but problem with it is that it is not distributed and can't be hoConnection to Azure cosmos db using GoHi All, Asking this as a newbie to Graphs databases in general. I have been trying to connect to an