cn-fileserver serves files from a directory over CNP.
It can also list directory contents as a CNM document.
cn-fileserver requires Go 1.8 or later.
Install it with:
go get -u contnet.org/tool/cn-fileserver
Run it with
-dir DIR: serve files from folder DIR (default
-listen HOST:PORT: listen on HOST:PORT (default
localhost:25454; port is optional and defaults to 25454)
-select SELECTORS: comma-separated list of enabled selectors (default
byte,info,cnmenables all selectors;
-select=to disable selectors)
File matching rules:
If the requested path doesn't end with
/but is a folder, it will be redirected to the same path with a slash appended.
If the requested path is a folder that contains a file named
index.cnm, that file will be sent as the response.
If the requested path is a file, the file will be sent as the response.
If the requested path with
.cnmappended is a file, that file will be sent as the response.
Otherwise the requested path does not exist and an
errorresponse is sent.
cn-fileserver -listen 0.0.0.0 -dir /var/contnet/cnroot
A sample systemd service unit file is also provided with the source code.
The cn-fileserver source code is available on https://git.clsr.net/contnet/cn-fileserver