Go to file
Ivan Bushchik 5d2944928f
Add note about rate limiter
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
2023-12-16 10:23:47 +03:00
src 0.2.0: Set up hashing via feature 2023-12-16 10:11:33 +03:00
.gitignore Initial commit 2023-12-16 08:05:45 +03:00
.rustfmt.toml Initial commit 2023-12-16 08:05:45 +03:00
Cargo.toml Remove once_cell from deps 2023-12-16 10:18:01 +03:00
LICENSE Initial commit 2023-12-16 08:05:45 +03:00
README.md Add note about rate limiter 2023-12-16 10:23:47 +03:00
web.sh 0.2.0: Set up hashing via feature 2023-12-16 10:11:33 +03:00

BinHost

HTTP server to easily serve (prebuilt) binaries for any (UNIX-like) platform

Installation

cargo install --git https://github.com/ivabus/binhost

Server usage

List options with --help

Make sure to use proxy with rate limiter in prod.

Directory structure

Directory, passed to binhost --dir option (defaults to ./bin) should look like (for hello binary)

Note: list of binaries will be refreshed every 5 minutes (by default, see --refresh option)

bin
└── hello
    ├── Darwin
    │   ├── arm64
    │   │   └── hello
    │   └── x86_64
    │       └── hello
    └── Linux
        └── aarch64
            └── hello

Client usage

Get available binaries

Request

GET / HTTP/1.1

Example response

- hello (platforms: ["Linux-aarch64", "Darwin-arm64", "Darwin-x86_64"])

Get script for specific binary (suitable for curl | sh syntax)

This script will determine platform and arch and download necessary binary (and check hashsum if sha256sum binary is present in $PATH).

Request

GET /<BIN> HTTP/1.1

Get binary for specific platform

Request

GET /bin/<BIN>/<PLATFORM>/<ARCH> HTTP/1.1

Get sha256 hash of binary for specific platform

Only with "sha256" feature (recalculates hash on each request, may be bad on large files or lots of requests)

Request

GET /bin/<BIN>/<PLATFORM>/<ARCH>/sha256 HTTP/1.1

Example response

a5d1fba1c28b60038fb1008a3c482b4119070a537af86a05046dedbe8f85e18d  hello

License

This project is licensed under MIT License