Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
Signed-off-by: adisos <[email protected]>
  • Loading branch information
adisos committed Oct 2, 2024
1 parent 59b76b4 commit 12ba6cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pkg/netset/icmpset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
}
Expand Down Expand Up @@ -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())
}
Expand All @@ -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, " | ")
Expand Down
4 changes: 2 additions & 2 deletions pkg/netset/rfcicmpset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions pkg/netset/tcpudpset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
}

Expand All @@ -103,23 +103,23 @@ func EmptyTCPorUDPSet() *TCPUDPSet {
}

func AllTCPUDPSet() *TCPUDPSet {
return pathLeft(
return tcpudpPathLeft(
AllTCPUDPProtocolSet(),
AllPorts(),
AllPorts(),
)
}

func NewAllTCPOnlySet() *TCPUDPSet {
return pathLeft(
return tcpudpPathLeft(
interval.New(TCPCode, TCPCode).ToSet(),
AllPorts(),
AllPorts(),
)
}

func NewAllUDPOnlySet() *TCPUDPSet {
return pathLeft(
return tcpudpPathLeft(
interval.New(UDPCode, UDPCode).ToSet(),
AllPorts(),
AllPorts(),
Expand All @@ -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(),
Expand Down

0 comments on commit 12ba6cf

Please sign in to comment.