seanime icon indicating copy to clipboard operation
seanime copied to clipboard

feature request: Change default host for streaming services and torrent client

Open sin3point14 opened this issue 5 months ago • 0 comments

Checklist

  • [X] I checked that this feature has not been requested before
  • [X] I checked that this feature is not in the "Not planned" list
  • [X] This feature will benefit the majority of users

Problem Description / Use Case

I run seanime on a NAS. On this machine I lock the network down by binding services to vpn ip and use ufw to limit communication(as a secondary measure). In the code I observed

sin3point14@devm-manas-wsl:~/github/seanime/internal$ rgrep --exclude-dir=extension_repo -w 0.0.0.0
torrentstream/server.go:        // Default address is "0.0.0.0:43214"
torrentstream/repository_test.go:               StreamingServerHost: "0.0.0.0",
torrentstream/repository_test.go:       }, "0.0.0.0")
torrentstream/client.go:        if settings.StreamingServerHost == "0.0.0.0" {
torrentstream/repository.go:            s.StreamingServerHost = "0.0.0.0"
core/modules.go:                        StreamingServerHost:            "0.0.0.0",
core/config.go: if cfg.Server.Host == "" || cfg.Server.Host == "0.0.0.0" {

Also while running seanime i observed:

root@the-beast:/data/seanime# netstat -ntulp | grep seanime
tcp        0      0 0.0.0.0:43213           0.0.0.0:*               LISTEN      1584086/seanime
tcp        0      0 100.106.233.76:43211    0.0.0.0:*               LISTEN      1584086/seanime
udp        0      0 0.0.0.0:43213           0.0.0.0:*                           1584086/seanime

it binds a service to 0.0.0.0:43213, which by grepping the code I find is the TorrentClientPort.

Proposed Solution

My thoughts:

The services are probably unauthenticated so by default they should bind to 127.0.0.1 like the main web server.

I don't know enough about torrent protocols and eyeballing the code in internal/torrentstream/repository.go felt maybe there's some need to bind to 0.0.0.0. However, I'm running qbittorrent in docker as an unpriviliged user and it still works so maybe there is no need to bind to 0.0.0.0 here after all?

  • Maybe we can allow the user to change the host for the torrent client? An option can be provided in the Torrent client section like Streaming server section's Host field.
  • Or maybe we can bind the torrent client and streaming server to same host as server.host? It would be weird if the user wants to use use it on a different host as the main server's host, and if they want to change, they can do that in the settings page.

sin3point14 avatar Sep 17 '24 20:09 sin3point14