updated ipbl api endpoints
This commit is contained in:
parent
9803adfbb9
commit
60943adc66
@ -64,6 +64,14 @@ func GetSets(cfg config.Config) (res []CfgSet, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetGlobalConfig(cfg config.Config) (res []Cfg, err error) {
|
||||
var w = []Cfg{}
|
||||
if err := cfg.Db.Find(&w); err == nil {
|
||||
return w, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func InsertOrUpdateSets(cfg config.Config, folders []CfgSet) (res string, err error) {
|
||||
var w = Cfg{Key: "folders"}
|
||||
if exists, _ := cfg.Db.Get(&w); exists {
|
||||
|
@ -73,6 +73,10 @@ func RegisterRoutes(e *echo.Echo, ctx *context.Context, cfg *config.Config) {
|
||||
log.Println(msg)
|
||||
return Result(c, err, msg)
|
||||
})
|
||||
e.GET("/config", func(c echo.Context) (err error) {
|
||||
trustlists, err := models.GetGlobalConfig(*cfg)
|
||||
return Result(c, err, trustlists)
|
||||
})
|
||||
e.GET("/config/trustlist", func(c echo.Context) (err error) {
|
||||
trustlists, err := models.GetTrustlists(*cfg)
|
||||
return Result(c, err, trustlists)
|
||||
|
@ -48,7 +48,7 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
log.Println(fmt.Sprintf("zmq: Inserted %d IP, Updated %d IP", numinsert, numupdate))
|
||||
log.Printf("zmq: Inserted %d IP, Updated %d IP\n", numinsert, numupdate)
|
||||
tmpval := fmt.Sprintf("%s %s", channel, string(val))
|
||||
val = []byte(tmpval)
|
||||
topub = append(topub, val)
|
||||
|
Loading…
Reference in New Issue
Block a user