Simple mini clone of torrra

This commit is contained in:
Alexander
2026-07-02 17:02:49 +02:00
commit 80ebf1cb63
24 changed files with 6424 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
version: v2
plugins:
- local: protoc-gen-prost
out: ../crates/proto/src/generated
opt:
- file_descriptor_set
- enable_type_names
- local: protoc-gen-prost-serde
out: ../crates/proto/src/generated
- local: protoc-gen-tonic
out: ../crates/proto/src/generated
+9
View File
@@ -0,0 +1,9 @@
version: v2
modules:
- path: .
lint:
use:
- STANDARD
breaking:
use:
- FILE
+53
View File
@@ -0,0 +1,53 @@
syntax = "proto3";
package torrent;
service Torrents {
// Add a torrent from a magnet link and start downloading it.
rpc Add(AddRequest) returns (AddResponse);
// Get the current status of a single torrent.
rpc Status(StatusRequest) returns (TorrentStatus);
// List all torrents known to the daemon.
rpc List(ListRequest) returns (ListResponse);
}
message AddRequest {
string magnet = 1;
// Optional output directory override. Empty means use torad's default.
string output_dir = 2;
}
message AddResponse {
string id = 1;
}
message StatusRequest {
string id = 1;
}
message ListRequest {}
message ListResponse {
repeated TorrentStatus torrents = 1;
}
enum State {
STATE_UNSPECIFIED = 0;
PENDING = 1;
DOWNLOADING = 2;
PAUSED = 3;
FINISHED = 4;
ERROR = 5;
}
message TorrentStatus {
string id = 1;
string info_hash = 2;
string name = 3;
string source = 4;
string output_path = 5;
uint64 total_bytes = 6;
uint64 downloaded_bytes = 7;
State state = 8;
string error_message = 9;
}