(remote *Remote, transport *Transport)
| 37 | } |
| 38 | |
| 39 | func httpSmartSubtransportFactory(remote *Remote, transport *Transport) (SmartSubtransport, error) { |
| 40 | var proxyFn func(*http.Request) (*url.URL, error) |
| 41 | remoteConnectOpts, err := transport.SmartRemoteConnectOptions() |
| 42 | if err != nil { |
| 43 | return nil, err |
| 44 | } |
| 45 | switch remoteConnectOpts.ProxyOptions.Type { |
| 46 | case ProxyTypeNone: |
| 47 | proxyFn = nil |
| 48 | case ProxyTypeAuto: |
| 49 | proxyFn = http.ProxyFromEnvironment |
| 50 | case ProxyTypeSpecified: |
| 51 | parsedUrl, err := url.Parse(remoteConnectOpts.ProxyOptions.Url) |
| 52 | if err != nil { |
| 53 | return nil, err |
| 54 | } |
| 55 | |
| 56 | proxyFn = http.ProxyURL(parsedUrl) |
| 57 | } |
| 58 | |
| 59 | return &httpSmartSubtransport{ |
| 60 | transport: transport, |
| 61 | client: &http.Client{ |
| 62 | Transport: &http.Transport{ |
| 63 | Proxy: proxyFn, |
| 64 | }, |
| 65 | }, |
| 66 | }, nil |
| 67 | } |
| 68 | |
| 69 | type httpSmartSubtransport struct { |
| 70 | transport *Transport |
nothing calls this directly
no test coverage detected
searching dependent graphs…