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

@ -129,7 +129,7 @@ func (f *frontendCLI) changePort(c *ishell.Context) {
}
func (f *frontendCLI) allowProxy(c *ishell.Context) {
if f.settings.GetBool(settings.AllowProxyKey) {
if f.bridge.GetProxyAllowed() {
f.Println("Bridge is already set to use alternative routing to connect to Proton if it is being blocked.")
return
}
@ -137,13 +137,12 @@ func (f *frontendCLI) allowProxy(c *ishell.Context) {
f.Println("Bridge is currently set to NOT use alternative routing to connect to Proton if it is being blocked.")
if f.yesNoQuestion("Are you sure you want to allow bridge to do this") {
f.settings.SetBool(settings.AllowProxyKey, true)
f.bridge.AllowProxy()
f.bridge.SetProxyAllowed(true)
}
}
func (f *frontendCLI) disallowProxy(c *ishell.Context) {
if !f.settings.GetBool(settings.AllowProxyKey) {
if !f.bridge.GetProxyAllowed() {
f.Println("Bridge is already set to NOT use alternative routing to connect to Proton if it is being blocked.")
return
}
@ -151,8 +150,7 @@ func (f *frontendCLI) disallowProxy(c *ishell.Context) {
f.Println("Bridge is currently set to use alternative routing to connect to Proton if it is being blocked.")
if f.yesNoQuestion("Are you sure you want to stop bridge from doing this") {
f.settings.SetBool(settings.AllowProxyKey, false)
f.bridge.DisallowProxy()
f.bridge.SetProxyAllowed(false)
}
}