diff --git a/api/plc.go b/api/plc.go index ac058ec2e..b64e44023 100644 --- a/api/plc.go +++ b/api/plc.go @@ -54,9 +54,7 @@ func (s *PLCServer) GetDocument(ctx context.Context, didstr string) (*did.Docume return &doc, nil } -func (s *PLCServer) FlushCacheFor(did string) { - return -} +func (s *PLCServer) FlushCacheFor(did string) {} type CreateOp struct { Type string `json:"type" cborgen:"type"` diff --git a/atproto/data/data.go b/atproto/data/data.go index 560566c2d..cdd185ddd 100644 --- a/atproto/data/data.go +++ b/atproto/data/data.go @@ -66,11 +66,13 @@ func extractBlobsAtom(atom any) []Blob { out = append(out, v) case []any: for _, el := range v { - out = append(out, extractBlobsAtom(el)...) + down := extractBlobsAtom(el) + out = append(out, down...) } case map[string]any: for _, val := range v { - out = append(out, extractBlobsAtom(val)...) + down := extractBlobsAtom(val) + out = append(out, down...) } default: } diff --git a/atproto/identity/cmd/atp-id/main.go b/atproto/identity/cmd/atp-id/main.go index 9d721656e..2beccaa5f 100644 --- a/atproto/identity/cmd/atp-id/main.go +++ b/atproto/identity/cmd/atp-id/main.go @@ -1,16 +1,15 @@ package main import ( - "context" "encoding/json" "fmt" "log/slog" "os" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" - - "github.com/urfave/cli/v2" ) func main() { @@ -44,7 +43,7 @@ func main() { } func runLookup(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context s := cctx.Args().First() if s == "" { return fmt.Errorf("need to provide identifier as an argument") @@ -66,7 +65,7 @@ func runLookup(cctx *cli.Context) error { } func runResolveHandle(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context s := cctx.Args().First() if s == "" { return fmt.Errorf("need to provide handle as an argument") @@ -88,7 +87,7 @@ func runResolveHandle(cctx *cli.Context) error { } func runResolveDID(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context s := cctx.Args().First() if s == "" { fmt.Println("need to provide DID as an argument") diff --git a/atproto/identity/mock_directory_test.go b/atproto/identity/mock_directory_test.go index 3f848a10d..30e841a15 100644 --- a/atproto/identity/mock_directory_test.go +++ b/atproto/identity/mock_directory_test.go @@ -50,6 +50,6 @@ func TestMockDirectory(t *testing.T) { _, err = c.LookupHandle(ctx, syntax.HandleInvalid) assert.ErrorIs(err, ErrHandleNotFound) - out, err = c.LookupDID(ctx, syntax.DID("did:plc:abc999")) + _, err = c.LookupDID(ctx, syntax.DID("did:plc:abc999")) assert.ErrorIs(err, ErrDIDNotFound) } diff --git a/atproto/lexicon/cmd/lextool/net.go b/atproto/lexicon/cmd/lextool/net.go index 1600aaee8..ee5382615 100644 --- a/atproto/lexicon/cmd/lextool/net.go +++ b/atproto/lexicon/cmd/lextool/net.go @@ -1,22 +1,22 @@ package main import ( - "context" "fmt" "io" "log/slog" "net/http" + "github.com/bobg/errors" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/atproto/data" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/lexicon" "github.com/bluesky-social/indigo/atproto/syntax" - - "github.com/urfave/cli/v2" ) func runValidateRecord(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context args := cctx.Args().Slice() if len(args) != 2 { return fmt.Errorf("expected two args (catalog path and AT-URI)") @@ -29,12 +29,12 @@ func runValidateRecord(cctx *cli.Context) error { cat := lexicon.NewBaseCatalog() err := cat.LoadDirectory(p) if err != nil { - return err + return errors.Wrap(err, "in LoadDirectory") } aturi, err := syntax.ParseATURI(args[1]) if err != nil { - return err + return errors.Wrap(err, "in ParseATURI") } if aturi.RecordKey() == "" { return fmt.Errorf("need a full, not partial, AT-URI: %s", aturi) @@ -54,17 +54,24 @@ func runValidateRecord(cctx *cli.Context) error { pdsURL, ident.DID, aturi.Collection(), aturi.RecordKey()) resp, err := http.Get(url) if err != nil { - return err + return errors.Wrap(err, "in http.Get") } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { return fmt.Errorf("fetch failed") } + respBytes, err := io.ReadAll(resp.Body) if err != nil { - return err + return errors.Wrap(err, "in ReadAll") } body, err := data.UnmarshalJSON(respBytes) + if err != nil { + return errors.Wrap(err, "in UnmarshalJSON") + } + record, ok := body["value"].(map[string]any) if !ok { return fmt.Errorf("fetched record was not an object") @@ -73,7 +80,7 @@ func runValidateRecord(cctx *cli.Context) error { slog.Info("validating", "did", ident.DID.String(), "collection", aturi.Collection().String(), "rkey", aturi.RecordKey().String()) err = lexicon.ValidateRecord(&cat, record, aturi.Collection().String(), lexicon.LenientMode) if err != nil { - return err + return errors.Wrap(err, "in ValidateRecord") } fmt.Println("success!") return nil diff --git a/atproto/lexicon/language.go b/atproto/lexicon/language.go index 1eb5bdf0e..d89e27a68 100644 --- a/atproto/lexicon/language.go +++ b/atproto/lexicon/language.go @@ -142,7 +142,6 @@ func (s *SchemaDef) SetBase(base string) { } s.Inner = v } - return } func (s SchemaDef) MarshalJSON() ([]byte, error) { diff --git a/atproto/lexicon/lexicon.go b/atproto/lexicon/lexicon.go index 840d2ae7a..d259a624a 100644 --- a/atproto/lexicon/lexicon.go +++ b/atproto/lexicon/lexicon.go @@ -136,7 +136,7 @@ func validateArray(cat Catalog, s SchemaArray, arr []any, flags ValidateFlags) e } func validateUnion(cat Catalog, s SchemaUnion, d any, flags ValidateFlags) error { - closed := s.Closed != nil && *s.Closed == true + closed := s.Closed != nil && *s.Closed obj, ok := d.(map[string]any) if !ok { diff --git a/automod/consumer/firehose.go b/automod/consumer/firehose.go index 91470cc43..d036adf47 100644 --- a/automod/consumer/firehose.go +++ b/automod/consumer/firehose.go @@ -171,7 +171,6 @@ func (fc *FirehoseConsumer) HandleRepoCommit(ctx context.Context, evt *comatprot action = automod.UpdateOp default: logger.Error("impossible event kind", "kind", ek) - break } recCID := syntax.CID(op.Cid.String()) op := automod.RecordOp{ diff --git a/automod/engine/fetch_account_meta.go b/automod/engine/fetch_account_meta.go index 39b4df1eb..e8b120679 100644 --- a/automod/engine/fetch_account_meta.go +++ b/automod/engine/fetch_account_meta.go @@ -93,7 +93,7 @@ func (e *Engine) GetAccountMeta(ctx context.Context, ident *identity.Identity) ( var labels []string var negLabels []string for _, lbl := range pv.Labels { - if lbl.Neg != nil && *lbl.Neg == true { + if lbl.Neg != nil && *lbl.Neg { negLabels = append(negLabels, lbl.Val) } else { labels = append(labels, lbl.Val) @@ -130,10 +130,10 @@ func (e *Engine) GetAccountMeta(ctx context.Context, ident *identity.Identity) ( am.Deactivated = true } if rd.Moderation != nil && rd.Moderation.SubjectStatus != nil { - if rd.Moderation.SubjectStatus.Takendown != nil && *rd.Moderation.SubjectStatus.Takendown == true { + if rd.Moderation.SubjectStatus.Takendown != nil && *rd.Moderation.SubjectStatus.Takendown { am.Takendown = true } - if rd.Moderation.SubjectStatus.Appealed != nil && *rd.Moderation.SubjectStatus.Appealed == true { + if rd.Moderation.SubjectStatus.Appealed != nil && *rd.Moderation.SubjectStatus.Appealed { ap.Appealed = true } ap.AccountTags = dedupeStrings(rd.Moderation.SubjectStatus.Tags) diff --git a/automod/engine/persist.go b/automod/engine/persist.go index 3c4b36fd0..e2dee5418 100644 --- a/automod/engine/persist.go +++ b/automod/engine/persist.go @@ -276,7 +276,7 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error { var existingLabels []string var negLabels []string for _, lbl := range rv.Labels { - if lbl.Neg != nil && *lbl.Neg == true { + if lbl.Neg != nil && *lbl.Neg { negLabels = append(negLabels, lbl.Val) } else { existingLabels = append(existingLabels, lbl.Val) diff --git a/automod/flagstore/flagstore_mem.go b/automod/flagstore/flagstore_mem.go index bc068475c..8d2859122 100644 --- a/automod/flagstore/flagstore_mem.go +++ b/automod/flagstore/flagstore_mem.go @@ -23,10 +23,7 @@ func (s MemFlagStore) Get(ctx context.Context, key string) ([]string, error) { } func (s MemFlagStore) Add(ctx context.Context, key string, flags []string) error { - v, ok := s.Data[key] - if !ok { - v = []string{} - } + v := s.Data[key] v = append(v, flags...) v = dedupeStrings(v) s.Data[key] = v @@ -49,8 +46,8 @@ func (s MemFlagStore) Remove(ctx context.Context, key string, flags []string) er for _, f := range flags { delete(m, f) } - out := []string{} - for f, _ := range m { + var out []string + for f := range m { out = append(out, f) } s.Data[key] = out diff --git a/automod/helpers/bsky.go b/automod/helpers/bsky.go index a38ecda92..00e586222 100644 --- a/automod/helpers/bsky.go +++ b/automod/helpers/bsky.go @@ -203,10 +203,7 @@ func ParentOrRootIsFollower(c *automod.RecordContext, post *appbsky.FeedPost) bo } rel = c.GetAccountRelationship(rootDID) - if rel.FollowedBy { - return true - } - return false + return rel.FollowedBy } func PostParentOrRootIsDid(post *appbsky.FeedPost, did string) bool { diff --git a/automod/keyword/cmd/kw-cli/main.go b/automod/keyword/cmd/kw-cli/main.go index 8d21993aa..d3d84ca91 100644 --- a/automod/keyword/cmd/kw-cli/main.go +++ b/automod/keyword/cmd/kw-cli/main.go @@ -2,15 +2,14 @@ package main import ( "bufio" - "context" "fmt" "log/slog" "os" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/automod/keyword" "github.com/bluesky-social/indigo/automod/setstore" - - "github.com/urfave/cli/v2" ) func main() { @@ -64,7 +63,7 @@ func runFuzzy(cctx *cli.Context) error { } func runTokens(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context sets := setstore.NewMemSetStore() if err := sets.LoadFromFileJSON(cctx.String("json-set-file")); err != nil { return err diff --git a/automod/keyword/tokenize.go b/automod/keyword/tokenize.go index 0b5a33ca4..f2353a834 100644 --- a/automod/keyword/tokenize.go +++ b/automod/keyword/tokenize.go @@ -12,7 +12,6 @@ import ( ) var ( - puncChars = regexp.MustCompile(`[[:punct:]]+`) nonTokenChars = regexp.MustCompile(`[^\pL\pN\s]+`) nonTokenCharsSkipCensorChars = regexp.MustCompile(`[^\pL\pN\s#*_-]`) ) diff --git a/backfill/backfill_test.go b/backfill/backfill_test.go deleted file mode 100644 index 9e6c25c76..000000000 --- a/backfill/backfill_test.go +++ /dev/null @@ -1,119 +0,0 @@ -package backfill_test - -import ( - "context" - "log/slog" - "sync" - "testing" - - "github.com/ipfs/go-cid" - typegen "github.com/whyrusleeping/cbor-gen" -) - -type testState struct { - creates int - updates int - deletes int - lk sync.Mutex -} - -func TestBackfill(t *testing.T) { - /* this test depends on being able to hit the live production bgs... - ctx := context.Background() - - testRepos := []string{ - "did:plc:q6gjnaw2blty4crticxkmujt", - "did:plc:f5f4diimystr7ima7nqvamhe", - "did:plc:t7y4sud4dhptvzz7ibnv5cbt", - } - - db, err := gorm.Open(sqlite.Open("sqlite://:memory")) - if err != nil { - t.Fatal(err) - } - - store := backfill.NewGormstore(db) - ts := &testState{} - - opts := backfill.DefaultBackfillOptions() - opts.CheckoutPath = "https://bsky.network/xrpc/com.atproto.sync.getRepo" - opts.NSIDFilter = "app.bsky.feed.follow/" - - bf := backfill.NewBackfiller( - "backfill-test", - store, - ts.handleCreate, - ts.handleUpdate, - ts.handleDelete, - opts, - ) - - slog.Info("starting backfiller") - - go bf.Start() - - for _, repo := range testRepos { - store.EnqueueJob(repo) - } - - // Wait until job 0 is in progress - for { - s, err := store.GetJob(ctx, testRepos[0]) - if err != nil { - t.Fatal(err) - } - if s.State() == backfill.StateInProgress { - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindDeleteRecord, "app.bsky.feed.follow/1", nil, &cid.Undef) - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindDeleteRecord, "app.bsky.feed.follow/2", nil, &cid.Undef) - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindDeleteRecord, "app.bsky.feed.follow/3", nil, &cid.Undef) - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindDeleteRecord, "app.bsky.feed.follow/4", nil, &cid.Undef) - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindDeleteRecord, "app.bsky.feed.follow/5", nil, &cid.Undef) - - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindCreateRecord, "app.bsky.feed.follow/1", nil, &cid.Undef) - - bf.BufferOp(ctx, testRepos[0], repomgr.EvtKindUpdateRecord, "app.bsky.feed.follow/1", nil, &cid.Undef) - - break - } - time.Sleep(100 * time.Millisecond) - } - - for { - ts.lk.Lock() - if ts.deletes >= 5 && ts.creates >= 1 && ts.updates >= 1 { - ts.lk.Unlock() - break - } - ts.lk.Unlock() - time.Sleep(100 * time.Millisecond) - } - - bf.Stop() - - slog.Info("shutting down") - */ -} - -func (ts *testState) handleCreate(ctx context.Context, repo string, path string, rec typegen.CBORMarshaler, cid *cid.Cid) error { - slog.Info("got create", "repo", repo, "path", path) - ts.lk.Lock() - ts.creates++ - ts.lk.Unlock() - return nil -} - -func (ts *testState) handleUpdate(ctx context.Context, repo string, path string, rec typegen.CBORMarshaler, cid *cid.Cid) error { - slog.Info("got update", "repo", repo, "path", path) - ts.lk.Lock() - ts.updates++ - ts.lk.Unlock() - return nil -} - -func (ts *testState) handleDelete(ctx context.Context, repo string, path string) error { - slog.Info("got delete", "repo", repo, "path", path) - ts.lk.Lock() - ts.deletes++ - ts.lk.Unlock() - return nil -} diff --git a/backfill/metrics.go b/backfill/metrics.go index effa21ee2..4b298ab39 100644 --- a/backfill/metrics.go +++ b/backfill/metrics.go @@ -5,11 +5,6 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" ) -var backfillJobsEnqueued = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "backfill_jobs_enqueued_total", - Help: "The total number of backfill jobs enqueued", -}, []string{"backfiller_name"}) - var backfillJobsProcessed = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "backfill_jobs_processed_total", Help: "The total number of backfill jobs processed", diff --git a/bgs/admin.go b/bgs/admin.go index 44b07cd8f..4b2145769 100644 --- a/bgs/admin.go +++ b/bgs/admin.go @@ -155,7 +155,7 @@ func (bgs *BGS) handleListPDSs(e echo.Context) error { enrichedPDSs[i].PDS = p enrichedPDSs[i].HasActiveConnection = false for _, host := range activePDSHosts { - if strings.ToLower(host) == strings.ToLower(p.Host) { + if strings.EqualFold(host, p.Host) { enrichedPDSs[i].HasActiveConnection = true break } @@ -639,6 +639,9 @@ func (bgs *BGS) handleAdminRequestCrawl(e echo.Context) error { host = u.Host // potentially hostname:port banned, err := bgs.domainIsBanned(ctx, host) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to check if domain is banned (%s)", err)) + } if banned { return echo.NewHTTPError(http.StatusUnauthorized, "domain is banned") } diff --git a/bgs/bgs.go b/bgs/bgs.go index d7838311e..d05bdda10 100644 --- a/bgs/bgs.go +++ b/bgs/bgs.go @@ -11,29 +11,13 @@ import ( "net/http" _ "net/http/pprof" "net/url" - "reflect" "strconv" "strings" "sync" "time" - "contrib.go.opencensus.io/exporter/prometheus" - "github.com/bluesky-social/indigo/api" - atproto "github.com/bluesky-social/indigo/api/atproto" - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/bluesky-social/indigo/carstore" - "github.com/bluesky-social/indigo/did" - "github.com/bluesky-social/indigo/events" - "github.com/bluesky-social/indigo/indexer" - lexutil "github.com/bluesky-social/indigo/lex/util" - "github.com/bluesky-social/indigo/models" - "github.com/bluesky-social/indigo/repomgr" - "github.com/bluesky-social/indigo/xrpc" - lru "github.com/hashicorp/golang-lru/v2" - "golang.org/x/sync/semaphore" - "golang.org/x/time/rate" - "github.com/gorilla/websocket" + lru "github.com/hashicorp/golang-lru/v2" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" "github.com/labstack/echo/v4" @@ -43,7 +27,20 @@ import ( dto "github.com/prometheus/client_model/go" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "golang.org/x/sync/semaphore" + "golang.org/x/time/rate" "gorm.io/gorm" + + "github.com/bluesky-social/indigo/api" + atproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/carstore" + "github.com/bluesky-social/indigo/did" + "github.com/bluesky-social/indigo/events" + "github.com/bluesky-social/indigo/indexer" + lexutil "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/models" + "github.com/bluesky-social/indigo/repomgr" + "github.com/bluesky-social/indigo/xrpc" ) var tracer = otel.Tracer("bgs") @@ -69,8 +66,6 @@ type BGS struct { // pieces that abstract the need for explicit ssl checks ssl bool - crawlOnly bool - // TODO: at some point we will want to lock specific DIDs, this lock as is // is overly broad, but i dont expect it to be a bottleneck for now extUserLk sync.Mutex @@ -347,7 +342,7 @@ func (bgs *BGS) StartWithListener(listen net.Listener) error { sendHeader = false } - bgs.log.Warn("HANDLER ERROR: (%s) %s", ctx.Path(), err) + bgs.log.Warn("HANDLER ERROR", "path", ctx.Path(), "err", err) if strings.HasPrefix(ctx.Path(), "/admin/") { ctx.JSON(500, map[string]any{ @@ -583,10 +578,6 @@ func (u *User) GetUpstreamStatus() string { return u.UpstreamStatus } -type addTargetBody struct { - Host string `json:"host"` -} - func (bgs *BGS) registerConsumer(c *SocketConsumer) uint64 { bgs.consumersLk.Lock() defer bgs.consumersLk.Unlock() @@ -662,7 +653,7 @@ func (bgs *BGS) EventsHandler(c echo.Context) error { } if err := conn.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(5*time.Second)); err != nil { - bgs.log.Warn("failed to ping client: %s", err) + bgs.log.Warn("failed to ping client", "err", err) cancel() return } @@ -687,7 +678,7 @@ func (bgs *BGS) EventsHandler(c echo.Context) error { for { _, _, err := conn.ReadMessage() if err != nil { - bgs.log.Warn("failed to read message from client: %s", err) + bgs.log.Warn("failed to read message from client", "err", err) cancel() return } @@ -760,26 +751,6 @@ func (bgs *BGS) EventsHandler(c echo.Context) error { } } -func prometheusHandler() http.Handler { - // Prometheus globals are exposed as interfaces, but the prometheus - // OpenCensus exporter expects a concrete *Registry. The concrete type of - // the globals are actually *Registry, so we downcast them, staying - // defensive in case things change under the hood. - registry, ok := promclient.DefaultRegisterer.(*promclient.Registry) - if !ok { - slog.Warn("failed to export default prometheus registry; some metrics will be unavailable; unexpected type", "type", reflect.TypeOf(promclient.DefaultRegisterer)) - } - exporter, err := prometheus.NewExporter(prometheus.Options{ - Registry: registry, - Namespace: "bigsky", - }) - if err != nil { - slog.Error("could not create the prometheus stats exporter", "err", err, "system", "bgs") - } - - return exporter -} - // domainIsBanned checks if the given host is banned, starting with the host // itself, then checking every parent domain up to the tld func (s *BGS) domainIsBanned(ctx context.Context, host string) (bool, error) { @@ -1042,7 +1013,7 @@ func (bgs *BGS) handleFedEvent(ctx context.Context, host *models.PDS, env *event // Broadcast the handle update to all consumers err = bgs.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoHandle: &comatproto.SyncSubscribeRepos_Handle{ + RepoHandle: &atproto.SyncSubscribeRepos_Handle{ Did: env.RepoHandle.Did, Handle: env.RepoHandle.Handle, Time: env.RepoHandle.Time, @@ -1067,7 +1038,7 @@ func (bgs *BGS) handleFedEvent(ctx context.Context, host *models.PDS, env *event // Broadcast the identity event to all consumers err = bgs.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoIdentity: &comatproto.SyncSubscribeRepos_Identity{ + RepoIdentity: &atproto.SyncSubscribeRepos_Identity{ Did: env.RepoIdentity.Did, Seq: env.RepoIdentity.Seq, Time: env.RepoIdentity.Time, @@ -1141,7 +1112,7 @@ func (bgs *BGS) handleFedEvent(ctx context.Context, host *models.PDS, env *event // Broadcast the account event to all consumers err = bgs.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoAccount: &comatproto.SyncSubscribeRepos_Account{ + RepoAccount: &atproto.SyncSubscribeRepos_Account{ Did: env.RepoAccount.Did, Seq: env.RepoAccount.Seq, Time: env.RepoAccount.Time, @@ -1547,11 +1518,6 @@ func (bgs *BGS) ReverseTakedown(ctx context.Context, did string) error { return nil } -type revCheckResult struct { - ai *models.ActorInfo - err error -} - func (bgs *BGS) LoadOrStoreResync(pds models.PDS) (PDSResync, bool) { bgs.pdsResyncsLk.Lock() defer bgs.pdsResyncsLk.Unlock() @@ -1635,7 +1601,7 @@ func (bgs *BGS) ResyncPDS(ctx context.Context, pds models.PDS) error { cursor := "" limit := int64(500) - repos := []comatproto.SyncListRepos_Repo{} + repos := []atproto.SyncListRepos_Repo{} pages := 0 @@ -1652,7 +1618,7 @@ func (bgs *BGS) ResyncPDS(ctx context.Context, pds models.PDS) error { log.Error("failed to wait for rate limiter", "error", err) return fmt.Errorf("failed to wait for rate limiter: %w", err) } - repoList, err := comatproto.SyncListRepos(ctx, &xrpcc, cursor, limit) + repoList, err := atproto.SyncListRepos(ctx, &xrpcc, cursor, limit) if err != nil { log.Error("failed to list repos", "error", err) return fmt.Errorf("failed to list repos: %w", err) @@ -1688,7 +1654,7 @@ func (bgs *BGS) ResyncPDS(ctx context.Context, pds models.PDS) error { log.Error("failed to acquire semaphore", "error", err) continue } - go func(r comatproto.SyncListRepos_Repo) { + go func(r atproto.SyncListRepos_Repo) { defer sem.Release(1) log := bgs.log.With("did", r.Did, "remote_rev", r.Rev) // Fetches the user if we have it, otherwise automatically enqueues it for crawling @@ -1719,7 +1685,7 @@ func (bgs *BGS) ResyncPDS(ctx context.Context, pds models.PDS) error { }(r) if i%100 == 0 { if i%10_000 == 0 { - log.Warn("checked revs during resync", "num_repos_checked", i, "num_repos_to_crawl", -1, "took", time.Now().Sub(resync.StatusChangedAt)) + log.Warn("checked revs during resync", "num_repos_checked", i, "num_repos_to_crawl", -1, "took", time.Since(resync.StatusChangedAt)) } resync.NumReposChecked = i bgs.UpdateResync(resync) @@ -1729,7 +1695,7 @@ func (bgs *BGS) ResyncPDS(ctx context.Context, pds models.PDS) error { resync.NumReposChecked = len(repos) bgs.UpdateResync(resync) - bgs.log.Warn("enqueued all crawls, exiting resync", "took", time.Now().Sub(start), "num_repos_to_crawl", -1) + bgs.log.Warn("enqueued all crawls, exiting resync", "took", time.Since(start), "num_repos_to_crawl", -1) return nil } diff --git a/bgs/compactor.go b/bgs/compactor.go index 6339d76b0..4c9b74818 100644 --- a/bgs/compactor.go +++ b/bgs/compactor.go @@ -133,17 +133,9 @@ type CompactorState struct { stats *carstore.CompactionStats } -func (cstate *CompactorState) set(uid models.Uid, did, status string, stats *carstore.CompactionStats) { - cstate.latestUID = uid - cstate.latestDID = did - cstate.status = status - cstate.stats = stats -} - // Compactor is a compactor daemon that compacts repos in the background type Compactor struct { q *uniQueue - stateLk sync.RWMutex exit chan struct{} requeueInterval time.Duration requeueLimit int @@ -190,11 +182,6 @@ func NewCompactor(opts *CompactorOptions) *Compactor { } } -type compactionStats struct { - Completed map[models.Uid]*carstore.CompactionStats - Targets []carstore.CompactionTarget -} - var errNoReposToCompact = fmt.Errorf("no repos to compact") // Start starts the compactor diff --git a/bgs/fedmgr.go b/bgs/fedmgr.go index c68759d91..a91d0b540 100644 --- a/bgs/fedmgr.go +++ b/bgs/fedmgr.go @@ -411,7 +411,7 @@ func (s *Slurper) SubscribeToPds(ctx context.Context, host string, reg bool, adm } } - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(ctx) sub := activeSub{ pds: &peering, ctx: ctx, @@ -549,7 +549,7 @@ func (s *Slurper) handleConnection(ctx context.Context, host *models.PDS, con *w rsc := &events.RepoStreamCallbacks{ RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { log.Debug("got remote repo event", "pdsHost", host.Host, "repo", evt.Repo, "seq", evt.Seq) - if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ + if err := s.cb(ctx, host, &events.XRPCStreamEvent{ RepoCommit: evt, }); err != nil { log.Error("failed handling event", "host", host.Host, "seq", evt.Seq, "err", err) @@ -564,7 +564,7 @@ func (s *Slurper) handleConnection(ctx context.Context, host *models.PDS, con *w }, RepoHandle: func(evt *comatproto.SyncSubscribeRepos_Handle) error { log.Info("got remote handle update event", "pdsHost", host.Host, "did", evt.Did, "handle", evt.Handle) - if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ + if err := s.cb(ctx, host, &events.XRPCStreamEvent{ RepoHandle: evt, }); err != nil { log.Error("failed handling event", "host", host.Host, "seq", evt.Seq, "err", err) @@ -579,7 +579,7 @@ func (s *Slurper) handleConnection(ctx context.Context, host *models.PDS, con *w }, RepoMigrate: func(evt *comatproto.SyncSubscribeRepos_Migrate) error { log.Info("got remote repo migrate event", "pdsHost", host.Host, "did", evt.Did, "migrateTo", evt.MigrateTo) - if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ + if err := s.cb(ctx, host, &events.XRPCStreamEvent{ RepoMigrate: evt, }); err != nil { log.Error("failed handling event", "host", host.Host, "seq", evt.Seq, "err", err) @@ -594,7 +594,7 @@ func (s *Slurper) handleConnection(ctx context.Context, host *models.PDS, con *w }, RepoTombstone: func(evt *comatproto.SyncSubscribeRepos_Tombstone) error { log.Info("got remote repo tombstone event", "pdsHost", host.Host, "did", evt.Did) - if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ + if err := s.cb(ctx, host, &events.XRPCStreamEvent{ RepoTombstone: evt, }); err != nil { log.Error("failed handling event", "host", host.Host, "seq", evt.Seq, "err", err) @@ -613,7 +613,7 @@ func (s *Slurper) handleConnection(ctx context.Context, host *models.PDS, con *w }, RepoIdentity: func(ident *comatproto.SyncSubscribeRepos_Identity) error { log.Info("identity event", "did", ident.Did) - if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ + if err := s.cb(ctx, host, &events.XRPCStreamEvent{ RepoIdentity: ident, }); err != nil { log.Error("failed handling event", "host", host.Host, "seq", ident.Seq, "err", err) @@ -628,7 +628,7 @@ func (s *Slurper) handleConnection(ctx context.Context, host *models.PDS, con *w }, RepoAccount: func(acct *comatproto.SyncSubscribeRepos_Account) error { log.Info("account event", "did", acct.Did, "status", acct.Status) - if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ + if err := s.cb(ctx, host, &events.XRPCStreamEvent{ RepoAccount: acct, }); err != nil { log.Error("failed handling event", "host", host.Host, "seq", acct.Seq, "err", err) diff --git a/bgs/handlers.go b/bgs/handlers.go index 0e46f0043..5547e3897 100644 --- a/bgs/handlers.go +++ b/bgs/handlers.go @@ -11,18 +11,17 @@ import ( "net/url" "strings" + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" + "github.com/ipld/go-car" + "github.com/labstack/echo/v4" + "gorm.io/gorm" + atproto "github.com/bluesky-social/indigo/api/atproto" - comatprototypes "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/carstore" "github.com/bluesky-social/indigo/events" "github.com/bluesky-social/indigo/mst" - "gorm.io/gorm" - "github.com/bluesky-social/indigo/xrpc" - "github.com/ipfs/go-cid" - cbor "github.com/ipfs/go-ipld-cbor" - "github.com/ipld/go-car" - "github.com/labstack/echo/v4" ) func (s *BGS) handleComAtprotoSyncGetRecord(ctx context.Context, collection string, did string, rkey string) (io.Reader, error) { @@ -70,6 +69,9 @@ func (s *BGS) handleComAtprotoSyncGetRecord(ctx context.Context, collection stri Roots: []cid.Cid{root}, Version: 1, }) + if err != nil { + return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to dump car header (%s)", err)) + } if _, err := carstore.LdWrite(buf, hb); err != nil { return nil, err } @@ -128,7 +130,7 @@ func (s *BGS) handleComAtprotoSyncGetBlocks(ctx context.Context, cids []string, return nil, fmt.Errorf("NYI") } -func (s *BGS) handleComAtprotoSyncRequestCrawl(ctx context.Context, body *comatprototypes.SyncRequestCrawl_Input) error { +func (s *BGS) handleComAtprotoSyncRequestCrawl(ctx context.Context, body *atproto.SyncRequestCrawl_Input) error { host := body.Hostname if host == "" { return echo.NewHTTPError(http.StatusBadRequest, "must pass hostname") @@ -144,7 +146,7 @@ func (s *BGS) handleComAtprotoSyncRequestCrawl(ctx context.Context, body *comatp u, err := url.Parse(host) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, "failed to parse hostname") + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("failed to parse hostname (%s)", err)) } if u.Scheme == "http" && s.ssl { @@ -166,6 +168,9 @@ func (s *BGS) handleComAtprotoSyncRequestCrawl(ctx context.Context, body *comatp host = u.Host // potentially hostname:port banned, err := s.domainIsBanned(ctx, host) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to check if domain is banned (%s)", err)) + } if banned { return echo.NewHTTPError(http.StatusUnauthorized, "domain is banned") } @@ -215,21 +220,21 @@ func (s *BGS) handleComAtprotoSyncRequestCrawl(ctx context.Context, body *comatp return s.slurper.SubscribeToPds(ctx, host, true, false) } -func (s *BGS) handleComAtprotoSyncNotifyOfUpdate(ctx context.Context, body *comatprototypes.SyncNotifyOfUpdate_Input) error { +func (s *BGS) handleComAtprotoSyncNotifyOfUpdate(ctx context.Context, body *atproto.SyncNotifyOfUpdate_Input) error { // TODO: return nil } -func (s *BGS) handleComAtprotoSyncListRepos(ctx context.Context, cursor int64, limit int) (*comatprototypes.SyncListRepos_Output, error) { +func (s *BGS) handleComAtprotoSyncListRepos(ctx context.Context, cursor int64, limit int) (*atproto.SyncListRepos_Output, error) { // Filter out tombstoned, taken down, and deactivated accounts q := fmt.Sprintf("id > ? AND NOT tombstoned AND NOT taken_down AND (upstream_status is NULL OR (upstream_status != '%s' AND upstream_status != '%s' AND upstream_status != '%s'))", events.AccountStatusDeactivated, events.AccountStatusSuspended, events.AccountStatusTakendown) // Load the users - users := []*User{} + var users []*User if err := s.db.Model(&User{}).Where(q, cursor).Order("id").Limit(limit).Find(&users).Error; err != nil { if err == gorm.ErrRecordNotFound { - return &comatprototypes.SyncListRepos_Output{}, nil + return &atproto.SyncListRepos_Output{}, nil } log.Error("failed to query users", "err", err) return nil, echo.NewHTTPError(http.StatusInternalServerError, "failed to query users") @@ -237,13 +242,13 @@ func (s *BGS) handleComAtprotoSyncListRepos(ctx context.Context, cursor int64, l if len(users) == 0 { // resp.Repos is an explicit empty array, not just 'nil' - return &comatprototypes.SyncListRepos_Output{ - Repos: []*comatprototypes.SyncListRepos_Repo{}, + return &atproto.SyncListRepos_Output{ + Repos: []*atproto.SyncListRepos_Repo{}, }, nil } - resp := &comatprototypes.SyncListRepos_Output{ - Repos: make([]*comatprototypes.SyncListRepos_Repo, len(users)), + resp := &atproto.SyncListRepos_Output{ + Repos: make([]*atproto.SyncListRepos_Repo, len(users)), } // Fetch the repo roots for each user @@ -256,7 +261,7 @@ func (s *BGS) handleComAtprotoSyncListRepos(ctx context.Context, cursor int64, l return nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to get repo root for (%s): %v", user.Did, err.Error())) } - resp.Repos[i] = &comatprototypes.SyncListRepos_Repo{ + resp.Repos[i] = &atproto.SyncListRepos_Repo{ Did: user.Did, Head: root.String(), } @@ -271,7 +276,7 @@ func (s *BGS) handleComAtprotoSyncListRepos(ctx context.Context, cursor int64, l return resp, nil } -func (s *BGS) handleComAtprotoSyncGetLatestCommit(ctx context.Context, did string) (*comatprototypes.SyncGetLatestCommit_Output, error) { +func (s *BGS) handleComAtprotoSyncGetLatestCommit(ctx context.Context, did string) (*atproto.SyncGetLatestCommit_Output, error) { u, err := s.lookupUserByDid(ctx, did) if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { @@ -313,7 +318,7 @@ func (s *BGS) handleComAtprotoSyncGetLatestCommit(ctx context.Context, did strin return nil, echo.NewHTTPError(http.StatusInternalServerError, "failed to get repo rev") } - return &comatprototypes.SyncGetLatestCommit_Output{ + return &atproto.SyncGetLatestCommit_Output{ Cid: root.String(), Rev: rev, }, nil diff --git a/bgs/stubs.go b/bgs/stubs.go index 08db70809..9c1694356 100644 --- a/bgs/stubs.go +++ b/bgs/stubs.go @@ -173,13 +173,8 @@ func (s *BGS) HandleComAtprotoSyncNotifyOfUpdate(c echo.Context) error { if err := c.Bind(&body); err != nil { return c.JSON(http.StatusBadRequest, XRPCError{Message: fmt.Sprintf("invalid body: %s", err)}) } - var handleErr error - // func (s *BGS) handleComAtprotoSyncNotifyOfUpdate(ctx context.Context,body *comatprototypes.SyncNotifyOfUpdate_Input) error - handleErr = s.handleComAtprotoSyncNotifyOfUpdate(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + + return s.handleComAtprotoSyncNotifyOfUpdate(ctx, &body) } func (s *BGS) HandleComAtprotoSyncRequestCrawl(c echo.Context) error { @@ -190,11 +185,6 @@ func (s *BGS) HandleComAtprotoSyncRequestCrawl(c echo.Context) error { if err := c.Bind(&body); err != nil { return c.JSON(http.StatusBadRequest, XRPCError{Message: fmt.Sprintf("invalid body: %s", err)}) } - var handleErr error - // func (s *BGS) handleComAtprotoSyncRequestCrawl(ctx context.Context,body *comatprototypes.SyncRequestCrawl_Input) error - handleErr = s.handleComAtprotoSyncRequestCrawl(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + + return s.handleComAtprotoSyncRequestCrawl(ctx, &body) } diff --git a/carstore/bs.go b/carstore/bs.go index 6486a8fb0..5f2e8b9d6 100644 --- a/carstore/bs.go +++ b/carstore/bs.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "context" + "errors" "fmt" "io" "log/slog" @@ -14,10 +15,6 @@ import ( "sync/atomic" "time" - "github.com/bluesky-social/indigo/models" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" - blockformat "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" @@ -27,10 +24,14 @@ import ( "github.com/ipfs/go-libipfs/blocks" car "github.com/ipld/go-car" carutil "github.com/ipld/go-car/util" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" cbg "github.com/whyrusleeping/cbor-gen" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "gorm.io/gorm" + + "github.com/bluesky-social/indigo/models" ) var blockGetTotalCounter = promauto.NewCounterVec(prometheus.CounterOpts{ @@ -549,17 +550,6 @@ func (cs *FileCarStore) dirForUser(user models.Uid) string { return cs.rootDirs[int(user)%len(cs.rootDirs)] } -func (cs *FileCarStore) openNewShardFile(ctx context.Context, user models.Uid, seq int) (*os.File, string, error) { - // TODO: some overwrite protections - fname := filepath.Join(cs.dirForUser(user), fnameForShard(user, seq)) - fi, err := os.Create(fname) - if err != nil { - return nil, "", err - } - - return fi, fname, nil -} - func (cs *FileCarStore) writeNewShardFile(ctx context.Context, user models.Uid, seq int, data []byte) (string, error) { _, span := otel.Tracer("carstore").Start(ctx, "writeNewShardFile") defer span.End() @@ -769,18 +759,15 @@ func (cs *FileCarStore) ImportSlice(ctx context.Context, uid models.Uid, since * return cid.Undef, nil, fmt.Errorf("new delta session failed: %w", err) } - var cids []cid.Cid for { blk, err := carr.Next() if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { break } return cid.Undef, nil, err } - cids = append(cids, blk.Cid()) - if err := ds.Put(ctx, blk); err != nil { return cid.Undef, nil, err } diff --git a/carstore/repo_test.go b/carstore/repo_test.go index 8366cab95..6a274c97f 100644 --- a/carstore/repo_test.go +++ b/carstore/repo_test.go @@ -11,10 +11,6 @@ import ( "testing" "time" - "github.com/bluesky-social/indigo/api/bsky" - appbsky "github.com/bluesky-social/indigo/api/bsky" - "github.com/bluesky-social/indigo/repo" - "github.com/bluesky-social/indigo/util" sqlbs "github.com/ipfs/go-bs-sqlite3" "github.com/ipfs/go-cid" flatfs "github.com/ipfs/go-ds-flatfs" @@ -22,6 +18,10 @@ import ( ipld "github.com/ipfs/go-ipld-format" "gorm.io/driver/sqlite" "gorm.io/gorm" + + "github.com/bluesky-social/indigo/api/bsky" + "github.com/bluesky-social/indigo/repo" + "github.com/bluesky-social/indigo/util" ) func testCarStore() (CarStore, func(), error) { @@ -114,7 +114,7 @@ func TestBasicOperation(t *testing.T) { t.Fatal(err) } - rc, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ + rc, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &bsky.FeedPost{ Text: fmt.Sprintf("hey look its a tweet %d", time.Now().UnixNano()), }) if err != nil { @@ -204,7 +204,7 @@ func TestRepeatedCompactions(t *testing.T) { } recs = recs[:len(recs)-1] } else { - rc, tid, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ + rc, tid, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &bsky.FeedPost{ Text: fmt.Sprintf("hey look its a tweet %d", time.Now().UnixNano()), }) if err != nil { @@ -356,7 +356,7 @@ func BenchmarkRepoWritesCarstore(b *testing.B) { b.Fatal(err) } - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &bsky.FeedPost{ Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), }); err != nil { b.Fatal(err) @@ -404,7 +404,7 @@ func BenchmarkRepoWritesFlatfs(b *testing.B) { b.Fatal(err) } - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &bsky.FeedPost{ Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), }); err != nil { b.Fatal(err) @@ -442,7 +442,7 @@ func BenchmarkRepoWritesSqlite(b *testing.B) { b.Fatal(err) } - if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ + if _, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &bsky.FeedPost{ Text: fmt.Sprintf("hey look its a tweet %s", time.Now()), }); err != nil { b.Fatal(err) @@ -511,7 +511,7 @@ func TestDuplicateBlockAcrossShards(t *testing.T) { t.Fatal(err) } - rc, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &appbsky.FeedPost{ + rc, _, err := rr.CreateRecord(ctx, "app.bsky.feed.post", &bsky.FeedPost{ Text: fmt.Sprintf("hey look its a tweet %d", time.Now().UnixNano()), }) if err != nil { @@ -552,7 +552,7 @@ func TestDuplicateBlockAcrossShards(t *testing.T) { } desc := "this is so unique" - rc, err := rr.UpdateRecord(ctx, "app.bsky.actor.profile/self", &appbsky.ActorProfile{ + rc, err := rr.UpdateRecord(ctx, "app.bsky.actor.profile/self", &bsky.ActorProfile{ Description: &desc, }) if err != nil { @@ -576,8 +576,6 @@ func TestDuplicateBlockAcrossShards(t *testing.T) { if _, err := ds.CloseWithRoot(ctx, nroot, rev); err != nil { t.Fatal(err) } - - head = nroot } buf := new(bytes.Buffer) diff --git a/cmd/astrolabe/handlers.go b/cmd/astrolabe/handlers.go index f7732fe4e..432646d01 100644 --- a/cmd/astrolabe/handlers.go +++ b/cmd/astrolabe/handlers.go @@ -30,9 +30,7 @@ func (srv *Server) WebQuery(c echo.Context) error { return c.Redirect(http.StatusFound, "/") } if strings.HasPrefix(q, "at://") { - if strings.HasSuffix(q, "/") { - q = q[0 : len(q)-1] - } + q = strings.TrimSuffix(q, "/") aturi, err := syntax.ParseATURI(q) if err != nil { diff --git a/cmd/beemo/notify_mentions.go b/cmd/beemo/notify_mentions.go index 7e4c5d143..db4a63d9c 100644 --- a/cmd/beemo/notify_mentions.go +++ b/cmd/beemo/notify_mentions.go @@ -62,7 +62,7 @@ func (mc *MentionChecker) ProcessPost(ctx context.Context, did syntax.DID, rkey } func notifyMentions(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context logger := configLogger(cctx, os.Stdout) relayHost := cctx.String("relay-host") minimumWords := cctx.Int("minimum-words") diff --git a/cmd/beemo/notify_reports.go b/cmd/beemo/notify_reports.go index 7593bd87c..9c7c9cdbe 100644 --- a/cmd/beemo/notify_reports.go +++ b/cmd/beemo/notify_reports.go @@ -1,22 +1,21 @@ package main import ( - "context" "fmt" "os" "strings" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" toolsozone "github.com/bluesky-social/indigo/api/ozone" "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/xrpc" - - "github.com/urfave/cli/v2" ) func pollNewReports(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context logger := configLogger(cctx, os.Stdout) slackWebhookURL := cctx.String("slack-webhook-url") @@ -33,7 +32,7 @@ func pollNewReports(cctx *cli.Context) error { Auth: &xrpc.AuthInfo{Handle: cctx.String("handle")}, } - auth, err := comatproto.ServerCreateSession(ctx, xrpcc, &comatproto.ServerCreateSession_Input{ + auth, err := atproto.ServerCreateSession(ctx, xrpcc, &atproto.ServerCreateSession_Input{ Identifier: xrpcc.Auth.Handle, Password: cctx.String("password"), }) @@ -60,7 +59,7 @@ func pollNewReports(cctx *cli.Context) error { for { // refresh session xrpcc.Auth.AccessJwt = xrpcc.Auth.RefreshJwt - refresh, err := comatproto.ServerRefreshSession(ctx, xrpcc) + refresh, err := atproto.ServerRefreshSession(ctx, xrpcc) if err != nil { return err } diff --git a/cmd/bigsky/main.go b/cmd/bigsky/main.go index a2d1de1a6..423eaac58 100644 --- a/cmd/bigsky/main.go +++ b/cmd/bigsky/main.go @@ -257,7 +257,7 @@ func setupOTEL(cctx *cli.Context) error { // OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 if ep := cctx.String("otel-exporter-otlp-endpoint"); ep != "" { slog.Info("setting up trace exporter", "endpoint", ep) - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(cctx.Context) defer cancel() exp, err := otlptracehttp.New(ctx) @@ -266,7 +266,7 @@ func setupOTEL(cctx *cli.Context) error { os.Exit(1) } defer func() { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() if err := exp.Shutdown(ctx); err != nil { slog.Error("failed to shutdown trace exporter", "error", err) diff --git a/cmd/fakermaker/main.go b/cmd/fakermaker/main.go index ecdd505b0..d31debf4a 100644 --- a/cmd/fakermaker/main.go +++ b/cmd/fakermaker/main.go @@ -1,17 +1,15 @@ -// Tool to generate fake accounts, content, and interactions. -// Intended for development and benchmarking. Similar to 'stress' and could -// merge at some point. - +// Command fakermaker is a tool to generate fake accounts, content, and interactions. +// Intended for development and benchmarking. +// Similar to 'stress' and could merge at some point. package main import ( - "context" "encoding/json" "fmt" "os" "runtime" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/fakedata" "github.com/bluesky-social/indigo/util/cliutil" @@ -223,7 +221,7 @@ func genAccounts(cctx *cli.Context) error { var inviteCode *string = nil if cctx.Bool("use-invite-code") { - resp, err := comatproto.ServerCreateInviteCodes(context.TODO(), xrpcc, &comatproto.ServerCreateInviteCodes_Input{ + resp, err := atproto.ServerCreateInviteCodes(cctx.Context, xrpcc, &atproto.ServerCreateInviteCodes_Input{ UseCount: int64(countTotal), ForAccounts: nil, CodeCount: 1, diff --git a/cmd/goat/account.go b/cmd/goat/account.go index 347ebc02f..e7a123c41 100644 --- a/cmd/goat/account.go +++ b/cmd/goat/account.go @@ -1,17 +1,16 @@ package main import ( - "context" "encoding/json" "fmt" "strings" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/xrpc" - - "github.com/urfave/cli/v2" ) var cmdAccount = &cli.Command{ @@ -156,7 +155,7 @@ var cmdAccount = &cli.Command{ } func runAccountLogin(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username, err := syntax.ParseAtIdentifier(cctx.String("username")) if err != nil { @@ -172,7 +171,7 @@ func runAccountLogout(cctx *cli.Context) error { } func runAccountLookup(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username := cctx.Args().First() if username == "" { return fmt.Errorf("need to provide username as an argument") @@ -190,7 +189,7 @@ func runAccountLookup(cctx *cli.Context) error { return fmt.Errorf("no PDS endpoint for identity") } - status, err := comatproto.SyncGetRepoStatus(ctx, &xrpcc, ident.DID.String()) + status, err := atproto.SyncGetRepoStatus(ctx, &xrpcc, ident.DID.String()) if err != nil { return err } @@ -207,7 +206,7 @@ func runAccountLookup(cctx *cli.Context) error { } func runAccountStatus(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context client, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -216,7 +215,7 @@ func runAccountStatus(cctx *cli.Context) error { return err } - status, err := comatproto.ServerCheckAccountStatus(ctx, client) + status, err := atproto.ServerCheckAccountStatus(ctx, client) if err != nil { return fmt.Errorf("failed checking account status: %w", err) } @@ -233,7 +232,7 @@ func runAccountStatus(cctx *cli.Context) error { } func runAccountMissingBlobs(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context client, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -244,7 +243,7 @@ func runAccountMissingBlobs(cctx *cli.Context) error { cursor := "" for { - resp, err := comatproto.RepoListMissingBlobs(ctx, client, cursor, 500) + resp, err := atproto.RepoListMissingBlobs(ctx, client, cursor, 500) if err != nil { return err } @@ -261,7 +260,7 @@ func runAccountMissingBlobs(cctx *cli.Context) error { } func runAccountActivate(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context client, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -270,7 +269,7 @@ func runAccountActivate(cctx *cli.Context) error { return err } - err = comatproto.ServerActivateAccount(ctx, client) + err = atproto.ServerActivateAccount(ctx, client) if err != nil { return fmt.Errorf("failed activating account: %w", err) } @@ -279,7 +278,7 @@ func runAccountActivate(cctx *cli.Context) error { } func runAccountDeactivate(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context client, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -288,7 +287,7 @@ func runAccountDeactivate(cctx *cli.Context) error { return err } - err = comatproto.ServerDeactivateAccount(ctx, client, &comatproto.ServerDeactivateAccount_Input{}) + err = atproto.ServerDeactivateAccount(ctx, client, &atproto.ServerDeactivateAccount_Input{}) if err != nil { return fmt.Errorf("failed deactivating account: %w", err) } @@ -297,7 +296,7 @@ func runAccountDeactivate(cctx *cli.Context) error { } func runAccountUpdateHandle(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context raw := cctx.Args().First() if raw == "" { @@ -315,7 +314,7 @@ func runAccountUpdateHandle(cctx *cli.Context) error { return err } - err = comatproto.IdentityUpdateHandle(ctx, client, &comatproto.IdentityUpdateHandle_Input{ + err = atproto.IdentityUpdateHandle(ctx, client, &atproto.IdentityUpdateHandle_Input{ Handle: handle.String(), }) if err != nil { @@ -326,7 +325,7 @@ func runAccountUpdateHandle(cctx *cli.Context) error { } func runAccountServiceAuth(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context client, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -353,7 +352,7 @@ func runAccountServiceAuth(cctx *cli.Context) error { durSec := cctx.Int("duration-sec") expTimestamp := time.Now().Unix() + int64(durSec) - resp, err := comatproto.ServerGetServiceAuth(ctx, client, aud, expTimestamp, lxm) + resp, err := atproto.ServerGetServiceAuth(ctx, client, aud, expTimestamp, lxm) if err != nil { return fmt.Errorf("failed updating handle: %w", err) } @@ -364,7 +363,7 @@ func runAccountServiceAuth(cctx *cli.Context) error { } func runAccountCreate(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context // validate args pdsHost := cctx.String("pds-host") @@ -377,7 +376,7 @@ func runAccountCreate(cctx *cli.Context) error { return err } password := cctx.String("password") - params := &comatproto.ServerCreateAccount_Input{ + params := &atproto.ServerCreateAccount_Input{ Handle: handle, Password: &password, } @@ -419,7 +418,7 @@ func runAccountCreate(cctx *cli.Context) error { } } - resp, err := comatproto.ServerCreateAccount(ctx, &xrpcc, params) + resp, err := atproto.ServerCreateAccount(ctx, &xrpcc, params) if err != nil { return fmt.Errorf("failed to create account: %w", err) } diff --git a/cmd/goat/account_migrate.go b/cmd/goat/account_migrate.go index fa3d60535..98af5f6e1 100644 --- a/cmd/goat/account_migrate.go +++ b/cmd/goat/account_migrate.go @@ -2,18 +2,17 @@ package main import ( "bytes" - "context" "encoding/json" "fmt" "log/slog" "strings" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/xrpc" - - "github.com/urfave/cli/v2" ) var cmdAccountMigrate = &cli.Command{ @@ -58,7 +57,7 @@ var cmdAccountMigrate = &cli.Command{ func runAccountMigrate(cctx *cli.Context) error { // NOTE: this could check rev / commit before and after and ensure last-minute content additions get lost - ctx := context.Background() + ctx := cctx.Context oldClient, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -87,7 +86,7 @@ func runAccountMigrate(cctx *cli.Context) error { } // connect to new host to discover service DID - newHostDesc, err := comatproto.ServerDescribeServer(ctx, &newClient) + newHostDesc, err := atproto.ServerDescribeServer(ctx, &newClient) if err != nil { return fmt.Errorf("failed connecting to new host: %w", err) } @@ -103,13 +102,13 @@ func runAccountMigrate(cctx *cli.Context) error { // get service auth token from old host // args: (ctx, client, aud string, exp int64, lxm string) expTimestamp := time.Now().Unix() + 60 - createAuthResp, err := comatproto.ServerGetServiceAuth(ctx, oldClient, newHostDID.String(), expTimestamp, "com.atproto.server.createAccount") + createAuthResp, err := atproto.ServerGetServiceAuth(ctx, oldClient, newHostDID.String(), expTimestamp, "com.atproto.server.createAccount") if err != nil { return fmt.Errorf("failed getting service auth token from old host: %w", err) } // then create the new account - createParams := comatproto.ServerCreateAccount_Input{ + createParams := atproto.ServerCreateAccount_Input{ Did: &did, Handle: newHandle, Password: &newPassword, @@ -128,7 +127,7 @@ func runAccountMigrate(cctx *cli.Context) error { AccessJwt: createAuthResp.Token, RefreshJwt: createAuthResp.Token, } - createAccountResp, err := comatproto.ServerCreateAccount(ctx, &newClient, &createParams) + createAccountResp, err := atproto.ServerCreateAccount(ctx, &newClient, &createParams) if err != nil { return fmt.Errorf("failed creating new account: %w", err) } @@ -140,7 +139,7 @@ func runAccountMigrate(cctx *cli.Context) error { newClient.Auth.RefreshJwt = createAccountResp.RefreshJwt // login client on the new host - sess, err := comatproto.ServerCreateSession(ctx, &newClient, &comatproto.ServerCreateSession_Input{ + sess, err := atproto.ServerCreateSession(ctx, &newClient, &atproto.ServerCreateSession_Input{ Identifier: did, Password: newPassword, }) @@ -155,11 +154,11 @@ func runAccountMigrate(cctx *cli.Context) error { // 2. Migrate Data slog.Info("migrating repo") - repoBytes, err := comatproto.SyncGetRepo(ctx, oldClient, did, "") + repoBytes, err := atproto.SyncGetRepo(ctx, oldClient, did, "") if err != nil { return fmt.Errorf("failed exporting repo: %w", err) } - err = comatproto.RepoImportRepo(ctx, &newClient, bytes.NewReader(repoBytes)) + err = atproto.RepoImportRepo(ctx, &newClient, bytes.NewReader(repoBytes)) if err != nil { return fmt.Errorf("failed importing repo: %w", err) } @@ -180,17 +179,17 @@ func runAccountMigrate(cctx *cli.Context) error { slog.Info("migrating blobs") blobCursor := "" for { - listResp, err := comatproto.SyncListBlobs(ctx, oldClient, blobCursor, did, 100, "") + listResp, err := atproto.SyncListBlobs(ctx, oldClient, blobCursor, did, 100, "") if err != nil { return fmt.Errorf("failed listing blobs: %w", err) } for _, blobCID := range listResp.Cids { - blobBytes, err := comatproto.SyncGetBlob(ctx, oldClient, blobCID, did) + blobBytes, err := atproto.SyncGetBlob(ctx, oldClient, blobCID, did) if err != nil { slog.Warn("failed downloading blob", "cid", blobCID, "err", err) continue } - _, err = comatproto.RepoUploadBlob(ctx, &newClient, bytes.NewReader(blobBytes)) + _, err = atproto.RepoUploadBlob(ctx, &newClient, bytes.NewReader(blobBytes)) if err != nil { slog.Warn("failed uploading blob", "cid", blobCID, "err", err, "size", len(blobBytes)) } @@ -204,7 +203,7 @@ func runAccountMigrate(cctx *cli.Context) error { // display migration status // NOTE: this could check between the old PDS and new PDS, polling in a loop showing progress until all records have been indexed - statusResp, err := comatproto.ServerCheckAccountStatus(ctx, &newClient) + statusResp, err := atproto.ServerCheckAccountStatus(ctx, &newClient) if err != nil { return fmt.Errorf("failed checking account status: %w", err) } @@ -246,11 +245,11 @@ func runAccountMigrate(cctx *cli.Context) error { // 4. Finalize Migration slog.Info("activating new account") - err = comatproto.ServerActivateAccount(ctx, &newClient) + err = atproto.ServerActivateAccount(ctx, &newClient) if err != nil { return fmt.Errorf("failed activating new host: %w", err) } - err = comatproto.ServerDeactivateAccount(ctx, oldClient, &comatproto.ServerDeactivateAccount_Input{}) + err = atproto.ServerDeactivateAccount(ctx, oldClient, &atproto.ServerDeactivateAccount_Input{}) if err != nil { return fmt.Errorf("failed deactivating old host: %w", err) } diff --git a/cmd/goat/account_plc.go b/cmd/goat/account_plc.go index a0dde653b..b9b75f5b4 100644 --- a/cmd/goat/account_plc.go +++ b/cmd/goat/account_plc.go @@ -1,14 +1,13 @@ package main import ( - "context" "encoding/json" "fmt" "os" - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" ) var cmdAccountPlc = &cli.Command{ @@ -47,7 +46,7 @@ var cmdAccountPlc = &cli.Command{ } func runAccountPlcRecommended(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context xrpcc, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -71,7 +70,7 @@ func runAccountPlcRecommended(cctx *cli.Context) error { } func runAccountPlcRequestToken(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context xrpcc, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -80,7 +79,7 @@ func runAccountPlcRequestToken(cctx *cli.Context) error { return err } - err = comatproto.IdentityRequestPlcOperationSignature(ctx, xrpcc) + err = atproto.IdentityRequestPlcOperationSignature(ctx, xrpcc) if err != nil { return err } @@ -90,7 +89,7 @@ func runAccountPlcRequestToken(cctx *cli.Context) error { } func runAccountPlcSign(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context opPath := cctx.Args().First() if opPath == "" { @@ -134,7 +133,7 @@ func runAccountPlcSign(cctx *cli.Context) error { } func runAccountPlcSubmit(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context opPath := cctx.Args().First() if opPath == "" { diff --git a/cmd/goat/blob.go b/cmd/goat/blob.go index e9422089d..39d4cf5a3 100644 --- a/cmd/goat/blob.go +++ b/cmd/goat/blob.go @@ -2,15 +2,14 @@ package main import ( "bytes" - "context" "encoding/json" "fmt" "os" - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/bluesky-social/indigo/xrpc" - "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/xrpc" ) var cmdBlob = &cli.Command{ @@ -63,7 +62,7 @@ var cmdBlob = &cli.Command{ } func runBlobExport(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username := cctx.Args().First() if username == "" { return fmt.Errorf("need to provide username as an argument") @@ -91,7 +90,7 @@ func runBlobExport(cctx *cli.Context) error { cursor := "" for { - resp, err := comatproto.SyncListBlobs(ctx, &xrpcc, cursor, ident.DID.String(), 500, "") + resp, err := atproto.SyncListBlobs(ctx, &xrpcc, cursor, ident.DID.String(), 500, "") if err != nil { return err } @@ -101,7 +100,7 @@ func runBlobExport(cctx *cli.Context) error { fmt.Printf("%s\texists\n", blobPath) continue } - blobBytes, err := comatproto.SyncGetBlob(ctx, &xrpcc, cidStr, ident.DID.String()) + blobBytes, err := atproto.SyncGetBlob(ctx, &xrpcc, cidStr, ident.DID.String()) if err != nil { return err } @@ -120,7 +119,7 @@ func runBlobExport(cctx *cli.Context) error { } func runBlobList(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username := cctx.Args().First() if username == "" { return fmt.Errorf("need to provide username as an argument") @@ -140,7 +139,7 @@ func runBlobList(cctx *cli.Context) error { cursor := "" for { - resp, err := comatproto.SyncListBlobs(ctx, &xrpcc, cursor, ident.DID.String(), 500, "") + resp, err := atproto.SyncListBlobs(ctx, &xrpcc, cursor, ident.DID.String(), 500, "") if err != nil { return err } @@ -157,7 +156,7 @@ func runBlobList(cctx *cli.Context) error { } func runBlobDownload(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username := cctx.Args().First() if username == "" { return fmt.Errorf("need to provide username as an argument") @@ -189,7 +188,7 @@ func runBlobDownload(cctx *cli.Context) error { if _, err := os.Stat(blobPath); err == nil { return fmt.Errorf("file exists: %s", blobPath) } - blobBytes, err := comatproto.SyncGetBlob(ctx, &xrpcc, blobCID, ident.DID.String()) + blobBytes, err := atproto.SyncGetBlob(ctx, &xrpcc, blobCID, ident.DID.String()) if err != nil { return err } @@ -197,7 +196,7 @@ func runBlobDownload(cctx *cli.Context) error { } func runBlobUpload(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context blobPath := cctx.Args().First() if blobPath == "" { return fmt.Errorf("need to provide file path as an argument") @@ -215,7 +214,7 @@ func runBlobUpload(cctx *cli.Context) error { return err } - resp, err := comatproto.RepoUploadBlob(ctx, xrpcc, bytes.NewReader(fileBytes)) + resp, err := atproto.RepoUploadBlob(ctx, xrpcc, bytes.NewReader(fileBytes)) if err != nil { return err } diff --git a/cmd/goat/bsky.go b/cmd/goat/bsky.go index 410c70d0c..d27b27e7c 100644 --- a/cmd/goat/bsky.go +++ b/cmd/goat/bsky.go @@ -1,15 +1,14 @@ package main import ( - "context" "fmt" - comatproto "github.com/bluesky-social/indigo/api/atproto" - appbsky "github.com/bluesky-social/indigo/api/bsky" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/api/bsky" "github.com/bluesky-social/indigo/atproto/syntax" lexutil "github.com/bluesky-social/indigo/lex/util" - - "github.com/urfave/cli/v2" ) var cmdBsky = &cli.Command{ @@ -28,7 +27,7 @@ var cmdBsky = &cli.Command{ } func runBskyPost(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context text := cctx.Args().First() if text == "" { return fmt.Errorf("need to provide post text as argument") @@ -41,11 +40,11 @@ func runBskyPost(cctx *cli.Context) error { return err } - post := appbsky.FeedPost{ + post := bsky.FeedPost{ Text: text, CreatedAt: syntax.DatetimeNow().String(), } - resp, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{ + resp, err := atproto.RepoCreateRecord(ctx, xrpcc, &atproto.RepoCreateRecord_Input{ Collection: "app.bsky.feed.post", Repo: xrpcc.Auth.Did, Record: &lexutil.LexiconTypeDecoder{Val: &post}, diff --git a/cmd/goat/bsky_prefs.go b/cmd/goat/bsky_prefs.go index 725072344..c0141f81d 100644 --- a/cmd/goat/bsky_prefs.go +++ b/cmd/goat/bsky_prefs.go @@ -1,7 +1,6 @@ package main import ( - "context" "encoding/json" "fmt" "os" @@ -29,7 +28,7 @@ var cmdBskyPrefs = &cli.Command{ } func runBskyPrefsExport(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context xrpcc, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -54,7 +53,7 @@ func runBskyPrefsExport(cctx *cli.Context) error { } func runBskyPrefsImport(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context prefsPath := cctx.Args().First() if prefsPath == "" { return fmt.Errorf("need to provide file path as an argument") diff --git a/cmd/goat/firehose.go b/cmd/goat/firehose.go index d106c62ff..5a4c45408 100644 --- a/cmd/goat/firehose.go +++ b/cmd/goat/firehose.go @@ -67,7 +67,7 @@ type GoatFirehoseConsumer struct { } func runFirehose(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stderr, nil))) @@ -193,7 +193,7 @@ func (gfc *GoatFirehoseConsumer) handleCommitEvent(ctx context.Context, evt *com break } } - if keep == true { + if keep { break } } @@ -244,7 +244,7 @@ func (gfc *GoatFirehoseConsumer) handleCommitEventOps(ctx context.Context, evt * break } } - if keep == false { + if !keep { continue } } @@ -277,7 +277,6 @@ func (gfc *GoatFirehoseConsumer) handleCommitEventOps(ctx context.Context, evt * out["action"] = "update" default: logger.Error("impossible event kind", "kind", ek) - break } d, err := data.UnmarshalCBOR(*recCBOR) if err != nil { diff --git a/cmd/goat/identity.go b/cmd/goat/identity.go index 49d85ab87..0dcbe375a 100644 --- a/cmd/goat/identity.go +++ b/cmd/goat/identity.go @@ -1,14 +1,13 @@ package main import ( - "context" "encoding/json" "fmt" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" - - "github.com/urfave/cli/v2" ) var cmdResolve = &cli.Command{ @@ -20,7 +19,7 @@ var cmdResolve = &cli.Command{ } func runResolve(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context s := cctx.Args().First() if s == "" { return fmt.Errorf("need to provide account identifier as an argument") diff --git a/cmd/goat/pds.go b/cmd/goat/pds.go index 9a2b96324..79021cea3 100644 --- a/cmd/goat/pds.go +++ b/cmd/goat/pds.go @@ -1,15 +1,14 @@ package main import ( - "context" "encoding/json" "fmt" "strings" - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/bluesky-social/indigo/xrpc" - "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/xrpc" ) var cmdPds = &cli.Command{ @@ -27,7 +26,7 @@ var cmdPds = &cli.Command{ } func runPdsDescribe(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context pdsHost := cctx.Args().First() if pdsHost == "" { @@ -40,7 +39,7 @@ func runPdsDescribe(cctx *cli.Context) error { Host: pdsHost, } - resp, err := comatproto.ServerDescribeServer(ctx, &client) + resp, err := atproto.ServerDescribeServer(ctx, &client) if err != nil { return err } diff --git a/cmd/goat/plc.go b/cmd/goat/plc.go index 37179fb93..36dcf171d 100644 --- a/cmd/goat/plc.go +++ b/cmd/goat/plc.go @@ -1,7 +1,6 @@ package main import ( - "context" "encoding/json" "fmt" "io" @@ -9,10 +8,11 @@ import ( "strings" "time" + "github.com/bobg/errors" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" - - "github.com/urfave/cli/v2" ) var cmdPLC = &cli.Command{ @@ -39,7 +39,7 @@ var cmdPLCHistory = &cli.Command{ } func runPLCHistory(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context plcURL := cctx.String("plc-directory") s := cctx.Args().First() if s == "" { @@ -52,22 +52,23 @@ func runPLCHistory(cctx *cli.Context) error { id, err := syntax.ParseAtIdentifier(s) if err != nil { - return err + return errors.Wrap(err, "in ParseAtIdentifier") } + var did syntax.DID if id.IsDID() { did, err = id.AsDID() if err != nil { - return err + return errors.Wrap(err, "in AsDID") } } else { hdl, err := id.AsHandle() if err != nil { - return err + return errors.Wrap(err, "in AsHandle") } did, err = dir.ResolveHandle(ctx, hdl) if err != nil { - return err + return errors.Wrap(err, "in ResolveHandle") } } @@ -78,27 +79,27 @@ func runPLCHistory(cctx *cli.Context) error { url := fmt.Sprintf("%s/%s/log", plcURL, did) resp, err := http.Get(url) if err != nil { - return err + return errors.Wrap(err, "in HTTP request") } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { - return fmt.Errorf("PLC HTTP request failed") - } - respBytes, err := io.ReadAll(resp.Body) - if err != nil { - return err + return fmt.Errorf("PLC HTTP request failed (status %d: %s)", resp.StatusCode, resp.Status) } - // parse JSON and reformat for printing - var oplog []map[string]interface{} - err = json.Unmarshal(respBytes, &oplog) - if err != nil { - return err + var ( + oplog []map[string]any + dec = json.NewDecoder(resp.Body) + ) + + if err := dec.Decode(&oplog); err != nil { + return errors.Wrap(err, "decoding JSON") } for _, op := range oplog { b, err := json.MarshalIndent(op, "", " ") if err != nil { - return err + return errors.Wrap(err, "remarshaling JSON") } fmt.Println(string(b)) } @@ -121,7 +122,7 @@ var cmdPLCDump = &cli.Command{ } func runPLCDump(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context plcURL := cctx.String("plc-directory") client := http.DefaultClient tailMode := cctx.Bool("tail") diff --git a/cmd/goat/record.go b/cmd/goat/record.go index 013913aa2..1ed3aab69 100644 --- a/cmd/goat/record.go +++ b/cmd/goat/record.go @@ -1,18 +1,17 @@ package main import ( - "context" "encoding/json" "fmt" "os" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/data" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/xrpc" - - "github.com/urfave/cli/v2" ) var cmdRecord = &cli.Command{ @@ -109,7 +108,7 @@ var cmdRecordList = &cli.Command{ } func runRecordGet(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context dir := identity.DefaultDirectory() uriArg := cctx.Args().First() @@ -141,7 +140,7 @@ func runRecordGet(cctx *cli.Context) error { } func runRecordList(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username := cctx.Args().First() if username == "" { return fmt.Errorf("need to provide username as an argument") @@ -159,7 +158,7 @@ func runRecordList(cctx *cli.Context) error { return fmt.Errorf("no PDS endpoint for identity") } - desc, err := comatproto.RepoDescribeRepo(ctx, &xrpcc, ident.DID.String()) + desc, err := atproto.RepoDescribeRepo(ctx, &xrpcc, ident.DID.String()) if err != nil { return err } @@ -202,7 +201,7 @@ func runRecordList(cctx *cli.Context) error { } func runRecordCreate(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context recordPath := cctx.Args().First() if recordPath == "" { return fmt.Errorf("need to provide file path as an argument") @@ -262,7 +261,7 @@ func runRecordCreate(cctx *cli.Context) error { } func runRecordUpdate(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context recordPath := cctx.Args().First() if recordPath == "" { return fmt.Errorf("need to provide file path as an argument") @@ -322,7 +321,7 @@ func runRecordUpdate(cctx *cli.Context) error { } func runRecordDelete(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context xrpcc, err := loadAuthClient(ctx) if err == ErrNoAuthSession { @@ -340,7 +339,7 @@ func runRecordDelete(cctx *cli.Context) error { return err } - _, err = comatproto.RepoDeleteRecord(ctx, xrpcc, &comatproto.RepoDeleteRecord_Input{ + _, err = atproto.RepoDeleteRecord(ctx, xrpcc, &atproto.RepoDeleteRecord_Input{ Collection: collection.String(), Repo: xrpcc.Auth.Did, Rkey: rkey.String(), diff --git a/cmd/goat/repo.go b/cmd/goat/repo.go index 97f2b81a2..f87e71d4e 100644 --- a/cmd/goat/repo.go +++ b/cmd/goat/repo.go @@ -2,21 +2,20 @@ package main import ( "bytes" - "context" "encoding/json" "fmt" "os" "path/filepath" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/ipfs/go-cid" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/data" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/repo" "github.com/bluesky-social/indigo/xrpc" - - "github.com/ipfs/go-cid" - "github.com/urfave/cli/v2" ) var cmdRepo = &cli.Command{ @@ -75,7 +74,7 @@ var cmdRepo = &cli.Command{ } func runRepoExport(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context username := cctx.Args().First() if username == "" { return fmt.Errorf("need to provide username as an argument") @@ -104,7 +103,7 @@ func runRepoExport(cctx *cli.Context) error { return fmt.Errorf("file already exists: %s", carPath) } fmt.Printf("downloading from %s to: %s\n", xrpcc.Host, carPath) - repoBytes, err := comatproto.SyncGetRepo(ctx, &xrpcc, ident.DID.String(), "") + repoBytes, err := atproto.SyncGetRepo(ctx, &xrpcc, ident.DID.String(), "") if err != nil { return err } @@ -112,7 +111,7 @@ func runRepoExport(cctx *cli.Context) error { } func runRepoImport(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context carPath := cctx.Args().First() if carPath == "" { @@ -131,7 +130,7 @@ func runRepoImport(cctx *cli.Context) error { return err } - err = comatproto.RepoImportRepo(ctx, xrpcc, bytes.NewReader(fileBytes)) + err = atproto.RepoImportRepo(ctx, xrpcc, bytes.NewReader(fileBytes)) if err != nil { return fmt.Errorf("failed to import repo: %w", err) } @@ -140,7 +139,7 @@ func runRepoImport(cctx *cli.Context) error { } func runRepoList(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context carPath := cctx.Args().First() if carPath == "" { return fmt.Errorf("need to provide path to CAR file as argument") @@ -167,7 +166,7 @@ func runRepoList(cctx *cli.Context) error { } func runRepoInspect(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context carPath := cctx.Args().First() if carPath == "" { return fmt.Errorf("need to provide path to CAR file as argument") @@ -195,7 +194,7 @@ func runRepoInspect(cctx *cli.Context) error { } func runRepoUnpack(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context carPath := cctx.Args().First() if carPath == "" { return fmt.Errorf("need to provide path to CAR file as argument") diff --git a/cmd/gosky/account.go b/cmd/gosky/account.go index edabfaf2a..723f067c4 100644 --- a/cmd/gosky/account.go +++ b/cmd/gosky/account.go @@ -2,15 +2,14 @@ package main import ( "bufio" - "context" "encoding/json" "fmt" "os" - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/bluesky-social/indigo/util/cliutil" + "github.com/urfave/cli/v2" - cli "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/util/cliutil" ) var accountCmd = &cli.Command{ @@ -40,7 +39,7 @@ var createSessionCmd = &cli.Command{ } handle, password := args[0], args[1] - ses, err := comatproto.ServerCreateSession(context.TODO(), xrpcc, &comatproto.ServerCreateSession_Input{ + ses, err := atproto.ServerCreateSession(cctx.Context, xrpcc, &atproto.ServerCreateSession_Input{ Identifier: handle, Password: password, }) @@ -78,7 +77,7 @@ var newAccountCmd = &cli.Command{ invite = &inv } - acc, err := comatproto.ServerCreateAccount(context.TODO(), xrpcc, &comatproto.ServerCreateAccount_Input{ + acc, err := atproto.ServerCreateAccount(cctx.Context, xrpcc, &atproto.ServerCreateAccount_Input{ Email: &email, Handle: handle, InviteCode: invite, @@ -102,7 +101,7 @@ var resetPasswordCmd = &cli.Command{ Name: "reset-password", ArgsUsage: ``, Action: func(cctx *cli.Context) error { - ctx := context.TODO() + ctx := cctx.Context xrpcc, err := cliutil.GetXrpcClient(cctx, false) if err != nil { @@ -115,7 +114,7 @@ var resetPasswordCmd = &cli.Command{ } email := args[0] - err = comatproto.ServerRequestPasswordReset(ctx, xrpcc, &comatproto.ServerRequestPasswordReset_Input{ + err = atproto.ServerRequestPasswordReset(ctx, xrpcc, &atproto.ServerRequestPasswordReset_Input{ Email: email, }) if err != nil { @@ -131,7 +130,7 @@ var resetPasswordCmd = &cli.Command{ inp.Scan() npass := inp.Text() - if err := comatproto.ServerResetPassword(ctx, xrpcc, &comatproto.ServerResetPassword_Input{ + if err := atproto.ServerResetPassword(ctx, xrpcc, &atproto.ServerResetPassword_Input{ Password: npass, Token: code, }); err != nil { @@ -154,8 +153,8 @@ var refreshAuthTokenCmd = &cli.Command{ a := xrpcc.Auth a.AccessJwt = a.RefreshJwt - ctx := context.TODO() - nauth, err := comatproto.ServerRefreshSession(ctx, xrpcc) + ctx := cctx.Context + nauth, err := atproto.ServerRefreshSession(ctx, xrpcc) if err != nil { return err } @@ -181,7 +180,7 @@ var requestAccountDeletionCmd = &cli.Command{ return err } - err = comatproto.ServerRequestAccountDelete(cctx.Context, xrpcc) + err = atproto.ServerRequestAccountDelete(cctx.Context, xrpcc) if err != nil { return err } @@ -203,7 +202,7 @@ var deleteAccountCmd = &cli.Command{ token := cctx.Args().First() password := cctx.Args().Get(1) - err = comatproto.ServerDeleteAccount(cctx.Context, xrpcc, &comatproto.ServerDeleteAccount_Input{ + err = atproto.ServerDeleteAccount(cctx.Context, xrpcc, &atproto.ServerDeleteAccount_Input{ Did: xrpcc.Auth.Did, Token: token, Password: password, diff --git a/cmd/gosky/admin.go b/cmd/gosky/admin.go index 9467975da..ac49ed7cb 100644 --- a/cmd/gosky/admin.go +++ b/cmd/gosky/admin.go @@ -1,7 +1,6 @@ package main import ( - "context" "encoding/json" "fmt" "os" @@ -10,14 +9,14 @@ import ( "sync" "time" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/api" "github.com/bluesky-social/indigo/api/atproto" - comatproto "github.com/bluesky-social/indigo/api/atproto" toolsozone "github.com/bluesky-social/indigo/api/ozone" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/util/cliutil" - cli "github.com/urfave/cli/v2" ) var adminCmd = &cli.Command{ @@ -66,7 +65,7 @@ var checkUserCmd = &cli.Command{ } dir := identity.DefaultDirectory() - ctx := context.Background() + ctx := cctx.Context ident, err := syntax.ParseAtIdentifier(cctx.Args().First()) if err != nil { @@ -193,7 +192,7 @@ var buildInviteTreeCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context adminKey := cctx.String("admin-password") @@ -244,8 +243,7 @@ var buildInviteTreeCmd = &cli.Command{ Handle: "admin", } - var getUser func(did string) (*userInviteInfo, error) - getUser = func(did string) (*userInviteInfo, error) { + getUser := func(did string) (*userInviteInfo, error) { u, ok := users[did] if ok { return u, nil @@ -290,7 +288,6 @@ var buildInviteTreeCmd = &cli.Command{ return u, nil } - _ = getUser initmap := make(map[string]*basicInvInfo) var initlist []*basicInvInfo @@ -383,7 +380,7 @@ var listReportsCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context adminKey := cctx.String("admin-password") xrpcc.AdminToken = &adminKey @@ -436,7 +433,7 @@ var disableInvitesCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context adminKey := cctx.String("admin-password") xrpcc.AdminToken = &adminKey @@ -478,7 +475,7 @@ var enableInvitesCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context adminKey := cctx.String("admin-password") xrpcc.AdminToken = &adminKey @@ -527,7 +524,7 @@ var listInviteTreeCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context phr := &api.ProdHandleResolver{} @@ -621,7 +618,7 @@ var takeDownAccountCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context adminKey := cctx.String("admin-password") xrpcc.AdminToken = &adminKey @@ -687,7 +684,7 @@ var queryModerationStatusesCmd = &cli.Command{ return err } - ctx := context.Background() + ctx := cctx.Context adminKey := cctx.String("admin-password") xrpcc.AdminToken = &adminKey @@ -695,12 +692,9 @@ var queryModerationStatusesCmd = &cli.Command{ did := cctx.Args().First() if !strings.HasPrefix(did, "did:") { phr := &api.ProdHandleResolver{} - resp, err := phr.ResolveHandleToDid(ctx, did) - if err != nil { + if _, err := phr.ResolveHandleToDid(ctx, did); err != nil { return err } - - did = resp } resp, err := toolsozone.ModerationQueryEvents( @@ -776,7 +770,7 @@ var createInviteCmd = &cli.Command{ for i, d := range dids { if !strings.HasPrefix(d, "did:plc:") { - out, err := phr.ResolveHandleToDid(context.TODO(), d) + out, err := phr.ResolveHandleToDid(cctx.Context, d) if err != nil { return fmt.Errorf("failed to resolve %q: %w", d, err) } @@ -791,7 +785,7 @@ var createInviteCmd = &cli.Command{ slice = slice[:500] } - _, err = comatproto.ServerCreateInviteCodes(context.TODO(), xrpcc, &comatproto.ServerCreateInviteCodes_Input{ + _, err = atproto.ServerCreateInviteCodes(cctx.Context, xrpcc, &atproto.ServerCreateInviteCodes_Input{ UseCount: int64(count), ForAccounts: slice, CodeCount: int64(num), @@ -807,7 +801,7 @@ var createInviteCmd = &cli.Command{ var usrdid []string if forUser := cctx.Args().Get(0); forUser != "" { if !strings.HasPrefix(forUser, "did:") { - resp, err := phr.ResolveHandleToDid(context.TODO(), forUser) + resp, err := phr.ResolveHandleToDid(cctx.Context, forUser) if err != nil { return fmt.Errorf("resolving handle: %w", err) } @@ -820,7 +814,7 @@ var createInviteCmd = &cli.Command{ xrpcc.AdminToken = &adminKey - resp, err := comatproto.ServerCreateInviteCodes(context.TODO(), xrpcc, &comatproto.ServerCreateInviteCodes_Input{ + resp, err := atproto.ServerCreateInviteCodes(cctx.Context, xrpcc, &atproto.ServerCreateInviteCodes_Input{ UseCount: int64(count), ForAccounts: usrdid, CodeCount: int64(num), diff --git a/cmd/gosky/bgs.go b/cmd/gosky/bgs.go index 5e49f34a7..39460a433 100644 --- a/cmd/gosky/bgs.go +++ b/cmd/gosky/bgs.go @@ -483,44 +483,3 @@ var bgsResetRepo = &cli.Command{ return nil }, } - -var bgsSetTrustedDomains = &cli.Command{ - Name: "set-trusted-domain", - Action: func(cctx *cli.Context) error { - url := cctx.String("bgs") + "/admin/pds/addTrustedDomain" - - domain := cctx.Args().First() - url += fmt.Sprintf("?domain=%s", domain) - - req, err := http.NewRequest("POST", url, nil) - if err != nil { - return err - } - - auth := cctx.String("key") - req.Header.Set("Authorization", "Bearer "+auth) - - resp, err := http.DefaultClient.Do(req) - if err != nil { - return err - } - - if resp.StatusCode != 200 { - var e xrpc.XRPCError - if err := json.NewDecoder(resp.Body).Decode(&e); err != nil { - return err - } - - return &e - } - - var out map[string]any - if err := json.NewDecoder(resp.Body).Decode(&out); err != nil { - return err - } - - fmt.Println(out) - - return nil - }, -} diff --git a/cmd/gosky/bsky.go b/cmd/gosky/bsky.go index afc7cb9df..339406a91 100644 --- a/cmd/gosky/bsky.go +++ b/cmd/gosky/bsky.go @@ -1,19 +1,20 @@ package main import ( - "context" "encoding/json" "fmt" + "os" "strings" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" - appbsky "github.com/bluesky-social/indigo/api/bsky" + "github.com/bobg/errors" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/api/bsky" lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/util/cliutil" - - cli "github.com/urfave/cli/v2" ) var bskyCmd = &cli.Command{ @@ -44,13 +45,13 @@ var bskyFollowCmd = &cli.Command{ user := cctx.Args().First() - follow := appbsky.GraphFollow{ + follow := bsky.GraphFollow{ LexiconTypeID: "app.bsky.graph.follow", CreatedAt: time.Now().Format(time.RFC3339), Subject: user, } - resp, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ + resp, err := atproto.RepoCreateRecord(cctx.Context, xrpcc, &atproto.RepoCreateRecord_Input{ Collection: "app.bsky.graph.follow", Repo: xrpcc.Auth.Did, Record: &lexutil.LexiconTypeDecoder{Val: &follow}, @@ -80,8 +81,8 @@ var bskyListFollowsCmd = &cli.Command{ user = xrpcc.Auth.Did } - ctx := context.TODO() - resp, err := appbsky.GraphGetFollows(ctx, xrpcc, user, "", 100) + ctx := cctx.Context + resp, err := bsky.GraphGetFollows(ctx, xrpcc, user, "", 100) if err != nil { return err } @@ -108,10 +109,10 @@ var bskyPostCmd = &cli.Command{ text := strings.Join(cctx.Args().Slice(), " ") - resp, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ + resp, err := atproto.RepoCreateRecord(cctx.Context, xrpcc, &atproto.RepoCreateRecord_Input{ Collection: "app.bsky.feed.post", Repo: auth.Did, - Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{ + Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedPost{ Text: text, CreatedAt: time.Now().Format(util.ISO8601), }}, @@ -127,9 +128,9 @@ var bskyPostCmd = &cli.Command{ }, } -func prettyPrintPost(p *appbsky.FeedDefs_FeedViewPost, uris bool) { +func prettyPrintPost(p *bsky.FeedDefs_FeedViewPost, uris bool) { fmt.Println(strings.Repeat("-", 60)) - rec := p.Post.Record.Val.(*appbsky.FeedPost) + rec := p.Post.Record.Val.(*bsky.FeedPost) fmt.Printf("%s (%s)", p.Post.Author.Handle, rec.CreatedAt) if uris { fmt.Println(" -- ", p.Post.Uri) @@ -166,7 +167,7 @@ var bskyGetFeedCmd = &cli.Command{ return err } - ctx := context.TODO() + ctx := cctx.Context raw := cctx.Bool("raw") @@ -178,7 +179,7 @@ var bskyGetFeedCmd = &cli.Command{ author = xrpcc.Auth.Did } - tl, err := appbsky.FeedGetAuthorFeed(ctx, xrpcc, author, "", "", false, 99) + tl, err := bsky.FeedGetAuthorFeed(ctx, xrpcc, author, "", "", false, 99) if err != nil { return err } @@ -193,7 +194,7 @@ var bskyGetFeedCmd = &cli.Command{ } } else { algo := "reverse-chronological" - tl, err := appbsky.FeedGetTimeline(ctx, xrpcc, algo, "", int64(cctx.Int("count"))) + tl, err := bsky.FeedGetTimeline(ctx, xrpcc, algo, "", int64(cctx.Int("count"))) if err != nil { return err } @@ -219,30 +220,17 @@ var bskyActorGetSuggestionsCmd = &cli.Command{ Action: func(cctx *cli.Context) error { xrpcc, err := cliutil.GetXrpcClient(cctx, true) if err != nil { - return err - } - - ctx := context.TODO() - - author := cctx.Args().First() - if author == "" { - author = xrpcc.Auth.Did + return errors.Wrap(err, "in GetXrpcClient") } - resp, err := appbsky.ActorGetSuggestions(ctx, xrpcc, "", 100) + resp, err := bsky.ActorGetSuggestions(cctx.Context, xrpcc, "", 100) if err != nil { - return err + return errors.Wrap(err, "in ActorGetSuggestions") } - b, err := json.MarshalIndent(resp.Actors, "", " ") - if err != nil { - return err - } - - fmt.Println(string(b)) - - return nil - + enc := json.NewEncoder(os.Stdout) + enc.SetIndent("", " ") + return enc.Encode(resp.Actors) }, } @@ -267,19 +255,19 @@ var bskyLikeCmd = &cli.Command{ did := parts[2] fmt.Println(did, collection, rkey) - ctx := context.TODO() - resp, err := comatproto.RepoGetRecord(ctx, xrpcc, "", collection, did, rkey) + ctx := cctx.Context + resp, err := atproto.RepoGetRecord(ctx, xrpcc, "", collection, did, rkey) if err != nil { return fmt.Errorf("getting record: %w", err) } - out, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{ + out, err := atproto.RepoCreateRecord(ctx, xrpcc, &atproto.RepoCreateRecord_Input{ Collection: "app.bsky.feed.like", Repo: xrpcc.Auth.Did, Record: &lexutil.LexiconTypeDecoder{ - Val: &appbsky.FeedLike{ + Val: &bsky.FeedLike{ CreatedAt: time.Now().Format(util.ISO8601), - Subject: &comatproto.RepoStrongRef{Uri: resp.Uri, Cid: *resp.Cid}, + Subject: &atproto.RepoStrongRef{Uri: resp.Uri, Cid: *resp.Cid}, }, }, }) @@ -314,7 +302,7 @@ var bskyDeletePostCmd = &cli.Command{ rkey = parts[1] } - _, err = comatproto.RepoDeleteRecord(context.TODO(), xrpcc, &comatproto.RepoDeleteRecord_Input{ + _, err = atproto.RepoDeleteRecord(cctx.Context, xrpcc, &atproto.RepoDeleteRecord_Input{ Repo: xrpcc.Auth.Did, Collection: schema, Rkey: rkey, @@ -328,14 +316,12 @@ var bskyNotificationsCmd = &cli.Command{ Usage: "fetch bsky notifications (requires auth)", Flags: []cli.Flag{}, Action: func(cctx *cli.Context) error { - ctx := context.TODO() - xrpcc, err := cliutil.GetXrpcClient(cctx, true) if err != nil { return err } - notifs, err := appbsky.NotificationListNotifications(ctx, xrpcc, "", 50, false, "") + notifs, err := bsky.NotificationListNotifications(cctx.Context, xrpcc, "", 50, false, "") if err != nil { return err } diff --git a/cmd/gosky/car.go b/cmd/gosky/car.go index 288a4640f..ecefaa8f7 100644 --- a/cmd/gosky/car.go +++ b/cmd/gosky/car.go @@ -2,17 +2,17 @@ package main import ( "bytes" - "context" "encoding/json" "fmt" "os" "path/filepath" + "github.com/bobg/errors" + "github.com/ipfs/go-cid" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/repo" - - "github.com/ipfs/go-cid" - cli "github.com/urfave/cli/v2" ) var carCmd = &cli.Command{ @@ -38,7 +38,7 @@ var carUnpackCmd = &cli.Command{ }, ArgsUsage: ``, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context arg := cctx.Args().First() if arg == "" { return fmt.Errorf("CAR file path arg is required") @@ -70,56 +70,48 @@ var carUnpackCmd = &cli.Command{ os.MkdirAll(filepath.Dir(commitPath), os.ModePerm) if cctx.Bool("cbor") { cborBytes := new(bytes.Buffer) - err = sc.MarshalCBOR(cborBytes) - if err := os.WriteFile(commitPath+".cbor", cborBytes.Bytes(), 0666); err != nil { - return err - } - } else { - recJson, err := json.MarshalIndent(sc, "", " ") - if err != nil { - return err - } - if err := os.WriteFile(commitPath+".json", recJson, 0666); err != nil { - return err + if err := sc.MarshalCBOR(cborBytes); err != nil { + return errors.Wrap(err, "in MarshalCBOR") } + err := os.WriteFile(commitPath+".cbor", cborBytes.Bytes(), 0666) + return errors.Wrap(err, "in WriteFile") } - err = r.ForEach(ctx, "", func(k string, v cid.Cid) error { + recJson, err := json.MarshalIndent(sc, "", " ") + if err != nil { + return errors.Wrap(err, "in MarshalIndent") + } + if err := os.WriteFile(commitPath+".json", recJson, 0666); err != nil { + return errors.Wrap(err, "in WriteFile") + } + return r.ForEach(ctx, "", func(k string, v cid.Cid) error { _, rec, err := r.GetRecord(ctx, k) if err != nil { - return err + return errors.Wrapf(err, "getting record %s", k) } log.Debug("processing record", "rec", k) // TODO: check if path is safe more carefully recPath := topDir + "/" + k - os.MkdirAll(filepath.Dir(recPath), os.ModePerm) - if err != nil { - return err + if err := os.MkdirAll(filepath.Dir(recPath), os.ModePerm); err != nil { + return errors.Wrap(err, "in MkdirAll") } if cctx.Bool("cbor") { cborBytes := new(bytes.Buffer) - err = rec.MarshalCBOR(cborBytes) - if err := os.WriteFile(recPath+".cbor", cborBytes.Bytes(), 0666); err != nil { - return err - } - } else { - recJson, err := json.MarshalIndent(rec, "", " ") - if err != nil { - return err - } - if err := os.WriteFile(recPath+".json", recJson, 0666); err != nil { - return err + if err := rec.MarshalCBOR(cborBytes); err != nil { + return errors.Wrap(err, "in MarshalCBOR") } + err := os.WriteFile(recPath+".cbor", cborBytes.Bytes(), 0666) + return errors.Wrap(err, "in WriteFile") } - return nil + recJson, err := json.MarshalIndent(rec, "", " ") + if err != nil { + return errors.Wrap(err, "in MarshalIndent") + } + err = os.WriteFile(recPath+".json", recJson, 0666) + return errors.Wrap(err, "in WriteFile") }) - if err != nil { - return err - } - - return nil }, } diff --git a/cmd/gosky/debug.go b/cmd/gosky/debug.go index 2037c328c..d19fec524 100644 --- a/cmd/gosky/debug.go +++ b/cmd/gosky/debug.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "context" "encoding/json" "fmt" "io" @@ -15,8 +14,13 @@ import ( "syscall" "time" + "github.com/gorilla/websocket" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-libipfs/blocks" + "github.com/ipld/go-car/v2" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/api/atproto" - comatproto "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/api/bsky" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" @@ -29,12 +33,6 @@ import ( "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/util/cliutil" "github.com/bluesky-social/indigo/xrpc" - - "github.com/gorilla/websocket" - "github.com/ipfs/go-cid" - "github.com/ipfs/go-libipfs/blocks" - "github.com/ipld/go-car/v2" - cli "github.com/urfave/cli/v2" ) var debugCmd = &cli.Command{ @@ -80,11 +78,11 @@ var inspectEventCmd = &cli.Command{ var errFoundIt = fmt.Errorf("gotem") - var match *comatproto.SyncSubscribeRepos_Commit + var match *atproto.SyncSubscribeRepos_Commit - ctx := context.TODO() + ctx := cctx.Context rsc := &events.RepoStreamCallbacks{ - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { + RepoCommit: func(evt *atproto.SyncSubscribeRepos_Commit) error { n := int64(n) if evt.Seq == n { match = evt @@ -96,7 +94,7 @@ var inspectEventCmd = &cli.Command{ return nil }, - RepoInfo: func(evt *comatproto.SyncSubscribeRepos_Info) error { + RepoInfo: func(evt *atproto.SyncSubscribeRepos_Info) error { return nil }, // TODO: all the other Repo* event types @@ -168,14 +166,6 @@ type eventInfo struct { LastRev string } -func cidStr(c *lexutil.LexLink) string { - if c == nil { - return "" - } - - return c.String() -} - var debugStreamCmd = &cli.Command{ Name: "debug-stream", Flags: []cli.Flag{ @@ -206,9 +196,9 @@ var debugStreamCmd = &cli.Command{ infos := make(map[string]*eventInfo) var lastSeq int64 = -1 - ctx := context.TODO() + ctx := cctx.Context rsc := &events.RepoStreamCallbacks{ - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { + RepoCommit: func(evt *atproto.SyncSubscribeRepos_Commit) error { fmt.Printf("\rChecking seq: %d ", evt.Seq) if lastSeq > 0 && evt.Seq != lastSeq+1 { @@ -259,7 +249,7 @@ var debugStreamCmd = &cli.Command{ return nil }, - RepoHandle: func(evt *comatproto.SyncSubscribeRepos_Handle) error { + RepoHandle: func(evt *atproto.SyncSubscribeRepos_Handle) error { fmt.Printf("\rChecking seq: %d ", evt.Seq) if lastSeq > 0 && evt.Seq != lastSeq+1 { fmt.Println("Gap in sequence numbers: ", lastSeq, evt.Seq) @@ -267,7 +257,7 @@ var debugStreamCmd = &cli.Command{ lastSeq = evt.Seq return nil }, - RepoTombstone: func(evt *comatproto.SyncSubscribeRepos_Tombstone) error { + RepoTombstone: func(evt *atproto.SyncSubscribeRepos_Tombstone) error { fmt.Printf("\rChecking seq: %d ", evt.Seq) if lastSeq > 0 && evt.Seq != lastSeq+1 { fmt.Println("Gap in sequence numbers: ", lastSeq, evt.Seq) @@ -275,7 +265,7 @@ var debugStreamCmd = &cli.Command{ lastSeq = evt.Seq return nil }, - RepoInfo: func(evt *comatproto.SyncSubscribeRepos_Info) error { + RepoInfo: func(evt *atproto.SyncSubscribeRepos_Info) error { return nil }, // TODO: all the other Repo* event types @@ -315,17 +305,17 @@ var compareStreamsCmd = &cli.Command{ d := websocket.DefaultDialer - eventChans := []chan *comatproto.SyncSubscribeRepos_Commit{ - make(chan *comatproto.SyncSubscribeRepos_Commit, 2), - make(chan *comatproto.SyncSubscribeRepos_Commit, 2), + eventChans := []chan *atproto.SyncSubscribeRepos_Commit{ + make(chan *atproto.SyncSubscribeRepos_Commit, 2), + make(chan *atproto.SyncSubscribeRepos_Commit, 2), } - buffers := []map[string][]*comatproto.SyncSubscribeRepos_Commit{ - make(map[string][]*comatproto.SyncSubscribeRepos_Commit), - make(map[string][]*comatproto.SyncSubscribeRepos_Commit), + buffers := []map[string][]*atproto.SyncSubscribeRepos_Commit{ + make(map[string][]*atproto.SyncSubscribeRepos_Commit), + make(map[string][]*atproto.SyncSubscribeRepos_Commit), } - addToBuffer := func(n int, event *comatproto.SyncSubscribeRepos_Commit) { + addToBuffer := func(n int, event *atproto.SyncSubscribeRepos_Commit) { buffers[n][event.Repo] = append(buffers[n][event.Repo], event) } @@ -336,31 +326,23 @@ var compareStreamsCmd = &cli.Command{ return ll.String() } - findMatchAndRemove := func(n int, event *comatproto.SyncSubscribeRepos_Commit) (*comatproto.SyncSubscribeRepos_Commit, error) { + findMatchAndRemove := func(n int, event *atproto.SyncSubscribeRepos_Commit) (*atproto.SyncSubscribeRepos_Commit, error) { buf := buffers[n] slice, ok := buf[event.Repo] if !ok || len(slice) == 0 { return nil, nil } - for i, ev := range slice { - if ev.Commit == event.Commit { - if pll(ev.Prev) != pll(event.Prev) { - // same commit different prev?? - return nil, fmt.Errorf("matched event with same commit but different prev: (%d) %d - %d", n, ev.Seq, event.Seq) - } + ev := slice[0] + if ev.Commit == event.Commit { + if pll(ev.Prev) != pll(event.Prev) { + // same commit different prev?? + return nil, fmt.Errorf("matched event with same commit but different prev: (%d) %d - %d", n, ev.Seq, event.Seq) } - - if i != 0 { - fmt.Printf("detected skipped event: %d (%d)\n", slice[0].Seq, i) - } - - slice = slice[i+1:] - buf[event.Repo] = slice - return ev, nil } - return nil, fmt.Errorf("did not find matching event despite having events in buffer") + buf[event.Repo] = slice[1:] + return ev, nil } printCurrentDelta := func() { @@ -394,9 +376,9 @@ var compareStreamsCmd = &cli.Command{ os.Exit(1) } - ctx := context.TODO() + ctx := cctx.Context rsc := &events.RepoStreamCallbacks{ - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { + RepoCommit: func(evt *atproto.SyncSubscribeRepos_Commit) error { eventChans[i] <- evt return nil }, @@ -479,7 +461,7 @@ var debugFeedGenCmd = &cli.Command{ return err } - ctx := context.TODO() + ctx := cctx.Context out, err := atproto.RepoGetRecord(ctx, xrpcc, "", puri.Collection, puri.Did, puri.Rkey) if err != nil { @@ -514,7 +496,7 @@ var debugFeedGenCmd = &cli.Command{ } if ss == nil { - return fmt.Errorf("No '#bsky_fg' service entry found in feedgens DID document") + return fmt.Errorf("no '#bsky_fg' service entry found in feedgens DID document") } fmt.Println("Service endpoint is: ", ss.ServiceEndpoint) @@ -611,7 +593,7 @@ var debugFeedViewCmd = &cli.Command{ return err } - ctx := context.TODO() + ctx := cctx.Context out, err := atproto.RepoGetRecord(ctx, xrpcc, "", puri.Collection, puri.Did, puri.Rkey) if err != nil { @@ -638,7 +620,7 @@ var debugFeedViewCmd = &cli.Command{ } if ss == nil { - return fmt.Errorf("No '#bsky_fg' service entry found in feedgens DID document") + return fmt.Errorf("no '#bsky_fg' service entry found in feedgens DID document") } fgclient := &xrpc.Client{ @@ -791,9 +773,9 @@ var debugGetRepoCmd = &cli.Command{ return err } - ctx := context.TODO() + ctx := cctx.Context - repobytes, err := comatproto.SyncGetRepo(ctx, xrpcc, cctx.Args().First(), "") + repobytes, err := atproto.SyncGetRepo(ctx, xrpcc, cctx.Args().First(), "") if err != nil { return fmt.Errorf("getting repo: %w", err) } @@ -876,7 +858,7 @@ var debugCompareReposCmd = &cli.Command{ go func() { defer wg.Done() logger := log.With("host", cctx.String("host-1")) - repo1bytes, err := comatproto.SyncGetRepo(ctx, &xrpc1, did.String(), "") + repo1bytes, err := atproto.SyncGetRepo(ctx, &xrpc1, did.String(), "") if err != nil { logger.Error("getting repo", "err", err) os.Exit(1) @@ -895,7 +877,7 @@ var debugCompareReposCmd = &cli.Command{ go func() { defer wg.Done() logger := log.With("host", cctx.String("host-2")) - repo2bytes, err := comatproto.SyncGetRepo(ctx, &xrpc2, did.String(), "") + repo2bytes, err := atproto.SyncGetRepo(ctx, &xrpc2, did.String(), "") if err != nil { logger.Error("getting repo", "err", err) os.Exit(1) diff --git a/cmd/gosky/did.go b/cmd/gosky/did.go index 405ef999c..839276ebf 100644 --- a/cmd/gosky/did.go +++ b/cmd/gosky/did.go @@ -1,15 +1,14 @@ package main import ( - "context" "encoding/json" "fmt" + "github.com/urfave/cli/v2" + "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/util/cliutil" - - cli "github.com/urfave/cli/v2" ) var didCmd = &cli.Command{ @@ -35,7 +34,7 @@ var didGetCmd = &cli.Command{ Action: func(cctx *cli.Context) error { s := cliutil.GetDidResolver(cctx) - ctx := context.TODO() + ctx := cctx.Context did := cctx.Args().First() dir := identity.DefaultDirectory() @@ -50,7 +49,7 @@ var didGetCmd = &cli.Command{ return nil } - doc, err := s.GetDocument(context.TODO(), did) + doc, err := s.GetDocument(cctx.Context, did) if err != nil { return err } @@ -94,7 +93,7 @@ var didCreateCmd = &cli.Command{ fmt.Println("KEYDID: ", sigkey.Public().DID()) - ndid, err := s.CreateDID(context.TODO(), sigkey, recoverydid, handle, service) + ndid, err := s.CreateDID(cctx.Context, sigkey, recoverydid, handle, service) if err != nil { return err } diff --git a/cmd/gosky/handle.go b/cmd/gosky/handle.go index ae32ab801..ff83a13e8 100644 --- a/cmd/gosky/handle.go +++ b/cmd/gosky/handle.go @@ -1,15 +1,14 @@ package main import ( - "context" "fmt" - comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/util/cliutil" - - cli "github.com/urfave/cli/v2" ) var handleCmd = &cli.Command{ @@ -25,7 +24,7 @@ var resolveHandleCmd = &cli.Command{ Name: "resolve", ArgsUsage: ``, Action: func(cctx *cli.Context) error { - ctx := context.TODO() + ctx := cctx.Context args, err := needArgs(cctx, "handle") if err != nil { @@ -54,7 +53,7 @@ var updateHandleCmd = &cli.Command{ Name: "update", ArgsUsage: ``, Action: func(cctx *cli.Context) error { - ctx := context.TODO() + ctx := cctx.Context xrpcc, err := cliutil.GetXrpcClient(cctx, false) if err != nil { @@ -67,7 +66,7 @@ var updateHandleCmd = &cli.Command{ } handle := args[0] - err = comatproto.IdentityUpdateHandle(ctx, xrpcc, &comatproto.IdentityUpdateHandle_Input{ + err = atproto.IdentityUpdateHandle(ctx, xrpcc, &atproto.IdentityUpdateHandle_Input{ Handle: handle, }) if err != nil { diff --git a/cmd/gosky/main.go b/cmd/gosky/main.go index f7ff87209..5395720a6 100644 --- a/cmd/gosky/main.go +++ b/cmd/gosky/main.go @@ -15,9 +15,22 @@ import ( "syscall" "time" + "github.com/carlmjohnson/versioninfo" + "github.com/gorilla/websocket" + lru "github.com/hashicorp/golang-lru/v2" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-datastore" + blockstore "github.com/ipfs/go-ipfs-blockstore" + "github.com/ipld/go-car" + _ "github.com/joho/godotenv/autoload" + "github.com/polydawn/refmt/cbor" + rejson "github.com/polydawn/refmt/json" + "github.com/polydawn/refmt/shared" + cli "github.com/urfave/cli/v2" + "golang.org/x/time/rate" + "github.com/bluesky-social/indigo/api" "github.com/bluesky-social/indigo/api/atproto" - comatproto "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/api/bsky" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" @@ -28,22 +41,6 @@ import ( "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/util/cliutil" "github.com/bluesky-social/indigo/xrpc" - "golang.org/x/time/rate" - - "github.com/gorilla/websocket" - lru "github.com/hashicorp/golang-lru/v2" - "github.com/ipfs/go-cid" - "github.com/ipfs/go-datastore" - blockstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/ipld/go-car" - - _ "github.com/joho/godotenv/autoload" - - "github.com/carlmjohnson/versioninfo" - "github.com/polydawn/refmt/cbor" - rejson "github.com/polydawn/refmt/json" - "github.com/polydawn/refmt/shared" - cli "github.com/urfave/cli/v2" ) var log = slog.Default().With("system", "gosky") @@ -162,7 +159,7 @@ var readRepoStreamCmd = &cli.Command{ }, ArgsUsage: `[ [cursor]]`, Action: func(cctx *cli.Context) error { - ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT) + ctx, stop := signal.NotifyContext(cctx.Context, syscall.SIGINT) defer stop() arg := cctx.Args().First() @@ -224,7 +221,7 @@ var readRepoStreamCmd = &cli.Command{ } rsc := &events.RepoStreamCallbacks{ - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { + RepoCommit: func(evt *atproto.SyncSubscribeRepos_Commit) error { if limiter != nil { limiter.Wait(ctx) } @@ -287,7 +284,7 @@ var readRepoStreamCmd = &cli.Command{ return nil }, - RepoMigrate: func(migrate *comatproto.SyncSubscribeRepos_Migrate) error { + RepoMigrate: func(migrate *atproto.SyncSubscribeRepos_Migrate) error { if jsonfmt { b, err := json.Marshal(migrate) if err != nil { @@ -300,7 +297,7 @@ var readRepoStreamCmd = &cli.Command{ return nil }, - RepoHandle: func(handle *comatproto.SyncSubscribeRepos_Handle) error { + RepoHandle: func(handle *atproto.SyncSubscribeRepos_Handle) error { if jsonfmt { b, err := json.Marshal(handle) if err != nil { @@ -314,7 +311,7 @@ var readRepoStreamCmd = &cli.Command{ return nil }, - RepoInfo: func(info *comatproto.SyncSubscribeRepos_Info) error { + RepoInfo: func(info *atproto.SyncSubscribeRepos_Info) error { if jsonfmt { b, err := json.Marshal(info) if err != nil { @@ -327,7 +324,7 @@ var readRepoStreamCmd = &cli.Command{ return nil }, - RepoTombstone: func(tomb *comatproto.SyncSubscribeRepos_Tombstone) error { + RepoTombstone: func(tomb *atproto.SyncSubscribeRepos_Tombstone) error { if jsonfmt { b, err := json.Marshal(tomb) if err != nil { @@ -406,7 +403,7 @@ var getRecordCmd = &cli.Command{ }, ArgsUsage: ``, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context rfi := cctx.String("repo") var repob []byte @@ -416,7 +413,7 @@ var getRecordCmd = &cli.Command{ return err } - rrb, err := comatproto.SyncGetRepo(ctx, xrpcc, rfi, "") + rrb, err := atproto.SyncGetRepo(ctx, xrpcc, rfi, "") if err != nil { return err } @@ -432,7 +429,7 @@ var getRecordCmd = &cli.Command{ return err } - out, err := comatproto.RepoGetRecord(ctx, xrpcc, "", puri.Collection, puri.Did, puri.Rkey) + out, err := atproto.RepoGetRecord(ctx, xrpcc, "", puri.Collection, puri.Did, puri.Rkey) if err != nil { return err } @@ -483,7 +480,7 @@ var getRecordCmd = &cli.Command{ xrpcc.Host = resp.PDSEndpoint() - out, err := comatproto.RepoGetRecord(ctx, xrpcc, "", collection, did, rkey) + out, err := atproto.RepoGetRecord(ctx, xrpcc, "", collection, did, rkey) if err != nil { return err } @@ -602,7 +599,7 @@ var createFeedGeneratorCmd = &cli.Command{ desc = &d } - ctx := context.TODO() + ctx := cctx.Context rec := &lexutil.LexiconTypeDecoder{Val: &bsky.FeedGenerator{ CreatedAt: time.Now().Format(util.ISO8601), @@ -661,7 +658,7 @@ var listAllRecordsCmd = &cli.Command{ Action: func(cctx *cli.Context) error { arg := cctx.Args().First() - ctx := context.TODO() + ctx := cctx.Context var repob []byte if strings.HasPrefix(arg, "did:") { @@ -674,7 +671,7 @@ var listAllRecordsCmd = &cli.Command{ arg = xrpcc.Auth.Did } - rrb, err := comatproto.SyncGetRepo(ctx, xrpcc, arg, "") + rrb, err := atproto.SyncGetRepo(ctx, xrpcc, arg, "") if err != nil { return err } @@ -780,7 +777,7 @@ var listLabelsCmd = &cli.Command{ }, Action: func(cctx *cli.Context) error { - ctx := context.TODO() + ctx := cctx.Context delta := cctx.Duration("since") since := time.Now().Add(-1 * delta).UnixMilli() diff --git a/cmd/gosky/streamdiff.go b/cmd/gosky/streamdiff.go deleted file mode 100644 index 230bfc1da..000000000 --- a/cmd/gosky/streamdiff.go +++ /dev/null @@ -1,170 +0,0 @@ -package main - -import ( - "context" - "fmt" - "net/http" - - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/bluesky-social/indigo/events" - "github.com/bluesky-social/indigo/events/schedulers/sequential" - "github.com/gorilla/websocket" - cli "github.com/urfave/cli/v2" -) - -// TODO: WIP - turns out to be more complicated than i initially thought -var streamCompareCmd = &cli.Command{ - Usage: "utility to subscribe and compare output from two repo streams", - Name: "diff-stream", - Flags: []cli.Flag{}, - ArgsUsage: ` `, - Action: func(cctx *cli.Context) error { - d := websocket.DefaultDialer - - args, err := needArgs(cctx, "hostA", "hostB") - if err != nil { - return err - } - hosta, hostb := args[0], args[1] - - cona, _, err := d.Dial(fmt.Sprintf("%s/xrpc/com.atproto.sync.subscribeRepos", hosta), http.Header{}) - if err != nil { - return fmt.Errorf("dial failure: %w", err) - } - - conb, _, err := d.Dial(fmt.Sprintf("%s/xrpc/com.atproto.sync.subscribeRepos", hostb), http.Header{}) - if err != nil { - return fmt.Errorf("dial failure: %w", err) - } - - sd := &streamDiffer{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - go func() { - rsc := &events.RepoStreamCallbacks{ - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { - sd.PushA(&events.XRPCStreamEvent{ - RepoCommit: evt, - }) - return nil - }, - RepoInfo: func(evt *comatproto.SyncSubscribeRepos_Info) error { - return nil - }, - // TODO: all the other Repo* event types - Error: func(evt *events.ErrorFrame) error { - return fmt.Errorf("%s: %s", evt.Error, evt.Message) - }, - } - seqScheduler := sequential.NewScheduler("streamA", rsc.EventHandler) - err = events.HandleRepoStream(ctx, cona, seqScheduler, log) - if err != nil { - log.Error("stream A failed", "err", err) - } - }() - - go func() { - rsc := &events.RepoStreamCallbacks{ - RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { - sd.PushB(&events.XRPCStreamEvent{ - RepoCommit: evt, - }) - return nil - }, - RepoInfo: func(evt *comatproto.SyncSubscribeRepos_Info) error { - return nil - }, - // TODO: all the other Repo* event types - Error: func(evt *events.ErrorFrame) error { - return fmt.Errorf("%s: %s", evt.Error, evt.Message) - }, - } - - seqScheduler := sequential.NewScheduler("streamB", rsc.EventHandler) - err = events.HandleRepoStream(ctx, conb, seqScheduler, log) - if err != nil { - log.Error("stream B failed", "err", err) - } - }() - - select {} - }, -} - -type streamDiffer struct { - Aevts []*events.XRPCStreamEvent - Bevts []*events.XRPCStreamEvent -} - -func (sd *streamDiffer) PushA(evt *events.XRPCStreamEvent) { - ix := findEvt(evt, sd.Bevts) - if ix < 0 { - sd.Aevts = append(sd.Aevts, evt) - return - } - - switch evtOp(evt) { - case "#commit": - e := evt.RepoCommit - oe := sd.Bevts[ix].RepoCommit - - if len(e.Blocks) != len(oe.Blocks) { - fmt.Printf("seq %d (A) and seq %d (B) have different carslice lengths: %d != %d", e.Seq, oe.Seq, len(e.Blocks), len(oe.Blocks)) - } - default: - } - -} - -func (sd *streamDiffer) PushB(evt *events.XRPCStreamEvent) { - -} - -func evtOp(evt *events.XRPCStreamEvent) string { - switch { - case evt.Error != nil: - return "ERROR" - case evt.RepoCommit != nil: - return "#commit" - case evt.RepoHandle != nil: - return "#handle" - case evt.RepoInfo != nil: - return "#info" - case evt.RepoMigrate != nil: - return "#migrate" - case evt.RepoTombstone != nil: - return "#tombstone" - default: - return "unknown" - } -} - -func sameCommit(a, b *comatproto.SyncSubscribeRepos_Commit) bool { - return a.Repo == b.Repo && cidStr(a.Prev) == cidStr(b.Prev) -} - -func findEvt(evt *events.XRPCStreamEvent, list []*events.XRPCStreamEvent) int { - evtop := evtOp(evt) - - for i, oe := range list { - if evtop != evtOp(oe) { - continue - } - - switch { - case evt.RepoCommit != nil: - if sameCommit(evt.RepoCommit, oe.RepoCommit) { - return i - } - case evt.RepoHandle != nil: - panic("not handling handle updates yet") - case evt.RepoMigrate != nil: - panic("not handling repo migrates yet") - default: - panic("unhandled event type: " + evtop) - } - } - - return -1 -} diff --git a/cmd/gosky/sync.go b/cmd/gosky/sync.go index 357131a10..c076708e4 100644 --- a/cmd/gosky/sync.go +++ b/cmd/gosky/sync.go @@ -1,16 +1,15 @@ package main import ( - "context" "fmt" "os" - comatproto "github.com/bluesky-social/indigo/api/atproto" + cli "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/util/cliutil" - - cli "github.com/urfave/cli/v2" ) var syncCmd = &cli.Command{ @@ -33,7 +32,7 @@ var syncGetRepoCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context arg := cctx.Args().First() if arg == "" { return fmt.Errorf("at-identifier arg is required") @@ -67,7 +66,7 @@ var syncGetRepoCmd = &cli.Command{ } log.Info("downloading", "from", xrpcc.Host, "to", carPath) - repoBytes, err := comatproto.SyncGetRepo(ctx, xrpcc, ident.DID.String(), "") + repoBytes, err := atproto.SyncGetRepo(ctx, xrpcc, ident.DID.String(), "") if err != nil { return err } @@ -90,7 +89,7 @@ var syncGetRootCmd = &cli.Command{ return err } - ctx := context.TODO() + ctx := cctx.Context atid, err := syntax.ParseAtIdentifier(cctx.Args().First()) if err != nil { @@ -103,17 +102,12 @@ var syncGetRootCmd = &cli.Command{ return err } - carPath := cctx.Args().Get(1) - if carPath == "" { - carPath = ident.DID.String() + ".car" - } - xrpcc.Host = ident.PDSEndpoint() if xrpcc.Host == "" { return fmt.Errorf("no PDS endpoint for identity") } - root, err := comatproto.SyncGetHead(ctx, xrpcc, cctx.Args().First()) + root, err := atproto.SyncGetHead(ctx, xrpcc, cctx.Args().First()) if err != nil { return err } @@ -134,7 +128,7 @@ var syncListReposCmd = &cli.Command{ var curs string for { - out, err := comatproto.SyncListRepos(context.TODO(), xrpcc, curs, 1000) + out, err := atproto.SyncListRepos(cctx.Context, xrpcc, curs, 1000) if err != nil { return err } diff --git a/cmd/hepa/main.go b/cmd/hepa/main.go index 9e3029b6c..1c83b4362 100644 --- a/cmd/hepa/main.go +++ b/cmd/hepa/main.go @@ -1,7 +1,6 @@ package main import ( - "context" "encoding/json" "fmt" "io" @@ -248,7 +247,7 @@ var runCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context logger := configLogger(cctx, os.Stdout) configOTEL("hepa") @@ -388,7 +387,7 @@ var processRecordCmd = &cli.Command{ ArgsUsage: ``, Flags: []cli.Flag{}, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context uriArg := cctx.Args().First() if uriArg == "" { return fmt.Errorf("expected a single AT-URI argument") @@ -419,7 +418,7 @@ var processRecentCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context idArg := cctx.Args().First() if idArg == "" { return fmt.Errorf("expected a single AT identifier (handle or DID) argument") @@ -450,7 +449,7 @@ var captureRecentCmd = &cli.Command{ }, }, Action: func(cctx *cli.Context) error { - ctx := context.Background() + ctx := cctx.Context idArg := cctx.Args().First() if idArg == "" { return fmt.Errorf("expected a single AT identifier (handle or DID) argument") diff --git a/cmd/hepa/otel.go b/cmd/hepa/otel.go index b551325c2..231d2d9e5 100644 --- a/cmd/hepa/otel.go +++ b/cmd/hepa/otel.go @@ -15,8 +15,6 @@ import ( semconv "go.opentelemetry.io/otel/semconv/v1.4.0" ) -var tracer = otel.Tracer("hepa") - // Enable OTLP HTTP exporter // For relevant environment variables: // https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace#readme-environment-variables @@ -34,7 +32,7 @@ func configOTEL(serviceName string) { log.Fatal("failed to create trace exporter", "error", err) } defer func() { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() if err := exp.Shutdown(ctx); err != nil { slog.Error("failed to shutdown trace exporter", "error", err) diff --git a/cmd/laputa/main.go b/cmd/laputa/main.go index 54da0a429..2b9d883aa 100644 --- a/cmd/laputa/main.go +++ b/cmd/laputa/main.go @@ -4,16 +4,8 @@ import ( "os" "path/filepath" - "github.com/bluesky-social/indigo/api" - "github.com/bluesky-social/indigo/carstore" - "github.com/bluesky-social/indigo/pds" - "github.com/bluesky-social/indigo/plc" - "github.com/bluesky-social/indigo/util/cliutil" - - _ "github.com/joho/godotenv/autoload" - _ "go.uber.org/automaxprocs" - "github.com/carlmjohnson/versioninfo" + _ "github.com/joho/godotenv/autoload" "github.com/urfave/cli/v2" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -21,7 +13,14 @@ import ( "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.4.0" + _ "go.uber.org/automaxprocs" "gorm.io/plugin/opentelemetry/tracing" + + "github.com/bluesky-social/indigo/api" + "github.com/bluesky-social/indigo/carstore" + "github.com/bluesky-social/indigo/pds" + "github.com/bluesky-social/indigo/plc" + "github.com/bluesky-social/indigo/util/cliutil" ) func main() { diff --git a/cmd/netsync/main.go b/cmd/netsync/main.go index 98d23a626..6cecefb83 100644 --- a/cmd/netsync/main.go +++ b/cmd/netsync/main.go @@ -541,7 +541,7 @@ func (s *NetsyncState) cloneRepo(ctx context.Context, did string) (cloneState st r, err := repo.ReadRepoFromCar(ctx, instrumentedReader) if err != nil { log.Error("Error reading repo", "err", err) - return "failed (read-repo)", fmt.Errorf("Failed to read repo from CAR: %w", err) + return "failed (read-repo)", fmt.Errorf("failed to read repo from CAR: %w", err) } err = r.ForEach(ctx, "", func(path string, nodeCid cid.Cid) error { @@ -576,13 +576,13 @@ func (s *NetsyncState) cloneRepo(ctx context.Context, did string) (cloneState st asCbor, err := data.UnmarshalCBOR(*rec) if err != nil { log.Error("Error unmarshalling record", "err", err) - return fmt.Errorf("Failed to unmarshal record: %w", err) + return fmt.Errorf("failed to unmarshal record: %w", err) } recJSON, err := json.Marshal(asCbor) if err != nil { log.Error("Error marshalling record to JSON", "err", err) - return fmt.Errorf("Failed to marshal record to JSON: %w", err) + return fmt.Errorf("failed to marshal record to JSON: %w", err) } // Write the record directly to the tar.gz file @@ -604,7 +604,7 @@ func (s *NetsyncState) cloneRepo(ctx context.Context, did string) (cloneState st }) if err != nil { log.Error("Error during ForEach", "err", err) - return "failed (for-each)", fmt.Errorf("Error during ForEach: %w", err) + return "failed (for-each)", fmt.Errorf("error during ForEach: %w", err) } log.Info("checkout complete", "numRecords", numRecords, "numCollections", len(collectionsSeen)) diff --git a/cmd/palomar/main.go b/cmd/palomar/main.go index 0485b243c..556ef7cad 100644 --- a/cmd/palomar/main.go +++ b/cmd/palomar/main.go @@ -12,7 +12,11 @@ import ( "strings" "time" + "github.com/bobg/errors" + "github.com/carlmjohnson/versioninfo" _ "github.com/joho/godotenv/autoload" + es "github.com/opensearch-project/opensearch-go/v2" + "github.com/urfave/cli/v2" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" @@ -24,10 +28,6 @@ import ( "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/search" "github.com/bluesky-social/indigo/util/cliutil" - - "github.com/carlmjohnson/versioninfo" - es "github.com/opensearch-project/opensearch-go/v2" - cli "github.com/urfave/cli/v2" ) func main() { @@ -217,7 +217,7 @@ var runCmd = &cli.Command{ // OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 if ep := os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT"); ep != "" { slog.Info("setting up trace exporter", "endpoint", ep) - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(cctx.Context) defer cancel() exp, err := otlptracehttp.New(ctx) @@ -225,7 +225,7 @@ var runCmd = &cli.Command{ log.Fatal("failed to create trace exporter", "error", err) } defer func() { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + ctx, cancel := context.WithTimeout(cctx.Context, time.Second) defer cancel() if err := exp.Shutdown(ctx); err != nil { slog.Error("failed to shutdown trace exporter", "error", err) @@ -309,36 +309,36 @@ var runCmd = &cli.Command{ srv.RunAPI(cctx.String("bind")) }() - // If we're in readonly mode, just block forever - if readonly { - select {} - } else if cctx.String("pagerank-file") != "" && srv.Indexer != nil { + ctx := cctx.Context + + switch { + case readonly: + // If we're in readonly mode, just block forever (or until the context is canceled) + <-ctx.Done() + return ctx.Err() + + case cctx.String("pagerank-file") != "" && srv.Indexer != nil: // If we're not in readonly mode, and we have a pagerank file, update pageranks - ctx := context.Background() - if err := srv.Indexer.BulkIndexPageranks(ctx, cctx.String("pagerank-file")); err != nil { - return fmt.Errorf("failed to update pageranks: %w", err) - } - } else if cctx.String("bulk-posts-file") != "" && srv.Indexer != nil { + err := srv.Indexer.BulkIndexPageranks(ctx, cctx.String("pagerank-file")) + return errors.Wrap(err, "failed to update pageranks") + + case cctx.String("bulk-posts-file") != "" && srv.Indexer != nil: // If we're not in readonly mode, and we have a bulk posts file, index posts - ctx := context.Background() - if err := srv.Indexer.BulkIndexPosts(ctx, cctx.String("bulk-posts-file")); err != nil { - return fmt.Errorf("failed to bulk index posts: %w", err) - } - } else if cctx.String("bulk-profiles-file") != "" && srv.Indexer != nil { + err := srv.Indexer.BulkIndexPosts(ctx, cctx.String("bulk-posts-file")) + return errors.Wrap(err, "failed to bulk index posts") + + case cctx.String("bulk-profiles-file") != "" && srv.Indexer != nil: // If we're not in readonly mode, and we have a bulk profiles file, index profiles - ctx := context.Background() - if err := srv.Indexer.BulkIndexProfiles(ctx, cctx.String("bulk-profiles-file")); err != nil { - return fmt.Errorf("failed to bulk index profiles: %w", err) - } - } else if srv.Indexer != nil { + err := srv.Indexer.BulkIndexProfiles(ctx, cctx.String("bulk-profiles-file")) + return errors.Wrap(err, "failed to bulk index profiles") + + case srv.Indexer != nil: // Otherwise, just run the indexer - ctx := context.Background() if err := srv.Indexer.EnsureIndices(ctx); err != nil { - return fmt.Errorf("failed to create opensearch indices: %w", err) - } - if err := srv.Indexer.RunIndexer(ctx); err != nil { - return fmt.Errorf("failed to run indexer: %w", err) + return errors.Wrap(err, "failed to create opensearch indices") } + err := srv.Indexer.RunIndexer(ctx) + return errors.Wrap(err, "failed to run indexer") } return nil @@ -386,7 +386,6 @@ func printHits(resp *search.EsSearchResponse) { b, _ := json.Marshal(hit.Source) fmt.Println(string(b)) } - return } var searchPostCmd = &cli.Command{ @@ -398,7 +397,7 @@ var searchPostCmd = &cli.Command{ return err } res, err := search.DoSearchPosts( - context.Background(), + cctx.Context, identity.DefaultDirectory(), // TODO: parse PLC arg escli, cctx.String("es-post-index"), @@ -431,7 +430,7 @@ var searchProfileCmd = &cli.Command{ } if cctx.Bool("typeahead") { res, err := search.DoSearchProfilesTypeahead( - context.Background(), + cctx.Context, escli, cctx.String("es-profile-index"), &search.ActorSearchParams{ @@ -445,7 +444,7 @@ var searchProfileCmd = &cli.Command{ printHits(res) } else { res, err := search.DoSearchProfiles( - context.Background(), + cctx.Context, identity.DefaultDirectory(), // TODO: parse PLC arg escli, cctx.String("es-profile-index"), diff --git a/cmd/querycheck/main.go b/cmd/querycheck/main.go index f0c5c1c00..b4f5bb080 100644 --- a/cmd/querycheck/main.go +++ b/cmd/querycheck/main.go @@ -5,26 +5,22 @@ import ( "fmt" "log" "log/slog" + "net/http" + _ "net/http/pprof" "os" "os/signal" "sync" "syscall" - "net/http" - _ "net/http/pprof" - - "github.com/bluesky-social/indigo/querycheck" - "github.com/bluesky-social/indigo/util/tracing" + "github.com/carlmjohnson/versioninfo" "github.com/labstack/echo-contrib/pprof" "github.com/labstack/echo/v4" - "github.com/labstack/echo/v4/middleware" - "github.com/prometheus/client_golang/prometheus/promhttp" - "go.opentelemetry.io/otel/trace" - - "github.com/carlmjohnson/versioninfo" "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/querycheck" + "github.com/bluesky-social/indigo/util/tracing" ) func main() { @@ -63,8 +59,6 @@ func main() { } } -var tracer trace.Tracer - // Querycheck is the main function for querycheck func Querycheck(cctx *cli.Context) error { ctx := cctx.Context diff --git a/cmd/stress/main.go b/cmd/stress/main.go index 09288a0f8..598ba56e2 100644 --- a/cmd/stress/main.go +++ b/cmd/stress/main.go @@ -1,7 +1,6 @@ package main import ( - "context" "crypto/rand" "encoding/hex" "fmt" @@ -9,25 +8,23 @@ import ( "sync" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" - appbsky "github.com/bluesky-social/indigo/api/bsky" - "github.com/bluesky-social/indigo/carstore" - lexutil "github.com/bluesky-social/indigo/lex/util" - "github.com/bluesky-social/indigo/repo" - "github.com/bluesky-social/indigo/testing" - "github.com/bluesky-social/indigo/util/cliutil" - "github.com/bluesky-social/indigo/xrpc" - + "github.com/carlmjohnson/versioninfo" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" cbor "github.com/ipfs/go-ipld-cbor" - - _ "github.com/joho/godotenv/autoload" - - "github.com/carlmjohnson/versioninfo" "github.com/ipld/go-car" + _ "github.com/joho/godotenv/autoload" cli "github.com/urfave/cli/v2" + + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/api/bsky" + "github.com/bluesky-social/indigo/carstore" + lexutil "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/repo" + "github.com/bluesky-social/indigo/testing" + "github.com/bluesky-social/indigo/util/cliutil" + "github.com/bluesky-social/indigo/xrpc" ) func main() { @@ -79,10 +76,12 @@ var postingCmd = &cli.Command{ return err } - count := cctx.Int("count") - concurrent := cctx.Int("concurrent") - quiet := cctx.Bool("quiet") - ctx := context.TODO() + var ( + count = cctx.Int("count") + concurrent = cctx.Int("concurrent") + quiet = cctx.Bool("quiet") + ctx = cctx.Context + ) buf := make([]byte, 6) rand.Read(buf) @@ -93,7 +92,7 @@ var postingCmd = &cli.Command{ invite = &inv } - cfg, err := comatproto.ServerDescribeServer(ctx, xrpcc) + cfg, err := atproto.ServerDescribeServer(ctx, xrpcc) if err != nil { return err } @@ -103,7 +102,7 @@ var postingCmd = &cli.Command{ email := fmt.Sprintf("user-%s@test.com", id) pass := "password" - resp, err := comatproto.ServerCreateAccount(ctx, xrpcc, &comatproto.ServerCreateAccount_Input{ + resp, err := atproto.ServerCreateAccount(ctx, xrpcc, &atproto.ServerCreateAccount_Input{ Email: &email, Handle: "user-" + id + domain, Password: &pass, @@ -129,10 +128,10 @@ var postingCmd = &cli.Command{ buf := make([]byte, 100) rand.Read(buf) - res, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ + res, err := atproto.RepoCreateRecord(ctx, xrpcc, &atproto.RepoCreateRecord_Input{ Collection: "app.bsky.feed.post", Repo: xrpcc.Auth.Did, - Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{ + Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedPost{ Text: hex.EncodeToString(buf), CreatedAt: time.Now().Format(time.RFC3339), }}, @@ -180,7 +179,7 @@ var genRepoCmd = &cli.Command{ membs := blockstore.NewBlockstore(datastore.NewMapDatastore()) - ctx := context.Background() + ctx := cctx.Context r := repo.NewRepo(ctx, "did:plc:foobar", membs) diff --git a/cmd/supercollider/main.go b/cmd/supercollider/main.go index 1c64e71d3..926b0cdd4 100644 --- a/cmd/supercollider/main.go +++ b/cmd/supercollider/main.go @@ -7,6 +7,8 @@ import ( "log" "log/slog" "net" + "net/http" + _ "net/http/pprof" "os" "os/signal" "path/filepath" @@ -15,41 +17,36 @@ import ( "syscall" "time" - "net/http" - _ "net/http/pprof" - - "github.com/bluesky-social/indigo/api/atproto" - comatproto "github.com/bluesky-social/indigo/api/atproto" - "github.com/bluesky-social/indigo/api/bsky" - "github.com/bluesky-social/indigo/carstore" - "github.com/bluesky-social/indigo/did" - "github.com/bluesky-social/indigo/events" - "github.com/bluesky-social/indigo/indexer" - "github.com/bluesky-social/indigo/models" - "github.com/bluesky-social/indigo/plc" + "github.com/carlmjohnson/versioninfo" petname "github.com/dustinkirkland/golang-petname" + "github.com/gorilla/websocket" "github.com/icrowley/fake" "github.com/labstack/echo-contrib/pprof" - "github.com/urfave/cli/v2" - godid "github.com/whyrusleeping/go-did" - "golang.org/x/crypto/acme/autocert" - "golang.org/x/time/rate" - - lexutil "github.com/bluesky-social/indigo/lex/util" - "github.com/bluesky-social/indigo/repomgr" - "github.com/bluesky-social/indigo/util" - "github.com/gorilla/websocket" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/urfave/cli/v2" + cbg "github.com/whyrusleeping/cbor-gen" + godid "github.com/whyrusleeping/go-did" _ "go.uber.org/automaxprocs" + "golang.org/x/crypto/acme/autocert" + "golang.org/x/time/rate" "gorm.io/driver/sqlite" "gorm.io/gorm" - "github.com/carlmjohnson/versioninfo" - cbg "github.com/whyrusleeping/cbor-gen" + "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/api/bsky" + "github.com/bluesky-social/indigo/carstore" + "github.com/bluesky-social/indigo/did" + "github.com/bluesky-social/indigo/events" + "github.com/bluesky-social/indigo/indexer" + lexutil "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/models" + "github.com/bluesky-social/indigo/plc" + "github.com/bluesky-social/indigo/repomgr" + "github.com/bluesky-social/indigo/util" ) var eventsGeneratedCounter = promauto.NewCounter(prometheus.CounterOpts{ @@ -164,7 +161,7 @@ func main() { }, } - err := app.Run(os.Args) + err := app.RunContext(ctx, os.Args) if err != nil { log.Fatal(err) } @@ -586,10 +583,10 @@ func initSpeedyRepoMan(key *godid.PrivKey) (*repomgr.RepoManager, *godid.PrivKey // HandleRepoEvent is the callback for the RepoManager func (s *Server) HandleRepoEvent(ctx context.Context, evt *repomgr.RepoEvent) { - outops := make([]*comatproto.SyncSubscribeRepos_RepoOp, 0, len(evt.Ops)) + outops := make([]*atproto.SyncSubscribeRepos_RepoOp, 0, len(evt.Ops)) for _, op := range evt.Ops { link := (*lexutil.LexLink)(op.RecCid) - outops = append(outops, &comatproto.SyncSubscribeRepos_RepoOp{ + outops = append(outops, &atproto.SyncSubscribeRepos_RepoOp{ Path: op.Collection + "/" + op.Rkey, Action: string(op.Kind), Cid: link, @@ -597,7 +594,7 @@ func (s *Server) HandleRepoEvent(ctx context.Context, evt *repomgr.RepoEvent) { } if err := s.Events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoCommit: &comatproto.SyncSubscribeRepos_Commit{ + RepoCommit: &atproto.SyncSubscribeRepos_Commit{ Repo: s.Dids[evt.User-1], Prev: (*lexutil.LexLink)(evt.OldRoot), Blocks: evt.RepoSlice, @@ -651,7 +648,6 @@ func (s *Server) EventGenerationLoop(ctx context.Context, cancel context.CancelF } s.Logger.Info("event generation complete, shutting down") - return } // ATProto Handlers for DID Web diff --git a/did/web.go b/did/web.go index baea42e6c..0e73697e0 100644 --- a/did/web.go +++ b/did/web.go @@ -71,9 +71,7 @@ var disallowedTlds = map[string]bool{ "internal": true, } -func (wr *WebResolver) FlushCacheFor(did string) { - return -} +func (wr *WebResolver) FlushCacheFor(did string) {} func checkValidDidWeb(val string) error { // no ports or ipv6 diff --git a/events/diskpersist.go b/events/diskpersist.go index 43778fe45..bbd26e01a 100644 --- a/events/diskpersist.go +++ b/events/diskpersist.go @@ -58,11 +58,6 @@ type persistJob struct { Buffer *bytes.Buffer // so we can put it back in the pool when we're done } -type jobResult struct { - Err error - Seq int64 -} - const ( EvtFlagTakedown = 1 << iota EvtFlagRebased @@ -597,25 +592,6 @@ func readHeader(r io.Reader, scratch []byte) (*evtHeader, error) { }, nil } -func (dp *DiskPersistence) writeHeader(ctx context.Context, flags uint32, kind uint32, l uint32, usr uint64, seq int64) error { - binary.LittleEndian.PutUint32(dp.scratch, flags) - binary.LittleEndian.PutUint32(dp.scratch[4:], kind) - binary.LittleEndian.PutUint32(dp.scratch[8:], l) - binary.LittleEndian.PutUint64(dp.scratch[12:], usr) - binary.LittleEndian.PutUint64(dp.scratch[20:], uint64(seq)) - - nw, err := dp.logfi.Write(dp.scratch) - if err != nil { - return err - } - - if nw != headerSize { - return fmt.Errorf("only wrote %d bytes for header", nw) - } - - return nil -} - func (dp *DiskPersistence) uidForDid(ctx context.Context, did string) (models.Uid, error) { if uid, ok := dp.didCache.Get(did); ok { return uid, nil @@ -677,11 +653,7 @@ func (dp *DiskPersistence) PlaybackLogfiles(ctx context.Context, since int64, cb } func postDoNotEmit(flags uint32) bool { - if flags&(EvtFlagRebased|EvtFlagTakedown) != 0 { - return true - } - - return false + return flags&(EvtFlagRebased|EvtFlagTakedown) != 0 } func (dp *DiskPersistence) readEventsFrom(ctx context.Context, since int64, fn string, cb func(*XRPCStreamEvent) error) (*int64, error) { diff --git a/events/events.go b/events/events.go index 5619fc20e..db6abf08f 100644 --- a/events/events.go +++ b/events/events.go @@ -51,17 +51,7 @@ func NewEventManager(persister EventPersistence) *EventManager { return em } -const ( - opSubscribe = iota - opUnsubscribe - opSend -) - -type Operation struct { - op int - sub *Subscriber - evt *XRPCStreamEvent -} +type Operation struct{} func (em *EventManager) Shutdown(ctx context.Context) error { return em.persister.Shutdown(ctx) diff --git a/events/pebblepersist.go b/events/pebblepersist.go index ff65387e3..0f998ec1c 100644 --- a/events/pebblepersist.go +++ b/events/pebblepersist.go @@ -5,12 +5,13 @@ import ( "context" "encoding/binary" "encoding/hex" - "errors" "fmt" "time" - "github.com/bluesky-social/indigo/models" + "github.com/bobg/errors" "github.com/cockroachdb/pebble" + + "github.com/bluesky-social/indigo/models" ) type PebblePersist struct { @@ -165,13 +166,18 @@ var ErrNoLast = errors.New("no last event") func (pp *PebblePersist) GetLast(ctx context.Context) (seq, millis int64, evt *XRPCStreamEvent, err error) { iter, err := pp.db.NewIterWithContext(ctx, &pebble.IterOptions{}) if err != nil { - return 0, 0, nil, err + return 0, 0, nil, errors.Wrap(err, "in NewIterWithContext") } ok := iter.Last() if !ok { return 0, 0, nil, ErrNoLast } + evt, err = eventFromPebbleIter(iter) + if err != nil { + return 0, 0, nil, errors.Wrap(err, "in eventFromPebbleIter") + } + keyblob := iter.Key() seq = int64(binary.BigEndian.Uint64(keyblob[:8])) millis = int64(binary.BigEndian.Uint64(keyblob[8:16])) diff --git a/events/schedulers/autoscaling/autoscaling.go b/events/schedulers/autoscaling/autoscaling.go index f842b8ad0..837d09129 100644 --- a/events/schedulers/autoscaling/autoscaling.go +++ b/events/schedulers/autoscaling/autoscaling.go @@ -165,7 +165,6 @@ type consumerTask struct { repo string val *events.XRPCStreamEvent signal string - wg *sync.WaitGroup } func (p *Scheduler) AddWork(ctx context.Context, repo string, val *events.XRPCStreamEvent) error { diff --git a/events/schedulers/sequential/sequential.go b/events/schedulers/sequential/sequential.go index 77d8087e4..e58562765 100644 --- a/events/schedulers/sequential/sequential.go +++ b/events/schedulers/sequential/sequential.go @@ -2,13 +2,13 @@ package sequential import ( "context" + + "github.com/prometheus/client_golang/prometheus" + "github.com/bluesky-social/indigo/events" "github.com/bluesky-social/indigo/events/schedulers" - "github.com/prometheus/client_golang/prometheus" ) -// var log = slog.Default().With("system", "sequential-scheduler") - // Scheduler is a sequential scheduler that will run work on a single worker type Scheduler struct { Do func(context.Context, *events.XRPCStreamEvent) error diff --git a/go.mod b/go.mod index ff1c8ee77..7af3fc3d4 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,11 @@ module github.com/bluesky-social/indigo go 1.22 require ( - contrib.go.opencensus.io/exporter/prometheus v0.4.2 github.com/PuerkitoBio/purell v1.2.1 github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b github.com/adrg/xdg v0.5.0 github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de + github.com/bobg/errors v1.1.0 github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 github.com/brianvoe/gofakeit/v6 v6.25.0 github.com/carlmjohnson/versioninfo v0.22.5 @@ -62,7 +62,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 go.uber.org/automaxprocs v1.5.3 golang.org/x/crypto v0.21.0 golang.org/x/sync v0.7.0 @@ -103,6 +102,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect ) @@ -117,12 +117,9 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/uuid v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect @@ -161,7 +158,6 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - github.com/prometheus/statsd_exporter v0.25.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/samber/lo v1.38.1 // indirect github.com/segmentio/asm v1.2.0 // indirect @@ -170,7 +166,6 @@ require ( github.com/valyala/fasttemplate v1.2.2 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.45.0 go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect @@ -183,7 +178,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.33.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect ) diff --git a/go.sum b/go.sum index b72fdce5b..7208e6703 100644 --- a/go.sum +++ b/go.sum @@ -1,40 +1,4 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= -contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28= @@ -43,12 +7,6 @@ github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b h1:5/++qT github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b/go.mod h1:4+EPqMRApwwE/6yo6CxiHoSnBzjRr3jsqer7frxP8y4= github.com/adrg/xdg v0.5.0 h1:dDaZvhMXatArP1NPHhnfaQUqWBLBsmx1h1HXQdMoFCY= github.com/adrg/xdg v0.5.0/go.mod h1:dDdY4M4DF9Rjy4kHPeNL+ilVF+p2lK8IdM9/rTSGcI4= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5 h1:iW0a5ljuFxkLGPNem5Ui+KBjFJzKg4Fv2fnxe4dvzpM= github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5/go.mod h1:Y2QMoi1vgtOIfc+6DhrMOGkLoGzqSV2rKp4Sm+opsyA= github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA= @@ -69,10 +27,10 @@ github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bobg/errors v1.1.0 h1:gsVanPzJMpZQpwY+27/GQYElZez5CuMYwiIpk2A3RGw= +github.com/bobg/errors v1.1.0/go.mod h1:Q4775qBZpnte7EGFJqmvnlB1U4pkI1XmU3qxqdp7Zcc= github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8bttX0bfZGmcGkjz7DLQXhAn3DNd3T0ous= github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c= github.com/brianvoe/gofakeit/v6 v6.25.0 h1:ZpFjktOpLZUeF8q223o0rUuXtA+m5qW5srjvVi+JkXk= @@ -85,16 +43,12 @@ github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQj github.com/carlmjohnson/versioninfo v0.22.5/go.mod h1:QT9mph3wcVfISUKd0i9sZfVrPviHuSF+cUtLjm2WSf8= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= @@ -127,10 +81,6 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dustinkirkland/golang-petname v0.0.0-20231002161417-6a283f1aaaf2 h1:S6Dco8FtAhEI/qkg/00H6RdEGC+MCy5GPiQ+xweNRFE= github.com/dustinkirkland/golang-petname v0.0.0-20231002161417-6a283f1aaaf2/go.mod h1:8AuBTZBRSFqEYBPYULd+NN474/zZBLP+6WeT5S9xlAc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flosch/pongo2/v6 v6.0.0 h1:lsGru8IAzHgIAw6H2m4PCyleO58I40ow6apih0WprMU= @@ -144,21 +94,6 @@ github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= -github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= @@ -169,86 +104,43 @@ github.com/go-redis/cache/v9 v9.0.0 h1:0thdtFo0xJi0/WXbRVu8B066z8OvVymXTJGaXrVWn github.com/go-redis/cache/v9 v9.0.0/go.mod h1:cMwi1N8ASBOufbIvk7cdXe2PbPjK/WMRL95FFHWsSgI= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= @@ -261,8 +153,6 @@ github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxC github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/arc/v2 v2.0.6 h1:4NU7uP5vSoK6TbaMj3NtY478TTAWLso/vL1gpNrInHg= @@ -272,7 +162,6 @@ github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyf github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/icrowley/fake v0.0.0-20221112152111-d7b7e2276db2 h1:qU3v73XG4QAqCPHA4HOpfC1EfUvtLIDvQK4mNQ0LvgI= github.com/icrowley/fake v0.0.0-20221112152111-d7b7e2276db2/go.mod h1:dQ6TM/OGAe+cMws81eTe4Btv1dKxfPZ2CX+YaAFAPN4= @@ -374,17 +263,8 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -393,11 +273,8 @@ github.com/klauspost/compress v1.17.3 h1:qkRjuerhUU1EmXLYGkSH6EZL+vPSxIrYjLNAK4s github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8= github.com/koron/go-ssdp v0.0.3/go.mod h1:b2MxI6yh02pKrsyNoQUsk4+YNikaGhe4894J+Q5lDvA= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -455,18 +332,12 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= @@ -489,8 +360,6 @@ github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3d github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -529,7 +398,6 @@ github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9/go.mod h1:x3N5drFsm2u github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -539,40 +407,14 @@ github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f h1:VXTQfuJj9vKR4 github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI= -github.com/prometheus/statsd_exporter v0.25.0 h1:gpVF1TMf1UqMJmBDpzBYrEaGOFMpbMBYYYUDwM38Y/I= -github.com/prometheus/statsd_exporter v0.25.0/go.mod h1:HwzfSvg6ehmb0Qg71ZuFrlgj5XQt9C+MGVLz5Gt5lqc= github.com/puzpuzpuz/xsync/v3 v3.0.2 h1:3yESHrRFYr6xzkz61LLkvNiPFXxJEAABanTQpKbAaew= github.com/puzpuzpuz/xsync/v3 v3.0.2/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= github.com/redis/go-redis/v9 v9.0.0-rc.4/go.mod h1:Vo3EsyWnicKnSKCA7HhgnvnyA74wOA69Cd2Meli5mmA= @@ -596,9 +438,6 @@ github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7 github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= @@ -606,7 +445,6 @@ github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3 github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= @@ -624,7 +462,6 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= @@ -653,9 +490,7 @@ github.com/whyrusleeping/go-did v0.0.0-20230824162731-404d1707d5d6 h1:yJ9/LwIGIk github.com/whyrusleeping/go-did v0.0.0-20230824162731-404d1707d5d6/go.mod h1:39U9RRVr4CKbXpXYopWn+FSH5s+vWu6+RmguSPWAq5s= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -664,14 +499,6 @@ gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRyS gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.45.0 h1:JJCIHAxGCB5HM3NxeIwFjHc087Xwk96TG9kaZU6TAec= go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.45.0/go.mod h1:Px9kH7SJ+NhsgWRtD/eMcs15Tyt4uL3rM7X54qv6pfA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= @@ -715,10 +542,8 @@ go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -726,36 +551,10 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -766,44 +565,17 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -816,82 +588,37 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -913,10 +640,7 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -928,56 +652,17 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -994,76 +679,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY= google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI= google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1071,18 +692,12 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1092,10 +707,8 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -1112,15 +725,6 @@ gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8= gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/plugin/opentelemetry v0.1.3 h1:z6QgEBef/+4S6D00+jUeRPreI0LAf7Idfqe3dz3TWKg= gorm.io/plugin/opentelemetry v0.1.3/go.mod h1:tndJHOdvPT0pyGhOb8E2209eXJCUxhC5UpKw7bGVWeI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/indexer/crawler.go b/indexer/crawler.go index 526da9bb6..70a45f22f 100644 --- a/indexer/crawler.go +++ b/indexer/crawler.go @@ -218,16 +218,14 @@ func (c *CrawlDispatcher) addToCatchupQueue(catchup *catchupJob) *crawlWork { } func (c *CrawlDispatcher) fetchWorker() { - for { - select { - case job := <-c.repoSync: - if err := c.doRepoCrawl(context.TODO(), job); err != nil { - c.log.Error("failed to perform repo crawl", "did", job.act.Did, "err", err) - } - - // TODO: do we still just do this if it errors? - c.complete <- job.act.Uid + // TODO: plumb a context object into this function and use select{} to multiplex its Done channel with c.repoSync + for job := range c.repoSync { + if err := c.doRepoCrawl(context.TODO(), job); err != nil { + c.log.Error("failed to perform repo crawl", "did", job.act.Did, "err", err) } + + // TODO: do we still just do this if it errors? + c.complete <- job.act.Uid } } diff --git a/indexer/indexer.go b/indexer/indexer.go index 2c3a2b53d..fbd7b2b87 100644 --- a/indexer/indexer.go +++ b/indexer/indexer.go @@ -2,7 +2,6 @@ package indexer import ( "context" - "database/sql" "errors" "fmt" "log/slog" @@ -346,39 +345,8 @@ func (ix *Indexer) LookupUserByHandle(ctx context.Context, handle string) (*mode return &ai, nil } -func (ix *Indexer) handleInitActor(ctx context.Context, evt *repomgr.RepoEvent, op *repomgr.RepoOp) error { - ai := op.ActorInfo - - if err := ix.db.Clauses(clause.OnConflict{ - Columns: []clause.Column{{Name: "uid"}}, - UpdateAll: true, - }).Create(&models.ActorInfo{ - Uid: evt.User, - Handle: sql.NullString{String: ai.Handle, Valid: true}, - Did: ai.Did, - DisplayName: ai.DisplayName, - Type: ai.Type, - PDS: evt.PDS, - }).Error; err != nil { - return fmt.Errorf("initializing new actor info: %w", err) - } - - if err := ix.db.Create(&models.FollowRecord{ - Follower: evt.User, - Target: evt.User, - }).Error; err != nil { - return err - } - - return nil -} - func isNotFound(err error) bool { - if errors.Is(err, gorm.ErrRecordNotFound) { - return true - } - - return false + return errors.Is(err, gorm.ErrRecordNotFound) } func (ix *Indexer) GetPost(ctx context.Context, uri string) (*models.FeedPost, error) { diff --git a/lex/gen.go b/lex/gen.go index 29447bb53..990d12e78 100644 --- a/lex/gen.go +++ b/lex/gen.go @@ -89,7 +89,7 @@ func FixRecordReferences(schemas []*Schema, defmap map[string]*ExtDef, prefix st r = s.ID + r } - if _, known := defmap[r]; known != true { + if _, known := defmap[r]; !known { panic(fmt.Sprintf("reference to unknown record type: %s", r)) } diff --git a/lex/util/lex_types_test.go b/lex/util/lex_types_test.go index 173ea9b24..76413cd80 100644 --- a/lex/util/lex_types_test.go +++ b/lex/util/lex_types_test.go @@ -27,6 +27,9 @@ func TestBlobParse(t *testing.T) { } }` cidOne, err := cid.Decode("bafyreidfayvfuwqa7qlnopdjiqrxzs6blmoeu4rujcjtnci5beludirz2a") + if err != nil { + t.Fatal(err) + } goObj := blobSchema{ A: "abc", B: LexBlob{ diff --git a/mst/mst_test.go b/mst/mst_test.go index 6bd491781..d6947fa7b 100644 --- a/mst/mst_test.go +++ b/mst/mst_test.go @@ -4,27 +4,24 @@ import ( "context" "encoding/hex" "fmt" - "io" "maps" "math/rand" - "os" "regexp" "sort" "testing" - "github.com/bluesky-social/indigo/util" cid "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/ipld/go-car/v2" "github.com/multiformats/go-multihash" - mh "github.com/multiformats/go-multihash" + + "github.com/bluesky-social/indigo/util" ) func randCid() cid.Cid { buf := make([]byte, 32) rand.Read(buf) - c, err := cid.NewPrefixV1(cid.Raw, mh.SHA2_256).Sum(buf) + c, err := cid.NewPrefixV1(cid.Raw, multihash.SHA2_256).Sum(buf) if err != nil { panic(err) } @@ -113,44 +110,6 @@ func assertValues(t *testing.T, mst *MerkleSearchTree, vals map[string]cid.Cid) } } -func mustCid(t *testing.T, s string) cid.Cid { - t.Helper() - c, err := cid.Decode(s) - if err != nil { - t.Fatal(err) - } - return c - -} - -func loadCar(bs blockstore.Blockstore, fname string) error { - fi, err := os.Open(fname) - if err != nil { - return err - } - defer fi.Close() - br, err := car.NewBlockReader(fi) - if err != nil { - return err - } - - for { - blk, err := br.Next() - if err != nil { - if err == io.EOF { - break - } - return err - } - - if err := bs.Put(context.TODO(), blk); err != nil { - return err - } - } - - return nil -} - /* func TestDiff(t *testing.T) { to := mustCid(t, "bafyreie5cvv4h45feadgeuwhbcutmh6t2ceseocckahdoe6uat64zmz454") diff --git a/mst/mst_util.go b/mst/mst_util.go index fca3a636d..143745e2e 100644 --- a/mst/mst_util.go +++ b/mst/mst_util.go @@ -130,7 +130,7 @@ func serializeNodeData(entries []nodeEntry) (*nodeData, error) { leaf := entries[i] if !leaf.isLeaf() { - return nil, fmt.Errorf("Not a valid node: two subtrees next to each other (%d, %d)", i, len(entries)) + return nil, fmt.Errorf("not a valid node: two subtrees next to each other (%d, %d)", i, len(entries)) } i++ @@ -234,7 +234,7 @@ func isValidMstKey(s string) bool { // Typescript: ensureValidMstKey(str) func ensureValidMstKey(s string) error { if !isValidMstKey(s) { - return fmt.Errorf("Not a valid MST key: %s", s) + return fmt.Errorf("not a valid MST key: %s", s) } return nil } diff --git a/pds/auth.go b/pds/auth.go index 6da1924c7..79d941cef 100644 --- a/pds/auth.go +++ b/pds/auth.go @@ -47,23 +47,3 @@ func (s *Server) createAuthTokenForUser(ctx context.Context, handle, did string) Did: did, }, nil } - -func (s *Server) createCrossServerAuthToken(ctx context.Context, otherpds string) (*xrpc.AuthInfo, error) { - accessTok := makeToken(otherpds, "com.atproto.federation", time.Now().Add(24*time.Hour)) - - // setting this is a little weird, - // since the token isn't signed by this key, we dont have a way to validate... - accessTok.Set("pds", s.signingKey.Public().DID()) - - rval := make([]byte, 10) - rand.Read(rval) - - accSig, err := jwt.Sign(accessTok, jwt.WithKey(jwa.HS256, s.jwtSigningKey)) - if err != nil { - return nil, err - } - - return &xrpc.AuthInfo{ - AccessJwt: string(accSig), - }, nil -} diff --git a/pds/context.go b/pds/context.go new file mode 100644 index 000000000..4c66fe6c8 --- /dev/null +++ b/pds/context.go @@ -0,0 +1,60 @@ +package pds + +import ( + "context" + + "github.com/golang-jwt/jwt" +) + +type ( + ctxAuth struct{} + ctxAuthScope struct{} + ctxDID struct{} + ctxToken struct{} + ctxUser struct{} +) + +func withAuth(ctx context.Context, auth string) context.Context { + return context.WithValue(ctx, ctxAuth{}, auth) +} + +func getAuth(ctx context.Context) string { + auth, _ := ctx.Value(ctxAuth{}).(string) + return auth +} + +func withAuthScope(ctx context.Context, scope string) context.Context { + return context.WithValue(ctx, ctxAuthScope{}, scope) +} + +func getAuthScope(ctx context.Context) string { + scope, _ := ctx.Value(ctxAuthScope{}).(string) + return scope +} + +func withDID(ctx context.Context, did string) context.Context { + return context.WithValue(ctx, ctxDID{}, did) +} + +func getDID(ctx context.Context) string { + did, _ := ctx.Value(ctxDID{}).(string) + return did +} + +func withToken(ctx context.Context, token *jwt.Token) context.Context { + return context.WithValue(ctx, ctxToken{}, token) +} + +func getToken(ctx context.Context) *jwt.Token { + token, _ := ctx.Value(ctxToken{}).(*jwt.Token) + return token +} + +func withUser(ctx context.Context, user *User) context.Context { + return context.WithValue(ctx, ctxUser{}, user) +} + +func getUser(ctx context.Context) *User { + user, _ := ctx.Value(ctxUser{}).(*User) + return user +} diff --git a/pds/feedgen.go b/pds/feedgen.go index 9ad51387a..4b2a39cfd 100644 --- a/pds/feedgen.go +++ b/pds/feedgen.go @@ -184,7 +184,7 @@ func (fg *FeedGenerator) getPostViewerState(ctx context.Context, item uint, view } func (fg *FeedGenerator) GetTimeline(ctx context.Context, user *User, algo string, before string, limit int) ([]*bsky.FeedDefs_FeedViewPost, error) { - ctx, span := otel.Tracer("feedgen").Start(context.Background(), "GetTimeline") + ctx, span := otel.Tracer("feedgen").Start(ctx, "GetTimeline") defer span.End() // TODO: this query is just a temporary hack... @@ -243,7 +243,7 @@ func (fg *FeedGenerator) personalizeFeed(ctx context.Context, feed []*bsky.FeedD } func (fg *FeedGenerator) GetAuthorFeed(ctx context.Context, user *User, before string, limit int) ([]*bsky.FeedDefs_FeedViewPost, error) { - ctx, span := otel.Tracer("feedgen").Start(context.Background(), "GetAuthorFeed") + ctx, span := otel.Tracer("feedgen").Start(ctx, "GetAuthorFeed") defer span.End() // for memory efficiency, should probably return the actual type that goes out to the user... @@ -411,7 +411,7 @@ func (fg *FeedGenerator) GetFollows(ctx context.Context, user string, limit int, return nil, err } - out := []*FollowInfo{} + var out []*FollowInfo for _, f := range follows { fai, err := fg.getActorRefInfo(ctx, f.Target) if err != nil { @@ -427,5 +427,5 @@ func (fg *FeedGenerator) GetFollows(ctx context.Context, user string, limit int, } - return nil, nil + return out, nil } diff --git a/pds/handlers.go b/pds/handlers.go index 73827a429..dc6651140 100644 --- a/pds/handlers.go +++ b/pds/handlers.go @@ -7,11 +7,11 @@ import ( "fmt" "io" + "github.com/ipfs/go-cid" + comatprototypes "github.com/bluesky-social/indigo/api/atproto" lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/models" - "github.com/ipfs/go-cid" - "github.com/lestrrat-go/jwx/v2/jwt" ) func (s *Server) handleComAtprotoServerCreateAccount(ctx context.Context, body *comatprototypes.ServerCreateAccount_Input) (*comatprototypes.ServerCreateAccount_Output, error) { @@ -276,8 +276,8 @@ func (s *Server) handleComAtprotoServerRefreshSession(ctx context.Context) (*com return nil, err } - scope, ok := ctx.Value("authScope").(string) - if !ok { + scope := getAuthScope(ctx) + if scope == "" { return nil, fmt.Errorf("scope not present in refresh token") } @@ -285,8 +285,8 @@ func (s *Server) handleComAtprotoServerRefreshSession(ctx context.Context) (*com return nil, fmt.Errorf("auth token did not have refresh scope") } - tok, ok := ctx.Value("token").(*jwt.Token) - if !ok { + tok := getToken(ctx) + if tok == nil { return nil, fmt.Errorf("internal auth error: token not set post auth check") } @@ -308,10 +308,6 @@ func (s *Server) handleComAtprotoServerRefreshSession(ctx context.Context) (*com } -func (s *Server) handleComAtprotoSyncUpdateRepo(ctx context.Context, r io.Reader) error { - panic("not yet implemented") -} - func (s *Server) handleComAtprotoSyncGetCheckout(ctx context.Context, did string) (io.Reader, error) { panic("not yet implemented") } diff --git a/pds/server.go b/pds/server.go index da534518c..b996210f9 100644 --- a/pds/server.go +++ b/pds/server.go @@ -13,8 +13,15 @@ import ( "strings" "time" + "github.com/golang-jwt/jwt" + "github.com/gorilla/websocket" + "github.com/ipfs/go-cid" + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" + "github.com/whyrusleeping/go-did" + "gorm.io/gorm" + "github.com/bluesky-social/indigo/api/atproto" - comatproto "github.com/bluesky-social/indigo/api/atproto" bsky "github.com/bluesky-social/indigo/api/bsky" "github.com/bluesky-social/indigo/carstore" "github.com/bluesky-social/indigo/events" @@ -26,16 +33,7 @@ import ( "github.com/bluesky-social/indigo/plc" "github.com/bluesky-social/indigo/repomgr" "github.com/bluesky-social/indigo/util" - bsutil "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/xrpc" - gojwt "github.com/golang-jwt/jwt" - "github.com/gorilla/websocket" - "github.com/ipfs/go-cid" - "github.com/labstack/echo/v4" - "github.com/labstack/echo/v4/middleware" - "github.com/lestrrat-go/jwx/v2/jwt" - "github.com/whyrusleeping/go-did" - "gorm.io/gorm" ) type Server struct { @@ -124,32 +122,6 @@ func (s *Server) Shutdown(ctx context.Context) error { return s.echo.Shutdown(ctx) } -func (s *Server) handleFedEvent(ctx context.Context, host *Peering, env *events.XRPCStreamEvent) error { - fmt.Printf("[%s] got fed event from %q\n", s.serviceUrl, host.Host) - switch { - case env.RepoCommit != nil: - evt := env.RepoCommit - u, err := s.lookupUserByDid(ctx, evt.Repo) - if err != nil { - if !errors.Is(err, gorm.ErrRecordNotFound) { - return fmt.Errorf("looking up event user: %w", err) - } - - subj, err := s.createExternalUser(ctx, evt.Repo) - if err != nil { - return err - } - - u = new(User) - u.ID = subj.Uid - } - - return s.repoman.HandleExternalUserEvent(ctx, host.ID, u.ID, u.Did, evt.Since, evt.Rev, evt.Blocks, evt.Ops) - default: - return fmt.Errorf("invalid fed event") - } -} - func (s *Server) createExternalUser(ctx context.Context, did string) (*models.ActorInfo, error) { doc, err := s.plc.GetDocument(ctx, did) if err != nil { @@ -239,31 +211,6 @@ func (s *Server) createExternalUser(ctx context.Context, did string) (*models.Ac return subj, nil } -func (s *Server) repoEventToFedEvent(ctx context.Context, evt *repomgr.RepoEvent) (*comatproto.SyncSubscribeRepos_Commit, error) { - did, err := s.indexer.DidForUser(ctx, evt.User) - if err != nil { - return nil, err - } - - out := &comatproto.SyncSubscribeRepos_Commit{ - Prev: (*lexutil.LexLink)(evt.OldRoot), - Blocks: evt.RepoSlice, - Repo: did, - Time: time.Now().Format(bsutil.ISO8601), - //PrivUid: evt.User, - } - - for _, op := range evt.Ops { - out.Ops = append(out.Ops, &comatproto.SyncSubscribeRepos_RepoOp{ - Path: op.Collection + "/" + op.Rkey, - Action: string(op.Kind), - Cid: (*lexutil.LexLink)(op.RecCid), - }) - } - - return out, nil -} - func (s *Server) readRecordFunc(ctx context.Context, user models.Uid, c cid.Cid) (lexutil.CBOR, error) { bs, err := s.cs.ReadOnlySession(user) if err != nil { @@ -323,8 +270,8 @@ func (s *Server) RunAPIWithListener(listen net.Listener) error { did := c.Request().Header.Get("DID") ctx := c.Request().Context() - ctx = context.WithValue(ctx, "did", did) - ctx = context.WithValue(ctx, "auth", auth) + ctx = withDID(ctx, did) + ctx = withAuth(ctx, auth) c.SetRequest(c.Request().WithContext(ctx)) return true case "/.well-known/atproto-did": @@ -475,8 +422,8 @@ func toTime(i interface{}) (time.Time, error) { return time.Unix(int64(ival), 0), nil } -func (s *Server) checkTokenValidity(user *gojwt.Token) (string, string, error) { - claims, ok := user.Claims.(gojwt.MapClaims) +func (s *Server) checkTokenValidity(user *jwt.Token) (string, string, error) { + claims, ok := user.Claims.(jwt.MapClaims) if !ok { return "", "", fmt.Errorf("invalid token claims map") } @@ -565,15 +512,15 @@ func (s *Server) lookupUserByHandle(ctx context.Context, handle string) (*User, func (s *Server) userCheckMiddleware(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - ctx := c.Request().Context() + req := c.Request() + ctx := req.Context() - user, ok := c.Get("user").(*gojwt.Token) - if !ok { + token := getToken(ctx) + if token == nil { return next(c) } - ctx = context.WithValue(ctx, "token", user) - scope, did, err := s.checkTokenValidity(user) + scope, did, err := s.checkTokenValidity(token) if err != nil { return fmt.Errorf("invalid token: %w", err) } @@ -583,23 +530,21 @@ func (s *Server) userCheckMiddleware(next echo.HandlerFunc) echo.HandlerFunc { return err } - ctx = context.WithValue(ctx, "authScope", scope) - ctx = context.WithValue(ctx, "user", u) - ctx = context.WithValue(ctx, "did", did) + ctx = withAuthScope(ctx, scope) + ctx = withUser(ctx, u) + ctx = withDID(ctx, did) - c.SetRequest(c.Request().WithContext(ctx)) + c.SetRequest(req.WithContext(ctx)) return next(c) } } func (s *Server) getUser(ctx context.Context) (*User, error) { - u, ok := ctx.Value("user").(*User) - if !ok { + u := getUser(ctx) + if u == nil { return nil, fmt.Errorf("auth required") } - //u.Did = ctx.Value("did").(string) - return u, nil } @@ -750,7 +695,7 @@ func (s *Server) UpdateUserHandle(ctx context.Context, u *User, handle string) e } if err := s.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoHandle: &comatproto.SyncSubscribeRepos_Handle{ + RepoHandle: &atproto.SyncSubscribeRepos_Handle{ Did: u.Did, Handle: handle, Time: time.Now().Format(util.ISO8601), @@ -761,7 +706,7 @@ func (s *Server) UpdateUserHandle(ctx context.Context, u *User, handle string) e // Also push an Identity event if err := s.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoIdentity: &comatproto.SyncSubscribeRepos_Identity{ + RepoIdentity: &atproto.SyncSubscribeRepos_Identity{ Did: u.Did, Time: time.Now().Format(util.ISO8601), }, @@ -775,7 +720,7 @@ func (s *Server) UpdateUserHandle(ctx context.Context, u *User, handle string) e func (s *Server) TakedownRepo(ctx context.Context, did string) error { // Push an Account event if err := s.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoAccount: &comatproto.SyncSubscribeRepos_Account{ + RepoAccount: &atproto.SyncSubscribeRepos_Account{ Did: did, Active: false, Status: &events.AccountStatusTakendown, @@ -791,7 +736,7 @@ func (s *Server) TakedownRepo(ctx context.Context, did string) error { func (s *Server) SuspendRepo(ctx context.Context, did string) error { // Push an Account event if err := s.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoAccount: &comatproto.SyncSubscribeRepos_Account{ + RepoAccount: &atproto.SyncSubscribeRepos_Account{ Did: did, Active: false, Status: &events.AccountStatusSuspended, @@ -807,7 +752,7 @@ func (s *Server) SuspendRepo(ctx context.Context, did string) error { func (s *Server) DeactivateRepo(ctx context.Context, did string) error { // Push an Account event if err := s.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoAccount: &comatproto.SyncSubscribeRepos_Account{ + RepoAccount: &atproto.SyncSubscribeRepos_Account{ Did: did, Active: false, Status: &events.AccountStatusDeactivated, @@ -823,7 +768,7 @@ func (s *Server) DeactivateRepo(ctx context.Context, did string) error { func (s *Server) ReactivateRepo(ctx context.Context, did string) error { // Push an Account event if err := s.events.AddEvent(ctx, &events.XRPCStreamEvent{ - RepoAccount: &comatproto.SyncSubscribeRepos_Account{ + RepoAccount: &atproto.SyncSubscribeRepos_Account{ Did: did, Active: true, Status: &events.AccountStatusActive, diff --git a/pds/stubs.go b/pds/stubs.go index 2543cced2..357da3b3b 100644 --- a/pds/stubs.go +++ b/pds/stubs.go @@ -1,44 +1,46 @@ package pds import ( - "io" + "context" "strconv" - comatprototypes "github.com/bluesky-social/indigo/api/atproto" "github.com/labstack/echo/v4" + "github.com/pkg/errors" "go.opentelemetry.io/otel" + + "github.com/bluesky-social/indigo/api/atproto" ) func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { - e.POST("/xrpc/com.atproto.admin.disableAccountInvites", s.HandleComAtprotoAdminDisableAccountInvites) - e.POST("/xrpc/com.atproto.admin.disableInviteCodes", s.HandleComAtprotoAdminDisableInviteCodes) - e.POST("/xrpc/com.atproto.admin.enableAccountInvites", s.HandleComAtprotoAdminEnableAccountInvites) + e.POST("/xrpc/com.atproto.admin.disableAccountInvites", bindStub("HandleComAtprotoAdminDisableAccountInvites", s.handleComAtprotoAdminDisableAccountInvites)) + e.POST("/xrpc/com.atproto.admin.disableInviteCodes", bindStub("HandleComAtprotoAdminDisableInviteCodes", s.handleComAtprotoAdminDisableInviteCodes)) + e.POST("/xrpc/com.atproto.admin.enableAccountInvites", bindStub("HandleComAtprotoAdminEnableAccountInvites", s.handleComAtprotoAdminEnableAccountInvites)) e.GET("/xrpc/com.atproto.admin.getAccountInfo", s.HandleComAtprotoAdminGetAccountInfo) e.GET("/xrpc/com.atproto.admin.getInviteCodes", s.HandleComAtprotoAdminGetInviteCodes) e.GET("/xrpc/com.atproto.admin.getSubjectStatus", s.HandleComAtprotoAdminGetSubjectStatus) e.POST("/xrpc/com.atproto.admin.sendEmail", s.HandleComAtprotoAdminSendEmail) - e.POST("/xrpc/com.atproto.admin.updateAccountEmail", s.HandleComAtprotoAdminUpdateAccountEmail) - e.POST("/xrpc/com.atproto.admin.updateAccountHandle", s.HandleComAtprotoAdminUpdateAccountHandle) + e.POST("/xrpc/com.atproto.admin.updateAccountEmail", bindStub("HandleComAtprotoAdminUpdateAccountEmail", s.handleComAtprotoAdminUpdateAccountEmail)) + e.POST("/xrpc/com.atproto.admin.updateAccountHandle", bindStub("HandleComAtprotoAdminUpdateAccountHandle", s.handleComAtprotoAdminUpdateAccountHandle)) e.POST("/xrpc/com.atproto.admin.updateSubjectStatus", s.HandleComAtprotoAdminUpdateSubjectStatus) e.GET("/xrpc/com.atproto.identity.resolveHandle", s.HandleComAtprotoIdentityResolveHandle) - e.POST("/xrpc/com.atproto.identity.updateHandle", s.HandleComAtprotoIdentityUpdateHandle) + e.POST("/xrpc/com.atproto.identity.updateHandle", bindStub("HandleComAtprotoIdentityUpdateHandle", s.handleComAtprotoIdentityUpdateHandle)) e.GET("/xrpc/com.atproto.label.queryLabels", s.HandleComAtprotoLabelQueryLabels) e.POST("/xrpc/com.atproto.moderation.createReport", s.HandleComAtprotoModerationCreateReport) - e.POST("/xrpc/com.atproto.repo.applyWrites", s.HandleComAtprotoRepoApplyWrites) + e.POST("/xrpc/com.atproto.repo.applyWrites", bindStub("HandleComAtprotoRepoApplyWrites", s.handleComAtprotoRepoApplyWrites)) e.POST("/xrpc/com.atproto.repo.createRecord", s.HandleComAtprotoRepoCreateRecord) - e.POST("/xrpc/com.atproto.repo.deleteRecord", s.HandleComAtprotoRepoDeleteRecord) + e.POST("/xrpc/com.atproto.repo.deleteRecord", bindStub("HandleComAtprotoRepoDeleteRecord", s.handleComAtprotoRepoDeleteRecord)) e.GET("/xrpc/com.atproto.repo.describeRepo", s.HandleComAtprotoRepoDescribeRepo) e.GET("/xrpc/com.atproto.repo.getRecord", s.HandleComAtprotoRepoGetRecord) e.GET("/xrpc/com.atproto.repo.listRecords", s.HandleComAtprotoRepoListRecords) e.POST("/xrpc/com.atproto.repo.putRecord", s.HandleComAtprotoRepoPutRecord) e.POST("/xrpc/com.atproto.repo.uploadBlob", s.HandleComAtprotoRepoUploadBlob) - e.POST("/xrpc/com.atproto.server.confirmEmail", s.HandleComAtprotoServerConfirmEmail) + e.POST("/xrpc/com.atproto.server.confirmEmail", bindStub("HandleComAtprotoServerConfirmEmail", s.handleComAtprotoServerConfirmEmail)) e.POST("/xrpc/com.atproto.server.createAccount", s.HandleComAtprotoServerCreateAccount) e.POST("/xrpc/com.atproto.server.createAppPassword", s.HandleComAtprotoServerCreateAppPassword) e.POST("/xrpc/com.atproto.server.createInviteCode", s.HandleComAtprotoServerCreateInviteCode) e.POST("/xrpc/com.atproto.server.createInviteCodes", s.HandleComAtprotoServerCreateInviteCodes) e.POST("/xrpc/com.atproto.server.createSession", s.HandleComAtprotoServerCreateSession) - e.POST("/xrpc/com.atproto.server.deleteAccount", s.HandleComAtprotoServerDeleteAccount) + e.POST("/xrpc/com.atproto.server.deleteAccount", bindStub("HandleComAtprotoServerDeleteAccount", s.handleComAtprotoServerDeleteAccount)) e.POST("/xrpc/com.atproto.server.deleteSession", s.HandleComAtprotoServerDeleteSession) e.GET("/xrpc/com.atproto.server.describeServer", s.HandleComAtprotoServerDescribeServer) e.GET("/xrpc/com.atproto.server.getAccountInviteCodes", s.HandleComAtprotoServerGetAccountInviteCodes) @@ -48,11 +50,11 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.POST("/xrpc/com.atproto.server.requestAccountDelete", s.HandleComAtprotoServerRequestAccountDelete) e.POST("/xrpc/com.atproto.server.requestEmailConfirmation", s.HandleComAtprotoServerRequestEmailConfirmation) e.POST("/xrpc/com.atproto.server.requestEmailUpdate", s.HandleComAtprotoServerRequestEmailUpdate) - e.POST("/xrpc/com.atproto.server.requestPasswordReset", s.HandleComAtprotoServerRequestPasswordReset) + e.POST("/xrpc/com.atproto.server.requestPasswordReset", bindStub("HandleComAtprotoServerRequestPasswordReset", s.handleComAtprotoServerRequestPasswordReset)) e.POST("/xrpc/com.atproto.server.reserveSigningKey", s.HandleComAtprotoServerReserveSigningKey) - e.POST("/xrpc/com.atproto.server.resetPassword", s.HandleComAtprotoServerResetPassword) - e.POST("/xrpc/com.atproto.server.revokeAppPassword", s.HandleComAtprotoServerRevokeAppPassword) - e.POST("/xrpc/com.atproto.server.updateEmail", s.HandleComAtprotoServerUpdateEmail) + e.POST("/xrpc/com.atproto.server.resetPassword", bindStub("HandleComAtprotoServerResetPassword", s.handleComAtprotoServerResetPassword)) + e.POST("/xrpc/com.atproto.server.revokeAppPassword", bindStub("HandleComAtprotoServerRevokeAppPassword", s.handleComAtprotoServerRevokeAppPassword)) + e.POST("/xrpc/com.atproto.server.updateEmail", bindStub("HandleComAtprotoServerUpdateEmail", s.handleComAtprotoServerUpdateEmail)) e.GET("/xrpc/com.atproto.sync.getBlob", s.HandleComAtprotoSyncGetBlob) e.GET("/xrpc/com.atproto.sync.getBlocks", s.HandleComAtprotoSyncGetBlocks) e.GET("/xrpc/com.atproto.sync.getCheckout", s.HandleComAtprotoSyncGetCheckout) @@ -62,73 +64,38 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.GET("/xrpc/com.atproto.sync.getRepo", s.HandleComAtprotoSyncGetRepo) e.GET("/xrpc/com.atproto.sync.listBlobs", s.HandleComAtprotoSyncListBlobs) e.GET("/xrpc/com.atproto.sync.listRepos", s.HandleComAtprotoSyncListRepos) - e.POST("/xrpc/com.atproto.sync.notifyOfUpdate", s.HandleComAtprotoSyncNotifyOfUpdate) - e.POST("/xrpc/com.atproto.sync.requestCrawl", s.HandleComAtprotoSyncRequestCrawl) + e.POST("/xrpc/com.atproto.sync.notifyOfUpdate", bindStub("HandleComAtprotoSyncNotifyOfUpdate", s.handleComAtprotoSyncNotifyOfUpdate)) + e.POST("/xrpc/com.atproto.sync.requestCrawl", bindStub("HandleComAtprotoSyncRequestCrawl", s.handleComAtprotoSyncRequestCrawl)) e.GET("/xrpc/com.atproto.temp.fetchLabels", s.HandleComAtprotoTempFetchLabels) return nil } -func (s *Server) HandleComAtprotoAdminDisableAccountInvites(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminDisableAccountInvites") - defer span.End() - - var body comatprototypes.AdminDisableAccountInvites_Input - if err := c.Bind(&body); err != nil { - return err - } - var handleErr error - // func (s *Server) handleComAtprotoAdminDisableAccountInvites(ctx context.Context,body *comatprototypes.AdminDisableAccountInvites_Input) error - handleErr = s.handleComAtprotoAdminDisableAccountInvites(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - -func (s *Server) HandleComAtprotoAdminDisableInviteCodes(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminDisableInviteCodes") - defer span.End() +func bindStub[T any](name string, f func(context.Context, *T) error) func(echo.Context) error { + return func(c echo.Context) error { + var ( + req = c.Request() + ctx = req.Context() + ) + ctx, span := otel.Tracer("server").Start(ctx, name) + defer span.End() - var body comatprototypes.AdminDisableInviteCodes_Input - if err := c.Bind(&body); err != nil { - return err - } - var handleErr error - // func (s *Server) handleComAtprotoAdminDisableInviteCodes(ctx context.Context,body *comatprototypes.AdminDisableInviteCodes_Input) error - handleErr = s.handleComAtprotoAdminDisableInviteCodes(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - -func (s *Server) HandleComAtprotoAdminEnableAccountInvites(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminEnableAccountInvites") - defer span.End() + var body T + if err := c.Bind(&body); err != nil { + return errors.Wrap(err, "in Bind") + } - var body comatprototypes.AdminEnableAccountInvites_Input - if err := c.Bind(&body); err != nil { - return err - } - var handleErr error - // func (s *Server) handleComAtprotoAdminEnableAccountInvites(ctx context.Context,body *comatprototypes.AdminEnableAccountInvites_Input) error - handleErr = s.handleComAtprotoAdminEnableAccountInvites(ctx, &body) - if handleErr != nil { - return handleErr + return f(ctx, &body) } - return nil } func (s *Server) HandleComAtprotoAdminGetAccountInfo(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetAccountInfo") defer span.End() did := c.QueryParam("did") - var out *comatprototypes.AdminDefs_AccountView - var handleErr error - // func (s *Server) handleComAtprotoAdminGetAccountInfo(ctx context.Context,did string) (*comatprototypes.AdminDefs_AccountView, error) - out, handleErr = s.handleComAtprotoAdminGetAccountInfo(ctx, did) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoAdminGetAccountInfo(ctx, did) + if err != nil { + return err } return c.JSON(200, out) } @@ -149,12 +116,10 @@ func (s *Server) HandleComAtprotoAdminGetInviteCodes(c echo.Context) error { limit = 100 } sort := c.QueryParam("sort") - var out *comatprototypes.AdminGetInviteCodes_Output - var handleErr error - // func (s *Server) handleComAtprotoAdminGetInviteCodes(ctx context.Context,cursor string,limit int,sort string) (*comatprototypes.AdminGetInviteCodes_Output, error) - out, handleErr = s.handleComAtprotoAdminGetInviteCodes(ctx, cursor, limit, sort) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoAdminGetInviteCodes(ctx, cursor, limit, sort) + if err != nil { + return err } return c.JSON(200, out) } @@ -162,85 +127,48 @@ func (s *Server) HandleComAtprotoAdminGetInviteCodes(c echo.Context) error { func (s *Server) HandleComAtprotoAdminGetSubjectStatus(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetSubjectStatus") defer span.End() - blob := c.QueryParam("blob") - did := c.QueryParam("did") - uri := c.QueryParam("uri") - var out *comatprototypes.AdminGetSubjectStatus_Output - var handleErr error - // func (s *Server) handleComAtprotoAdminGetSubjectStatus(ctx context.Context,blob string,did string,uri string) (*comatprototypes.AdminGetSubjectStatus_Output, error) - out, handleErr = s.handleComAtprotoAdminGetSubjectStatus(ctx, blob, did, uri) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} -func (s *Server) HandleComAtprotoAdminSendEmail(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminSendEmail") - defer span.End() + var ( + blob = c.QueryParam("blob") + did = c.QueryParam("did") + uri = c.QueryParam("uri") + ) - var body comatprototypes.AdminSendEmail_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoAdminGetSubjectStatus(ctx, blob, did, uri) + if err != nil { return err } - var out *comatprototypes.AdminSendEmail_Output - var handleErr error - // func (s *Server) handleComAtprotoAdminSendEmail(ctx context.Context,body *comatprototypes.AdminSendEmail_Input) (*comatprototypes.AdminSendEmail_Output, error) - out, handleErr = s.handleComAtprotoAdminSendEmail(ctx, &body) - if handleErr != nil { - return handleErr - } return c.JSON(200, out) } -func (s *Server) HandleComAtprotoAdminUpdateAccountEmail(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminUpdateAccountEmail") +func (s *Server) HandleComAtprotoAdminSendEmail(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminSendEmail") defer span.End() - var body comatprototypes.AdminUpdateAccountEmail_Input + var body atproto.AdminSendEmail_Input if err := c.Bind(&body); err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoAdminUpdateAccountEmail(ctx context.Context,body *comatprototypes.AdminUpdateAccountEmail_Input) error - handleErr = s.handleComAtprotoAdminUpdateAccountEmail(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - -func (s *Server) HandleComAtprotoAdminUpdateAccountHandle(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminUpdateAccountHandle") - defer span.End() - var body comatprototypes.AdminUpdateAccountHandle_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoAdminSendEmail(ctx, &body) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoAdminUpdateAccountHandle(ctx context.Context,body *comatprototypes.AdminUpdateAccountHandle_Input) error - handleErr = s.handleComAtprotoAdminUpdateAccountHandle(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoAdminUpdateSubjectStatus(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminUpdateSubjectStatus") defer span.End() - var body comatprototypes.AdminUpdateSubjectStatus_Input + var body atproto.AdminUpdateSubjectStatus_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.AdminUpdateSubjectStatus_Output - var handleErr error - // func (s *Server) handleComAtprotoAdminUpdateSubjectStatus(ctx context.Context,body *comatprototypes.AdminUpdateSubjectStatus_Input) (*comatprototypes.AdminUpdateSubjectStatus_Output, error) - out, handleErr = s.handleComAtprotoAdminUpdateSubjectStatus(ctx, &body) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoAdminUpdateSubjectStatus(ctx, &body) + if err != nil { + return err } return c.JSON(200, out) } @@ -249,31 +177,12 @@ func (s *Server) HandleComAtprotoIdentityResolveHandle(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoIdentityResolveHandle") defer span.End() handle := c.QueryParam("handle") - var out *comatprototypes.IdentityResolveHandle_Output - var handleErr error - // func (s *Server) handleComAtprotoIdentityResolveHandle(ctx context.Context,handle string) (*comatprototypes.IdentityResolveHandle_Output, error) - out, handleErr = s.handleComAtprotoIdentityResolveHandle(ctx, handle) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} -func (s *Server) HandleComAtprotoIdentityUpdateHandle(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoIdentityUpdateHandle") - defer span.End() - - var body comatprototypes.IdentityUpdateHandle_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoIdentityResolveHandle(ctx, handle) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoIdentityUpdateHandle(ctx context.Context,body *comatprototypes.IdentityUpdateHandle_Input) error - handleErr = s.handleComAtprotoIdentityUpdateHandle(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoLabelQueryLabels(c echo.Context) error { @@ -292,15 +201,14 @@ func (s *Server) HandleComAtprotoLabelQueryLabels(c echo.Context) error { limit = 50 } - sources := c.QueryParams()["sources"] + var ( + sources = c.QueryParams()["sources"] + uriPatterns = c.QueryParams()["uriPatterns"] + ) - uriPatterns := c.QueryParams()["uriPatterns"] - var out *comatprototypes.LabelQueryLabels_Output - var handleErr error - // func (s *Server) handleComAtprotoLabelQueryLabels(ctx context.Context,cursor string,limit int,sources []string,uriPatterns []string) (*comatprototypes.LabelQueryLabels_Output, error) - out, handleErr = s.handleComAtprotoLabelQueryLabels(ctx, cursor, limit, sources, uriPatterns) - if handleErr != nil { - return handleErr + out, err := s.handleComAtprotoLabelQueryLabels(ctx, cursor, limit, sources, uriPatterns) + if err != nil { + return err } return c.JSON(200, out) } @@ -309,82 +217,42 @@ func (s *Server) HandleComAtprotoModerationCreateReport(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoModerationCreateReport") defer span.End() - var body comatprototypes.ModerationCreateReport_Input + var body atproto.ModerationCreateReport_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.ModerationCreateReport_Output - var handleErr error - // func (s *Server) handleComAtprotoModerationCreateReport(ctx context.Context,body *comatprototypes.ModerationCreateReport_Input) (*comatprototypes.ModerationCreateReport_Output, error) - out, handleErr = s.handleComAtprotoModerationCreateReport(ctx, &body) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} -func (s *Server) HandleComAtprotoRepoApplyWrites(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoApplyWrites") - defer span.End() - - var body comatprototypes.RepoApplyWrites_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoModerationCreateReport(ctx, &body) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoRepoApplyWrites(ctx context.Context,body *comatprototypes.RepoApplyWrites_Input) error - handleErr = s.handleComAtprotoRepoApplyWrites(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoRepoCreateRecord(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoCreateRecord") defer span.End() - var body comatprototypes.RepoCreateRecord_Input + var body atproto.RepoCreateRecord_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.RepoCreateRecord_Output - var handleErr error - // func (s *Server) handleComAtprotoRepoCreateRecord(ctx context.Context,body *comatprototypes.RepoCreateRecord_Input) (*comatprototypes.RepoCreateRecord_Output, error) - out, handleErr = s.handleComAtprotoRepoCreateRecord(ctx, &body) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} -func (s *Server) HandleComAtprotoRepoDeleteRecord(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDeleteRecord") - defer span.End() - - var body comatprototypes.RepoDeleteRecord_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoRepoCreateRecord(ctx, &body) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoRepoDeleteRecord(ctx context.Context,body *comatprototypes.RepoDeleteRecord_Input) error - handleErr = s.handleComAtprotoRepoDeleteRecord(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoRepoDescribeRepo(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDescribeRepo") defer span.End() repo := c.QueryParam("repo") - var out *comatprototypes.RepoDescribeRepo_Output - var handleErr error - // func (s *Server) handleComAtprotoRepoDescribeRepo(ctx context.Context,repo string) (*comatprototypes.RepoDescribeRepo_Output, error) - out, handleErr = s.handleComAtprotoRepoDescribeRepo(ctx, repo) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoRepoDescribeRepo(ctx, repo) + if err != nil { + return err } return c.JSON(200, out) } @@ -392,16 +260,17 @@ func (s *Server) HandleComAtprotoRepoDescribeRepo(c echo.Context) error { func (s *Server) HandleComAtprotoRepoGetRecord(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoGetRecord") defer span.End() - cid := c.QueryParam("cid") - collection := c.QueryParam("collection") - repo := c.QueryParam("repo") - rkey := c.QueryParam("rkey") - var out *comatprototypes.RepoGetRecord_Output - var handleErr error - // func (s *Server) handleComAtprotoRepoGetRecord(ctx context.Context,cid string,collection string,repo string,rkey string) (*comatprototypes.RepoGetRecord_Output, error) - out, handleErr = s.handleComAtprotoRepoGetRecord(ctx, cid, collection, repo, rkey) - if handleErr != nil { - return handleErr + + var ( + cid = c.QueryParam("cid") + collection = c.QueryParam("collection") + repo = c.QueryParam("repo") + rkey = c.QueryParam("rkey") + ) + + out, err := s.handleComAtprotoRepoGetRecord(ctx, cid, collection, repo, rkey) + if err != nil { + return err } return c.JSON(200, out) } @@ -434,12 +303,10 @@ func (s *Server) HandleComAtprotoRepoListRecords(c echo.Context) error { } rkeyEnd := c.QueryParam("rkeyEnd") rkeyStart := c.QueryParam("rkeyStart") - var out *comatprototypes.RepoListRecords_Output - var handleErr error - // func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context,collection string,cursor string,limit int,repo string,reverse *bool,rkeyEnd string,rkeyStart string) (*comatprototypes.RepoListRecords_Output, error) - out, handleErr = s.handleComAtprotoRepoListRecords(ctx, collection, cursor, limit, repo, reverse, rkeyEnd, rkeyStart) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoRepoListRecords(ctx, collection, cursor, limit, repo, reverse, rkeyEnd, rkeyStart) + if err != nil { + return err } return c.JSON(200, out) } @@ -448,16 +315,14 @@ func (s *Server) HandleComAtprotoRepoPutRecord(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoPutRecord") defer span.End() - var body comatprototypes.RepoPutRecord_Input + var body atproto.RepoPutRecord_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.RepoPutRecord_Output - var handleErr error - // func (s *Server) handleComAtprotoRepoPutRecord(ctx context.Context,body *comatprototypes.RepoPutRecord_Input) (*comatprototypes.RepoPutRecord_Output, error) - out, handleErr = s.handleComAtprotoRepoPutRecord(ctx, &body) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoRepoPutRecord(ctx, &body) + if err != nil { + return err } return c.JSON(200, out) } @@ -467,47 +332,26 @@ func (s *Server) HandleComAtprotoRepoUploadBlob(c echo.Context) error { defer span.End() body := c.Request().Body contentType := c.Request().Header.Get("Content-Type") - var out *comatprototypes.RepoUploadBlob_Output - var handleErr error - // func (s *Server) handleComAtprotoRepoUploadBlob(ctx context.Context,r io.Reader,contentType string) (*comatprototypes.RepoUploadBlob_Output, error) - out, handleErr = s.handleComAtprotoRepoUploadBlob(ctx, body, contentType) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - -func (s *Server) HandleComAtprotoServerConfirmEmail(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerConfirmEmail") - defer span.End() - var body comatprototypes.ServerConfirmEmail_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoRepoUploadBlob(ctx, body, contentType) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoServerConfirmEmail(ctx context.Context,body *comatprototypes.ServerConfirmEmail_Input) error - handleErr = s.handleComAtprotoServerConfirmEmail(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoServerCreateAccount(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerCreateAccount") defer span.End() - var body comatprototypes.ServerCreateAccount_Input + var body atproto.ServerCreateAccount_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.ServerCreateAccount_Output - var handleErr error - // func (s *Server) handleComAtprotoServerCreateAccount(ctx context.Context,body *comatprototypes.ServerCreateAccount_Input) (*comatprototypes.ServerCreateAccount_Output, error) - out, handleErr = s.handleComAtprotoServerCreateAccount(ctx, &body) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerCreateAccount(ctx, &body) + if err != nil { + return err } return c.JSON(200, out) } @@ -516,16 +360,14 @@ func (s *Server) HandleComAtprotoServerCreateAppPassword(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerCreateAppPassword") defer span.End() - var body comatprototypes.ServerCreateAppPassword_Input + var body atproto.ServerCreateAppPassword_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.ServerCreateAppPassword_AppPassword - var handleErr error - // func (s *Server) handleComAtprotoServerCreateAppPassword(ctx context.Context,body *comatprototypes.ServerCreateAppPassword_Input) (*comatprototypes.ServerCreateAppPassword_AppPassword, error) - out, handleErr = s.handleComAtprotoServerCreateAppPassword(ctx, &body) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerCreateAppPassword(ctx, &body) + if err != nil { + return err } return c.JSON(200, out) } @@ -534,16 +376,14 @@ func (s *Server) HandleComAtprotoServerCreateInviteCode(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerCreateInviteCode") defer span.End() - var body comatprototypes.ServerCreateInviteCode_Input + var body atproto.ServerCreateInviteCode_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.ServerCreateInviteCode_Output - var handleErr error - // func (s *Server) handleComAtprotoServerCreateInviteCode(ctx context.Context,body *comatprototypes.ServerCreateInviteCode_Input) (*comatprototypes.ServerCreateInviteCode_Output, error) - out, handleErr = s.handleComAtprotoServerCreateInviteCode(ctx, &body) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerCreateInviteCode(ctx, &body) + if err != nil { + return err } return c.JSON(200, out) } @@ -552,16 +392,14 @@ func (s *Server) HandleComAtprotoServerCreateInviteCodes(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerCreateInviteCodes") defer span.End() - var body comatprototypes.ServerCreateInviteCodes_Input + var body atproto.ServerCreateInviteCodes_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.ServerCreateInviteCodes_Output - var handleErr error - // func (s *Server) handleComAtprotoServerCreateInviteCodes(ctx context.Context,body *comatprototypes.ServerCreateInviteCodes_Input) (*comatprototypes.ServerCreateInviteCodes_Output, error) - out, handleErr = s.handleComAtprotoServerCreateInviteCodes(ctx, &body) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerCreateInviteCodes(ctx, &body) + if err != nil { + return err } return c.JSON(200, out) } @@ -570,58 +408,32 @@ func (s *Server) HandleComAtprotoServerCreateSession(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerCreateSession") defer span.End() - var body comatprototypes.ServerCreateSession_Input + var body atproto.ServerCreateSession_Input if err := c.Bind(&body); err != nil { return err } - var out *comatprototypes.ServerCreateSession_Output - var handleErr error - // func (s *Server) handleComAtprotoServerCreateSession(ctx context.Context,body *comatprototypes.ServerCreateSession_Input) (*comatprototypes.ServerCreateSession_Output, error) - out, handleErr = s.handleComAtprotoServerCreateSession(ctx, &body) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} -func (s *Server) HandleComAtprotoServerDeleteAccount(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerDeleteAccount") - defer span.End() - - var body comatprototypes.ServerDeleteAccount_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoServerCreateSession(ctx, &body) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoServerDeleteAccount(ctx context.Context,body *comatprototypes.ServerDeleteAccount_Input) error - handleErr = s.handleComAtprotoServerDeleteAccount(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoServerDeleteSession(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerDeleteSession") defer span.End() - var handleErr error - // func (s *Server) handleComAtprotoServerDeleteSession(ctx context.Context) error - handleErr = s.handleComAtprotoServerDeleteSession(ctx) - if handleErr != nil { - return handleErr - } - return nil + + return s.handleComAtprotoServerDeleteSession(ctx) } func (s *Server) HandleComAtprotoServerDescribeServer(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerDescribeServer") defer span.End() - var out *comatprototypes.ServerDescribeServer_Output - var handleErr error - // func (s *Server) handleComAtprotoServerDescribeServer(ctx context.Context) (*comatprototypes.ServerDescribeServer_Output, error) - out, handleErr = s.handleComAtprotoServerDescribeServer(ctx) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerDescribeServer(ctx) + if err != nil { + return err } return c.JSON(200, out) } @@ -651,12 +463,10 @@ func (s *Server) HandleComAtprotoServerGetAccountInviteCodes(c echo.Context) err } else { includeUsed = true } - var out *comatprototypes.ServerGetAccountInviteCodes_Output - var handleErr error - // func (s *Server) handleComAtprotoServerGetAccountInviteCodes(ctx context.Context,createAvailable bool,includeUsed bool) (*comatprototypes.ServerGetAccountInviteCodes_Output, error) - out, handleErr = s.handleComAtprotoServerGetAccountInviteCodes(ctx, createAvailable, includeUsed) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerGetAccountInviteCodes(ctx, createAvailable, includeUsed) + if err != nil { + return err } return c.JSON(200, out) } @@ -664,12 +474,10 @@ func (s *Server) HandleComAtprotoServerGetAccountInviteCodes(c echo.Context) err func (s *Server) HandleComAtprotoServerGetSession(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerGetSession") defer span.End() - var out *comatprototypes.ServerGetSession_Output - var handleErr error - // func (s *Server) handleComAtprotoServerGetSession(ctx context.Context) (*comatprototypes.ServerGetSession_Output, error) - out, handleErr = s.handleComAtprotoServerGetSession(ctx) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerGetSession(ctx) + if err != nil { + return err } return c.JSON(200, out) } @@ -677,12 +485,10 @@ func (s *Server) HandleComAtprotoServerGetSession(c echo.Context) error { func (s *Server) HandleComAtprotoServerListAppPasswords(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerListAppPasswords") defer span.End() - var out *comatprototypes.ServerListAppPasswords_Output - var handleErr error - // func (s *Server) handleComAtprotoServerListAppPasswords(ctx context.Context) (*comatprototypes.ServerListAppPasswords_Output, error) - out, handleErr = s.handleComAtprotoServerListAppPasswords(ctx) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerListAppPasswords(ctx) + if err != nil { + return err } return c.JSON(200, out) } @@ -690,12 +496,10 @@ func (s *Server) HandleComAtprotoServerListAppPasswords(c echo.Context) error { func (s *Server) HandleComAtprotoServerRefreshSession(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRefreshSession") defer span.End() - var out *comatprototypes.ServerRefreshSession_Output - var handleErr error - // func (s *Server) handleComAtprotoServerRefreshSession(ctx context.Context) (*comatprototypes.ServerRefreshSession_Output, error) - out, handleErr = s.handleComAtprotoServerRefreshSession(ctx) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoServerRefreshSession(ctx) + if err != nil { + return err } return c.JSON(200, out) } @@ -703,124 +507,42 @@ func (s *Server) HandleComAtprotoServerRefreshSession(c echo.Context) error { func (s *Server) HandleComAtprotoServerRequestAccountDelete(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestAccountDelete") defer span.End() - var handleErr error - // func (s *Server) handleComAtprotoServerRequestAccountDelete(ctx context.Context) error - handleErr = s.handleComAtprotoServerRequestAccountDelete(ctx) - if handleErr != nil { - return handleErr - } - return nil + + return s.handleComAtprotoServerRequestAccountDelete(ctx) } func (s *Server) HandleComAtprotoServerRequestEmailConfirmation(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestEmailConfirmation") defer span.End() - var handleErr error - // func (s *Server) handleComAtprotoServerRequestEmailConfirmation(ctx context.Context) error - handleErr = s.handleComAtprotoServerRequestEmailConfirmation(ctx) - if handleErr != nil { - return handleErr - } - return nil + + return s.handleComAtprotoServerRequestEmailConfirmation(ctx) } func (s *Server) HandleComAtprotoServerRequestEmailUpdate(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestEmailUpdate") defer span.End() - var out *comatprototypes.ServerRequestEmailUpdate_Output - var handleErr error - // func (s *Server) handleComAtprotoServerRequestEmailUpdate(ctx context.Context) (*comatprototypes.ServerRequestEmailUpdate_Output, error) - out, handleErr = s.handleComAtprotoServerRequestEmailUpdate(ctx) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - -func (s *Server) HandleComAtprotoServerRequestPasswordReset(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestPasswordReset") - defer span.End() - var body comatprototypes.ServerRequestPasswordReset_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoServerRequestEmailUpdate(ctx) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoServerRequestPasswordReset(ctx context.Context,body *comatprototypes.ServerRequestPasswordReset_Input) error - handleErr = s.handleComAtprotoServerRequestPasswordReset(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoServerReserveSigningKey(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerReserveSigningKey") defer span.End() - var body comatprototypes.ServerReserveSigningKey_Input - if err := c.Bind(&body); err != nil { - return err - } - var out *comatprototypes.ServerReserveSigningKey_Output - var handleErr error - // func (s *Server) handleComAtprotoServerReserveSigningKey(ctx context.Context,body *comatprototypes.ServerReserveSigningKey_Input) (*comatprototypes.ServerReserveSigningKey_Output, error) - out, handleErr = s.handleComAtprotoServerReserveSigningKey(ctx, &body) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - -func (s *Server) HandleComAtprotoServerResetPassword(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerResetPassword") - defer span.End() - - var body comatprototypes.ServerResetPassword_Input - if err := c.Bind(&body); err != nil { - return err - } - var handleErr error - // func (s *Server) handleComAtprotoServerResetPassword(ctx context.Context,body *comatprototypes.ServerResetPassword_Input) error - handleErr = s.handleComAtprotoServerResetPassword(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - -func (s *Server) HandleComAtprotoServerRevokeAppPassword(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRevokeAppPassword") - defer span.End() - - var body comatprototypes.ServerRevokeAppPassword_Input + var body atproto.ServerReserveSigningKey_Input if err := c.Bind(&body); err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoServerRevokeAppPassword(ctx context.Context,body *comatprototypes.ServerRevokeAppPassword_Input) error - handleErr = s.handleComAtprotoServerRevokeAppPassword(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - -func (s *Server) HandleComAtprotoServerUpdateEmail(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerUpdateEmail") - defer span.End() - var body comatprototypes.ServerUpdateEmail_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoServerReserveSigningKey(ctx, &body) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoServerUpdateEmail(ctx context.Context,body *comatprototypes.ServerUpdateEmail_Input) error - handleErr = s.handleComAtprotoServerUpdateEmail(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoSyncGetBlob(c echo.Context) error { @@ -828,12 +550,10 @@ func (s *Server) HandleComAtprotoSyncGetBlob(c echo.Context) error { defer span.End() cid := c.QueryParam("cid") did := c.QueryParam("did") - var out io.Reader - var handleErr error - // func (s *Server) handleComAtprotoSyncGetBlob(ctx context.Context,cid string,did string) (io.Reader, error) - out, handleErr = s.handleComAtprotoSyncGetBlob(ctx, cid, did) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncGetBlob(ctx, cid, did) + if err != nil { + return err } return c.Stream(200, "application/octet-stream", out) } @@ -842,14 +562,14 @@ func (s *Server) HandleComAtprotoSyncGetBlocks(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetBlocks") defer span.End() - cids := c.QueryParams()["cids"] - did := c.QueryParam("did") - var out io.Reader - var handleErr error - // func (s *Server) handleComAtprotoSyncGetBlocks(ctx context.Context,cids []string,did string) (io.Reader, error) - out, handleErr = s.handleComAtprotoSyncGetBlocks(ctx, cids, did) - if handleErr != nil { - return handleErr + var ( + cids = c.QueryParams()["cids"] + did = c.QueryParam("did") + ) + + out, err := s.handleComAtprotoSyncGetBlocks(ctx, cids, did) + if err != nil { + return err } return c.Stream(200, "application/vnd.ipld.car", out) } @@ -858,12 +578,10 @@ func (s *Server) HandleComAtprotoSyncGetCheckout(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetCheckout") defer span.End() did := c.QueryParam("did") - var out io.Reader - var handleErr error - // func (s *Server) handleComAtprotoSyncGetCheckout(ctx context.Context,did string) (io.Reader, error) - out, handleErr = s.handleComAtprotoSyncGetCheckout(ctx, did) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncGetCheckout(ctx, did) + if err != nil { + return err } return c.Stream(200, "application/vnd.ipld.car", out) } @@ -872,12 +590,10 @@ func (s *Server) HandleComAtprotoSyncGetHead(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetHead") defer span.End() did := c.QueryParam("did") - var out *comatprototypes.SyncGetHead_Output - var handleErr error - // func (s *Server) handleComAtprotoSyncGetHead(ctx context.Context,did string) (*comatprototypes.SyncGetHead_Output, error) - out, handleErr = s.handleComAtprotoSyncGetHead(ctx, did) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncGetHead(ctx, did) + if err != nil { + return err } return c.JSON(200, out) } @@ -886,12 +602,10 @@ func (s *Server) HandleComAtprotoSyncGetLatestCommit(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetLatestCommit") defer span.End() did := c.QueryParam("did") - var out *comatprototypes.SyncGetLatestCommit_Output - var handleErr error - // func (s *Server) handleComAtprotoSyncGetLatestCommit(ctx context.Context,did string) (*comatprototypes.SyncGetLatestCommit_Output, error) - out, handleErr = s.handleComAtprotoSyncGetLatestCommit(ctx, did) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncGetLatestCommit(ctx, did) + if err != nil { + return err } return c.JSON(200, out) } @@ -903,12 +617,10 @@ func (s *Server) HandleComAtprotoSyncGetRecord(c echo.Context) error { commit := c.QueryParam("commit") did := c.QueryParam("did") rkey := c.QueryParam("rkey") - var out io.Reader - var handleErr error - // func (s *Server) handleComAtprotoSyncGetRecord(ctx context.Context,collection string,commit string,did string,rkey string) (io.Reader, error) - out, handleErr = s.handleComAtprotoSyncGetRecord(ctx, collection, commit, did, rkey) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncGetRecord(ctx, collection, commit, did, rkey) + if err != nil { + return err } return c.Stream(200, "application/vnd.ipld.car", out) } @@ -918,12 +630,10 @@ func (s *Server) HandleComAtprotoSyncGetRepo(c echo.Context) error { defer span.End() did := c.QueryParam("did") since := c.QueryParam("since") - var out io.Reader - var handleErr error - // func (s *Server) handleComAtprotoSyncGetRepo(ctx context.Context,did string,since string) (io.Reader, error) - out, handleErr = s.handleComAtprotoSyncGetRepo(ctx, did, since) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncGetRepo(ctx, did, since) + if err != nil { + return err } return c.Stream(200, "application/vnd.ipld.car", out) } @@ -945,12 +655,10 @@ func (s *Server) HandleComAtprotoSyncListBlobs(c echo.Context) error { limit = 500 } since := c.QueryParam("since") - var out *comatprototypes.SyncListBlobs_Output - var handleErr error - // func (s *Server) handleComAtprotoSyncListBlobs(ctx context.Context,cursor string,did string,limit int,since string) (*comatprototypes.SyncListBlobs_Output, error) - out, handleErr = s.handleComAtprotoSyncListBlobs(ctx, cursor, did, limit, since) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoSyncListBlobs(ctx, cursor, did, limit, since) + if err != nil { + return err } return c.JSON(200, out) } @@ -970,48 +678,12 @@ func (s *Server) HandleComAtprotoSyncListRepos(c echo.Context) error { } else { limit = 500 } - var out *comatprototypes.SyncListRepos_Output - var handleErr error - // func (s *Server) handleComAtprotoSyncListRepos(ctx context.Context,cursor string,limit int) (*comatprototypes.SyncListRepos_Output, error) - out, handleErr = s.handleComAtprotoSyncListRepos(ctx, cursor, limit) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - -func (s *Server) HandleComAtprotoSyncNotifyOfUpdate(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncNotifyOfUpdate") - defer span.End() - - var body comatprototypes.SyncNotifyOfUpdate_Input - if err := c.Bind(&body); err != nil { - return err - } - var handleErr error - // func (s *Server) handleComAtprotoSyncNotifyOfUpdate(ctx context.Context,body *comatprototypes.SyncNotifyOfUpdate_Input) error - handleErr = s.handleComAtprotoSyncNotifyOfUpdate(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - -func (s *Server) HandleComAtprotoSyncRequestCrawl(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncRequestCrawl") - defer span.End() - var body comatprototypes.SyncRequestCrawl_Input - if err := c.Bind(&body); err != nil { + out, err := s.handleComAtprotoSyncListRepos(ctx, cursor, limit) + if err != nil { return err } - var handleErr error - // func (s *Server) handleComAtprotoSyncRequestCrawl(ctx context.Context,body *comatprototypes.SyncRequestCrawl_Input) error - handleErr = s.handleComAtprotoSyncRequestCrawl(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil + return c.JSON(200, out) } func (s *Server) HandleComAtprotoTempFetchLabels(c echo.Context) error { @@ -1031,18 +703,16 @@ func (s *Server) HandleComAtprotoTempFetchLabels(c echo.Context) error { var since *int if p := c.QueryParam("since"); p != "" { - since_val, err := strconv.Atoi(p) + sinceVal, err := strconv.Atoi(p) if err != nil { return err } - since = &since_val + since = &sinceVal } - var out *comatprototypes.TempFetchLabels_Output - var handleErr error - // func (s *Server) handleComAtprotoTempFetchLabels(ctx context.Context,limit int,since *int) (*comatprototypes.TempFetchLabels_Output, error) - out, handleErr = s.handleComAtprotoTempFetchLabels(ctx, limit, since) - if handleErr != nil { - return handleErr + + out, err := s.handleComAtprotoTempFetchLabels(ctx, limit, since) + if err != nil { + return err } return c.JSON(200, out) } diff --git a/plc/fakedid.go b/plc/fakedid.go index 5162ca8a5..05d31f927 100644 --- a/plc/fakedid.go +++ b/plc/fakedid.go @@ -66,9 +66,7 @@ func (fd *FakeDid) GetDocument(ctx context.Context, udid string) (*did.Document, }, nil } -func (fd *FakeDid) FlushCacheFor(did string) { - return -} +func (fd *FakeDid) FlushCacheFor(did string) {} func (fd *FakeDid) CreateDID(ctx context.Context, sigkey *did.PrivKey, recovery string, handle string, service string) (string, error) { buf := make([]byte, 8) diff --git a/repomgr/repomgr.go b/repomgr/repomgr.go index 1e09dbcd9..f2fd8414c 100644 --- a/repomgr/repomgr.go +++ b/repomgr/repomgr.go @@ -866,7 +866,7 @@ func (rm *RepoManager) ImportNewRepo(ctx context.Context, user models.Uid, repoD return nil }) if err != nil { - return fmt.Errorf("process new repo (current rev: %s): %w:", currev, err) + return fmt.Errorf("process new repo (current rev: %s): %w", currev, err) } return nil @@ -1025,8 +1025,6 @@ func (rm *RepoManager) walkTree(ctx context.Context, skip map[cid.Cid]bool, root links = append(links, c) skip[c] = true - - return }); err != nil { return nil, err } diff --git a/search/bulk.go b/search/bulk.go index 65c42f2b5..9e9a69c22 100644 --- a/search/bulk.go +++ b/search/bulk.go @@ -18,11 +18,6 @@ import ( "github.com/ipfs/go-cid" ) -type pagerankJob struct { - did syntax.DID - rank float64 -} - // BulkIndexPageranks updates the pageranks for the DIDs in the Search Index from a CSV file. func (idx *Indexer) BulkIndexPageranks(ctx context.Context, pagerankFile string) error { f, err := os.Open(pagerankFile) diff --git a/search/firehose.go b/search/firehose.go index 6db633cc0..40cf054cd 100644 --- a/search/firehose.go +++ b/search/firehose.go @@ -79,7 +79,6 @@ func (idx *Indexer) RunIndexer(ctx context.Context) error { rsc := &events.RepoStreamCallbacks{ RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { - ctx := context.Background() ctx, span := tracer.Start(ctx, "RepoCommit") defer span.End() @@ -116,7 +115,6 @@ func (idx *Indexer) RunIndexer(ctx context.Context) error { }, RepoHandle: func(evt *comatproto.SyncSubscribeRepos_Handle) error { - ctx := context.Background() ctx, span := tracer.Start(ctx, "RepoHandle") defer span.End() diff --git a/search/indexing.go b/search/indexing.go index 2d2082a21..8fb014ae6 100644 --- a/search/indexing.go +++ b/search/indexing.go @@ -12,19 +12,18 @@ import ( "strings" "time" - appbsky "github.com/bluesky-social/indigo/api/bsky" - "github.com/bluesky-social/indigo/atproto/identity" - "github.com/bluesky-social/indigo/atproto/syntax" - "github.com/bluesky-social/indigo/backfill" - "github.com/bluesky-social/indigo/xrpc" "github.com/ipfs/go-cid" - "github.com/labstack/echo/v4" + es "github.com/opensearch-project/opensearch-go/v2" + esapi "github.com/opensearch-project/opensearch-go/v2/opensearchapi" "go.opentelemetry.io/otel/attribute" "golang.org/x/time/rate" gorm "gorm.io/gorm" - es "github.com/opensearch-project/opensearch-go/v2" - esapi "github.com/opensearch-project/opensearch-go/v2/opensearchapi" + appbsky "github.com/bluesky-social/indigo/api/bsky" + "github.com/bluesky-social/indigo/atproto/identity" + "github.com/bluesky-social/indigo/atproto/syntax" + "github.com/bluesky-social/indigo/backfill" + "github.com/bluesky-social/indigo/xrpc" ) type Indexer struct { @@ -35,7 +34,6 @@ type Indexer struct { relayhost string relayXRPC *xrpc.Client dir identity.Directory - echo *echo.Echo logger *slog.Logger bfs *backfill.Gormstore diff --git a/search/metrics.go b/search/metrics.go index 9378af3b6..759a4b1a8 100644 --- a/search/metrics.go +++ b/search/metrics.go @@ -12,51 +12,21 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" ) -var postsReceived = promauto.NewCounter(prometheus.CounterOpts{ - Name: "search_posts_received", - Help: "Number of posts received", -}) - var postsIndexed = promauto.NewCounter(prometheus.CounterOpts{ Name: "search_posts_indexed", Help: "Number of posts indexed", }) -var postsFailed = promauto.NewCounter(prometheus.CounterOpts{ - Name: "search_posts_failed", - Help: "Number of posts that failed indexing", -}) - var postsDeleted = promauto.NewCounter(prometheus.CounterOpts{ Name: "search_posts_deleted", Help: "Number of posts deleted", }) -var profilesReceived = promauto.NewCounter(prometheus.CounterOpts{ - Name: "search_profiles_received", - Help: "Number of profiles received", -}) - var profilesIndexed = promauto.NewCounter(prometheus.CounterOpts{ Name: "search_profiles_indexed", Help: "Number of profiles indexed", }) -var profilesFailed = promauto.NewCounter(prometheus.CounterOpts{ - Name: "search_profiles_failed", - Help: "Number of profiles that failed indexing", -}) - -var profilesDeleted = promauto.NewCounter(prometheus.CounterOpts{ - Name: "search_profiles_deleted", - Help: "Number of profiles deleted", -}) - -var currentSeq = promauto.NewGauge(prometheus.GaugeOpts{ - Name: "search_current_seq", - Help: "Current sequence number", -}) - var reqSz = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "http_request_size_bytes", Help: "A histogram of request sizes for requests.", diff --git a/search/query.go b/search/query.go index 14d6aef79..de240cc70 100644 --- a/search/query.go +++ b/search/query.go @@ -192,7 +192,7 @@ func (p *PostSearchParams) Filters() []map[string]interface{} { func (p *ActorSearchParams) Filters() []map[string]interface{} { var filters []map[string]interface{} - if p.Follows != nil && len(p.Follows) > 0 { + if len(p.Follows) > 0 { follows := make([]string, len(p.Follows)) for i, did := range p.Follows { follows[i] = did.String() diff --git a/search/transform.go b/search/transform.go index 917b622d8..4c6027081 100644 --- a/search/transform.go +++ b/search/transform.go @@ -103,15 +103,8 @@ func TransformProfile(profile *appbsky.ActorProfile, ident *identity.Identity, c } func TransformPost(post *appbsky.FeedPost, did syntax.DID, rkey, cid string) PostDoc { - altText := []string{} - if post.Embed != nil && post.Embed.EmbedImages != nil { - for _, img := range post.Embed.EmbedImages.Images { - if img.Alt != "" { - altText = append(altText, img.Alt) - } - } - } var langCodeIso2 []string + for _, lang := range post.Langs { // TODO: include an actual language code map to go from 3char to 2char prefix := strings.SplitN(lang, "-", 2)[0] @@ -119,8 +112,8 @@ func TransformPost(post *appbsky.FeedPost, did syntax.DID, rkey, cid string) Pos langCodeIso2 = append(langCodeIso2, strings.ToLower(prefix)) } } - var mentionDIDs []string - var urls []string + + var mentionDIDs, urls []string for _, facet := range post.Facets { for _, feat := range facet.Features { if feat.RichtextFacet_Mention != nil { @@ -283,7 +276,7 @@ func parseEmojis(s string) []string { firstRune := gr.Runes()[0] if (firstRune >= 0x1F000 && firstRune <= 0x1FFFF) || (firstRune >= 0x2600 && firstRune <= 0x26FF) { emoji := gr.Str() - if seen[emoji] == false { + if !seen[emoji] { ret = append(ret, emoji) seen[emoji] = true } diff --git a/sonar/metrics.go b/sonar/metrics.go index ca0069786..f3c3ebc48 100644 --- a/sonar/metrics.go +++ b/sonar/metrics.go @@ -53,11 +53,6 @@ var lastEvtCreatedAtGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{ Help: "The timestamp of the last event created", }, []string{"socket_url"}) -var lastRecordCreatedAtGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "sonar_last_record_created_at", - Help: "The timestamp of the last record processed", -}, []string{"socket_url"}) - var lastEvtCreatedRecordCreatedGapGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "sonar_last_evt_created_record_created_gap", Help: "The gap between the last event's event timestamp and it's record timestamp", diff --git a/testing/feedpost_test.go b/testing/feedpost_test.go index a42cf7084..c5b066516 100644 --- a/testing/feedpost_test.go +++ b/testing/feedpost_test.go @@ -9,13 +9,12 @@ import ( "os" "testing" - comatproto "github.com/bluesky-social/indigo/api/atproto" - appbsky "github.com/bluesky-social/indigo/api/bsky" - bsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/ipfs/go-cid" - "github.com/stretchr/testify/assert" + + comatproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/api/bsky" + lexutil "github.com/bluesky-social/indigo/lex/util" ) func TestFeedPostParse(t *testing.T) { @@ -27,7 +26,7 @@ func TestFeedPostParse(t *testing.T) { cborBytes, err := io.ReadAll(inFile) assert.NoError(err) - var fp appbsky.FeedPost + var fp bsky.FeedPost assert.NoError(fp.UnmarshalCBOR(bytes.NewReader(cborBytes))) assert.Equal("app.bsky.feed.post", fp.LexiconTypeID) @@ -48,13 +47,13 @@ func TestFeedPostParse(t *testing.T) { } assert.Equal( - &appbsky.EmbedRecordWithMedia{ + &bsky.EmbedRecordWithMedia{ LexiconTypeID: "app.bsky.embed.recordWithMedia", - Media: &appbsky.EmbedRecordWithMedia_Media{ - EmbedImages: &appbsky.EmbedImages{ + Media: &bsky.EmbedRecordWithMedia_Media{ + EmbedImages: &bsky.EmbedImages{ LexiconTypeID: "app.bsky.embed.images", - Images: []*appbsky.EmbedImages_Image{ - &appbsky.EmbedImages_Image{ + Images: []*bsky.EmbedImages_Image{ + &bsky.EmbedImages_Image{ Image: &lexutil.LexBlob{ //LexiconTypeID: "blob", Ref: lexutil.LexLink(cc), // 000155122090873DBDFF810882487CCF6127D8D62F241D6F4F919A73151DABA3078580C080 @@ -65,7 +64,7 @@ func TestFeedPostParse(t *testing.T) { }, }, }, - Record: &appbsky.EmbedRecord{ + Record: &bsky.EmbedRecord{ LexiconTypeID: "app.bsky.embed.record", Record: &comatproto.RepoStrongRef{ Cid: "bafyreiaku7udekkiijxcuue3sn6esz7qijqj637rigz4xqdw57fk5houji", @@ -169,8 +168,8 @@ func TestFeedPostRichtextLink(t *testing.T) { } recordCBOR := new(bytes.Buffer) - var recordOrig appbsky.FeedPost - var recordRepro appbsky.FeedPost + var recordOrig bsky.FeedPost + var recordRepro bsky.FeedPost assert.NoError(recordOrig.UnmarshalCBOR(bytes.NewReader(cborBytes))) assert.Equal("app.bsky.feed.post", recordOrig.LexiconTypeID) diff --git a/testing/integ_test.go b/testing/integ_test.go index df3c3fedb..0fc43bf22 100644 --- a/testing/integ_test.go +++ b/testing/integ_test.go @@ -1,22 +1,18 @@ package testing import ( - "bytes" "context" - "encoding/json" "fmt" "math/rand" "strings" "testing" "time" - atproto "github.com/bluesky-social/indigo/api/atproto" + "github.com/stretchr/testify/assert" + + "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/events" - "github.com/bluesky-social/indigo/repo" "github.com/bluesky-social/indigo/xrpc" - "github.com/ipfs/go-cid" - car "github.com/ipld/go-car" - "github.com/stretchr/testify/assert" ) func TestRelayBasic(t *testing.T) { @@ -441,34 +437,6 @@ func TestRelayTakedown(t *testing.T) { assert.Equal(alice.did, last.RepoCommit.Repo) } -func jsonPrint(v any) { - b, _ := json.Marshal(v) - fmt.Println(string(b)) -} - -func commitFromSlice(t *testing.T, slice []byte, rcid cid.Cid) *repo.SignedCommit { - carr, err := car.NewCarReader(bytes.NewReader(slice)) - if err != nil { - t.Fatal(err) - } - - for { - blk, err := carr.Next() - if err != nil { - t.Fatal(err) - } - - if blk.Cid() == rcid { - - var sc repo.SignedCommit - if err := sc.UnmarshalCBOR(bytes.NewReader(blk.RawData())); err != nil { - t.Fatal(err) - } - return &sc - } - } -} - func TestDomainBans(t *testing.T) { if testing.Short() { t.Skip("skipping Relay test in 'short' test mode") diff --git a/testing/utils.go b/testing/utils.go index 066f7bf51..612c00b5f 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -19,6 +19,11 @@ import ( "testing" "time" + "github.com/bobg/errors" + "github.com/ipfs/go-cid" + "github.com/multiformats/go-multihash" + "github.com/whyrusleeping/go-did" + "github.com/bluesky-social/indigo/api" atproto "github.com/bluesky-social/indigo/api/atproto" bsky "github.com/bluesky-social/indigo/api/bsky" @@ -36,9 +41,6 @@ import ( "github.com/bluesky-social/indigo/repomgr" bsutil "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/xrpc" - "github.com/ipfs/go-cid" - "github.com/multiformats/go-multihash" - "github.com/whyrusleeping/go-did" "net/url" @@ -50,7 +52,6 @@ import ( type TestPDS struct { dir string server *pds.Server - plc *api.PLCServer listener net.Listener @@ -173,6 +174,9 @@ func (tp *TestPDS) RequestScraping(t *testing.T, b *TestRelay) { } req, err := http.NewRequest("POST", "http://"+b.Host()+"/admin/subs/setPerDayLimit?limit=500", nil) + if err != nil { + t.Fatal(err) + } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer test") @@ -565,6 +569,9 @@ func SetupRelay(ctx context.Context, didr plc.PLCClient) (*TestRelay, error) { opts := events.DefaultDiskPersistOptions() opts.EventsPerFile = 10 diskpersist, err := events.NewDiskPersistence(filepath.Join(dir, "dp-primary"), filepath.Join(dir, "dp-archive"), maindb, opts) + if err != nil { + return nil, errors.Wrap(err, "in NewDiskPersistence") + } evtman := events.NewEventManager(diskpersist) rf := indexer.NewRepoFetcher(maindb, repoman, 10) @@ -715,10 +722,9 @@ func (es *EventStream) Next() *events.XRPCStreamEvent { func (es *EventStream) All() []*events.XRPCStreamEvent { es.Lk.Lock() defer es.Lk.Unlock() + out := make([]*events.XRPCStreamEvent, len(es.Events)) - for i, e := range es.Events { - out[i] = e - } + copy(out, es.Events) return out }