Migrate internal module imports to unified package path.
Replaced legacy `*.orly` module imports with `next.orly.dev/pkg` paths across the codebase for consistency. Removed legacy `go.mod` files from sub-packages, consolidating dependency management. Added Dockerfiles and configurations for benchmarking environments.
This commit is contained in:
@@ -4,15 +4,15 @@ import (
|
||||
"bytes"
|
||||
"strings"
|
||||
|
||||
"crypto.orly/ec"
|
||||
"crypto.orly/ec/bech32"
|
||||
"crypto.orly/ec/schnorr"
|
||||
"crypto.orly/ec/secp256k1"
|
||||
"encoders.orly/hex"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly"
|
||||
"utils.orly/constraints"
|
||||
"next.orly.dev/pkg/crypto/ec"
|
||||
"next.orly.dev/pkg/crypto/ec/bech32"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/crypto/ec/secp256k1"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"crypto.orly/ec/schnorr"
|
||||
"crypto.orly/ec/secp256k1"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/crypto/ec/secp256k1"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestConvertBits(t *testing.T) {
|
||||
|
||||
@@ -4,17 +4,17 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
"crypto.orly/ec/bech32"
|
||||
"crypto.orly/ec/schnorr"
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/bech32encoding/pointers"
|
||||
"encoders.orly/bech32encoding/tlv"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/kind"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/crypto/ec/bech32"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/bech32encoding/pointers"
|
||||
"next.orly.dev/pkg/encoders/bech32encoding/tlv"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"encoders.orly/bech32encoding/pointers"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/kind"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly"
|
||||
"utils.orly/constraints"
|
||||
"next.orly.dev/pkg/encoders/bech32encoding/pointers"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
)
|
||||
|
||||
func TestEncodeNpub(t *testing.T) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package pointers
|
||||
|
||||
import (
|
||||
"encoders.orly/kind"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
)
|
||||
|
||||
// Profile pointer is a combination of pubkey and relay list.
|
||||
|
||||
@@ -5,14 +5,14 @@ package authenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/event"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly/constraints"
|
||||
"utils.orly/units"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
"next.orly.dev/pkg/utils/units"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -3,12 +3,12 @@ package authenvelope
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"crypto.orly/p256k"
|
||||
"encoders.orly/envelopes"
|
||||
"lol.mleku.dev/chk"
|
||||
"protocol.orly/auth"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/crypto/p256k"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/protocol/auth"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
const relayURL = "wss://example.com"
|
||||
|
||||
@@ -6,10 +6,10 @@ package closedenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
|
||||
"lukechampine.com/frand"
|
||||
)
|
||||
|
||||
@@ -5,10 +5,10 @@ package closeenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/filter"
|
||||
"encoders.orly/ints"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly/constraints"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/filter"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -3,12 +3,12 @@ package countenvelope
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/filter"
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/filter"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
func TestRequest(t *testing.T) {
|
||||
|
||||
@@ -7,10 +7,10 @@ package eoseenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -3,9 +3,9 @@ package eoseenvelope
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -5,15 +5,15 @@ package eventenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/event"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly/bufpool"
|
||||
"utils.orly/constraints"
|
||||
"utils.orly/units"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
"next.orly.dev/pkg/utils/units"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/event"
|
||||
"encoders.orly/event/examples"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
"next.orly.dev/pkg/encoders/event/examples"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
func TestSubmission(t *testing.T) {
|
||||
|
||||
@@ -6,11 +6,11 @@ package noticeenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly/constraints"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -3,10 +3,10 @@ package noticeenvelope
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/envelopes/messages"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/envelopes/messages"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -6,15 +6,15 @@ package okenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly/constraints"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -3,12 +3,12 @@ package okenvelope
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/envelopes/messages"
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/envelopes/messages"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -5,12 +5,12 @@ package reqenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/filter"
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly/constraints"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/filter"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/interfaces/codec"
|
||||
"next.orly.dev/pkg/utils/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -3,11 +3,11 @@ package reqenvelope
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"encoders.orly/envelopes"
|
||||
"encoders.orly/filter"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/encoders/envelopes"
|
||||
"next.orly.dev/pkg/encoders/filter"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -3,10 +3,10 @@ package event
|
||||
import (
|
||||
"io"
|
||||
|
||||
"crypto.orly/ec/schnorr"
|
||||
"encoders.orly/tag"
|
||||
"encoders.orly/varint"
|
||||
"lol.mleku.dev/chk"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/encoders/tag"
|
||||
"next.orly.dev/pkg/encoders/varint"
|
||||
)
|
||||
|
||||
// MarshalBinary writes a binary encoding of an event.
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"encoders.orly/event/examples"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/encoders/event/examples"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestTMarshalBinary_UnmarshalBinary(t *testing.T) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/ints"
|
||||
"encoders.orly/text"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
)
|
||||
|
||||
// ToCanonical converts the event to the canonical encoding used to derive the
|
||||
|
||||
@@ -4,18 +4,18 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"crypto.orly/ec/schnorr"
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/ints"
|
||||
"encoders.orly/kind"
|
||||
"encoders.orly/tag"
|
||||
"encoders.orly/text"
|
||||
"github.com/templexxx/xhex"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
"next.orly.dev/pkg/encoders/tag"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
// E is the primary datatype of nostr. This is the form of the structure that
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
// library. Either call MarshalJSON directly or use a json.Encoder with html
|
||||
// escaping disabled.
|
||||
//
|
||||
// Or import "encoders.orly/json" and use json.Marshal which is the
|
||||
// Or import "next.orly.dev/pkg/encoders/json" and use json.Marshal which is the
|
||||
// same as go 1.25 json v1 except with this one stupidity removed.
|
||||
type E struct {
|
||||
|
||||
|
||||
@@ -6,16 +6,16 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"encoders.orly/event/examples"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/json"
|
||||
"encoders.orly/tag"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/log"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"utils.orly/units"
|
||||
"next.orly.dev/pkg/encoders/event/examples"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/json"
|
||||
"next.orly.dev/pkg/encoders/tag"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
"next.orly.dev/pkg/utils/units"
|
||||
)
|
||||
|
||||
func TestMarshalJSONUnmarshalJSON(t *testing.T) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"crypto.orly/p256k"
|
||||
"interfaces.orly/signer"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/crypto/p256k"
|
||||
"next.orly.dev/pkg/interfaces/signer"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
// Sign the event using the signer.I. Uses github.com/bitcoin-core/secp256k1 if
|
||||
|
||||
@@ -4,17 +4,17 @@ import (
|
||||
"bytes"
|
||||
"sort"
|
||||
|
||||
"crypto.orly/ec/schnorr"
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/event"
|
||||
"encoders.orly/ints"
|
||||
"encoders.orly/kind"
|
||||
"encoders.orly/tag"
|
||||
"encoders.orly/text"
|
||||
"encoders.orly/timestamp"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly/pointers"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
"next.orly.dev/pkg/encoders/tag"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
"next.orly.dev/pkg/encoders/timestamp"
|
||||
"next.orly.dev/pkg/utils/pointers"
|
||||
)
|
||||
|
||||
// F is the primary query form for requesting events from a nostr relay.
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestT_MarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package filter
|
||||
|
||||
import (
|
||||
"encoders.orly/event"
|
||||
"lol.mleku.dev/errorf"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
)
|
||||
|
||||
type S []*F
|
||||
|
||||
func NewS(ff ...*F) *S {
|
||||
s := S(ff)
|
||||
return &s
|
||||
}
|
||||
|
||||
// Match checks if a set of filters.T matches on an event.F.
|
||||
func (s *S) Match(event *event.E) bool {
|
||||
for _, f := range *s {
|
||||
@@ -19,11 +24,14 @@ func (s *S) Match(event *event.E) bool {
|
||||
|
||||
// Marshal encodes a slice of filters as a JSON array of objects.
|
||||
// It appends the result to dst and returns the resulting slice.
|
||||
func (s S) Marshal(dst []byte) (b []byte) {
|
||||
func (s *S) Marshal(dst []byte) (b []byte) {
|
||||
if s == nil {
|
||||
panic("nil filter slice")
|
||||
}
|
||||
b = dst
|
||||
b = append(b, '[')
|
||||
first := false
|
||||
for _, f := range s {
|
||||
for _, f := range *s {
|
||||
if f == nil {
|
||||
continue
|
||||
}
|
||||
@@ -82,3 +90,11 @@ func (s *S) Unmarshal(b []byte) (r []byte, err error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
func (s *S) MatchIgnoringTimestampConstraints(ev *event.E) bool {
|
||||
for _, ff := range *s {
|
||||
if ff.MatchesIgnoringTimestampConstraints(ev) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ package filter
|
||||
import (
|
||||
"math"
|
||||
|
||||
"crypto.orly/ec/schnorr"
|
||||
"crypto.orly/ec/secp256k1"
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/kind"
|
||||
"encoders.orly/tag"
|
||||
"encoders.orly/timestamp"
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly/values"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/crypto/ec/secp256k1"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
"next.orly.dev/pkg/encoders/tag"
|
||||
"next.orly.dev/pkg/encoders/timestamp"
|
||||
"next.orly.dev/pkg/utils/values"
|
||||
)
|
||||
|
||||
// GenFilter is a testing tool to create random arbitrary filters for tests.
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
module encoders.orly
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
crypto.orly v0.0.0-00010101000000-000000000000
|
||||
github.com/templexxx/xhex v0.0.0-20200614015412-aed53437177b
|
||||
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b
|
||||
interfaces.orly v0.0.0-00010101000000-000000000000
|
||||
lol.mleku.dev v1.0.2
|
||||
lukechampine.com/frand v1.5.1
|
||||
protocol.orly v0.0.0-00010101000000-000000000000
|
||||
utils.orly v0.0.0-00010101000000-000000000000
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/templexxx/cpu v0.0.1 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
)
|
||||
|
||||
replace (
|
||||
acl.orly => ../acl
|
||||
crypto.orly => ../crypto
|
||||
database.orly => ../database
|
||||
encoders.orly => ../encoders
|
||||
interfaces.orly => ../interfaces
|
||||
next.orly.dev => ../../
|
||||
protocol.orly => ../protocol
|
||||
utils.orly => ../utils
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
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/templexxx/cpu v0.0.1 h1:hY4WdLOgKdc8y13EYklu9OUTXik80BkxHoWvTO6MQQY=
|
||||
github.com/templexxx/cpu v0.0.1/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk=
|
||||
github.com/templexxx/xhex v0.0.0-20200614015412-aed53437177b h1:XeDLE6c9mzHpdv3Wb1+pWBaWv/BlHK0ZYIu/KaL6eHg=
|
||||
github.com/templexxx/xhex v0.0.0-20200614015412-aed53437177b/go.mod h1:7rwmCH0wC2fQvNEvPZ3sKXukhyCTyiaZ5VTZMQYpZKQ=
|
||||
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0=
|
||||
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
lol.mleku.dev v1.0.2 h1:bSV1hHnkmt1hq+9nSvRwN6wgcI7itbM3XRZ4dMB438c=
|
||||
lol.mleku.dev v1.0.2/go.mod h1:DQ0WnmkntA9dPLCXgvtIgYt5G0HSqx3wSTLolHgWeLA=
|
||||
lukechampine.com/frand v1.5.1 h1:fg0eRtdmGFIxhP5zQJzM1lFDbD6CUfu/f+7WgAZd5/w=
|
||||
lukechampine.com/frand v1.5.1/go.mod h1:4VstaWc2plN4Mjr10chUD46RAVGWhpkZ5Nja8+Azp0Q=
|
||||
@@ -6,9 +6,9 @@ package kind
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"encoders.orly/ints"
|
||||
"golang.org/x/exp/constraints"
|
||||
"lol.mleku.dev/chk"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
)
|
||||
|
||||
// K - which will be externally referenced as kind.K is the event type in the
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
package kind
|
||||
|
||||
import (
|
||||
"encoders.orly/ints"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
)
|
||||
|
||||
// S is an array of kind.K, used in filter.K and filter.S for searches.
|
||||
|
||||
@@ -5,10 +5,10 @@ package atag
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/ints"
|
||||
"encoders.orly/kind"
|
||||
"lol.mleku.dev/chk"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
)
|
||||
|
||||
// T is a data structure for what is found in an `a` tag: kind:pubkey:arbitrary data
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"crypto.orly/ec/schnorr"
|
||||
"encoders.orly/hex"
|
||||
"encoders.orly/kind"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/log"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/crypto/ec/schnorr"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/encoders/kind"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestT_Marshal_Unmarshal(t *testing.T) {
|
||||
|
||||
@@ -6,10 +6,10 @@ package tag
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"encoders.orly/text"
|
||||
"lol.mleku.dev/errorf"
|
||||
utils "utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/encoders/text"
|
||||
utils "next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
// The tag position meanings, so they are clear when reading.
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"bytes"
|
||||
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly"
|
||||
"utils.orly/bufpool"
|
||||
"next.orly.dev/pkg/utils"
|
||||
"next.orly.dev/pkg/utils/bufpool"
|
||||
)
|
||||
|
||||
// S is a list of tag.T - which are lists of string elements with ordering and
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestSMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -3,9 +3,9 @@ package text
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"crypto.orly/sha256"
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
)
|
||||
|
||||
func TestUnescapeByteString(t *testing.T) {
|
||||
|
||||
@@ -3,11 +3,11 @@ package text
|
||||
import (
|
||||
"io"
|
||||
|
||||
"encoders.orly/hex"
|
||||
"github.com/templexxx/xhex"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
// JSONKey generates the JSON format for an object key and terminates with the semicolon.
|
||||
|
||||
@@ -3,11 +3,11 @@ package text
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"crypto.orly/sha256"
|
||||
"encoders.orly/hex"
|
||||
"lol.mleku.dev/chk"
|
||||
"lukechampine.com/frand"
|
||||
"utils.orly"
|
||||
"next.orly.dev/pkg/crypto/sha256"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
"next.orly.dev/pkg/utils"
|
||||
)
|
||||
|
||||
func TestUnmarshalHexArray(t *testing.T) {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"encoders.orly/ints"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"next.orly.dev/pkg/encoders/ints"
|
||||
)
|
||||
|
||||
// T is a convenience type for UNIX 64 bit timestamps of 1 second
|
||||
|
||||
Reference in New Issue
Block a user