-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.go
48 lines (37 loc) · 947 Bytes
/
routes.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
package main
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
func addPublicRoutes(g *gin.RouterGroup) {
g.GET("/", basicAuth)
g.GET("/ws/agent", wsAgent)
g.POST("/api/agents/add", AddAgent)
}
func addPrivateRoutes(g *gin.RouterGroup) {
g.GET("/topology", index)
g.GET("/connections", connections)
g.GET("/filter", filter)
g.GET("/agents", agents)
g.GET("/api/connections/get", GetConnections)
g.GET("/api/agents/get", GetAgents)
g.GET("/ws/web", wsWeb)
}
func index(c *gin.Context) {
c.HTML(200, "index.html", gin.H{})
}
func connections(c *gin.Context) {
c.HTML(200, "connections.html", gin.H{})
}
func filter(c *gin.Context) {
c.HTML(200, "filter.html", gin.H{})
}
func agents(c *gin.Context) {
c.HTML(200, "agents.html", gin.H{})
}