summaryrefslogtreecommitdiff
path: root/examples/inspectls/main.go
diff options
context:
space:
mode:
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) {