-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
50 lines (41 loc) · 908 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
. "github.com/antonio-cabreraglz/fortinet-go-client/logger"
"flag"
"fmt"
"github.com/antonio-cabreraglz/fortinet-go-client/proxy"
"github.com/antonio-cabreraglz/fortinet-go-client/proxymanager"
"os"
"os/signal"
"syscall"
)
var runAsServer bool
var clientAddr string
func init() {
flag.BoolVar(&runAsServer, "server", false, "do something")
flag.StringVar(&clientAddr, "clientAddr", ":3030", "Server Address")
}
func main() {
flag.Parse()
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT)
if runAsServer {
serverAddress := ":514"
go proxymanager.StartServer()
go proxy.ListenUDP(serverAddress)
Log("Starting server at " + serverAddress)
} else {
go proxy.StartListener(clientAddr)
Log("Starting client at " + clientAddr)
}
for {
select {
case msg := <-sigs:
{
fmt.Println()
fmt.Println(msg)
return
}
}
}
}