|
@@ -36,8 +36,9 @@ type restStatusResp struct {
|
36
|
36
|
Channels int `json:"channels"`
|
37
|
37
|
}
|
38
|
38
|
|
39
|
|
-type restDLinesResp struct {
|
|
39
|
+type restXLinesResp struct {
|
40
|
40
|
DLines map[string]IPBanInfo `json:"dlines"`
|
|
41
|
+ KLines map[string]IPBanInfo `json:"klines"`
|
41
|
42
|
}
|
42
|
43
|
|
43
|
44
|
type restAcct struct {
|
|
@@ -84,9 +85,10 @@ func restStatus(w http.ResponseWriter, r *http.Request) {
|
84
|
85
|
}
|
85
|
86
|
}
|
86
|
87
|
|
87
|
|
-func restGetDLines(w http.ResponseWriter, r *http.Request) {
|
88
|
|
- rs := restDLinesResp{
|
|
88
|
+func restGetXLines(w http.ResponseWriter, r *http.Request) {
|
|
89
|
+ rs := restXLinesResp{
|
89
|
90
|
DLines: restAPIServer.dlines.AllBans(),
|
|
91
|
+ KLines: restAPIServer.klines.AllBans(),
|
90
|
92
|
}
|
91
|
93
|
b, err := json.Marshal(rs)
|
92
|
94
|
if err != nil {
|
|
@@ -175,7 +177,7 @@ func (s *Server) startRestAPI() {
|
175
|
177
|
rg := r.Methods("GET").Subrouter()
|
176
|
178
|
rg.HandleFunc("/info", restInfo)
|
177
|
179
|
rg.HandleFunc("/status", restStatus)
|
178
|
|
- rg.HandleFunc("/dlines", restGetDLines)
|
|
180
|
+ rg.HandleFunc("/xlines", restGetXLines)
|
179
|
181
|
rg.HandleFunc("/accounts", restGetAccounts)
|
180
|
182
|
|
181
|
183
|
// PUT methods
|