{"id":24764304,"url":"https://github.com/liut/kedge","last_synced_at":"2025-10-11T13:30:33.608Z","repository":{"id":46148777,"uuid":"396853851","full_name":"liut/kedge","owner":"liut","description":"A bittorrent engine base on libtorrent-rasterbar with RESTful API","archived":false,"fork":false,"pushed_at":"2022-02-15T15:59:08.000Z","size":502,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-26T00:16:14.696Z","etag":null,"topics":["api","bittorrent","boost","cpp","http","kedge","linux","web"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-16T15:26:16.000Z","updated_at":"2024-04-26T00:16:14.697Z","dependencies_parsed_at":"2022-09-03T06:52:07.732Z","dependency_job_id":null,"html_url":"https://github.com/liut/kedge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liut%2Fkedge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liut%2Fkedge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liut%2Fkedge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liut%2Fkedge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liut","download_url":"https://codeload.github.com/liut/kedge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236096180,"owners_count":19094179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bittorrent","boost","cpp","http","kedge","linux","web"],"created_at":"2025-01-28T21:47:19.931Z","updated_at":"2025-10-11T13:30:28.298Z","avatar_url":"https://github.com/liut.png","language":"C++","readme":"Kedge\n===\n\nA bittorrent engine base on libtorrent-rasterbar with RESTful API\n\nJSON APIs\n---\n\n* `GET` `/api/session` current session information, 200\n* `GET` `/api/session/stats` statistices of session, 200\n* `PUT` `/api/session/toggle` toggle session pause and resume, 200\n* `GET` `/api/torrents` show all torrents, 200\n* `POST` `/api/torrents` new task with torrent file in body, 204 | 500\n* `GET` `/api/torrent/{infohash}` show a torrent status, 200 | 404\n* `GET` `/api/torrent/{infohash}/{act}` act=(files|peers), 200 | 404\n* `HEAD` `/api/torrent/{infohash}`, 204 | 404\n* `DELETE` `/api/torrent/{infohash}` remove a torrent, 204 | 404\n* `PUT` `/api/torrent/{infohash}/{act}` act=(toggle|start) toggle a torrent or force start, 204\n* `GET` `/api/sync` Websocket only! response using [JSON-patch](https://tools.ietf.org/html/rfc6902) format (see [velox](https://github.com/jpillora/velox)).\n\n**note: `infohash` has 40 bytes string with hex format**\n\nIf you want to experience these APIs please check the official web UI [kedge-svelte](https://github.com/liut/kedge-svelte) that support them.\n\nPlans\n---\n* \u003cdel\u003eSupport for Add a new task by magnet link\u003c/del\u003e.\n* \u003cdel\u003eSupport optional actions such as moving folder when task is completed\u003c/del\u003e.\n* \u003cdel\u003eSplit logs with alert types?\u003c/del\u003e.\n* \u003cdel\u003ePause and resume torrents\u003c/del\u003e.\n* Support base32 format `infohash`.\n* API with authorization.\n\n## API Test with cURL\n\n### add a torrent\n```bash\ncurl -v -X POST \\\n\t--url http://localhost:16180/api/torrents \\\n\t-H 'Content-Type: application/x-bittorrent' \\\n\t-H 'Content-Length: 30786' \\\n\t--data-binary @debian-11.1.0-amd64-netinst.iso.torrent\n\ncurl -v -X POST \\\n\t--data-raw 'magnet:?xt=urn:btih:LYJSQPMNZA4JJ6UJTNDQF4IU3SVWW43O\u0026dn=debian-mac-10.10.0-amd64-netinst.iso\u0026xl=351272960\u0026tr=http%3A%2F%2Fbttracker.debian.org%3A6969%2Fannounce' \\\n\thttp://localhost:16180/api/torrents\n\n```\n\n### show all torrents\n```bash\ncurl http://localhost:16180/api/torrents | jq\n```\n\n### check a torrent exist with infohash\n```bash\ncurl -v -I http://localhost:16180/api/torrent/5e13283d8dc83894fa899b4702f114dcab6b736e\n```\n\n### drop a torrent (with data optional)\n```bash\ncurl -v -X DELETE \\\n\thttp://localhost:16180/api/torrent/5e13283d8dc83894fa899b4702f114dcab6b736e\n# or\ncurl -v -X DELETE \\\n\thttp://localhost:16180/api/torrent/5e13283d8dc83894fa899b4702f114dcab6b736e/with_data\n```\n\n### toggle session pause and resume\n```bash\ncurl -v -X PUT http://localhost:16180/api/session/toggle\n# response {\"isPaused\":true} or {\"isPaused\":false}\n```\n\n### pause and resume a torrent\n```bash\n# toggle a torrent puase or resume\ncurl -v -X PUT \\\n\thttp://localhost:16180/api/torrent/7cf55428325617fdde910fe55b79ab72be937924/toggle\n# force start a torrent\ncurl -v -X PUT \\\n\thttp://localhost:16180/api/torrent/7cf55428325617fdde910fe55b79ab72be937924/start\n```\n\n### show session stats\n```bash\ncurl http://localhost:16180/api/stats | jq\n```\n\n## Dependencies\n* [boost](https://www.boost.org/users/download/) \u003e= 1.76\n* [libtorrent-rasterbar](https://github.com/arvidn/libtorrent/releases) \u003e= 1.2.14\n\n### Components\n* [Boost.Asio](https://github.com/boostorg/asio) net, io context, ...\n* [Boost.Beast](https://github.com/boostorg/beast) http, websocket\n* [Boost.JSON](https://github.com/boostorg/json) new JSON relative to PropertyTree!\n* [Boost.ProgramOption](https://github.com/boostorg/program_options) config and options\n* [plog](https://github.com/SergiusTheBest/plog) logging\n\n## Build\n\n### Prepare for macOS\n```bash\nsudo port install cmake clang-11 llvm-11\nsudo port install zlib bzip2 openssl\n```\n\n### Prepare for debian/ubuntu\n```bash\nsudo apt install cmake automake libtool pkg-config libgnutls28-dev libcurl4-gnutls-dev zlib1g-dev\nsudo apt install clang-11 libc++-11-dev libclang-11-dev\n```\n\n### Install boost \u0026 libtorrent\n\n```bash\necho 'using clang : 11.0 : : \u003ccxxflags\u003e -std=c++17 -O2 -no-pie -fPIC ;' \u003e\u003e ~/user-config.jam\n\nexport CPPFLAGS='-std=c++17 -no-pie -fPIC'\n\n# download boost and uncompress it into ~/tmp\ncd ~/tmp/boost_1_76_0/\n./bootstrap.sh --prefix=/opt/boost --with-toolset=clang\n\n./b2 -j12 --build-dir=build --prefix=/opt/boost --with=all cxxstd=17 toolset=clang link=static runtime-link=static variant=release threading=multi install\ncd tools/build\n./b2 -j12 --build-dir=build --prefix=/opt/boost --with=all cxxstd=17 toolset=clang variant=release install\n\n# donwload libtorrent and uncompress it into ~/tmp\n# Or git clone -b RC_1_2 https://github.com/arvidn/libtorrent.git\ncd libtorrent\n\n/opt/boost/bin/b2 -j12 --prefix=/opt/lt12 cxxstd=17 variant=release crypto=openssl link=static runtime-link=static install\n```\n\n### Compile\n```bash\ntest -e build \u0026\u0026 rm -rf build\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake -j4\n```\n\n### Run\n```bash\n# show help\n./build/kedge -h\n# create and edit .env for config\ntouch .env\nenv `cat .env 2\u003e/dev/null | xargs` ./build/kedge\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliut%2Fkedge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliut%2Fkedge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliut%2Fkedge/lists"}