trim21 / transmission-rpc

https://transmission-rpc.readthedocs.io/en/stable/
MIT License
139 stars 34 forks source link

feat(client): Add support for Unix sockets #447

Closed dechamps closed 2 months ago

dechamps commented 2 months ago

This commit adds support for the http+unix protocol which makes it possible to specify a Unix socket path as the host. This in turn makes it possible to connect to Transmission daemons that listen on a Unix socket file as opposed to an IP:port.

This is an alternative to #445.

trim21 commented 2 months ago

can you add a basic tests for this in ci?

trim21 commented 2 months ago

and what usecase you run transmission API on Unix socket?

dechamps commented 2 months ago

can you add a basic tests for this in ci?

Done.

and what usecase you run transmission API on Unix socket?

I'm not sure how that's relevant: transmission-daemon supports listening on a Unix socket, so it makes sense that client libraries would support that, otherwise these instances are unconnectable from transmission-rpc. Why someone would want to use a Unix socket in the first place is neither here nor there.

That being said, if you really want to know, I strongly prefer Unix sockets to localhost:port when dealing with local services because Unix sockets (1) have clear names instead of cryptic numbers, (2) are less likely to conflict and, most importantly, (3) are easier to secure (Unix sockets follow the usual Unix file permission/ACL model; in contrast, a port on localhost is accessible by any user on the local machine which is a security headache).

trim21 commented 2 months ago

thanks, "transmission-daemon supports listening on a Unix socket" is news to me. I thought it only support listen on net port