Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPBlock convenience functions #76

Merged
merged 10 commits into from
Oct 8, 2024
Merged

Conversation

YairSlobodin1
Copy link
Member

No description provided.

@YairSlobodin1 YairSlobodin1 requested a review from zivnevo October 7, 2024 14:04
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
pkg/netset/ipblock.go Outdated Show resolved Hide resolved
Copy link
Member

@zivnevo zivnevo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring for renamed functions has to be updated too

Copy link
Member

@zivnevo zivnevo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for exported functions in ipblock_test.go

Comment on lines 502 to 505
if len(b.Split()) != 1 || len(other.Split()) != 1 {
return false, fmt.Errorf("both ipblocks should be a single IP range")
}
return (!b.Overlap(other) && len(b.Union(other).Split()) == 1), nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(b.Split()) != 1 || len(other.Split()) != 1 {
return false, fmt.Errorf("both ipblocks should be a single IP range")
}
return (!b.Overlap(other) && len(b.Union(other).Split()) == 1), nil
if b.ipRange.NumIntervals() != 1 || other.ipRange.NumIntervals() != 1 {
return false, fmt.Errorf("both ipblocks should be a single IP range")
}
return (!b.Overlap(other) && b.Union(other).ipRange.NumIntervals() == 1), nil

@YairSlobodin1 YairSlobodin1 requested review from zivnevo and removed request for zivnevo October 8, 2024 10:03
@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 8, 2024
@YairSlobodin1 YairSlobodin1 requested a review from zivnevo October 8, 2024 11:28
@YairSlobodin1 YairSlobodin1 merged commit 1e27bae into main Oct 8, 2024
4 checks passed
@YairSlobodin1 YairSlobodin1 deleted the ipblock_convenience_functions branch October 8, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants