summaryrefslogtreecommitdiff
path: root/examples/inspectls/main.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-10 13:46:35 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-10 13:46:35 -0700
commit96f3a7607ffbdb349a4c2eff35efdf11b8d35a4e (patch)
tree8f1755bd3f3aedf33784f66aab9feccdd36c165e /examples/inspectls/main.go
parentdb7b6ef07254d61dee46a863786458e15a6459f6 (diff)
Add a CGI contrib
Diffstat (limited to 'examples/inspectls/main.go')
-rw-r--r--examples/inspectls/main.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/inspectls/main.go b/examples/inspectls/main.go
index a315e40..d690af1 100644
--- a/examples/inspectls/main.go
+++ b/examples/inspectls/main.go
@@ -9,12 +9,11 @@ import (
"encoding/hex"
"fmt"
"log"
- "net"
"os"
"strings"
- "tildegit.org/tjp/gus/gemini"
guslog "tildegit.org/tjp/gus/contrib/log"
+ "tildegit.org/tjp/gus/gemini"
)
func main() {
@@ -27,17 +26,15 @@ func main() {
log.Fatal(err)
}
- // set up the network listener
- listener, err := net.Listen("tcp4", ":1965")
- if err != nil {
- log.Fatal(err)
- }
-
// add stdout logging to the request handler
handler := guslog.Requests(os.Stdout, nil)(inspectHandler)
// run the server
- gemini.NewServer(context.Background(), tlsconf, listener, handler).Serve()
+ server, err := gemini.NewServer(context.Background(), tlsconf, "tcp4", ":1965", handler)
+ if err != nil {
+ log.Fatal(err)
+ }
+ server.Serve()
}
func envConfig() (string, string) {