Relay config by json (#47)

* relay-config.json

* fix README.md

* trustedPubKeys is not relay configuration

* update README.md
This commit is contained in:
mattn
2024-02-18 02:05:22 +09:00
committed by GitHub
parent d09ff98ab8
commit 1019fef1d3
7 changed files with 130 additions and 47 deletions

View File

@@ -69,7 +69,7 @@ func loadNpubsArchive(ctx context.Context) {
log.Debug().Msg("refreshing the npubs archive")
contactsArchive := make([]string, 0, 500)
for _, pubkey := range trustedPubKeys {
for _, pubkey := range s.TrustedPubKeys {
ctx, cancel := context.WithTimeout(ctx, time.Second*4)
pubkeyContacts := contactsForPubkey(ctx, pubkey)
contactsArchive = append(contactsArchive, pubkeyContacts...)
@@ -87,15 +87,15 @@ func loadRelaysArchive(ctx context.Context) {
relaysArchive := make([]string, 0, 500)
for _, pubkey := range trustedPubKeys {
for _, pubkey := range s.TrustedPubKeys {
ctx, cancel := context.WithTimeout(ctx, time.Second*4)
pubkeyContacts := relaysForPubkey(ctx, pubkey, profiles...)
pubkeyContacts := relaysForPubkey(ctx, pubkey, relayConfig.Profiles...)
relaysArchive = append(relaysArchive, pubkeyContacts...)
cancel()
}
for _, relay := range unique(relaysArchive) {
for _, excluded := range excludedRelays {
for _, excluded := range relayConfig.ExcludedRelays {
if strings.Contains(relay, excluded) {
log.Debug().Msgf("skipping relay %s", relay)
continue