-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmain.go
69 lines (61 loc) · 1.25 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
62
63
64
65
66
67
68
69
package main
import (
"github.com/abiosoft/ishell"
"gogb28181/transport"
"gogb28181/tu"
)
func main() {
// create new shell.
// by default, new shell includes 'exit', 'help' and 'clear' commands.
shell := ishell.New()
// display welcome info.
shell.Println("gb28181 test")
// simulate an authentication
shell.AddCmd(&ishell.Cmd{
Name: "tcps",
Help: "tcp server",
Func: func(c *ishell.Context) {
transport.RunServerTCP()
},
})
shell.AddCmd(&ishell.Cmd{
Name: "tcpc",
Help: "tcp client",
Func: func(c *ishell.Context) {
transport.RunClientTCP()
},
})
// simulate an authentication
shell.AddCmd(&ishell.Cmd{
Name: "udps",
Help: "udp server",
Func: func(c *ishell.Context) {
transport.RunServerUDP()
},
})
shell.AddCmd(&ishell.Cmd{
Name: "udpc",
Help: "udp client",
Func: func(c *ishell.Context) {
transport.RunClientUDP()
},
})
//=======================================
shell.AddCmd(&ishell.Cmd{
Name: "uas",
Help: "sip user agent server",
Func: func(c *ishell.Context) {
tu.RunServer()
},
})
shell.AddCmd(&ishell.Cmd{
Name: "uac",
Help: "sip user agent client",
Func: func(c *ishell.Context) {
tu.RunClient()
},
})
//=======================================
// run shell
shell.Run()
}