Hardcoded blacklist.txt
This commit is contained in:
parent
9e16ac479a
commit
05950c5a63
16
node/api.go
16
node/api.go
@ -28,6 +28,21 @@ func (es ESConf) ListTXTHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Write(echoes)
|
w.Write(echoes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ed ESConf) BlacklistTXT(w http.ResponseWriter, r *http.Request) {
|
||||||
|
LogRequest(r)
|
||||||
|
w.WriteHeader(200)
|
||||||
|
w.Write([]byte(`KNMUXRTMJA6XWHMB22CD
|
||||||
|
6AKO6DEWYF7EHXWMI2BY
|
||||||
|
qcYj9ceDYjoxt2z6qhzN
|
||||||
|
k1zaEUu1Tg0g97osDeS7
|
||||||
|
j8s7ZMdTzmHzsRJna3xb
|
||||||
|
vuMNfQWe8xonMFPZtOxP
|
||||||
|
bcp6izdkdCj9AXUOP2aT
|
||||||
|
0dIDXSJTLtR8N2KnLTl1
|
||||||
|
2QzNqUiyuoPcPn0l74KP
|
||||||
|
`))
|
||||||
|
}
|
||||||
|
|
||||||
// XFeaturesHandler list supported features
|
// XFeaturesHandler list supported features
|
||||||
func XFeaturesHandler(w http.ResponseWriter, r *http.Request) {
|
func XFeaturesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
features := []string{"list.txt", "u/e", "u/m", "x/c"}
|
features := []string{"list.txt", "u/e", "u/m", "x/c"}
|
||||||
@ -200,6 +215,7 @@ func (es ESConf) UPointHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
func Serve(listen string, es ESConf) {
|
func Serve(listen string, es ESConf) {
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/list.txt", es.ListTXTHandler).Methods("GET")
|
r.HandleFunc("/list.txt", es.ListTXTHandler).Methods("GET")
|
||||||
|
r.HandleFunc("/blacklist.txt", es.BlacklistTXT).Methods("GET")
|
||||||
r.HandleFunc("/x/features", XFeaturesHandler).Methods("GET")
|
r.HandleFunc("/x/features", XFeaturesHandler).Methods("GET")
|
||||||
|
|
||||||
// Standart schemas
|
// Standart schemas
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
log "github.com/Sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LogRequest ...
|
// LogRequest ...
|
||||||
func LogRequest(r *http.Request) {
|
func LogRequest(r *http.Request) {
|
||||||
logString := strings.Join([]string{r.Method, string(r.ContentLength), r.RequestURI, r.RemoteAddr}, " ")
|
logString := fmt.Sprintf("%s %d %s %s", r.Method, r.ContentLength, r.RequestURI, r.RemoteAddr)
|
||||||
log.Print("[API] ", logString)
|
log.Print("[API] " + logString)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user