-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (29 loc) · 755 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
package main
import (
"flag"
"fmt"
"github.com/mr-kelly/monkeyd/monkeyd"
"github.com/op/go-logging"
"os"
)
var log = logging.MustGetLogger("monkeyd:main")
func main() {
configFile := flag.String("config", "config.toml", "`config file path`")
log.Info("=== Monkeyd v0.1")
log.Info("=== Port forward tool")
log.Info("")
flag.Parse()
if _, err := os.Stat(*configFile); err != nil {
if os.IsNotExist(err) {
log.Fatalf("Not foune config file '%s', please use `-config` tell me the config file path", *configFile)
return
}
}
fmt.Printf("Begin read config...%s\n", *configFile)
newMonkeyd, err := monkeyd.New(*configFile)
if err != nil {
fmt.Printf("Error on new monkeyd %s", err.Error())
return
}
newMonkeyd.Run("server")
}