# WIP: rc / rcd over unix socket

**URL:** <https://forum.rclone.org/t/wip-rc-rcd-over-unix-socket/33619>\
**Category:** Feature\
**Created:** [October 20, 2022, 3:48am UTC](https://forum.rclone.org/t/wip-rc-rcd-over-unix-socket/33619 "2022-10-20T03:48:03Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [October 20, 2022, 5:18pm UTC](https://forum.rclone.org/t/wip-rc-rcd-over-unix-socket/33619/5 "2022-10-20T17:18:41Z")

</div>

> [@devnode](#):
>
> I'm currently working on an rclone integration that would benefit from having the ability to interact with the rcd over unix socket.

Rclone runs `rclone serve restic` over a stdin/stdout pipe. This runs http2 over that pipe so some code might be re-usable from there.

Your patch looks much less scary than I thought it would be!

I suggest open a [new issue](https://github.com/rclone/rclone/issues/new/choose) on Github with the above in it then we can work on a PR.

> [@devnode](#):
>
> [There's still an issue with detecting SIGINT and performing cleanup of the socket on shutdown](https://github.com/devnode/rclone/commit/c8a1d07cb00291a69d354b830aa60687632fa30b#r87330587).

`lib/atexit` is the solution here

> [@devnode](#):
>
> It does make changes to the shared `httplib` code so additional testing would be required to ensure all code importing it would also support unix sockets.

Note that there is actually two bits to httplib (refactor that never got finished grrr) so make sure both bits get done!

> [@devnode](#):
>
> OS Compatibility: I think it's fine just to make a note of it in the documentation as it would be an opt in feature. If someone did happen to enable it on an unsupported system, `net.Listen` would ultimately throw an error.

Fine.

> [@devnode](#):
>
> Do we refactor to reuse the unix socket code already implemented in `cmd/serve/docker/unix.go`?

I'd say probably not as that code is quite specialized to docker stuff. But then I don't know that code very well.

> [@devnode](#):
>
> Where to store the socket? My first thought was to keep it simple, just piggyback off the default config dir and put it next to `rclone.conf`.

Isn't the socket location something the user provides? Or we make a default location in a flag?

> [@devnode](#):
>
> Then ideally, we would add a few global config options / flags / env vars so you'd configure it once and not have to pass flags to every `rc / rcd` command call:

You can already pass every flag as an env var - would this do?

---

_[View the full topic](https://forum.rclone.org/t/wip-rc-rcd-over-unix-socket/33619)._
