https://github.com/pinpox/gopherlix
A Server for the Gopher protocol written in Go
https://github.com/pinpox/gopherlix
go golang gopher gopher-protocol gopher-server server
Last synced: over 1 year ago
JSON representation
A Server for the Gopher protocol written in Go
- Host: GitHub
- URL: https://github.com/pinpox/gopherlix
- Owner: pinpox
- License: gpl-3.0
- Created: 2020-01-27T15:02:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-01T09:21:06.000Z (over 6 years ago)
- Last Synced: 2025-01-28T10:17:58.324Z (over 1 year ago)
- Topics: go, golang, gopher, gopher-protocol, gopher-server, server
- Language: Go
- Homepage: https://pablo.tools
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/binaryplease/gopherlix)
[](https://godoc.org/github.com/binaryplease/gopherlix)
[](https://goreportcard.com/report/github.com/binaryplease/gopherlix)
[](https://codecov.io/gh/binaryplease/gopherlix)
# gopherlix
A Server for the Gopher protocol, written in the Go.
## Usage
### Quickstart
#### Installation
Just clone the repository and run `go build` in it.
```sh
git clone https://github.com/binaryplease/gopherlix.git
cd gopherlix
go build
```
#### Basic configuration
```ini
[paths]
content = "data/content"
templates = "data/templates"
[server]
port = "8000"
domain = "localhost"
host = "0.0.0.0"
```
The configuration file (`config.ini`) should be self explanatory. The server
includes some sample pages and should run with it out of the box on port `8000`.
You may want to change the port to gophers default port `70`
#### Run the server
Gopherlix will look for the configuration file in the same folder as the server
per defalt.
To start it just run `./gopherlix` and start browsing `goopher://localhost:8000`
### Features
#### Adding content
You can add content in the `content` directory configured in `config.ini`.
The `templates` directory includes templates that can be rendered in inside
other files. The `header.gph` and `footer.gph` will be added automatically to
all pages.
#### Directory listings
A request like `gopher://localhost/something` will look for
`data/content/something` and check if it's a file or a directory.
For a file, the contents of it will be returned. If the requested path is a
directory, it will try to find a file called `index.gph` in it and display it.
If no `index.gph` is found in this directory, it will generate a listing with
links to all the directory contents.
#### Templating
Gopherlix leverages the power of golangs
[templates](https://golang.org/pkg/text/template/) to generate content
dynamically. This allows to include ariables in the form of `{{.Variablename}}`
in any page that will be replaced accordingly. At the moment the following
variables are suported (more to come in future updates):
| Variable | Description |
|-----------------|--------------------------------|
| {{.Directory}} | Path of the current request |
| {{.ServerName}} | Shows the server's domain name |
# Contributing
Pull-request, issues, feature-requst and contributions of any kind are *very*
welcome!