From 07b791e90a0af895c8fab585ef68dd24081fb86a Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 18 Apr 2026 09:19:43 -0300 Subject: [PATCH] adapt to some nostrlib changes. --- go.mod | 2 +- go.sum | 2 ++ serve.go | 6 ++++-- sync.go | 6 +++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index ae6c102..b29c57d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/fiatjaf/nak go 1.25 require ( - fiatjaf.com/nostr v0.0.0-20260402062956-72a5be58d755 + fiatjaf.com/nostr v0.0.0-20260416191442-f50b7b0f8dcb github.com/AlecAivazis/survey/v2 v2.3.7 github.com/bep/debounce v1.2.1 github.com/btcsuite/btcd/btcec/v2 v2.3.6 diff --git a/go.sum b/go.sum index 938cc03..791ff41 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ fiatjaf.com/lib v0.3.6 h1:GRZNSxHI2EWdjSKVuzaT+c0aifLDtS16SzkeJaHyJfY= fiatjaf.com/lib v0.3.6/go.mod h1:UlHaZvPHj25PtKLh9GjZkUHRmQ2xZ8Jkoa4VRaLeeQ8= fiatjaf.com/nostr v0.0.0-20260402062956-72a5be58d755 h1:Tt9XwQMaGaZw2cwujK8IAD/g6FkJC9WWRJuz+7qM1zM= fiatjaf.com/nostr v0.0.0-20260402062956-72a5be58d755/go.mod h1:iRKV8eYKzePA30MdbaYBpAv8pYQ6to8rDr3W+R2hJzM= +fiatjaf.com/nostr v0.0.0-20260416191442-f50b7b0f8dcb h1:zOni3zgiu+hnzZFjt8SAMzmntlAxm+c8T9kEr0qwGRw= +fiatjaf.com/nostr v0.0.0-20260416191442-f50b7b0f8dcb/go.mod h1:1cmygNC87Pw06/WjkZqDV+Xo6rV10kpTjzuayosIX4Y= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/FastFilter/xorfilter v0.2.1 h1:lbdeLG9BdpquK64ZsleBS8B4xO/QW1IM0gMzF7KaBKc= diff --git a/serve.go b/serve.go index ca800e7..8929927 100644 --- a/serve.go +++ b/serve.go @@ -6,9 +6,12 @@ import ( "context" "fmt" "io" + "net" + "net/http" "net/url" "os" "path/filepath" + "strconv" "sync/atomic" "time" @@ -163,8 +166,7 @@ var serve = &cli.Command{ } go func() { - err := rl.Start(hostname, port, started) - exited <- err + exited <- http.ListenAndServe(net.JoinHostPort(hostname, strconv.Itoa(port)), rl) }() // relay logging diff --git a/sync.go b/sync.go index 348d97f..33ac0a8 100644 --- a/sync.go +++ b/sync.go @@ -409,7 +409,7 @@ func parseMessageBuildNext( skipCallback(getBoundKey(bound)) if _, skipped := skippedBounds[getBoundKey(bound)]; !skipped { bw.WriteBound(nextMsg, bound) - negentropy.WriteVarInt(nextMsg, int(negentropy.SkipMode)) + negentropy.WriteVarInt(nextMsg, uint64(negentropy.SkipMode)) } case negentropy.FingerprintMode: @@ -420,7 +420,7 @@ func parseMessageBuildNext( if _, skipped := skippedBounds[getBoundKey(bound)]; !skipped { bw.WriteBound(nextMsg, bound) - negentropy.WriteVarInt(nextMsg, int(negentropy.FingerprintMode)) + negentropy.WriteVarInt(nextMsg, uint64(negentropy.FingerprintMode)) nextMsg.Write(acc.Buf[0:negentropy.FingerprintSize] /* idem */) } case negentropy.IdListMode: @@ -452,7 +452,7 @@ func parseMessageBuildNext( fingerprint := acc.GetFingerprint(numIds) bw.WriteBound(nextMsg, bound) - negentropy.WriteVarInt(nextMsg, int(negentropy.FingerprintMode)) + negentropy.WriteVarInt(nextMsg, uint64(negentropy.FingerprintMode)) nextMsg.Write(fingerprint[:]) } default: