GODT-1388: Refactor Alternative routing

This commit is contained in:
Alexander Bilyak
2021-10-27 16:14:18 +02:00
committed by Jakub
parent af0c5e6bae
commit 42ced6694e
6 changed files with 26 additions and 27 deletions

View File

@ -223,3 +223,19 @@ func (b *Bridge) MigrateCache(from, to string) error {
return nil
}
// SetProxyAllowed instructs the app whether to use DoH to access an API proxy if necessary.
// It also needs to work before the app is initialised (because we may need to use the proxy at startup).
func (b *Bridge) SetProxyAllowed(proxyAllowed bool) {
b.settings.SetBool(settings.AllowProxyKey, proxyAllowed)
if proxyAllowed {
b.clientManager.AllowProxy()
} else {
b.clientManager.DisallowProxy()
}
}
// GetProxyAllowed returns whether use of DoH is enabled to access an API proxy if necessary.
func (b *Bridge) GetProxyAllowed() bool {
return b.settings.GetBool(settings.AllowProxyKey)
}