{"modulePath":"github.com/FelineStateMachine/tinyrelay","version":"v0.0.0-20260923223823-92682824e566","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package syncprotocol\n\nPackage syncprotocol contains the relay's NIP-45 count sketch and NIP-77 negentropy session wrappers. The wrappers exchange protocol strings while exposing relay-friendly event IDs and reconciliation results.\n\n## Functions\n\n```go\nfunc HLLFilterOffset(f event.Filter) (int, bool)\n```\nHLLFilterOffset derives the register byte offset from the single tag value used by the relay's count filter. Hashed values and address-style values are both accepted.\n\n## Types\n\n```go\ntype HLL struct {\n\t// contains filtered or unexported fields\n}\n```\nHLL is the NIP-45 256-register sketch used to merge counts from relays.\n\n```go\nfunc NewHLL(offset int) *HLL\n```\n\n```go\nfunc (h *HLL) Add(pubkeyHex string) error\n```\nAdd incorporates one 32-byte hexadecimal public key into the sketch.\n\n```go\nfunc (h *HLL) Hex() string\n```\nHex returns the 256 registers in their wire hexadecimal form.\n\n```go\nfunc (h *HLL) MergeHex(encoded string) error\n```\nMergeHex unions another 256-register sketch into h.\n\n```go\ntype Item = wire.EventRef\n```\nItem identifies one event in a reconciliation index.\n\n```go\ntype Result struct {\n\tResponse string\n\tHave     []string\n\tNeed     []string\n\tDone     bool\n}\n```\nResult contains one negentropy response and the IDs discovered by the initiator when reconciliation completes.\n\n```go\ntype Session struct {\n\t// contains filtered or unexported fields\n}\n```\nSession holds one stateful negentropy exchange. A session is used by one initiator or responder for the lifetime of that exchange.\n\n```go\nfunc NewSession(items []Item, initiator bool) (*Session, error)\n```\nNewSession builds a sealed negentropy index from the relay's event IDs and timestamps. The initiator flag selects the side that starts the exchange and receives Have and Need IDs.\n\n```go\nfunc (s *Session) Reconcile(message string) (Result, error)\n```\nReconcile consumes one peer message and returns the next response. An initiator receives IDs present on each side once the exchange is complete.\n\n```go\nfunc (s *Session) Start() (string, error)\n```\nStart begins an initiator session and returns its protocol message.\n\n","path":"github.com/FelineStateMachine/tinyrelay/internal/syncprotocol","name":"syncprotocol","synopsis":"Package syncprotocol contains the relay's NIP-45 count sketch and NIP-77 negentropy session wrappers.","isRedistributable":true}
