-
Notifications
You must be signed in to change notification settings - Fork 6
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
Http object type #143
Http object type #143
Conversation
Signed-off-by: Matthias Bertschy <[email protected]>
Signed-off-by: Matthias Bertschy <[email protected]>
Summary:
|
7570d2d
to
247343c
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.
I would like to see more test coverage on the path analyser
and maybe some benchmarks too
|
||
type IsInternal string | ||
|
||
const ( |
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'm not convinced we need to do this... this sounds non idiomatic Go to me - do you have some reference for this pattern?
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.
Wdym by it? I did it because I could not transfer bool value (The bug we talked about)
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.
Damn, forgot about it. Still looking ugly 🫣
SegmentName string | ||
Count int | ||
Children map[string]*SegmentNode | ||
mutex sync.RWMutex |
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.
unused mutex
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.
DONE
var newEndpoints []types.HTTPEndpoint | ||
MergeDuplicateEndpoints(endpoints) | ||
for _, endpoint := range *endpoints { | ||
AnalyzeURL(endpoint.Endpoint, analyzer) |
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.
you don't use return value and error?
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.
In segment of the code no, because I would just skip errors.
We can talk about it
} | ||
} | ||
|
||
func shallowChildrensCopy(src, dst *SegmentNode) { |
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.
children is already plural
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.
DONE
|
||
func AnalyzeURL(urlString string, analyzer *PathAnalyzer) (string, error) { | ||
if !strings.HasPrefix(urlString, "http://") && !strings.HasPrefix(urlString, "https://") { | ||
urlString = "http://" + urlString |
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.
maybe we want to default to https?
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.
It does not matter as it is used only for parsing parsedURL, err := url.Parse(urlString)
|
||
const dynamicIdentifier string = "<dynamic>" | ||
|
||
const theshold = 100 |
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.
threshold
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.
DONE
I have started a new branch, rebased on my changes to main (some refactoring to use gRPC) so you might want to use this one instead: https://github.com/kubescape/storage/tree/http-object-type-mb |
6fd10ed
to
2019ba4
Compare
Sorry, we do not accept changes directly against this repository. Please see
CONTRIBUTING.md for information on where and how to contribute instead.