no 404, instead 3xx redirect to onion
This commit is contained in:
parent
7ca5f77545
commit
2b102d8051
12
main.go
12
main.go
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
//"fmt"
|
||||
"git.openprivacy.ca/openprivacy/log"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
@ -120,8 +120,9 @@ func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort in
|
|||
blocklistLock.Unlock()
|
||||
if ok && blocked {
|
||||
log.Debugln("blocked ip, 404ing")
|
||||
res.WriteHeader(http.StatusNotFound)
|
||||
fmt.Fprint(res, "404 - suspected botnet")
|
||||
http.Redirect(res, req, "http://gitopcybr57ris5iuivfz62gdwe2qk5pinnt2wplpwzicaybw73stjqd.onion", http.StatusSeeOther)
|
||||
//res.WriteHeader(http.StatusNotFound)
|
||||
//fmt.Fprint(res, "404 - suspected botnet")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -176,8 +177,9 @@ func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort in
|
|||
blocklistedIps[ip] = true
|
||||
}
|
||||
blocklistLock.Unlock()
|
||||
res.WriteHeader(http.StatusNotFound)
|
||||
fmt.Fprint(res, "404 - suspected botnet")
|
||||
http.Redirect(res, req, "http://gitopcybr57ris5iuivfz62gdwe2qk5pinnt2wplpwzicaybw73stjqd.onion", http.StatusSeeOther)
|
||||
// res.WriteHeader(http.StatusNotFound)
|
||||
//fmt.Fprint(res, "404 - suspected botnet")
|
||||
}
|
||||
|
||||
// https://medium.com/@mlowicki/http-s-proxy-in-golang-in-less-than-100-lines-of-code-6a51c2f2c38c
|
||||
|
|
Loading…
Reference in New Issue