From b250a6b3c8118ef0b02a9173e1f7f5a2029d702b Mon Sep 17 00:00:00 2001 From: Melora Hugues Date: Wed, 27 Mar 2024 22:07:09 +0100 Subject: [PATCH] Allow sending correct public name in autodiscovery --- bootserver/config/config.go | 12 ++++++++---- bootserver/udplistener/udplistener.go | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bootserver/config/config.go b/bootserver/config/config.go index f5cfea8..c78ead4 100644 --- a/bootserver/config/config.go +++ b/bootserver/config/config.go @@ -48,10 +48,11 @@ type jsonConf struct { StaticDir string `json:"staticPath"` } `json:"storage"` Server struct { - Host string `json:"host"` - Port int `json:"port"` - Mode string `json:"mode"` - SockPath string `json:"sock"` + Host string `json:"host"` + Port int `json:"port"` + Mode string `json:"mode"` + SockPath string `json:"sock"` + PublicHost string `json:"public_host"` } `json:"server"` BootProvider struct { Iface string `json:"interface"` @@ -67,6 +68,7 @@ type AppConfig struct { DataFilepath string StaticDir string Host string + PublicHost string Port int SockPath string UPDMcastGroup string @@ -98,6 +100,7 @@ func (ac *AppConfig) UnmarshalJSON(data []byte) error { ac.ServerMode = lm ac.SockPath = jsonConf.Server.SockPath ac.Host = jsonConf.Server.Host + ac.PublicHost = jsonConf.Server.PublicHost ac.Port = jsonConf.Server.Port ac.UPDMcastGroup = jsonConf.BootProvider.McastGroup ac.UDPIface = jsonConf.BootProvider.Iface @@ -113,6 +116,7 @@ var defaultConfig AppConfig = AppConfig{ ServerMode: ModeNet, DataFilepath: "boot_options.json", Host: "0.0.0.0", + PublicHost: "http://127.0.0.1:5000", Port: 5000, UPDMcastGroup: "ff02::abcd:1234", UDPPort: 42, diff --git a/bootserver/udplistener/udplistener.go b/bootserver/udplistener/udplistener.go index 067139e..33290ee 100644 --- a/bootserver/udplistener/udplistener.go +++ b/bootserver/udplistener/udplistener.go @@ -28,7 +28,7 @@ type discoveryPayload struct { func payloadFromConfig(conf config.AppConfig) discoveryPayload { return discoveryPayload{ - ManagementAddress: conf.Host, + ManagementAddress: conf.PublicHost, Version: "1", } }