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?
Solution:Jump to solution
disregard that last part, i've figured it out, used https://github.com/awslabs/amazon-neptune-tools/blob/master/neptune-export/src/main/java/org/apache/tinkerpop/gremlin/driver/LBAwareSigV4WebSocketChannelizer.java for reference!
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
6 Replies
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
https://github.com/apache/tinkerpop/blob/master/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/WebSocketChannelizer.java#L84 for reference is where im feeling something would need done
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.
@spmallette any ideas on this one?
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.
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:
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
disregard that last part, i've figured it out, used https://github.com/awslabs/amazon-neptune-tools/blob/master/neptune-export/src/main/java/org/apache/tinkerpop/gremlin/driver/LBAwareSigV4WebSocketChannelizer.java for reference!
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