-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 964 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
package main
import (
"fmt"
"net"
"time"
"github.com/tttfrfr2/ECHONETTester/echonetlite"
"github.com/tttfrfr2/ECHONETTester/util"
)
var auditor echonetlite.Auditor
var echonetConf util.EchonetLiteConf
func main() {
t := time.Now()
echonetlite.TimeStr = fmt.Sprint(t.Year()) + "-" + fmt.Sprint(int(t.Month())) + "-" + fmt.Sprint(t.Day()) + "-" + fmt.Sprint(t.Minute()) + "-" + fmt.Sprint(t.Second())
var config *util.Config
config = util.ReadConfig("config.tml")
if config == nil {
return
}
echonetConf = util.DistributeConf(*config)
fmt.Println("---Tool Start---")
var echonetTargets []net.IP
for _, ip := range echonetConf.IP {
echonetTargets = append(echonetTargets, net.ParseIP(ip))
}
err := auditor.NewAuditor(echonetTargets)
if err != nil {
fmt.Printf("ECHONET Lite testing ERROR: %+v\n", err)
}
if len(auditor.DistNodes) < 1 {
fmt.Printf("There are no ECHONET Lite node\nEXIT\n")
return
}
auditor.RunEchonetPrompt()
}