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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
//"fmt"
|
||||||
"git.openprivacy.ca/openprivacy/log"
|
"git.openprivacy.ca/openprivacy/log"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -120,8 +120,9 @@ func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort in
|
||||||
blocklistLock.Unlock()
|
blocklistLock.Unlock()
|
||||||
if ok && blocked {
|
if ok && blocked {
|
||||||
log.Debugln("blocked ip, 404ing")
|
log.Debugln("blocked ip, 404ing")
|
||||||
res.WriteHeader(http.StatusNotFound)
|
http.Redirect(res, req, "http://gitopcybr57ris5iuivfz62gdwe2qk5pinnt2wplpwzicaybw73stjqd.onion", http.StatusSeeOther)
|
||||||
fmt.Fprint(res, "404 - suspected botnet")
|
//res.WriteHeader(http.StatusNotFound)
|
||||||
|
//fmt.Fprint(res, "404 - suspected botnet")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +177,9 @@ func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort in
|
||||||
blocklistedIps[ip] = true
|
blocklistedIps[ip] = true
|
||||||
}
|
}
|
||||||
blocklistLock.Unlock()
|
blocklistLock.Unlock()
|
||||||
res.WriteHeader(http.StatusNotFound)
|
http.Redirect(res, req, "http://gitopcybr57ris5iuivfz62gdwe2qk5pinnt2wplpwzicaybw73stjqd.onion", http.StatusSeeOther)
|
||||||
fmt.Fprint(res, "404 - suspected botnet")
|
// 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
|
// https://medium.com/@mlowicki/http-s-proxy-in-golang-in-less-than-100-lines-of-code-6a51c2f2c38c
|
||||||
|
|
Loading…
Reference in New Issue