fix(sessionresolver): honour the proxy (#250)
In reality, we are not going to use the sessionresolver when we're using a proxy (I just tested). But, it nonetheless feels a lot more robust to write a correct sessionresolver that handles the proxy in the most correct way. That is, the sessionresolver will now skip all the entries that cannot use a socks5 proxy (including among them also the system resolver). What's more, it will construct a child resolver that propagates the proxy. We have confidence that this holds true because we have added a test ensuring that we are really using the configured proxy. See https://github.com/ooni/probe/issues/1381
This commit is contained in:
parent
4da372a84d
commit
f0110fe85a
4 changed files with 112 additions and 1 deletions
|
|
@ -108,14 +108,15 @@ func NewSession(config SessionConfig) (*Session, error) {
|
|||
ByteCounter: sess.byteCounter,
|
||||
BogonIsError: true,
|
||||
Logger: sess.logger,
|
||||
ProxyURL: config.ProxyURL,
|
||||
}
|
||||
sess.resolver = &sessionresolver.Resolver{
|
||||
ByteCounter: sess.byteCounter,
|
||||
KVStore: config.KVStore,
|
||||
Logger: sess.logger,
|
||||
ProxyURL: config.ProxyURL,
|
||||
}
|
||||
httpConfig.FullResolver = sess.resolver
|
||||
httpConfig.ProxyURL = config.ProxyURL // no need to proxy the resolver
|
||||
sess.httpDefaultTransport = netx.NewHTTPTransport(httpConfig)
|
||||
return sess, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue