mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 14:26:31 +00:00
Fix proxy settings are not reverted after panic. (#183)
This commit is contained in:
parent
aa04524565
commit
e9311bf4db
@ -38,6 +38,11 @@ func main() {
|
||||
if err := util.SetOsProxy(*config.Port); err != nil {
|
||||
logger.Fatal().Msgf("error while changing proxy settings: %s", err)
|
||||
}
|
||||
defer func() {
|
||||
if err := util.UnsetOsProxy(); err != nil {
|
||||
logger.Fatal().Msgf("error while disabling proxy: %s", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
go pxy.Start(context.Background())
|
||||
@ -60,10 +65,4 @@ func main() {
|
||||
}()
|
||||
|
||||
<-done
|
||||
|
||||
if *config.SystemProxy {
|
||||
if err := util.UnsetOsProxy(); err != nil {
|
||||
logger.Fatal().Msgf("%s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user