-
Notifications
You must be signed in to change notification settings - Fork 7
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
Sort commatrix by node role, protocol and port #5
Sort commatrix by node role, protocol and port #5
Conversation
1ad046b
to
c2e4916
Compare
ee7fdaa
to
fc75215
Compare
455e188
to
6e5fe36
Compare
types/types.go
Outdated
Service string `json:"Service"` | ||
Pod string `json:"Pod"` | ||
Container string `json:"Container"` | ||
NodeRole string `json:"Node Role"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the space here is wrong (in the json:
), also is there a reason for the uppercase change in the rest?
types/types.go
Outdated
@@ -78,14 +78,14 @@ func (m *ComMatrix) String() string { | |||
} | |||
|
|||
func (cd ComDetails) String() string { | |||
return fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s,%s,%v", cd.Direction, cd.Protocol, cd.Port, cd.Namespace, cd.Service, cd.Pod, cd.Container, cd.NodeRole, cd.Optional) | |||
return fmt.Sprintf("%s,%s,%d,%s,%s,%s,%s,%s,%v", cd.Direction, cd.Protocol, cd.Port, cd.Namespace, cd.Service, cd.Pod, cd.Container, cd.NodeRole, cd.Optional) | |||
} | |||
|
|||
func RemoveDups(outPuts []ComDetails) []ComDetails { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it seems this and the CmpComDetails
are called together, wdyt about just combining them into one function that remove dups and sorts?
cmd/main.go
Outdated
} | ||
} | ||
|
||
func diff(mat types.ComMatrix, ssMat types.ComMatrix) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name can be changed to something clearer, also is ssMat still correct here? can this just be mat1,mat2?
6e5fe36
to
8650b45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
8650b45
to
b3c0099
Compare
Sort commatrix by node role, protocol and port and fix ss filter causing missing UDP ports