Skip to content

Re-work router #29

@staab

Description

@staab
  • NIP 66 based bootstrapping instead of NIP 65
  • Implement scenarios more granularly (publish vs request, multiple heuristics, heuristic overrides)

Something like this:

const RouterContext = {
  getOutboxRelays: async (pubkey: string) => string[]
  getInboxRelays: async (pubkey: string) => string[]
}

const outboxHeuristic = async (pubkey: string) => {
  return RouterContext.getOutboxRelays(pubkey)
}

const inboxHeuristic = async (pubkey: string) => {
  return RouterContext.getInboxRelays(pubkey)
}

const publicBroadcastHeuristic = async (event: SignedEvent) => {
  return uniq([
    await outboxHeuristic(event.pubkey),
    await Promise.all(getTagValues("p", event.tags).map(inboxHeuristic)),
  ])
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions