-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
48 lines (39 loc) · 827 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
package main
import (
co "V-switch/conf"
aes "V-switch/crypt"
pl "V-switch/plane"
tap "V-switch/tap"
to "V-switch/tools"
udp "V-switch/udp"
"fmt"
"log"
"os"
"os/signal"
)
func init() {
if (os.Getuid() != 0) && (os.Getgid() != 0) {
fmt.Println("[MAIN] YOU MUST BE ROOT TO RUN THIS PROGRAM")
os.Exit(1)
}
to.LogEngineStart()
co.StartConfig()
pl.PlaneInit()
aes.GPGEngineStart()
tap.EngineStart()
udp.UDPEngineStart()
}
func main() {
if co.GetConfigItem("DEBUG") != "TRUE" {
log.Println("[MAIN] End of bootstrap.")
to.VSlogfile.DisableLog()
} else {
log.Println("[MAIN] End of bootstrap.")
}
// Just a nice way to wait until the Operating system sends a kill signal.
// select{} was just horrible.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
<-c
os.Exit(0)
}