AdguardTeam / AdguardTeam/gomitmproxy

Feat request: Please allow us to have access to transport config

Đang mở
#24 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Go
Star
344
Fork
71
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

`gomitmproxy.NewProxy` starts out as follows:

```go

// NewProxy creates a new instance of the Proxy
func NewProxy(config Config) *Proxy {
proxy := &Proxy{
Config: config,
transport: &http.Transport{
// This forces http.Transport to not upgrade requests to HTTP/2
// TODO: Remove when HTTP/2 can be supported
TLSNextProto: make(map[string]func(string, *tls.Conn) http.RoundTripper),
Proxy: http.ProxyFromEnvironment,
...
```

The `Proxy: http.ProxyFromEnvironment` is what affects me specifically. I am using an upstream proxy, and having to `os.Setenv...` to make it work is very inelegant:

```go
os.Setenv("ALL_PROXY", upstreamProxy)
os.Setenv("HTTP_PROXY", upstreamProxy)
os.Setenv("HTTPS_PROXY", upstreamProxy)
fmt.Println("Upstream Proxy =", upstreamProxy)
```

Being able to pass this in, perhaps via the `Config` would be amazing. I would be happy to make a PR, please suggest if can be added to `Config` (maybe simple/non-breaking) or should be done some other way.

Thank you.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.