mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-08 22:24:54 +00:00
feat: allow to bind to multiple host IP addresses specified as CIDR prefix in x-ports (#358)
Signed-off-by: Miek Gieben <miek@miek.nl> Co-authored-by: Pasha Sviderski <me@psviderski.name>
This commit is contained in:
1 parent
3586a32987
commit
1247f961c2
11 files changed
+312
-76
No files matched your search
@@ -112,10 +112,14 @@ func convertServicePortConfigToPortSpec(port types.ServicePortConfig) (api.PortS
|
||||
// Set host IP if specified
|
||||
if port.HostIP != "" {
|
||||
hostIP, err := netip.ParseAddr(port.HostIP)
|
||||
if err != nil {
|
||||
return spec, fmt.Errorf("invalid host IP %q: %w", port.HostIP, err)
|
||||
if err == nil {
|
||||
spec.HostIP = hostIP
|
||||
} else {
|
||||
spec.HostPrefix, err = netip.ParsePrefix(port.HostIP)
|
||||
if err != nil {
|
||||
return spec, fmt.Errorf("invalid host IP or prefix '%s': %w", port.HostIP, err)
|
||||
}
|
||||
}
|
||||
spec.HostIP = hostIP
|
||||
}
|
||||
|
||||
// Validate the resulting spec
|
||||
|
||||
Reference in new issue
Block a user