Skip to content

Commit

Permalink
add dnn
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Nov 28, 2024
1 parent d54bd85 commit 28be70f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions internal/app/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"context"
"net"
"net/http"
"net/netip"
"time"

"github.com/nextmn/json-api/healthcheck"
Expand All @@ -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)
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion internal/app/pdu_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 28be70f

Please sign in to comment.