A rust rewrite of clnrest
There is two ways you can do this, either edit the config or switch out the plugin file:
- Either replace
/usr/local/libexec/c-lightning/plugins/clnrest/clnrest
(can be different path depending on your OS) with the binary from this repo - Or edit the config:
disable-plugin=clnrest
plugin=/path/to/clnrest-rs
Release binaries for
- x86_64-linux
- armv7-linux (Raspberry Pi 32bit)
- aarch64-linux (Raspberry Pi 64bit)
can be found on the release page. If you are unsure about your architecture you can run uname -m
.
They require glibc>=2.31
, which you can check with ldd --version
.
You can build the plugin yourself instead of using the release binaries. First clone the repo:
git clone https://github.com/daywalker90/clnrest-rs.git
Install a recent rust version (rustup is recommended) and in the clnrest-rs
folder run:
cargo build --release
After that the binary will be here: target/release/clnrest-rs
Note: Release binaries are built using cross
and the optimized
profile.
These work the same as with the python implementation:
clnrest-port
: REST server port to listen on
clnrest-certs
: Path for certificates (for https), if you have your own certificates, otherwise clnrest will generate self-signed certs in yourlightning-dir
clnrest-protocol
: REST server protocol (https
orhttp
), defaults tohttps
clnrest-host
: REST server host, defaults to127.0.0.1
clnrest-cors-origins
:Cross origin resource sharing origins, defaults to*
clnrest-csp
: Content security policy (CSP) for the server, defaults todefault-src 'self'; font-src 'self'; img-src 'self' data:; frame-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';
clnrest-swagger-root
: Root path for Swagger UI, defaults to/
Thank you to the original author of clnrest Shahana