From 96f3a7607ffbdb349a4c2eff35efdf11b8d35a4e Mon Sep 17 00:00:00 2001 From: tjpcc Date: Tue, 10 Jan 2023 13:46:35 -0700 Subject: Add a CGI contrib --- examples/inspectls/main.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'examples/inspectls') 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) { -- cgit v1.2.3