Mirror of the official eokvin repository
Go to file
Tyler Sommer d4e72f2816
Listen on any address
2019-07-17 18:25:51 -06:00
cmd Listen on any address 2019-07-17 18:25:51 -06:00
Dockerfile Add Dockerfile 2019-07-16 07:25:51 -06:00
LICENSE Initial commit 2019-03-02 04:32:05 -07:00
README.md Adjust formatting in README 2019-03-07 16:32:24 -07:00
client.go Update client and eokify command with ttl 2019-04-16 18:00:37 -06:00



Private, single-user, self-hosted URL shortening service.

"These are words." -- anonymous


eokvin enforces TLS, relying on LetsEncrypt to issue certificates automatically by default. Short URLs are created using a basic POST API and expire after a set time.

Usage of ./eokvin:
  -cert-file string
        TLS certificate chain file, blank for autocert
  -hash-token string
        If given, the sha256 of the given value will be printed
  -host string
        Listen hostname (default "eok.vin")
  -http-port int
        HTTP listen port (default 80)
  -key-file string
        TLS private key file, blank for autocert
  -port int
        HTTPS listen port (default 443)
  -token string
        SHA256 of the secret token, used to authenticate

Important notes

  • A secret token is required to create new short URLs, given in the -token command-line option. This must be the hexadecimal string representation of the token (ie. 64 characters long) in question.

  • Use the -hash-token command-line option to print the SHA256 result (formatted as the -hash option expects) of a given phrase.

    $ ./eokvin -hash-token "this is a really long and arbitrary input"
  • To avoid using LetsEncrypt (for example, when running locally), use a standard cert and key by using the -cert-file and -key-file command-line options.

Create a short URL

Submit a POST request with Content-Type application/x-www-form-encoded to /new with the request body containing:

  1. The original, plaintext secret token as token=<plain token>.
  2. The real URL to redirect to for the new short URL as url=<redirect-url>.

Upon success, the server will respond with a JSON blob. For example:


Visiting the generated URL in your browser will redirect you to the specified redirect URL. After the configured expiry duration passes (5 minutes at the time of writing), short URLs are no longer accessible and are removed from the in-memory data store.