rTorrent XMLRPC Bindings for Go (golang)
Fork of github.com/mrobinsn/go-rtorrent.
- Get IP, Name, Up/Down totals
- Get torrents within a view
- Get torrent by hash
- Get files for torrents
- Set the label on a torrent
- Add a torrent by URL or by metadata
- Delete a torrent (including files)
To install the package, run go get github.com/autobrr/go-rtorrent
To use it in application, import "github.com/autobrr/go-rtorrent"
client := rtorrent.NewClient(rtorrent.Config{Addr: "http://my-rtorrent.com/RPC2"})
name, _ := client.Name(context.Background())
fmt.Printf("My rTorrent's name: %v", name)You can connect to a server using Basic Authentication by adding User and Pass to the config:
client := rtorrent.NewClient(rtorrent.Config{Addr: "http://my-rtorrent.com/RPC2", BasicUser: "user", BasicPass: "pass"})Pull requests are welcome, please ensure you add relevant tests for any new/changed functionality.
Unit tests need nothing but Go:
go test ./...Integration tests need Docker. They start two rTorrent containers with Testcontainers, one under test and one as its peer, and transfer generated torrents between them, so they don't need internet access:
go test -tags integration ./...They default to crazymax/rtorrent-rutorrent:latest. Set RTORRENT_TEST_IMAGE to test another image.