62 lines
1.2 KiB
Markdown
62 lines
1.2 KiB
Markdown
Finger server written in Rust.
|
|
|
|
Features:
|
|
- [x] Config file support for users and their info
|
|
- [x] Support for multiple users
|
|
- [x] Support dynamic content in templates (e.g. fetch from an API)
|
|
|
|
The project is intentionally lightweight:
|
|
- Small dependency set (`ureq` + `serde_json`)
|
|
- Fast startup
|
|
- Minimal CLI argument parser using `std::env`
|
|
|
|
## Build
|
|
|
|
```bash
|
|
cargo build
|
|
```
|
|
|
|
## Test
|
|
|
|
```bash
|
|
cargo test
|
|
```
|
|
|
|
## Run as CLI
|
|
|
|
```bash
|
|
# List known users from ./users
|
|
cargo run -- --list
|
|
|
|
# Render one user profile
|
|
cargo run -- bob
|
|
```
|
|
|
|
## Run as finger-like TCP server
|
|
|
|
```bash
|
|
# Listen on 127.0.0.1:7979 by default
|
|
cargo run -- --serve
|
|
|
|
# Custom bind and users directory
|
|
cargo run -- --serve --bind 0.0.0.0:7979 --users-dir ./users
|
|
```
|
|
|
|
You can query the server with tools like `nc`:
|
|
|
|
```bash
|
|
printf 'bob\n' | nc 127.0.0.1 7979
|
|
```
|
|
|
|
## Config Format
|
|
|
|
Each `.config` file under `users/` is plain text.
|
|
|
|
- The `Login:` field is used to identify the user.
|
|
- If `Login:` is missing, the filename stem is used.
|
|
- Dynamic template tokens are supported:
|
|
- `{{url https://example.com}}`
|
|
- `{{json_url https://example.com/data.json field_name}}`
|
|
|
|
If dynamic fetches fail, the token is replaced with `[unavailable]`.
|