-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Merge the various proxy dialer implementations from the fasthttpproxy into a single struct. #1829
Merge the various proxy dialer implementations from the fasthttpproxy into a single struct. #1829
Conversation
27677ca
to
f5f48fb
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 like it. I think it makes the old method obsolete, but we can't remove them for backwards compatibility of course. So I think we should rewrite the old methods to use this new Dialer
instead. What do you think?
You are correct;I agree with your point. I forgot about backward compatibility and deduplication. Next, I will try to rewrite the existing functions. |
f5f48fb
to
3c1fff8
Compare
fasthttpproxy/example_test.go
Outdated
DialDualStack: true, | ||
} | ||
// proxy information comes from environment | ||
dialer, err := p.GetDialFunc(false) |
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.
Shouldn't this be true
if you want the config to come from the env?
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.
My thinking was somewhat flawed; I should have combined the three examples together. Thank you.
fasthttpproxy/example_test.go
Outdated
_ = resp | ||
} | ||
|
||
func ExampleDialer_GetDialFunc_three() { |
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.
What is the difference between this and the second example? Besides NoProxy: "example.com",
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.
My thinking was somewhat flawed; I should have combined the three examples together. Thank you.
Add a multifunctional `Dialer` struct and reimplement the function API Reimplement the existing function interfaces of the fasthttpproxy package through Dialer. Refactor Dialer.GetDialFunc to ensure that its performance is comparable to the original function interfaces when the proxy does not change with the request address.
3c1fff8
to
582ac0a
Compare
Thanks! |
#1822
In this issue, I noticed that the existing implementation doesn't leverage fasthttp's dialer mechanism, so I created this pull request.
At the same time, provide more comprehensive support for proxy environment variables and allow configuration of the fasthttp dialer.
No tests were committed, and the logic is built on top of the existing fasthttpproxy foundation. I noticed that the original fasthttpproxy also didn't include any test code.
The proxy address is not universal, but I did some local debugging and didn't find any issues.