Skip to content

daywalker90/clnrest-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

latest release on CLN v24.08.2 latest release on CLN v24.05 latest release on CLN v24.02.2

main on CLN v24.08.2 main on CLN v24.05 main on CLN v24.02.2

clnrest-rs

A rust rewrite of clnrest

Installation

There is two ways you can do this, either edit the config or switch out the plugin file:

CLN v24.05 and later

  • 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

CLN v24.02.2 and older

  • Either replace /usr/local/libexec/c-lightning/plugins/clnrest/clnrest.py (can be different path depending on your OS) with the binary from this repo.
  • Or edit the config:
disable-plugin=clnrest.py
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.

Building

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.

Options

These work the same as with the python implementation:

Required options

  • clnrest-port: REST server port to listen on

Optional options

  • clnrest-certs: Path for certificates (for https), if you have your own certificates, otherwise clnrest will generate self-signed certs in your lightning-dir
  • clnrest-protocol: REST server protocol (https or http), defaults to https
  • clnrest-host: REST server host, defaults to 127.0.0.1
  • clnrest-cors-origins:Cross origin resource sharing origins, defaults to *
  • clnrest-csp: Content security policy (CSP) for the server, defaults to default-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 /

Thanks

Thank you to the original author of clnrest Shahana