mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-24 16:49:07 -05:00
nak/b and nak/s user-agents.
This commit is contained in:
parent
d7c0ff2bb7
commit
2988c71ccb
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
||||||
github.com/fiatjaf/khatru v0.7.5
|
github.com/fiatjaf/khatru v0.7.5
|
||||||
github.com/mailru/easyjson v0.7.7
|
github.com/mailru/easyjson v0.7.7
|
||||||
github.com/markusmobius/go-dateparser v1.2.3
|
github.com/markusmobius/go-dateparser v1.2.3
|
||||||
github.com/nbd-wtf/go-nostr v0.37.2
|
github.com/nbd-wtf/go-nostr v0.37.5
|
||||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
|
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -113,8 +113,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/nbd-wtf/go-nostr v0.37.2 h1:42rriFqqz07EdydERwYeQnewl+Rah1Gq46I+Wh0KYYg=
|
github.com/nbd-wtf/go-nostr v0.37.5 h1:w/8aBgSf3lC2OoqAJXnYUO0Nxqv+YAdxDC8X3FbLYS8=
|
||||||
github.com/nbd-wtf/go-nostr v0.37.2/go.mod h1:TGKGj00BmJRXvRe0LlpDN3KKbELhhPXgBwUEhzu3Oq0=
|
github.com/nbd-wtf/go-nostr v0.37.5/go.mod h1:TGKGj00BmJRXvRe0LlpDN3KKbELhhPXgBwUEhzu3Oq0=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
|
|
@ -18,6 +18,12 @@ import (
|
||||||
|
|
||||||
var sys = sdk.NewSystem()
|
var sys = sdk.NewSystem()
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
sys.Pool = nostr.NewSimplePool(context.Background(),
|
||||||
|
nostr.WithUserAgent("nak/b"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LINE_PROCESSING_ERROR = iota
|
LINE_PROCESSING_ERROR = iota
|
||||||
)
|
)
|
||||||
|
@ -123,6 +129,7 @@ func connectToAllRelays(
|
||||||
append(opts,
|
append(opts,
|
||||||
nostr.WithEventMiddleware(sys.TrackEventHints),
|
nostr.WithEventMiddleware(sys.TrackEventHints),
|
||||||
nostr.WithPenaltyBox(),
|
nostr.WithPenaltyBox(),
|
||||||
|
nostr.WithUserAgent("nak/s"),
|
||||||
)...,
|
)...,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
func paginateWithParams(
|
func paginateWithParams(
|
||||||
interval time.Duration,
|
interval time.Duration,
|
||||||
globalLimit uint64,
|
globalLimit uint64,
|
||||||
) func(ctx context.Context, urls []string, filters nostr.Filters) chan nostr.RelayEvent {
|
) func(ctx context.Context, urls []string, filters nostr.Filters, opts ...nostr.SubscriptionOption) chan nostr.RelayEvent {
|
||||||
return func(ctx context.Context, urls []string, filters nostr.Filters) chan nostr.RelayEvent {
|
return func(ctx context.Context, urls []string, filters nostr.Filters, opts ...nostr.SubscriptionOption) chan nostr.RelayEvent {
|
||||||
// filters will always be just one
|
// filters will always be just one
|
||||||
filter := filters[0]
|
filter := filters[0]
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ func paginateWithParams(
|
||||||
time.Sleep(interval)
|
time.Sleep(interval)
|
||||||
|
|
||||||
keepGoing := false
|
keepGoing := false
|
||||||
for evt := range sys.Pool.SubManyEose(ctx, urls, nostr.Filters{filter}) {
|
for evt := range sys.Pool.SubManyEose(ctx, urls, nostr.Filters{filter}, opts...) {
|
||||||
if slices.Contains(repeatedCache, evt.ID) {
|
if slices.Contains(repeatedCache, evt.ID) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user