From 02231d33a43ba5d13b495bf17c41d54a94f13ab1 Mon Sep 17 00:00:00 2001 From: Yair Slobodin Date: Mon, 2 Sep 2024 11:23:31 +0300 Subject: [PATCH] use ToIPAddressString --- pkg/io/confio/sg.go | 2 +- pkg/io/csvio/sg.go | 2 +- pkg/io/mdio/sg.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/io/confio/sg.go b/pkg/io/confio/sg.go index ee551214..656ec479 100644 --- a/pkg/io/confio/sg.go +++ b/pkg/io/confio/sg.go @@ -53,7 +53,7 @@ func sgRemote(nameToSGRemoteRef map[string]*vpcv1.SecurityGroupRuleRemoteSecurit st := rule.Remote.String() switch t := rule.Remote.(type) { case *netset.IPBlock: - if t.Size() == 1 { // single IP address + if ipString := t.ToIPAddressString(); ipString != "" { // single IP address return &vpcv1.SecurityGroupRuleRemoteIP{ Address: &st, } diff --git a/pkg/io/csvio/sg.go b/pkg/io/csvio/sg.go index a10dc8db..3a958754 100644 --- a/pkg/io/csvio/sg.go +++ b/pkg/io/csvio/sg.go @@ -74,7 +74,7 @@ func sGPort(p interval.Interval) string { func sGRemoteType(t ir.RemoteType) string { switch t := t.(type) { case *netset.IPBlock: - if t.Size() == 1 { + if ipString := t.ToIPAddressString(); ipString != "" { return "IP address" } return "CIDR block" diff --git a/pkg/io/mdio/sg.go b/pkg/io/mdio/sg.go index 044ddbca..8750af42 100644 --- a/pkg/io/mdio/sg.go +++ b/pkg/io/mdio/sg.go @@ -88,7 +88,7 @@ func sGPort(p interval.Interval) string { func sGRemoteType(t ir.RemoteType) string { switch t := t.(type) { case *netset.IPBlock: - if t.Size() == 1 { + if ipString := t.ToIPAddressString(); ipString != "" { return "IP address" } return "CIDR block"