summaryrefslogtreecommitdiff
path: root/modules/proxy/proxy.go
diff options
context:
space:
mode:
authorPhilipp Tanlak <philipp.tanlak@gmail.com>2024-01-10 21:06:43 +0100
committerGitHub <noreply@github.com>2024-01-10 21:06:43 +0100
commit8ad9f9f66af1452b1a4875d755e7f18154c3f18a (patch)
tree4a8d68513e71c44d121b11093094238a31e03daf /modules/proxy/proxy.go
parent8b7425e58909cdfa458ca00a10efc95f197bfb0b (diff)
Add single proxy support (#30)
* Add single proxy config option * Update readme
Diffstat (limited to 'modules/proxy/proxy.go')
-rw-r--r--modules/proxy/proxy.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/proxy/proxy.go b/modules/proxy/proxy.go
index 120a856..ff9aa5c 100644
--- a/modules/proxy/proxy.go
+++ b/modules/proxy/proxy.go
@@ -19,6 +19,7 @@ func init() {
type Module struct {
Proxies []string `json:"proxies"`
+ Proxy string `json:"proxy"`
transports []*http.Transport
}
@@ -35,13 +36,14 @@ func (m *Module) Provision(ctx flyscrape.Context) {
return
}
- for _, purl := range m.Proxies {
+ for _, purl := range append(m.Proxies, m.Proxy) {
if parsed, err := url.Parse(purl); err == nil {
m.transports = append(m.transports, &http.Transport{
Proxy: http.ProxyURL(parsed),
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
})
}
+
}
}