Initiate sbot connection over Unix socket #57

Open
opened 2022-09-08 07:57:29 +00:00 by glyph · 1 comment
Owner

We currently only offer the ability to connect via TCP with a secret handshake. Local connections can instead be initiated using a socket (e.g. .ssb-go/socket).

We currently only offer the ability to connect via TCP with a secret handshake. Local connections can instead be initiated using a socket (e.g. `.ssb-go/socket`).
glyph added the
enhancement
label 2022-09-08 07:57:29 +00:00
glyph self-assigned this 2022-09-08 07:57:36 +00:00
glyph added this to the Enhancements and fixes project 2022-11-22 12:13:00 +00:00
Author
Owner

Reporting back on some investigations into this:

The short story is that supporting Unix socket connections will require a non-trivial suite of changes to kuska and golgi.

kuska expects the reader and writer streams to be wrapped in BoxStreamRead and BoxStreamWrite (https://github.com/Kuska-ssb/ssb/blob/master/src/rpc/stream.rs#L143), this means that we can't simply plug a UnixStream into the RpcReader and RpcWriter structs.

Perhaps the simplest option would be to rename RpcReader to RpcTcpReader and RpcWriter to RpcTcpWriter and create a second set of variants for RpcUnixReader and RpcUnixWriter.

Not so simple, of course, because then changes would also have to be made to ApiCaller (https://github.com/Kuska-ssb/ssb/blob/master/src/api/helper.rs#L97) as well as SbotConnection (15c5e77da6/src/sbot.rs (L33)) and Sbot in golgi.

My current feeling is that this may be an undesirable amount of work (and change) for what is essentially a 'nice to have'. We are already able to communicate successfully over TCP. The main offering of Unix socket communication is a lowering of the overhead; the secret handshake would not need to be executed on each connection, nor would the box stream need to be created.

I am therefore shelving this change for the time being. I may at some point implement a Unix socket-only client just for fun.

Reporting back on some investigations into this: The short story is that supporting Unix socket connections will require a non-trivial suite of changes to kuska and golgi. kuska expects the reader and writer streams to be wrapped in `BoxStreamRead` and `BoxStreamWrite` (https://github.com/Kuska-ssb/ssb/blob/master/src/rpc/stream.rs#L143), this means that we can't simply plug a `UnixStream` into the `RpcReader` and `RpcWriter` `struct`s. Perhaps the simplest option would be to rename `RpcReader` to `RpcTcpReader` and `RpcWriter` to `RpcTcpWriter` and create a second set of variants for `RpcUnixReader` and `RpcUnixWriter`. Not so simple, of course, because then changes would also have to be made to `ApiCaller` (https://github.com/Kuska-ssb/ssb/blob/master/src/api/helper.rs#L97) as well as `SbotConnection` (https://git.coopcloud.tech/golgi-ssb/golgi/src/commit/15c5e77da642460f60fbe75564abaf113201cc59/src/sbot.rs#L33) and `Sbot` in golgi. My current feeling is that this may be an undesirable amount of work (and change) for what is essentially a 'nice to have'. We are already able to communicate successfully over TCP. The main offering of Unix socket communication is a lowering of the overhead; the secret handshake would not need to be executed on each connection, nor would the box stream need to be created. I am therefore shelving this change for the time being. I may at some point implement a Unix socket-only client just for fun.
glyph added the
wontfix
label 2022-11-29 08:31:26 +00:00
glyph removed this from the Enhancements and fixes project 2022-11-29 08:31:40 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#57
No description provided.