diff --git a/internal/app/setup.go b/internal/app/setup.go index f5d9843..a24ac97 100644 --- a/internal/app/setup.go +++ b/internal/app/setup.go @@ -59,7 +59,13 @@ func (s *Setup) AddTasks() { if s.config.HTTPPort != nil { httpPort = *s.config.HTTPPort } - httpURI := "http://" + s.config.HTTPAddress + httpPort + httpURI := "http://" + if s.config.HTTPAddress.Is6() { + httpURI = httpURI + "[" + s.config.HTTPAddress.String() + "]" + httpPort + } else { + httpURI = httpURI + s.config.HTTPAddress.String() + httpPort + } + // 0.3 http server // 0.4 controller registry if s.config.Locator != nil { diff --git a/internal/config/config.go b/internal/config/config.go index 0aaea75..c920762 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -33,8 +33,8 @@ type SRv6Config struct { Hooks *Hooks `yaml:"hooks"` // interface with controller - HTTPAddress string `yaml:"http-address"` - HTTPPort *string `yaml:"http-port,omitempty"` // default: 80 + HTTPAddress netip.Addr `yaml:"http-address"` + HTTPPort *string `yaml:"http-port,omitempty"` // default: 80 // TODO: use a better type for this information ControllerURI string `yaml:"controller-uri"` // example: http://192.0.2.2/8080