Skip to content

Commit

Permalink
Fix URI when control addr is IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Feb 14, 2024
1 parent 2b2a49d commit 2175604
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion internal/app/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2175604

Please sign in to comment.