mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 22:36:53 +00:00
refactor main.go
This commit is contained in:
parent
1a55f159d1
commit
3739c8b712
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -16,18 +15,15 @@ func main() {
|
|||||||
port, dns, debug := util.ParseArgs()
|
port, dns, debug := util.ParseArgs()
|
||||||
|
|
||||||
p := proxy.New(port, dns, runtime.GOOS, debug)
|
p := proxy.New(port, dns, runtime.GOOS, debug)
|
||||||
fmt.Println(*p)
|
|
||||||
|
|
||||||
p.PrintWelcome()
|
p.PrintWelcome()
|
||||||
|
|
||||||
err := p.SetOsProxy()
|
if err := p.SetOsProxy(); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
go p.Start()
|
go p.Start()
|
||||||
|
|
||||||
|
// Handle signals
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
done := make(chan bool, 1)
|
done := make(chan bool, 1)
|
||||||
|
|
||||||
@ -45,9 +41,7 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
<-done
|
<-done
|
||||||
err = p.UnsetOsProxy()
|
if err := p.UnsetOsProxy(); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user