From ac024567e880f0da59557f0051018f4ac932c6ad Mon Sep 17 00:00:00 2001 From: tjpcc Date: Thu, 2 Feb 2023 16:15:53 -0700 Subject: Initial Router work. - Router type, supports: adding handlers, serving, fetching the matching handler for a route. - Private PathTree type handles the modified radix trie. --- internal/server.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'internal/server.go') 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) -- cgit v1.2.3