display message when viewing server in browser

This commit is contained in:
Cyberes 2024-04-12 18:51:41 -06:00
parent 74d18e781a
commit d05b93768c
2 changed files with 19 additions and 3 deletions

12
src/proxy/retardation.go Normal file

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,9 @@ package proxy
import (
"fmt"
"math/rand"
"net/http"
"time"
)
func (p *ForwardProxyCluster) ServeHTTP(w http.ResponseWriter, req *http.Request) {
@ -12,9 +14,11 @@ func (p *ForwardProxyCluster) ServeHTTP(w http.ResponseWriter, req *http.Request
} else {
// HTTP
if req.URL.Scheme != "http" {
msg := fmt.Sprintf(`unsupported protocal "%s"`, req.URL.Scheme)
log.Errorf(msg)
http.Error(w, msg, http.StatusBadRequest)
//msg := fmt.Sprintf(`unsupported protocal "%s"`, req.URL.Scheme)
//log.Errorf(msg)
//http.Error(w, msg, http.StatusBadRequest)
rand.New(rand.NewSource(time.Now().Unix()))
fmt.Fprint(w, "proxy-loadbalancer\n<https://git.evulid.cc/cyberes/proxy-loadbalancer>\n\n"+retardation[rand.Intn(len(retardation))])
return
}
p.proxyHttpConnect(w, req)