Skip to content
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

Configurable http and https proxy addrs #208

Merged
merged 5 commits into from
Nov 15, 2023

Conversation

xieyuxi-stripe
Copy link
Contributor

@xieyuxi-stripe xieyuxi-stripe commented Nov 14, 2023

Summary

Update the stripe/goproxy dependency to include stripe/goproxy#22. Allow setting the httpProxyAddr and httpsProxyAddr directly in smokescreen's configuration. When the TransportHttpProxyAddr and TransportHttpsProxyAddr in the smokescreen configuration is non-empty, use these proxy address to create the NewProxyHttpServer for smokescreen. If these addresses are not set, use the default values from environment.

Motivation

stripe/smokescreen uses this library for the proxy server. Currently, the only way to set the transport proxy for smokescreen are setting the proxy from environment, which requires us to set the environment variables like HTTP_PROXY, HTTPS_PROXY. We would like to have a more robust way of configuring the smokescreen server's transport proxy. Thus we are adding the transport proxy address as another configurations for the smokescreen server and the goproxy library it uses underneath.

Test plan

  • New and existing unit tests
  • Vendored the smokescreen change in stripe-internal repo and tested the services that depends on it in QA

Copy link

github-actions bot commented Nov 14, 2023

Pull Request Test Coverage Report for Build 6858847444

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 62.524%

Totals Coverage Status
Change from base Build 6802817309: 0.0%
Covered Lines: 1303
Relevant Lines: 2084

💛 - Coveralls

@xieyuxi-stripe
Copy link
Contributor Author

r? @cds2-stripe

Copy link

github-actions bot commented Nov 14, 2023

Pull Request Test Coverage Report for Build 6858934496

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 62.524%

Totals Coverage Status
Change from base Build 6802817309: 0.0%
Covered Lines: 1303
Relevant Lines: 2084

💛 - Coveralls

@xieyuxi-stripe xieyuxi-stripe force-pushed the xieyuxi-configurable-proxy-addrs branch from 373a392 to 3f8bcc3 Compare November 14, 2023 03:43
Copy link

github-actions bot commented Nov 14, 2023

Pull Request Test Coverage Report for Build 6859183623

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 62.524%

Totals Coverage Status
Change from base Build 6802817309: 0.0%
Covered Lines: 1303
Relevant Lines: 2084

💛 - Coveralls

@xieyuxi-stripe xieyuxi-stripe force-pushed the xieyuxi-configurable-proxy-addrs branch 2 times, most recently from 2f7264e to 3f8bcc3 Compare November 14, 2023 04:38
Copy link

github-actions bot commented Nov 14, 2023

Pull Request Test Coverage Report for Build 6869798316

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 62.524%

Totals Coverage Status
Change from base Build 6802817309: 0.0%
Covered Lines: 1303
Relevant Lines: 2084

💛 - Coveralls

Copy link
Contributor

@cds2-stripe cds2-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of small variable changes!

cli.StringFlag{
Name: "transport-http-proxy-addr",
Value: "",
Usage: "Set the smokescreen's HTTP transport proxy address",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this to:

Set Smokescreen's upstream HTTP proxy address

cli.StringFlag{
Name: "transport-https-proxy-addr",
Value: "",
Usage: "Set the smokescreen's HTTPS transport proxy address",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above but for HTTPS

@@ -146,6 +146,16 @@ func NewConfiguration(args []string, logger *log.Logger) (*smokescreen.Config, e
Name: "unsafe-allow-private-ranges",
Usage: "Allow private ip ranges by default",
},
cli.StringFlag{
Name: "transport-http-proxy-addr",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this to: upstream-http-proxy-addr

Usage: "Set the smokescreen's HTTP transport proxy address",
},
cli.StringFlag{
Name: "transport-https-proxy-addr",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upstream-https-proxy-addr

@@ -73,6 +73,10 @@ type Config struct {
TransportMaxIdleConns int
TransportMaxIdleConnsPerHost int

// There are the http and https address for the transport proxy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpstreamHttpProxyAddr  string
UpstreamHttpsProxyAddr string

@xieyuxi-stripe
Copy link
Contributor Author

r? @cds2-stripe

@xieyuxi-stripe xieyuxi-stripe merged commit 4cae3b1 into master Nov 15, 2023
5 checks passed
@xieyuxi-stripe xieyuxi-stripe deleted the xieyuxi-configurable-proxy-addrs branch November 15, 2023 17:40
@miguelhrocha miguelhrocha mentioned this pull request Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants