From c1d541b78ff112936c5fd08450384f96758e3852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kasi=C4=8D?= Date: Sat, 6 Nov 2021 13:15:14 +0100 Subject: [PATCH] Fix generating IPv6 address (#105) --- handler/routes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handler/routes.go b/handler/routes.go index 8e8289f..8fcbab7 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -621,7 +621,11 @@ func SuggestIPAllocation(db store.IStore) echo.HandlerFunc { fmt.Sprintf("Cannot suggest ip allocation: failed to get available ip from network %s", cidr), }) } - suggestedIPs = append(suggestedIPs, fmt.Sprintf("%s/32", ip)) + if (strings.Contains(ip, ":")) { + suggestedIPs = append(suggestedIPs, fmt.Sprintf("%s/128", ip)) + } else { + suggestedIPs = append(suggestedIPs, fmt.Sprintf("%s/32", ip)) + } } return c.JSON(http.StatusOK, suggestedIPs)