From 12ba6cf75e5ca7a4ca5932d19f4099bea6bf38be Mon Sep 17 00:00:00 2001 From: adisos Date: Wed, 2 Oct 2024 08:18:19 +0300 Subject: [PATCH] small fixes Signed-off-by: adisos --- pkg/netset/icmpset.go | 6 +++--- pkg/netset/rfcicmpset.go | 4 ++-- pkg/netset/tcpudpset.go | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/netset/icmpset.go b/pkg/netset/icmpset.go index 4d205d3..96b6995 100644 --- a/pkg/netset/icmpset.go +++ b/pkg/netset/icmpset.go @@ -65,7 +65,7 @@ func (c *ICMPSet) IsSubset(other *ICMPSet) bool { return c.props.IsSubset(other.props) } -// pathLeft creates a new TCPUDPSet, implemented using LeftTriple. +// icmpPropsPathLeft creates a new ICMPSet, implemented using CartesianPairLeft. func icmpPropsPathLeft(typesSet *TypeSet, codeSet *CodeSet) *ICMPSet { return &ICMPSet{props: ds.CartesianPairLeft(typesSet, codeSet)} } @@ -102,7 +102,7 @@ func (c *ICMPSet) IsAll() bool { return c.Equal(allICMP) } -func gettICMPCubeStr(cube ds.Pair[*TypeSet, *CodeSet]) string { +func getICMPCubeStr(cube ds.Pair[*TypeSet, *CodeSet]) string { if cube.Right.Equal(AllICMPCodes()) { return fmt.Sprintf("ICMP type: %s", cube.Left.String()) } @@ -116,7 +116,7 @@ func (c *ICMPSet) String() string { cubes := c.Partitions() var resStrings = make([]string, len(cubes)) for i, cube := range cubes { - resStrings[i] = gettICMPCubeStr(cube) + resStrings[i] = getICMPCubeStr(cube) } sort.Strings(resStrings) return strings.Join(resStrings, " | ") diff --git a/pkg/netset/rfcicmpset.go b/pkg/netset/rfcicmpset.go index f91a0f7..f3c08a8 100644 --- a/pkg/netset/rfcicmpset.go +++ b/pkg/netset/rfcicmpset.go @@ -223,7 +223,7 @@ func NewICMPSetStrict(t netp.ICMP) *RFCICMPSet { return &res } -func getICMPCubeStr(cube netp.ICMP) string { +func getRFCICMPCubeStr(cube netp.ICMP) string { tc := cube.ICMPTypeCode() if tc == nil { return "" @@ -244,7 +244,7 @@ func (s *RFCICMPSet) String() string { cubes := s.Partitions() var resStrings = make([]string, len(cubes)) for i, cube := range cubes { - resStrings[i] = getICMPCubeStr(cube) + resStrings[i] = getRFCICMPCubeStr(cube) } sort.Strings(resStrings) str := string(netp.ProtocolStringICMP) diff --git a/pkg/netset/tcpudpset.go b/pkg/netset/tcpudpset.go index 3baea26..40ab37f 100644 --- a/pkg/netset/tcpudpset.go +++ b/pkg/netset/tcpudpset.go @@ -93,8 +93,8 @@ func (c *TCPUDPSet) IsSubset(other *TCPUDPSet) bool { return c.props.IsSubset(other.props) } -// pathLeft creates a new TCPUDPSet, implemented using LeftTriple. -func pathLeft(protocol *ProtocolSet, srcPort, dstPort *PortSet) *TCPUDPSet { +// tcpudpPathLeft creates a new TCPUDPSet, implemented using LeftTriple. +func tcpudpPathLeft(protocol *ProtocolSet, srcPort, dstPort *PortSet) *TCPUDPSet { return &TCPUDPSet{props: ds.CartesianLeftTriple(protocol, srcPort, dstPort)} } @@ -103,7 +103,7 @@ func EmptyTCPorUDPSet() *TCPUDPSet { } func AllTCPUDPSet() *TCPUDPSet { - return pathLeft( + return tcpudpPathLeft( AllTCPUDPProtocolSet(), AllPorts(), AllPorts(), @@ -111,7 +111,7 @@ func AllTCPUDPSet() *TCPUDPSet { } func NewAllTCPOnlySet() *TCPUDPSet { - return pathLeft( + return tcpudpPathLeft( interval.New(TCPCode, TCPCode).ToSet(), AllPorts(), AllPorts(), @@ -119,7 +119,7 @@ func NewAllTCPOnlySet() *TCPUDPSet { } func NewAllUDPOnlySet() *TCPUDPSet { - return pathLeft( + return tcpudpPathLeft( interval.New(UDPCode, UDPCode).ToSet(), AllPorts(), AllPorts(), @@ -128,7 +128,7 @@ func NewAllUDPOnlySet() *TCPUDPSet { func NewTCPorUDPSet(protocolString netp.ProtocolString, srcMinP, srcMaxP, dstMinP, dstMaxP int64) *TCPUDPSet { protocol := protocolStringToCode(protocolString) - return pathLeft( + return tcpudpPathLeft( interval.New(protocol, protocol).ToSet(), interval.New(srcMinP, srcMaxP).ToSet(), interval.New(dstMinP, dstMaxP).ToSet(),