summaryrefslogtreecommitdiff
path: root/internal/server.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-02-02 16:15:53 -0700
committertjpcc <tjp@ctrl-c.club>2023-02-02 16:15:53 -0700
commitac024567e880f0da59557f0051018f4ac932c6ad (patch)
treea1d0d5661d5f980ed56716e430a4e4de4b5e7bd3 /internal/server.go
parentb7cb13b4e68568b014c868186f536439e92d662f (diff)
Initial Router work.
- Router type, supports: adding handlers, serving, fetching the matching handler for a route. - Private PathTree type handles the modified radix trie.
Diffstat (limited to 'internal/server.go')
-rw-r--r--internal/server.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/server.go b/internal/server.go
index 38e478c..3efdf6e 100644
--- a/internal/server.go
+++ b/internal/server.go
@@ -4,17 +4,19 @@ import (
"context"
"net"
"sync"
-
- "tildegit.org/tjp/gus/logging"
)
+type logger interface {
+ Log(keyvals ...any) error
+}
+
type Server struct {
Ctx context.Context
Cancel context.CancelFunc
Wg *sync.WaitGroup
Listener net.Listener
HandleConn connHandler
- ErrorLog logging.Logger
+ ErrorLog logger
Host string
NetworkAddr net.Addr
}
@@ -26,7 +28,7 @@ func NewServer(
hostname string,
network string,
address string,
- errorLog logging.Logger,
+ errorLog logger,
handleConn connHandler,
) (Server, error) {
listener, err := net.Listen(network, address)