2019-12-28 20:45:20 +00:00
|
|
|
<!--
|
2019-12-19 18:27:15 +00:00
|
|
|
/ |
|
|
|
|
___ (___ ___|
|
|
|
|
| )| )| )
|
2019-12-23 02:05:48 +00:00
|
|
|
|__/ | / |__/
|
|
|
|
|
|
2019-12-28 21:08:38 +00:00
|
|
|
--> <p align="center"><img src="./img/logo.png"></p>
|
2019-12-19 18:27:15 +00:00
|
|
|
|
2019-12-28 21:13:49 +00:00
|
|
|
`phd` is an esoteric gopher server for small gopherholes.
|
2019-12-19 18:27:15 +00:00
|
|
|
|
2019-12-31 19:25:30 +00:00
|
|
|
point it at a directory and it'll serve up all its text files,
|
|
|
|
sub-directories, and binary files over gopher. any `.gph` files will
|
|
|
|
be served up as [gopermaps][map] and executable `.gph` files will be
|
|
|
|
run as a script with their output served to the client, like cgi!
|
2019-12-28 05:06:33 +00:00
|
|
|
|
2019-12-28 05:50:28 +00:00
|
|
|
special files:
|
2019-12-19 18:27:15 +00:00
|
|
|
|
2019-12-31 19:25:30 +00:00
|
|
|
- **header.gph**: if it exists in a directory, its content will be
|
|
|
|
shown above the directory's content. put ascii art in it.
|
2019-12-28 05:50:28 +00:00
|
|
|
- **footer.gph**: same, but will be shown below a directory's content.
|
2019-12-31 19:25:30 +00:00
|
|
|
- **index.gph**: completely replaces a directory's content with what's
|
|
|
|
in this file.
|
|
|
|
- **??.gph**: visiting gopher://yoursite/1/dog/ will try to render
|
2020-01-01 03:47:34 +00:00
|
|
|
`dog.gph` from disk.
|
2019-12-31 19:25:30 +00:00
|
|
|
- **.reverse**: if this exists, the directory contents will be listed
|
|
|
|
in reverse alphanumeric order. useful for phloggin'.
|
|
|
|
|
|
|
|
any line in a `.gph` file that doesn't contain tabs (`\t`) and doesn't
|
|
|
|
start with an `i` will get an `i` automatically prefixed, turning it
|
|
|
|
into a gopher information item.
|
|
|
|
|
|
|
|
any `.gph` file that is marked **executable** with be run as if it
|
|
|
|
were a shell script and its output will be sent to the client. it will
|
|
|
|
be passed three arguments: the query string (if any, the host, and the
|
|
|
|
port. do with them what you will.
|
2019-12-28 07:46:27 +00:00
|
|
|
|
2019-12-28 20:45:20 +00:00
|
|
|
for example:
|
2019-12-28 07:46:27 +00:00
|
|
|
|
|
|
|
$ cat echo.gph
|
|
|
|
#!/bin/sh
|
2019-12-28 09:27:29 +00:00
|
|
|
echo "Hi, world! You said:" $1
|
2019-12-28 20:45:20 +00:00
|
|
|
echo "1Visit Gopherpedia / gopherpedia.com 70"
|
2019-12-28 07:46:27 +00:00
|
|
|
|
2019-12-28 20:45:20 +00:00
|
|
|
then:
|
2019-12-28 07:46:27 +00:00
|
|
|
|
2019-12-28 09:27:29 +00:00
|
|
|
$ gopher-client gopher://localhost/1/echo?something
|
2019-12-28 20:45:20 +00:00
|
|
|
[INFO] Hi, world! You said: something
|
|
|
|
[LINK] Visit Gopherpedia
|
|
|
|
|
|
|
|
or more seriously:
|
|
|
|
|
|
|
|
$ cat figlet.gph
|
|
|
|
#!/bin/sh
|
|
|
|
figlet $1
|
|
|
|
|
|
|
|
then:
|
|
|
|
|
|
|
|
$ gopher-client gopher://localhost/1/figlet?hi gopher
|
2019-12-29 22:48:40 +00:00
|
|
|
[INFO] _ _ _
|
|
|
|
[INFO] | |__ (_) __ _ ___ _ __ | |__ ___ _ __
|
2019-12-28 20:45:20 +00:00
|
|
|
[INFO] | '_ \| | / _` |/ _ \| '_ \| '_ \ / _ \ '__|
|
2019-12-29 22:48:40 +00:00
|
|
|
[INFO] | | | | | | (_| | (_) | |_) | | | | __/ |
|
|
|
|
[INFO] |_| |_|_| \__, |\___/| .__/|_| |_|\___|_|
|
|
|
|
[INFO] |___/ |_|
|
2019-12-28 20:45:20 +00:00
|
|
|
|
2019-12-28 07:46:27 +00:00
|
|
|
|
2019-12-19 18:27:15 +00:00
|
|
|
## usage
|
|
|
|
|
2019-12-28 21:45:47 +00:00
|
|
|
Usage:
|
|
|
|
|
|
|
|
phd [options] <root directory>
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
-p, --port Port to bind to.
|
|
|
|
-h, --host Hostname to use when generating links.
|
|
|
|
|
|
|
|
Other flags:
|
|
|
|
|
|
|
|
-h, --help Print this screen.
|
|
|
|
-v, --version Print phd version.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
2019-12-31 19:25:30 +00:00
|
|
|
phd ./path/to/site # Serve directory over port 7070.
|
|
|
|
phd -p 70 docs # Serve 'docs' directory on port 70
|
|
|
|
phd -h gopher.com # Serve current directory over port 7070
|
|
|
|
# using hostname "gopher.com"
|
2019-12-19 18:27:15 +00:00
|
|
|
|
2019-12-28 21:25:01 +00:00
|
|
|
## installation
|
|
|
|
|
2019-12-31 19:25:30 +00:00
|
|
|
binaries for linux, mac, and raspberry pi are available
|
|
|
|
at https://github.com/dvkt/phd/releases:
|
2019-12-28 21:25:01 +00:00
|
|
|
|
2020-01-01 22:02:15 +00:00
|
|
|
- [phd-v0.1.4-linux-x86_64.tar.gz][0]
|
|
|
|
- [phd-v0.1.4-linux-armv7.tar.gz (RPi)][1]
|
2020-01-01 21:59:30 +00:00
|
|
|
- [phd-v0.1.4-macos.zip][2]
|
2019-12-28 21:25:01 +00:00
|
|
|
|
|
|
|
just unzip/untar the `phd` program into your $PATH and get going!
|
|
|
|
|
2019-12-19 18:27:15 +00:00
|
|
|
## development
|
|
|
|
|
|
|
|
cargo run -- ./path/to/gopher/site
|
|
|
|
|
|
|
|
## resources
|
|
|
|
|
|
|
|
- https://github.com/gophernicus/gophernicus/blob/master/README.Gophermap
|
|
|
|
- https://gopher.zone/posts/how-to-gophermap/
|
2019-12-28 00:53:36 +00:00
|
|
|
- [rfc 1436](https://tools.ietf.org/html/rfc1436)
|
2019-12-19 18:27:15 +00:00
|
|
|
|
2019-12-28 06:27:56 +00:00
|
|
|
## todo
|
|
|
|
|
2019-12-31 19:25:30 +00:00
|
|
|
- [ ] script/serverless mode
|
2019-12-28 21:37:08 +00:00
|
|
|
- [ ] systemd config, or something
|
2019-12-28 21:47:39 +00:00
|
|
|
- [ ] TLS support
|
|
|
|
- [ ] man page
|
2020-01-01 03:47:34 +00:00
|
|
|
- [ ] ipv6
|
2019-12-29 22:48:40 +00:00
|
|
|
|
2020-01-01 22:02:15 +00:00
|
|
|
[0]: https://github.com/dvkt/phd/releases/download/v0.1.3/phd-v0.1.4-linux-x86_64.tar.gz
|
|
|
|
[1]: https://github.com/dvkt/phd/releases/download/v0.1.3/phd-v0.1.4-linux-armv7.tar.gz
|
2020-01-01 21:59:30 +00:00
|
|
|
[2]: https://github.com/dvkt/phd/releases/download/v0.1.3/phd-v0.1.4-macos.zip
|
2020-01-01 03:47:34 +00:00
|
|
|
[map]: https://en.wikipedia.org/wiki/Gopher_(protocol)#Source_code_of_a_menu
|