Give every HTTP client its own transport
satdress.SetupHttpClient changes the TLS settings of the transport it gets from network.GetClient. With one shared transport that switched certificate checks off for all later LNURL requests. (cherry picked from commit 864cc7b3e7d6b4cd9b57ae84b5d2646f8ba3177f) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
committed by
Michilis
parent
5360a9d4a1
commit
8d557f3043
@@ -39,19 +39,20 @@ func GetClientForScheme(url *url.URL) (*http.Client, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// directTransport is used when no proxy is configured. The URLs fetched with
|
||||
// these clients come from users and remote servers, so it only connects to
|
||||
// public addresses.
|
||||
var directTransport = func() *http.Transport {
|
||||
// directTransport returns the transport used when no proxy is configured. The
|
||||
// URLs fetched with these clients come from users and remote servers, so it
|
||||
// only connects to public addresses. Every client gets its own transport,
|
||||
// because callers change its TLS settings (satdress.SetupHttpClient).
|
||||
func directTransport() *http.Transport {
|
||||
t := http.DefaultTransport.(*http.Transport).Clone()
|
||||
t.DialContext = netguard.DialContext
|
||||
return t
|
||||
}()
|
||||
}
|
||||
|
||||
func GetClient(clientType ClientType) (*http.Client, error) {
|
||||
client := http.Client{
|
||||
Timeout: 10 * time.Second,
|
||||
Transport: directTransport,
|
||||
Transport: directTransport(),
|
||||
}
|
||||
var cfg *internal.SocksConfiguration
|
||||
switch clientType {
|
||||
|
||||
Reference in New Issue
Block a user