From 28be70fa9840948e7935897f897a2831ad81ddc9 Mon Sep 17 00:00:00 2001 From: Louis Royer Date: Thu, 28 Nov 2024 12:01:10 +0100 Subject: [PATCH] add dnn --- internal/app/control.go | 5 +++-- internal/app/pdu_session.go | 2 +- internal/config/config.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/app/control.go b/internal/app/control.go index b07eac2..86a2545 100644 --- a/internal/app/control.go +++ b/internal/app/control.go @@ -9,6 +9,7 @@ import ( "context" "net" "net/http" + "net/netip" "time" "github.com/nextmn/json-api/healthcheck" @@ -22,7 +23,7 @@ type HttpServerEntity struct { ps *PduSessions } -func NewHttpServerEntity(bindAddr string, ps *PduSessions) *HttpServerEntity { +func NewHttpServerEntity(bindAddr netip.AddrPort, ps *PduSessions) *HttpServerEntity { // TODO: gin.SetMode(gin.DebugMode) / gin.SetMode(gin.ReleaseMode) depending on log level r := gin.Default() r.GET("/status", Status) @@ -34,7 +35,7 @@ func NewHttpServerEntity(bindAddr string, ps *PduSessions) *HttpServerEntity { logrus.WithFields(logrus.Fields{"http-addr": bindAddr}).Info("HTTP Server created") e := HttpServerEntity{ srv: &http.Server{ - Addr: bindAddr, + Addr: bindAddr.String(), Handler: r, }, ps: ps, diff --git a/internal/app/pdu_session.go b/internal/app/pdu_session.go index e938fbf..b9df7b1 100644 --- a/internal/app/pdu_session.go +++ b/internal/app/pdu_session.go @@ -87,7 +87,7 @@ type PduSession struct { } func NewPduSessions(control jsonapi.ControlURI, slices map[string]config.Slice, userAgent string) *PduSessions { - var pools map[string]*Pool + pools := make(map[string]*Pool) for name, p := range slices { pools[name] = NewPool(p.Pool) } diff --git a/internal/config/config.go b/internal/config/config.go index 795dde7..59649e4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -39,7 +39,7 @@ type CPConfig struct { type Control struct { Uri jsonapi.ControlURI `yaml:"uri"` // may contain domain name instead of ip address - BindAddr string `yaml:"bind-addr"` // in the form `ip:port` + BindAddr netip.AddrPort `yaml:"bind-addr"` // in the form `ip:port` } type Slice struct {