Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support UNIX sockets #84

Open
david-macmahon opened this issue Nov 1, 2021 · 6 comments
Open

Support UNIX sockets #84

david-macmahon opened this issue Nov 1, 2021 · 6 comments

Comments

@david-macmahon
Copy link

redis-server can use only UNIX sockets (i.e. no TCP sockets) by setting port to 0 and unixsocket to the pathname of a UNIX socket. Redis.jl only supports TCP sockets currently so it cannot access such a server. Not a big problem if one can configure the server to also bind to a TCP port on localhost, but a very big problem if one does not control the redis-server configuration.

@jkaye2012
Copy link
Collaborator

jkaye2012 commented Nov 2, 2021

Are you familiar with how the Julia networking libraries work in the current version of the standard lib? I took a quick look at it seems a bit odd that connect has an overload that returns PipeEndpoint instead of TCPSocket, but the documentation on what one can actually do with that endpoint is severely lacking (or I am looking in the wrong place).

@david-macmahon
Copy link
Author

Hmm, I didn't realize Redis.jl did its own socket management. I had assumed (uh-oh!) that it was using a C client under the covers.

It looks like Base.PipeEndpoint and Sockets.TCPSocket are both subtypes of Base.LibuvStream. Once can use methodswith(Base.PipeEndpoint) to see that it doesn't have any special methods. TCPSocket has a few methods, but most (all?) of the interesting stuff shows up in methodswith(Base.LibuvStream).

@jkaye2012
Copy link
Collaborator

jkaye2012 commented Nov 2, 2021 via email

@david-macmahon
Copy link
Author

I think RedisConnection might need a new RedisConnection(; unixsocket) (or similar) method, but I think that would effectively be the same as the RedisConnection(;host, port, ...) method since the kwargs don't count towards dispatch. Might have to roll the new keyword into the existing method and somehow discern what the caller wants.

@jkaye2012
Copy link
Collaborator

jkaye2012 commented Nov 2, 2021 via email

@david-macmahon
Copy link
Author

I guess one could use RedisConnection(; host="localhost", port=6379, unixsocket="") and then use unixsocket if it is not empty, otherwise use host/port. Maybe just name it socket rather than unixsocket so it doesn't sound so strange for non-unix systems? I don't know what the windows equivalent it called.

tanmaykm added a commit that referenced this issue Dec 28, 2023
This adds TLS support. An abstraction for the redis transport `RedisTransport` has been added. The existing TCP transport has been moved in as an implementation `TCPTransport <: RedisTransport`. A new TLS transport has been added as `TLSTransport <: RedisTransport`.

This can in future be extended to support unix sockets too (ref: #84)

fixes: #87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants