aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2023-12-09 20:49:37 -0700
committerNavan Chauhan <navanchauhan@gmail.com>2023-12-09 20:49:37 -0700
commitf7af66e9e9880196e194d02e7c11e041f63a3110 (patch)
tree21e5dcac83977589a4f0771fba246894bc3ea67c /README.md
parent2fab25898415483b49aeadff333dd4e2804288ff (diff)
add more instructions
Diffstat (limited to 'README.md')
-rw-r--r--README.md69
1 files changed, 67 insertions, 2 deletions
diff --git a/README.md b/README.md
index 5354ef4..291e6a0 100644
--- a/README.md
+++ b/README.md
@@ -25,11 +25,28 @@
# Swift-Gopher
+You can interact with my hosted gopher server at [gopher://gopher.navan.dev](gopher://gopher.navan.dev) or [https://gopher.navan.dev](https://gopher.navan.dev)
+
+```
+USAGE: swift-gopher [--gopher-host-name <gopher-host-name>] [--host <host>] [--port <port>] [--gopher-data-dir <gopher-data-dir>] [--disable-search] [--disable-gophermap]
+
+OPTIONS:
+ -g, --gopher-host-name <gopher-host-name>
+ Hostname used for generating selectors (default: localhost)
+ -h, --host <host> (default: 0.0.0.0)
+ -p, --port <port> (default: 8080)
+ -d, --gopher-data-dir <gopher-data-dir>
+ Data directory to map (default: ./example-gopherdata)
+ --disable-search Disable full-text search feature
+ --disable-gophermap Disable reading gophermap files to override automatic generation
+ -h, --help
+```
+
## Get Started
```
git clone https://github.com/navanchauhan
cd swift-gopher
-swift build && swift run swift-gopher
+swift build -c release && swift run swift-gopher
```
Then, you can either use lynx or curl (or other Gopher clients) to connect to the server.
@@ -38,4 +55,52 @@ Then, you can either use lynx or curl (or other Gopher clients) to connect to th
lynx gopher://localhost:8080
# Or,
curl gopher://localhost:8080
-``` \ No newline at end of file
+```
+
+**Note: Depending on user privileges, you may not be able to bind to port 70.**
+
+To give privilege to the binary on Linux, you can use the following command:
+
+```bash
+sudo setcap CAP_NET_BIND_SERVICE=+eip ./.build/release/swift-gopher
+```
+
+## Deploying
+
+### Systemd
+
+Sample systemd file:
+
+```
+[Unit]
+Description=Swift-Gopher
+
+[Service]
+ExecStart=/home/swift-gopher/swift-gopher/.build/release/swift-gopher --port 70 --gopher-host-name gopher.navan.dev --gopher-data-dir /home/swift-gopher/gopher_data
+User=swift-gopher
+Group=swift-gopher
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+NoNewPrivileges=true
+
+[Install]
+WantedBy=multi-user.target
+```
+
+## HTTP Proxy
+
+Although, `swift-gopher` does not currently have a native HTTP handler, you can use self host some of the following packages to proxy the Gopher server to HTTP:
+
+* [gophper-proxy](https://github.com/muffinista/gophper-proxy) + Caddy is what I use to host the HTTPS version of my Gopher server at [https://gopher.navan.dev](https://gopher.navan.dev)
+* [gopher-proxy](https://hackage.haskell.org/package/gopher-proxy)
+* [gopherproxy-c](https://git.codemadness.org/gopherproxy-c/)
+
+## TODO:
+
+- [ ] Add Tests
+- [ ] Add CI
+- [ ] Add more documentation
+- [ ] Automatic Versioning
+- [ ] Verify Compatibility with other Gopher Clients
+- [ ] Support Gemini Protocol
+- [ ] Add a client library
+- [ ] Add native HTTP handler \ No newline at end of file