summaryrefslogtreecommitdiffstats
path: root/relay_test.go
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-02-08 10:25:39 -0800
committerbndw <ben@bdw.to>2026-02-08 10:25:39 -0800
commit7fba76d7e4e63e0c29da81d6be43330743af1aaf (patch)
tree97d20b9d8a077cabdf3e693af64b9fd13e77f736 /relay_test.go
parente79f9ad89556000521b43ce5ff4eb59dd00768b0 (diff)
fix: correct WebSocket GUID constant (RFC 6455)
Fixed typo in WebSocket GUID that was causing handshake failures. The GUID had '5AB5' instead of 'C5AB0' in the middle section. Correct value: 258EAFA5-E914-47DA-95CA-C5AB0DC85B11 This also includes the implementation of an internal WebSocket client to replace the external dependency, providing a minimal implementation tailored for Nostr relay connections.
Diffstat (limited to 'relay_test.go')
-rw-r--r--relay_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/relay_test.go b/relay_test.go
index b39aa06..38b2062 100644
--- a/relay_test.go
+++ b/relay_test.go
@@ -9,13 +9,13 @@ import (
9 "testing" 9 "testing"
10 "time" 10 "time"
11 11
12 "github.com/coder/websocket" 12 "northwest.io/nostr/internal/websocket"
13) 13)
14 14
15// mockRelay creates a test WebSocket server that echoes messages 15// mockRelay creates a test WebSocket server that echoes messages
16func mockRelay(t *testing.T, handler func(conn *websocket.Conn)) *httptest.Server { 16func mockRelay(t *testing.T, handler func(conn *websocket.Conn)) *httptest.Server {
17 return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 17 return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
18 conn, err := websocket.Accept(w, r, nil) 18 conn, err := websocket.Accept(w, r)
19 if err != nil { 19 if err != nil {
20 t.Logf("Failed to accept WebSocket: %v", err) 20 t.Logf("Failed to accept WebSocket: %v", err)
21 return 21 return
@@ -77,7 +77,7 @@ func TestRelaySendReceive(t *testing.T) {
77 ctx := context.Background() 77 ctx := context.Background()
78 78
79 // Create relay without auto-Listen to test Send/Receive directly 79 // Create relay without auto-Listen to test Send/Receive directly
80 conn, _, err := websocket.Dial(ctx, url, nil) 80 conn, err := websocket.Dial(ctx, url)
81 if err != nil { 81 if err != nil {
82 t.Fatalf("Dial() error = %v", err) 82 t.Fatalf("Dial() error = %v", err)
83 } 83 }