forked from cyfdecyf/cow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (41 loc) · 757 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
51
package main
import (
"fmt"
"os"
"runtime"
"sync"
)
func main() {
// Parse flags after load config to allow override options in config
cmdLineConfig := parseCmdLineConfig()
if cmdLineConfig.PrintVer {
printVersion()
os.Exit(0)
}
fmt.Printf(`
/\
) ( ') MEOW Proxy %s
( / ) http://renzhn.github.io/MEOW/
\(__)|
`, version)
fmt.Println()
parseConfig(cmdLineConfig.RcFile, cmdLineConfig)
initSelfListenAddr()
initLog()
initAuth()
initStat()
initParentPool()
if config.JudgeByIP {
initCNIPData()
}
if config.Core > 0 {
runtime.GOMAXPROCS(config.Core)
}
go runSSH()
var wg sync.WaitGroup
wg.Add(len(listenProxy))
for _, proxy := range listenProxy {
go proxy.Serve(&wg)
}
wg.Wait()
}