summaryrefslogtreecommitdiff
path: root/openbsd/blowfish.buetow.org/opt/src/gemini/myserver
diff options
context:
space:
mode:
authoradmin user <admin@twofish.buetow.org>2022-01-05 05:53:36 +0000
committeradmin user <admin@twofish.buetow.org>2022-01-05 05:53:36 +0000
commitd75cd71f106258db61dd24e19d8909af86774c69 (patch)
treef4c2409f733498579ee79e2d906828c1651edd91 /openbsd/blowfish.buetow.org/opt/src/gemini/myserver
parent7978ab5f02f3b07e99b44bed3e52ff5bf6eb455c (diff)
rebrand as frontends
Diffstat (limited to 'openbsd/blowfish.buetow.org/opt/src/gemini/myserver')
-rw-r--r--openbsd/blowfish.buetow.org/opt/src/gemini/myserver/main.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/openbsd/blowfish.buetow.org/opt/src/gemini/myserver/main.go b/openbsd/blowfish.buetow.org/opt/src/gemini/myserver/main.go
deleted file mode 100644
index 09bcb3f..0000000
--- a/openbsd/blowfish.buetow.org/opt/src/gemini/myserver/main.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package main
-
-import (
- "context"
- "crypto/tls"
- "fmt"
- "os"
- "time"
-
- "github.com/a-h/gemini"
-)
-
-type configuration struct {
- // Domain name, e.g. localhost.
- domain string
- // Certfile is the path to a server cerfificate file.
- certFile string
- // Keyfile is the path to a server key file.
- keyFile string
- // Path to Gemini content to serve.
- path string
-}
-
-func main() {
- config := []configuration{
- {
- domain: "buetow.org",
- certFile: "/etc/ssl/buetow.org.fullchain.pem",
- keyFile: "/etc/ssl/private/buetow.org.key",
- path: "/var/gemini/gemtexter/buetow.org",
- },
- {
- domain: "snonux.de",
- certFile: "/etc/ssl/snonux.de.fullchain.pem",
- keyFile: "/etc/ssl/private/snonux.de.key",
- path: "/var/gemini/gemtexter/snonux.de",
- },
- }
-
- // Load the config.
- domainToHandler := map[string]*gemini.DomainHandler{}
-
- for i := 0; i < len(config); i++ {
- c := config[i]
- h := gemini.FileSystemHandler(gemini.Dir(c.path))
- cert, err := tls.LoadX509KeyPair(c.certFile, c.keyFile)
- if err != nil {
- fmt.Printf("error: failed to load certificates for domain %q: %v\n", c.domain, err)
- os.Exit(1)
- }
- dh := gemini.NewDomainHandler(c.domain, cert, h)
- domainToHandler[c.domain] = dh
- }
-
- // Start the server.
- ctx := context.Background()
- server := gemini.NewServer(ctx, ":1965", domainToHandler)
- server.ReadTimeout = time.Second * 5
- server.WriteTimeout = time.Second * 10
- err := server.ListenAndServe()
- if err != nil {
- fmt.Printf("error: %v\n", err)
- os.Exit(1)
- }
-}