gPanel/pkg/public/filter.go
George Shaw b9f7c5d065 Fix import paths
* github.com/Ennovar/gPanel -> github.com/kentonh/gPanel
2018-09-21 20:13:49 -05:00

27 lines
582 B
Go

package public
import (
"net/http"
"github.com/kentonh/gPanel/pkg/database"
"github.com/kentonh/gPanel/pkg/networking"
)
func (con *Controller) Filter(req *http.Request, ftype string) bool {
ip := networking.GetClientIP(req)
ds, err := database.Open(con.Directory + database.DB_MAIN)
if err != nil || ds == nil {
con.PublicLogger.Println(req.URL.Path + "::" + err.Error())
return false
}
defer ds.Close()
filtered, err := ds.IsFiltered(ip, ftype)
if err != nil {
con.PublicLogger.Println(req.URL.Path + "::" + err.Error())
return false
}
return filtered
}