forked from kingparks/cursor-vip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
31 lines (28 loc) · 719 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"github.com/kingparks/cursor-vip/auth"
"github.com/kingparks/cursor-vip/tui"
"os"
"os/signal"
"syscall"
)
func main() {
productSelected, modelIndexSelected := tui.Run()
startServer(productSelected, modelIndexSelected)
}
func startServer(productSelected string, modelIndexSelected int) {
tui.Sigs = make(chan os.Signal, 1)
signal.Notify(tui.Sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGKILL)
go func() {
<-tui.Sigs
auth.UnSetClient(productSelected)
if modelIndexSelected == 2 {
tui.UnSetProxy()
}
os.Exit(0)
}()
if modelIndexSelected == 2 {
tui.SetProxy("localhost", auth.Port)
}
auth.Run(productSelected, modelIndexSelected)
}