mirror of
https://github.com/YGGverse/nexy.git
synced 2026-03-31 09:15:28 +00:00
183 lines
No EOL
6.2 KiB
Markdown
183 lines
No EOL
6.2 KiB
Markdown
# Nexy - Multi-network server for the [Nex protocol](https://nightfall.city/nex/info/specification.txt)
|
|
|
|

|
|
[](https://deps.rs/repo/github/yggverse/nexy)
|
|
[](https://crates.io/crates/nexy)
|
|
|
|

|
|
|
|
## Features
|
|
|
|
> [!TIP]
|
|
> See the [Options](#options) section for a complete list of other features!
|
|
|
|
* [x] Run IPv4/IPv6 server accessible to Internet, [Yggdrasil](https://yggdrasil-network.github.io/), [Mycelium](https://github.com/threefoldtech/mycelium), and other networks simultaneously, as many as desired;
|
|
* [x] Optimized for streaming large files (in chunks) without memory overload on buffering the data;
|
|
* [x] Customizable templates for the directory index locations;
|
|
* [x] Build-in daily requests counter for the current session with template macro support;
|
|
* [x] Detailed debug logs with `StandardOutput` and `StandardError` separation;
|
|
* [x] Supports the [CLF](https://en.wikipedia.org/wiki/Common_Log_Format) access log, which is compatible with analytics tools such as [GoAccess](https://goaccess.io/), [GoatCounter](https://www.goatcounter.com/) or just [htcount](https://github.com/yggverse/htcount);
|
|
* [x] Custom templates for various server response types;
|
|
* [ ] Soft links support (requires regex option for canonical path resolver)
|
|
* [ ] Cache directory listing
|
|
* [ ] Limit downloading speed
|
|
* [ ] Traffic abuse protection
|
|
|
|
## Install
|
|
|
|
1. `git clone https://github.com/yggverse/nexy.git && cd nexy`
|
|
2. `cargo build --release`
|
|
3. `sudo install target/release/nexy /usr/local/bin/nexy`
|
|
|
|
## Usage
|
|
|
|
> [!TIP]
|
|
> For more examples, visit the project [Wiki](https://github.com/YGGverse/nexy/wiki)
|
|
|
|
``` bash
|
|
nexy -p /path/to/public_dir
|
|
```
|
|
* by default, server starts on localhost; change it with the `--bind` option(s)
|
|
|
|
### Options
|
|
|
|
``` bash
|
|
-a, --access-log <ACCESS_LOG>
|
|
Absolute path to the access log file
|
|
|
|
-b, --bind <BIND>
|
|
Bind server(s) `host:port` to listen incoming connections
|
|
|
|
* use `[host]:port` notation for IPv6
|
|
|
|
[default: 127.0.0.1:1900 [::1]:1900]
|
|
|
|
-d, --debug
|
|
Print debug information
|
|
|
|
-p, --public <PUBLIC>
|
|
Absolute path to the public files directory
|
|
|
|
--show-hidden
|
|
Show hidden entries (in the directory listing)
|
|
|
|
* Important: this option does not prevent access to hidden files!
|
|
|
|
--template-access-denied <TEMPLATE_ACCESS_DENIED>
|
|
Absolute path to the `Access denied` template file
|
|
|
|
* this template file can be in binary format (e.g. image)
|
|
|
|
--template-internal-server-error <TEMPLATE_INTERNAL_SERVER_ERROR>
|
|
Absolute path to the `Internal server error` template file
|
|
|
|
* this template file can be in binary format (e.g. image)
|
|
|
|
--template-not-found <TEMPLATE_NOT_FOUND>
|
|
Absolute path to the `Not found` template file
|
|
|
|
* this template file can be in binary format (e.g. image)
|
|
|
|
--template-welcome <TEMPLATE_WELCOME>
|
|
Absolute path to the `Welcome` template file. Unlike `template-index`, this applies only to the `public` location
|
|
|
|
* this template file expects pattern and cannot be in binary format
|
|
|
|
**Patterns**
|
|
* `{list}` - entries list for the `public` directory
|
|
* `{hosts}` - unique visitors count
|
|
* `{hits}` - requests count
|
|
|
|
--template-index <TEMPLATE_INDEX>
|
|
Absolute path to the `Index` template file for each directory
|
|
|
|
* this template file expects pattern and cannot be in binary format
|
|
|
|
**Patterns**
|
|
* `{list}` - entries list for the current directory
|
|
* `{hosts}` - unique visitors count
|
|
* `{hits}` - requests count
|
|
|
|
--list-dir-show-count
|
|
Show files count in dir (as the alternative text for navigation links)
|
|
|
|
--list-dir-show-accessed
|
|
Show directory accessed time
|
|
|
|
--list-dir-show-created
|
|
Show directory created time
|
|
|
|
--list-dir-show-modified
|
|
Show directory modified time
|
|
|
|
--list-dir-sort-by-accessed
|
|
Sort dirs by time accessed (name by default)
|
|
|
|
--list-dir-sort-by-created
|
|
Sort dirs by time created (name by default)
|
|
|
|
--list-dir-sort-by-modified
|
|
Sort dirs by time modified (name by default)
|
|
|
|
--list-dir-sort-by-count
|
|
Sort dirs by count (name by default)
|
|
|
|
--list-dir-reverse
|
|
Sort directories in list DESC (ASC by default)
|
|
|
|
--list-file-show-size
|
|
Show file size in list (as the alternative text for navigation links)
|
|
|
|
--list-file-show-accessed
|
|
Show file accessed time
|
|
|
|
--list-file-show-created
|
|
Show file created time
|
|
|
|
--list-file-show-modified
|
|
Show file modified time
|
|
|
|
--list-file-sort-by-accessed
|
|
Sort files by time accessed (name by default)
|
|
|
|
--list-file-sort-by-created
|
|
Sort files by time created (name by default)
|
|
|
|
--list-file-sort-by-modified
|
|
Sort files by time modified (name by default)
|
|
|
|
--list-file-sort-by-size
|
|
Sort files by size (name by default)
|
|
|
|
--list-file-reverse
|
|
Sort files in list DESC (ASC by default)
|
|
|
|
--list-file-slash <LIST_FILE_SLASH>
|
|
Append trailing slash to files match regex pattern(s)
|
|
|
|
--list-time-format <LIST_TIME_FORMAT>
|
|
Time format for listing items
|
|
|
|
* use escape notation for `%` e.g. `"%%Y-%%m-%%d %%H:%%M:%%S"`
|
|
|
|
[default: %Y/%m/%d]
|
|
|
|
--list-url-encode <LIST_URL_ENCODE>
|
|
Encode listing URL match regex pattern (use `.*` for all entries)
|
|
|
|
-r, --read-chunk <READ_CHUNK>
|
|
Optimize memory usage on reading large files or stream
|
|
|
|
[default: 1024]
|
|
|
|
-h, --help
|
|
Print help (see a summary with '-h')
|
|
|
|
-V, --version
|
|
Print version
|
|
```
|
|
|
|
## See also
|
|
|
|
* [Yoda](https://github.com/YGGverse/Yoda) - Client for the Gemini & Nex protocols, written in Rust
|
|
* [snac2nex](https://crates.io/crates/snac2nex) - Export [Snac](https://codeberg.org/grunfink/snac2) profiles to the Nex blog format |