-
-
Notifications
You must be signed in to change notification settings - Fork 634
feat(endpoints): add domain-expiration-only-check #1360
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
base: master
Are you sure you want to change the base?
Conversation
2abf238 to
9694008
Compare
|
@TwiN Is there anything I can do to help merge PR? Is there no progress? |
test result cpu: AMD Ryzen 7 4800H with Radeon Graphics BenchmarkEndpoint_Type-16 Cut + switch 5053628 238.7 ns/op 0 B/op 0 allocs/op Cut + map 2714998 438.6 ns/op 0 B/op 0 allocs/op switch HasPerfix 2683519 430.9 ns/op 0 B/op 0 allocs/op
9694008 to
8a079be
Compare
|
@PythonGermany Your PR qianlongzt#1 looks good to me, but what should I do next? |
|
@qianlongzt Just merge my changes into your branch. |
Refactor endpoint call method
TwiN
left a comment
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.
Small nitpicks
| before, _, ok := strings.Cut(e.URL, ":") | ||
| if !ok { | ||
| return TypeUNKNOWN | ||
| } | ||
| switch before { | ||
| case "tcp": | ||
| return TypeTCP | ||
| case strings.HasPrefix(e.URL, "sctp://"): | ||
| case "sctp": | ||
| return TypeSCTP | ||
| case strings.HasPrefix(e.URL, "udp://"): | ||
| case "udp": | ||
| return TypeUDP | ||
| case strings.HasPrefix(e.URL, "icmp://"): | ||
| case "icmp": |
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 understand and appreciate your intention to simplify the code, but personally, having the ability to do a global search for <protocol/endpoint-type>:// (e.g. icmp://) makes navigating the code much easier (reasoning here being that if you search for just http instead of http://, you're going to get hundreds of results as opposed to exactly what you're looking for).
Could you revert the changes here and update the new domain:// prefix accordingly?
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.
| type testEndpoint_typeArgs struct { | ||
| URL string | ||
| DNS *dns.Config | ||
| SSH *ssh.Config | ||
| } | ||
|
|
||
| var testEndpoint_typeData = []struct { |
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 whole Test<something>_<something> notation is more intended to be for the struct name followed by the method name (and occasionally further details).
Is there any reason why you moved those outside of the function? They're only used in the function, you could just name them typeArgs and typeData within the TestEndpoint_Type test function itself
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 just want BenchmarkEndpoint_Type to reuse the same test data as TestEndpoint_Type.
This benchmark is for both the old and new Type implementations, and I would like to keep it in the tests.



Summary
test result for perfomance
cpu: AMD Ryzen 7 4800H with Radeon Graphics
BenchmarkEndpoint_Type-16
Cut + switch 5053628 238.7 ns/op 0 B/op 0 allocs/op
Cut + map 2714998 438.6 ns/op 0 B/op 0 allocs/op
switch HasPerfix 2683519 430.9 ns/op 0 B/op 0 allocs/op
Checklist
README.md, if applicable.