include original http.Request in WebSocket struct.

This commit is contained in:
fiatjaf 2023-11-29 12:26:04 -03:00
parent 84d01dc1d3
commit 3c1b062eb8
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,7 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
ws := &WebSocket{
conn: conn,
Request: r,
Challenge: hex.EncodeToString(challenge),
Authed: make(chan struct{}),
}

View File

@ -1,6 +1,7 @@
package khatru
import (
"net/http"
"sync"
"github.com/fasthttp/websocket"
@ -10,6 +11,9 @@ type WebSocket struct {
conn *websocket.Conn
mutex sync.Mutex
// original request
Request *http.Request
// nip42
Challenge string
AuthedPublicKey string