From 2f4a604975197ae273b13a6d4ab5a51e529ecba9 Mon Sep 17 00:00:00 2001 From: 1l0 Date: Sun, 15 Jun 2025 08:56:22 +0900 Subject: [PATCH] nip11: add user-agent for nostr.wine, replace dead relays --- nip11/fetch.go | 3 ++- nip11/nip11_test.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nip11/fetch.go b/nip11/fetch.go index a679f14..9d13dfb 100644 --- a/nip11/fetch.go +++ b/nip11/fetch.go @@ -36,8 +36,9 @@ func Fetch(ctx context.Context, u string) (info RelayInformationDocument, err er // make request req, _ := http.NewRequestWithContext(ctx, "GET", "http"+u[2:], nil) - // add the NIP-11 header + // add the NIP-11 headers req.Header.Add("Accept", "application/nostr+json") + req.Header.Add("User-Agent", "https://github.com/nbd-wtf/go-nostr") // send the request resp, err := http.DefaultClient.Do(req) diff --git a/nip11/nip11_test.go b/nip11/nip11_test.go index 1a3ca69..f2019be 100644 --- a/nip11/nip11_test.go +++ b/nip11/nip11_test.go @@ -45,9 +45,9 @@ func TestFetch(t *testing.T) { {"wss://nostr.wine", false, "", "wss://nostr.wine"}, {"https://nostr.wine", false, "", "wss://nostr.wine"}, {"nostr.wine", false, "", "wss://nostr.wine"}, - {"no.str.cr", false, "", "wss://no.str.cr"}, - {"https://no.str.cr", false, "", "wss://no.str.cr"}, - {"wss://no.str.cr", false, "", "wss://no.str.cr"}, + {"nos.lol", false, "", "wss://nos.lol"}, + {"https://nos.lol", false, "", "wss://nos.lol"}, + {"wss://nos.lol", false, "", "wss://nos.lol"}, {"wlenwqkeqwe.asjdaskd", true, "", "wss://wlenwqkeqwe.asjdaskd"}, }