-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
61 lines (48 loc) · 1.13 KB
/
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
52
53
54
55
56
57
58
59
60
61
package main
import (
"io/ioutil"
"log"
)
func Check(err error) {
if err != nil {
panic(err)
}
}
func main() {
// f, _ := os.Create("cpuprof2")
// defer f.Close()
// pprof.StartCPUProfile(f)
// pprof.StopCPUProfile()
// c := make(chan TsPacket, 10)
// n, _ := serv.Router.GetNodeByName("rmp")
// n.RegisterListener(c)
// for _ = range c {
// }
log.Print("starting")
var err error
cfgdat, _ := ioutil.ReadFile("basic.chq")
serv := NewServer()
err = serv.Router.ApplyConfig(string(cfgdat))
Check(err)
serv.Router.ToggleAll()
err = serv.Start()
Check(err)
/////////
// fname := flag.String("if", "", "input file")
// addr := flag.String("a", "", "input multicast/unicast address")
// port := flag.Int("p", 0, "input UDP port")
// flag.Parse()
// rtr := NewRouter()
// cfgdat, _ := ioutil.ReadFile("basic.chq")
// err := rtr.ApplyConfig(string(cfgdat))
// Check(err)
// out := make(chan TsPacket)
// n := rtr.Nodes["t"]
// n.RegisterListener(out)
// for _ = range out {
// }
// for nn, np := range rtr.Nodes {
// j, err := np.MarshalJSON()
// log.Printf("node: %s\n json: %s\n err: %v\n", nn, j, err)
// }
}