GitHub

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

3 Commits

gonetd listens on localhost:80 and does a few related tasks:

  • "inetd"-like system; I have a few local webapps I only access infrequently. I think systemd socket activation can do this as well(?) But I use Void Linux and runit.

  • Proxy sites to deal with CORS; I use this for displaying weather information from met.ie on my custom new tab page.

  • Serve local files; easy enough to add here if it's running anyway.


This requires a TOML config file; example:

['met.localhost']
proxy = 'http://openaccess.pf.api.met.ie'
['metimg.localhost']
proxy       = 'https://www.met.ie'
proxy-cache = true  # Cache everything unconditionally
['new.arp242.net']
fileserve = '/home/martin/code/arp242.net/_site'
['review.localhost']
listen  = 'localhost:2000'
cmd     = ['/home/martin/.local/gobin/review']
dir     = '/home/martin/code/Prog/review'
timeout = '60s'  # Kill after not being access for this long.
['gog.localhost']
listen  = 'localhost:2001'
cmd     = ['/home/martin/.local/gobin/gog', 'serve']
dir     = '/home/martin/code/Prog/gog'
timeout = '60s'

The table header is the domain; you may need to set up these in /etc/hosts. Make sure to quote the names to avoid the dots being interpreted.

The config can be as a file in the first positional argument:

% gonetd /path/to/config.toml

Or via stdin:

% gonetd <<<'
    ["met.localhost"]
    proxy = "http://openaccess.pf.api.met.ie"
    ['metimg.localhost']
    proxy       = 'https://www.met.ie'
    proxy-cache = true  # Cache everything unconditionally
    ["new.arp242.net"]
    fileserve = "/home/martin/code/arp242.net/_site"
    ["review.localhost"]
    listen  = "localhost:2000"
    cmd     = ["/home/martin/.local/gobin/review"]
    dir     = "/home/martin/code/Prog/review"
    timeout = "60s"
    ["gog.localhost"]
    listen  = "localhost:2001"
    cmd     = ["/home/martin/.local/gobin/gog", "serve"]
    dir     = "/home/martin/code/Prog/gog"
    timeout = "60s"
'

Read the original on github.com ↗