mirror of
https://github.com/aljazceru/khatru.git
synced 2025-12-18 14:04:22 +01:00
ratelimits.
This commit is contained in:
@@ -34,6 +34,13 @@ func (rl *Relay) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
|
||||
for _, reject := range rl.RejectConnection {
|
||||
if reject(r) {
|
||||
w.WriteHeader(418) // I'm a teapot
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
conn, err := rl.upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
rl.Log.Printf("failed to upgrade websocket: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user