Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6cfbd932
Commit
6cfbd932
authored
Jul 04, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint errors of pkg/util/net/sets/ipnet.go
parent
016f1cfd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
ipnet.go
pkg/util/net/sets/ipnet.go
+6
-4
No files found.
pkg/util/net/sets/ipnet.go
View file @
6cfbd932
...
@@ -21,8 +21,10 @@ import (
...
@@ -21,8 +21,10 @@ import (
"strings"
"strings"
)
)
// IPNet maps string to net.IPNet.
type
IPNet
map
[
string
]
*
net
.
IPNet
type
IPNet
map
[
string
]
*
net
.
IPNet
// ParseIPNets parses string slice to IPNet.
func
ParseIPNets
(
specs
...
string
)
(
IPNet
,
error
)
{
func
ParseIPNets
(
specs
...
string
)
(
IPNet
,
error
)
{
ipnetset
:=
make
(
IPNet
)
ipnetset
:=
make
(
IPNet
)
for
_
,
spec
:=
range
specs
{
for
_
,
spec
:=
range
specs
{
...
@@ -96,9 +98,9 @@ func (s IPNet) StringSlice() []string {
...
@@ -96,9 +98,9 @@ func (s IPNet) StringSlice() []string {
}
}
// IsSuperset returns true if and only if s1 is a superset of s2.
// IsSuperset returns true if and only if s1 is a superset of s2.
func
(
s
1
IPNet
)
IsSuperset
(
s2
IPNet
)
bool
{
func
(
s
IPNet
)
IsSuperset
(
s2
IPNet
)
bool
{
for
k
:=
range
s2
{
for
k
:=
range
s2
{
_
,
found
:=
s
1
[
k
]
_
,
found
:=
s
[
k
]
if
!
found
{
if
!
found
{
return
false
return
false
}
}
...
@@ -109,8 +111,8 @@ func (s1 IPNet) IsSuperset(s2 IPNet) bool {
...
@@ -109,8 +111,8 @@ func (s1 IPNet) IsSuperset(s2 IPNet) bool {
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Equal returns true if and only if s1 is equal (as a set) to s2.
// Two sets are equal if their membership is identical.
// Two sets are equal if their membership is identical.
// (In practice, this means same elements, order doesn't matter)
// (In practice, this means same elements, order doesn't matter)
func
(
s
1
IPNet
)
Equal
(
s2
IPNet
)
bool
{
func
(
s
IPNet
)
Equal
(
s2
IPNet
)
bool
{
return
len
(
s
1
)
==
len
(
s2
)
&&
s1
.
IsSuperset
(
s2
)
return
len
(
s
)
==
len
(
s2
)
&&
s
.
IsSuperset
(
s2
)
}
}
// Len returns the size of the set.
// Len returns the size of the set.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment