top level docs for event, eventid and filter packages
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Command lerproxy implements https reverse proxy with automatic LetsEncrypt
|
||||
// usage for multiple hostnames/backends, and URL rewriting capability.
|
||||
// usage for multiple hostnames/backends,your own SSL certificates, nostr NIP-05
|
||||
// DNS verification hosting and Go vanity redirects.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Package main is a tester that reads in a provided JSON line structured
|
||||
// (.jsonl) document containing a set of events and attempts to parse them and
|
||||
// prints out the events that failed various steps in the encode/decode process.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
5
event/codectester/doc.go
Normal file
5
event/codectester/doc.go
Normal file
@@ -0,0 +1,5 @@
|
||||
// Package codectester is a tester to accept a large volume of (ostensibly
|
||||
// valid) event data in a .jsonl (JSON line structured) file and categorize it
|
||||
// into subsets that have failed at separate parts of the processing, a tool for
|
||||
// testing the event codec.
|
||||
package codectester
|
||||
@@ -1,3 +1,7 @@
|
||||
// Package event provides a codec for nostr events, for the wire format (with Id
|
||||
// and signature), for the canonical form, that is hashed to generate the Id,
|
||||
// and a custom format called "wirecompact" which wraps a canonical form with an
|
||||
// array and encodes the signature with base64 for a more compact size.
|
||||
package event
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Package examples is an embeded jsonl format of a collection of events
|
||||
// intended to be used to test an event codec.
|
||||
package examples
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Package eventid is a codec for managing nostr event Ids (hash of the
|
||||
// canonical form of a nostr event).
|
||||
package eventid
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Package filter is a codec for nostr filters (queries) and includes tools for
|
||||
// matching them to events, a canonical format scheme to enable compactly
|
||||
// identifying subscription filters, and a simplified filter that leavse out the
|
||||
// IDs and Search fields for use in the HTTP API.
|
||||
package filter
|
||||
|
||||
import (
|
||||
@@ -25,13 +29,14 @@ func Present(i *uint) bool { return i != nil }
|
||||
|
||||
// T is the primary query form for requesting events from a nostr relay.
|
||||
//
|
||||
// The ordering of fields of filters is not specified as in the protocol there is no requirement
|
||||
// to generate a hash for fast recognition of identical filters. However, for internal use in a
|
||||
// relay, by applying a consistent sort order, this library will produce an identical JSON from
|
||||
// the same *set* of fields no matter what order they were provided.
|
||||
// The ordering of fields of filters is not specified as in the protocol there
|
||||
// is no requirement to generate a hash for fast recognition of identical
|
||||
// filters. However, for internal use in a relay, by applying a consistent sort
|
||||
// order, this library will produce an identical JSON from the same *set* of
|
||||
// fields no matter what order they were provided.
|
||||
//
|
||||
// This is to facilitate the deduplication of filters so an effective identical match is not
|
||||
// performed on an identical filter.
|
||||
// This is to facilitate the deduplication of filters so an effective identical
|
||||
// match is not performed on an identical filter.
|
||||
type T struct {
|
||||
IDs *tag.T `json:"ids,omitempty"`
|
||||
Kinds *kinds.T `json:"kinds,omitempty"`
|
||||
@@ -55,10 +60,10 @@ func New() (f *T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Clone creates a new filter with all the same elements in them, because they are immutable,
|
||||
// basically, except setting the Limit field as 1, because it is used in the subscription
|
||||
// management code to act as a reference counter, and making a clone implicitly means 1
|
||||
// reference.
|
||||
// Clone creates a new filter with all the same elements in them, because they
|
||||
// are immutable, basically, except setting the Limit field as 1, because it is
|
||||
// used in the subscription management code to act as a reference counter, and
|
||||
// making a clone implicitly means 1 reference.
|
||||
func (f *T) Clone() (clone *T) {
|
||||
lim := new(uint)
|
||||
*lim = 1
|
||||
|
||||
Reference in New Issue
Block a user