Bluesky avatar proxy thing
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

initial commit

+925
+21
Dockerfile
··· 1 + FROM golang:1.25-alpine AS builder 2 + 3 + WORKDIR /build 4 + 5 + COPY go.mod go.sum ./ 6 + RUN go mod download 7 + 8 + COPY . . 9 + RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o blavatar ./cmd/blavatar 10 + 11 + FROM alpine:latest 12 + 13 + RUN apk --no-cache add ca-certificates 14 + 15 + WORKDIR /app 16 + 17 + COPY --from=builder /build/blavatar . 18 + 19 + EXPOSE 8080 20 + 21 + ENTRYPOINT ["/app/blavatar"]
+26
Makefile
··· 1 + .PHONY: build clean install release-dev release 2 + 3 + IMAGE_NAME := blavatar 4 + 5 + build: 6 + go build -o blavatar ./cmd/blavatar 7 + 8 + clean: 9 + rm -f blavatar 10 + 11 + install: build 12 + go install ./cmd/blavatar 13 + 14 + release-dev: 15 + $(eval VERSION := $(shell svu prerelease --pre-release dev)) 16 + docker build -t $(IMAGE_NAME):$(VERSION) . 17 + git tag $(VERSION) 18 + git push origin $(VERSION) 19 + @echo "Built $(IMAGE_NAME):$(VERSION)" 20 + 21 + release: 22 + $(eval VERSION := $(shell svu next)) 23 + docker build -t $(IMAGE_NAME):$(VERSION) -t $(IMAGE_NAME):latest . 24 + git tag $(VERSION) 25 + git push origin $(VERSION) 26 + @echo "Released $(IMAGE_NAME):$(VERSION)"
+101
cmd/blavatar/main.go
··· 1 + package main 2 + 3 + import ( 4 + "context" 5 + "log" 6 + "os" 7 + "os/signal" 8 + "syscall" 9 + 10 + "github.com/urfave/cli/v3" 11 + 12 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/avatar" 13 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/cache" 14 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/jetstream" 15 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/server" 16 + ) 17 + 18 + func main() { 19 + cmd := &cli.Command{ 20 + Name: "blavatar", 21 + Usage: "Bluesky avatar caching proxy", 22 + Flags: []cli.Flag{ 23 + &cli.StringFlag{ 24 + Name: "jetstream-url", 25 + Value: "wss://jetstream2.us-west.bsky.network/subscribe", 26 + Usage: "Jetstream WebSocket URL", 27 + Sources: cli.EnvVars("BLAVATAR_JETSTREAM_URL"), 28 + }, 29 + &cli.StringFlag{ 30 + Name: "store-path", 31 + Value: "./avatars", 32 + Usage: "Local avatar cache directory", 33 + Sources: cli.EnvVars("BLAVATAR_STORE_PATH"), 34 + }, 35 + &cli.StringFlag{ 36 + Name: "listen", 37 + Value: ":8080", 38 + Usage: "HTTP listen address", 39 + Sources: cli.EnvVars("BLAVATAR_LISTEN"), 40 + }, 41 + }, 42 + Action: run, 43 + } 44 + 45 + if err := cmd.Run(context.Background(), os.Args); err != nil { 46 + log.Fatal(err) 47 + } 48 + } 49 + 50 + func run(ctx context.Context, cmd *cli.Command) error { 51 + jetstreamURL := cmd.String("jetstream-url") 52 + storePath := cmd.String("store-path") 53 + listenAddr := cmd.String("listen") 54 + 55 + c, err := cache.New(storePath) 56 + if err != nil { 57 + return err 58 + } 59 + 60 + fetcher := avatar.New() 61 + consumer := jetstream.New(c, jetstreamURL) 62 + srv := server.New(c, fetcher, listenAddr) 63 + 64 + ctx, cancel := context.WithCancel(ctx) 65 + defer cancel() 66 + 67 + errCh := make(chan error, 2) 68 + 69 + go func() { 70 + if err := consumer.Start(ctx); err != nil && ctx.Err() == nil { 71 + errCh <- err 72 + } 73 + }() 74 + 75 + go func() { 76 + if err := srv.Start(); err != nil && ctx.Err() == nil { 77 + errCh <- err 78 + } 79 + }() 80 + 81 + sigCh := make(chan os.Signal, 1) 82 + signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM) 83 + 84 + select { 85 + case sig := <-sigCh: 86 + log.Printf("Received signal %v, shutting down", sig) 87 + case err := <-errCh: 88 + log.Printf("Error: %v", err) 89 + } 90 + 91 + cancel() 92 + 93 + shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 10) 94 + defer shutdownCancel() 95 + 96 + if err := srv.Shutdown(shutdownCtx); err != nil { 97 + log.Printf("Error during shutdown: %v", err) 98 + } 99 + 100 + return nil 101 + }
+74
go.mod
··· 1 + module tangled.org/angrydutchman.peedee.es/blavatar 2 + 3 + go 1.25.3 4 + 5 + require ( 6 + github.com/bluesky-social/indigo v0.0.0-20260103083015-78a1c1894f36 7 + github.com/bluesky-social/jetstream v0.0.0-20251009222037-7d7efa58d7f1 8 + github.com/urfave/cli/v3 v3.6.1 9 + golang.org/x/image v0.34.0 10 + ) 11 + 12 + require ( 13 + github.com/beorn7/perks v1.0.1 // indirect 14 + github.com/cespare/xxhash/v2 v2.3.0 // indirect 15 + github.com/earthboundkid/versioninfo/v2 v2.24.1 // indirect 16 + github.com/felixge/httpsnoop v1.0.4 // indirect 17 + github.com/go-logr/logr v1.4.1 // indirect 18 + github.com/go-logr/stdr v1.2.2 // indirect 19 + github.com/goccy/go-json v0.10.2 // indirect 20 + github.com/gogo/protobuf v1.3.2 // indirect 21 + github.com/google/uuid v1.6.0 // indirect 22 + github.com/gorilla/websocket v1.5.1 // indirect 23 + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect 24 + github.com/hashicorp/go-retryablehttp v0.7.5 // indirect 25 + github.com/hashicorp/golang-lru v1.0.2 // indirect 26 + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect 27 + github.com/ipfs/bbloom v0.0.4 // indirect 28 + github.com/ipfs/go-block-format v0.2.0 // indirect 29 + github.com/ipfs/go-cid v0.4.1 // indirect 30 + github.com/ipfs/go-datastore v0.6.0 // indirect 31 + github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect 32 + github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect 33 + github.com/ipfs/go-ipfs-util v0.0.3 // indirect 34 + github.com/ipfs/go-ipld-cbor v0.1.0 // indirect 35 + github.com/ipfs/go-ipld-format v0.6.0 // indirect 36 + github.com/ipfs/go-log v1.0.5 // indirect 37 + github.com/ipfs/go-log/v2 v2.5.1 // indirect 38 + github.com/ipfs/go-metrics-interface v0.0.1 // indirect 39 + github.com/jbenet/goprocess v0.1.4 // indirect 40 + github.com/klauspost/compress v1.17.9 // indirect 41 + github.com/klauspost/cpuid/v2 v2.2.7 // indirect 42 + github.com/mattn/go-isatty v0.0.20 // indirect 43 + github.com/minio/sha256-simd v1.0.1 // indirect 44 + github.com/mr-tron/base58 v1.2.0 // indirect 45 + github.com/multiformats/go-base32 v0.1.0 // indirect 46 + github.com/multiformats/go-base36 v0.2.0 // indirect 47 + github.com/multiformats/go-multibase v0.2.0 // indirect 48 + github.com/multiformats/go-multihash v0.2.3 // indirect 49 + github.com/multiformats/go-varint v0.0.7 // indirect 50 + github.com/opentracing/opentracing-go v1.2.0 // indirect 51 + github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f // indirect 52 + github.com/prometheus/client_golang v1.19.1 // indirect 53 + github.com/prometheus/client_model v0.6.1 // indirect 54 + github.com/prometheus/common v0.54.0 // indirect 55 + github.com/prometheus/procfs v0.15.1 // indirect 56 + github.com/spaolacci/murmur3 v1.1.0 // indirect 57 + github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e // indirect 58 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect 59 + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect 60 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect 61 + go.opentelemetry.io/otel v1.21.0 // indirect 62 + go.opentelemetry.io/otel/metric v1.21.0 // indirect 63 + go.opentelemetry.io/otel/trace v1.21.0 // indirect 64 + go.uber.org/atomic v1.11.0 // indirect 65 + go.uber.org/multierr v1.11.0 // indirect 66 + go.uber.org/zap v1.26.0 // indirect 67 + golang.org/x/crypto v0.22.0 // indirect 68 + golang.org/x/net v0.24.0 // indirect 69 + golang.org/x/sys v0.22.0 // indirect 70 + golang.org/x/time v0.5.0 // indirect 71 + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect 72 + google.golang.org/protobuf v1.34.2 // indirect 73 + lukechampine.com/blake3 v1.2.1 // indirect 74 + )
+253
go.sum
··· 1 + github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 + github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 3 + github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 4 + github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 5 + github.com/bluesky-social/indigo v0.0.0-20260103083015-78a1c1894f36 h1:0biH9kLhFMnTDdyJN+e+D+Hb4eZ7P5K66iiqWwyZzYE= 6 + github.com/bluesky-social/indigo v0.0.0-20260103083015-78a1c1894f36/go.mod h1:KIy0FgNQacp4uv2Z7xhNkV3qZiUSGuRky97s7Pa4v+o= 7 + github.com/bluesky-social/jetstream v0.0.0-20251009222037-7d7efa58d7f1 h1:ovcRKN1iXZnY5WApVg+0Hw2RkwMH0ziA7lSAA8vellU= 8 + github.com/bluesky-social/jetstream v0.0.0-20251009222037-7d7efa58d7f1/go.mod h1:5PtGi4r/PjEVBBl+0xWuQn4mBEjr9h6xsfDBADS6cHs= 9 + github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= 10 + github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 11 + github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 12 + github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 13 + github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 14 + github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 15 + github.com/earthboundkid/versioninfo/v2 v2.24.1 h1:SJTMHaoUx3GzjjnUO1QzP3ZXK6Ee/nbWyCm58eY3oUg= 16 + github.com/earthboundkid/versioninfo/v2 v2.24.1/go.mod h1:VcWEooDEuyUJnMfbdTh0uFN4cfEIg+kHMuWB2CDCLjw= 17 + github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= 18 + github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= 19 + github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 20 + github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= 21 + github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 22 + github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 23 + github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 24 + github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= 25 + github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= 26 + github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= 27 + github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 28 + github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 29 + github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 30 + github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 31 + github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 32 + github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 33 + github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 34 + github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= 35 + github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= 36 + github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= 37 + github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= 38 + github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= 39 + github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= 40 + github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= 41 + github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= 42 + github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= 43 + github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= 44 + github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= 45 + github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= 46 + github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= 47 + github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= 48 + github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= 49 + github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= 50 + github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= 51 + github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= 52 + github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= 53 + github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= 54 + github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= 55 + github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= 56 + github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= 57 + github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= 58 + github.com/ipfs/go-ipfs-blockstore v1.3.1 h1:cEI9ci7V0sRNivqaOr0elDsamxXFxJMMMy7PTTDQNsQ= 59 + github.com/ipfs/go-ipfs-blockstore v1.3.1/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= 60 + github.com/ipfs/go-ipfs-ds-help v1.1.1 h1:B5UJOH52IbcfS56+Ul+sv8jnIV10lbjLF5eOO0C66Nw= 61 + github.com/ipfs/go-ipfs-ds-help v1.1.1/go.mod h1:75vrVCkSdSFidJscs8n4W+77AtTpCIAdDGAwjitJMIo= 62 + github.com/ipfs/go-ipfs-util v0.0.3 h1:2RFdGez6bu2ZlZdI+rWfIdbQb1KudQp3VGwPtdNCmE0= 63 + github.com/ipfs/go-ipfs-util v0.0.3/go.mod h1:LHzG1a0Ig4G+iZ26UUOMjHd+lfM84LZCrn17xAKWBvs= 64 + github.com/ipfs/go-ipld-cbor v0.1.0 h1:dx0nS0kILVivGhfWuB6dUpMa/LAwElHPw1yOGYopoYs= 65 + github.com/ipfs/go-ipld-cbor v0.1.0/go.mod h1:U2aYlmVrJr2wsUBU67K4KgepApSZddGRDWBYR0H4sCk= 66 + github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U= 67 + github.com/ipfs/go-ipld-format v0.6.0/go.mod h1:g4QVMTn3marU3qXchwjpKPKgJv+zF+OlaKMyhJ4LHPg= 68 + github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= 69 + github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= 70 + github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= 71 + github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= 72 + github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= 73 + github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= 74 + github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= 75 + github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= 76 + github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= 77 + github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= 78 + github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= 79 + github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= 80 + github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= 81 + github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 82 + github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= 83 + github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 84 + github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= 85 + github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= 86 + github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 87 + github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 88 + github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 89 + github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 90 + github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 91 + github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 92 + github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 93 + github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 94 + github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 95 + github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 96 + github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= 97 + github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= 98 + github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= 99 + github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= 100 + github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= 101 + github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= 102 + github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= 103 + github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= 104 + github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= 105 + github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= 106 + github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= 107 + github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= 108 + github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= 109 + github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= 110 + github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= 111 + github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= 112 + github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 113 + github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 114 + github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 115 + github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f h1:VXTQfuJj9vKR4TCkEuWIckKvdHFeJH/huIFJ9/cXOB0= 116 + github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= 117 + github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= 118 + github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= 119 + github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= 120 + github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= 121 + github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8= 122 + github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ= 123 + github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= 124 + github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= 125 + github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 126 + github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= 127 + github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= 128 + github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 129 + github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 130 + github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= 131 + github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= 132 + github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= 133 + github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= 134 + github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= 135 + github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 136 + github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 137 + github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 138 + github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 139 + github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 140 + github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 141 + github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 142 + github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 143 + github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= 144 + github.com/urfave/cli/v3 v3.6.1 h1:j8Qq8NyUawj/7rTYdBGrxcH7A/j7/G8Q5LhWEW4G3Mo= 145 + github.com/urfave/cli/v3 v3.6.1/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= 146 + github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= 147 + github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= 148 + github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e h1:28X54ciEwwUxyHn9yrZfl5ojgF4CBNLWX7LR0rvBkf4= 149 + github.com/whyrusleeping/cbor-gen v0.2.1-0.20241030202151-b7a6831be65e/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so= 150 + github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 151 + github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 152 + github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= 153 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= 154 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= 155 + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= 156 + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 157 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= 158 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= 159 + go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= 160 + go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= 161 + go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= 162 + go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= 163 + go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= 164 + go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= 165 + go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= 166 + go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= 167 + go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= 168 + go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= 169 + go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= 170 + go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= 171 + go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= 172 + go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= 173 + go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= 174 + go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= 175 + go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= 176 + go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= 177 + go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= 178 + go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= 179 + go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= 180 + go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= 181 + golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 182 + golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 183 + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 184 + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 185 + golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= 186 + golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= 187 + golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8= 188 + golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU= 189 + golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 190 + golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 191 + golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 192 + golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 193 + golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 194 + golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 195 + golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 196 + golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 197 + golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 198 + golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 199 + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= 200 + golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= 201 + golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= 202 + golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 203 + golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 204 + golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 205 + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 206 + golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 207 + golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 208 + golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 209 + golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 210 + golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 211 + golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 212 + golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 213 + golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 214 + golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 215 + golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= 216 + golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 217 + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 218 + golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 219 + golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 220 + golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= 221 + golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 222 + golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 223 + golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 224 + golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 225 + golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 226 + golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 227 + golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 228 + golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 229 + golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 230 + golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 231 + golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 232 + golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 233 + golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 234 + golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 235 + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 236 + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= 237 + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= 238 + google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= 239 + google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 240 + gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 241 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 242 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 243 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 244 + gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 245 + gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 246 + gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 247 + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 248 + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 249 + gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 250 + gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 251 + honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 252 + lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= 253 + lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
+124
internal/avatar/fetcher.go
··· 1 + package avatar 2 + 3 + import ( 4 + "bytes" 5 + "context" 6 + "fmt" 7 + "image" 8 + "image/jpeg" 9 + _ "image/png" 10 + 11 + "github.com/bluesky-social/indigo/api/atproto" 12 + "github.com/bluesky-social/indigo/api/bsky" 13 + "github.com/bluesky-social/indigo/atproto/identity" 14 + "github.com/bluesky-social/indigo/atproto/syntax" 15 + "github.com/bluesky-social/indigo/xrpc" 16 + 17 + "golang.org/x/image/draw" 18 + ) 19 + 20 + // FetchResult contains the result of fetching an avatar 21 + type FetchResult struct { 22 + DID string 23 + Avatar []byte 24 + HasAvatar bool 25 + } 26 + 27 + // Fetcher handles avatar fetching from Bluesky 28 + type Fetcher struct { 29 + dir identity.Directory 30 + } 31 + 32 + // New creates a new Fetcher 33 + func New() *Fetcher { 34 + return &Fetcher{ 35 + dir: identity.DefaultDirectory(), 36 + } 37 + } 38 + 39 + // ResolveDID resolves an identifier (DID or handle) to a DID string 40 + func (f *Fetcher) ResolveDID(ctx context.Context, identifier string) (string, error) { 41 + atid, err := syntax.ParseAtIdentifier(identifier) 42 + if err != nil { 43 + return "", fmt.Errorf("invalid identifier: %w", err) 44 + } 45 + 46 + ident, err := f.dir.Lookup(ctx, *atid) 47 + if err != nil { 48 + return "", fmt.Errorf("failed to lookup identity: %w", err) 49 + } 50 + 51 + return ident.DID.String(), nil 52 + } 53 + 54 + // Fetch fetches an avatar for the given identifier (DID or handle) 55 + func (f *Fetcher) Fetch(ctx context.Context, identifier string) (*FetchResult, error) { 56 + atid, err := syntax.ParseAtIdentifier(identifier) 57 + if err != nil { 58 + return nil, fmt.Errorf("invalid identifier: %w", err) 59 + } 60 + 61 + ident, err := f.dir.Lookup(ctx, *atid) 62 + if err != nil { 63 + return nil, fmt.Errorf("failed to lookup identity: %w", err) 64 + } 65 + 66 + pdsURL := ident.PDSEndpoint() 67 + if pdsURL == "" { 68 + return nil, fmt.Errorf("no PDS endpoint for %s", identifier) 69 + } 70 + 71 + client := &xrpc.Client{Host: pdsURL} 72 + 73 + output, err := atproto.RepoGetRecord(ctx, client, "", "app.bsky.actor.profile", ident.DID.String(), "self") 74 + if err != nil { 75 + return nil, fmt.Errorf("failed to get profile record: %w", err) 76 + } 77 + 78 + profile, ok := output.Value.Val.(*bsky.ActorProfile) 79 + if !ok { 80 + return nil, fmt.Errorf("unexpected profile type: %T", output.Value.Val) 81 + } 82 + 83 + if profile.Avatar == nil || !profile.Avatar.Ref.Defined() { 84 + return &FetchResult{ 85 + DID: ident.DID.String(), 86 + HasAvatar: false, 87 + }, nil 88 + } 89 + 90 + avatarCID := profile.Avatar.Ref.String() 91 + avatarBytes, err := atproto.SyncGetBlob(ctx, client, avatarCID, ident.DID.String()) 92 + if err != nil { 93 + return nil, fmt.Errorf("failed to get avatar blob: %w", err) 94 + } 95 + 96 + scaled, err := scaleImage(avatarBytes, 128, 128) 97 + if err != nil { 98 + return nil, fmt.Errorf("failed to scale avatar: %w", err) 99 + } 100 + 101 + return &FetchResult{ 102 + DID: ident.DID.String(), 103 + Avatar: scaled, 104 + HasAvatar: true, 105 + }, nil 106 + } 107 + 108 + // scaleImage scales an image to the specified dimensions 109 + func scaleImage(data []byte, width, height int) ([]byte, error) { 110 + img, _, err := image.Decode(bytes.NewReader(data)) 111 + if err != nil { 112 + return nil, err 113 + } 114 + 115 + scaled := image.NewRGBA(image.Rect(0, 0, width, height)) 116 + draw.CatmullRom.Scale(scaled, scaled.Bounds(), img, img.Bounds(), draw.Over, nil) 117 + 118 + var buf bytes.Buffer 119 + if err := jpeg.Encode(&buf, scaled, &jpeg.Options{Quality: 95}); err != nil { 120 + return nil, err 121 + } 122 + 123 + return buf.Bytes(), nil 124 + }
+62
internal/cache/cache.go
··· 1 + package cache 2 + 3 + import ( 4 + "os" 5 + "path/filepath" 6 + "strings" 7 + "sync" 8 + ) 9 + 10 + // Cache manages file-based avatar caching 11 + type Cache struct { 12 + storePath string 13 + mu sync.RWMutex 14 + } 15 + 16 + // New creates a new Cache with the given store path 17 + func New(storePath string) (*Cache, error) { 18 + if err := os.MkdirAll(storePath, 0755); err != nil { 19 + return nil, err 20 + } 21 + return &Cache{storePath: storePath}, nil 22 + } 23 + 24 + // didToFilename converts a DID to a safe filename 25 + func didToFilename(did string) string { 26 + return strings.ReplaceAll(did, ":", "_") + ".jpg" 27 + } 28 + 29 + // Get retrieves an avatar from the cache 30 + func (c *Cache) Get(did string) ([]byte, bool) { 31 + c.mu.RLock() 32 + defer c.mu.RUnlock() 33 + 34 + path := filepath.Join(c.storePath, didToFilename(did)) 35 + data, err := os.ReadFile(path) 36 + if err != nil { 37 + return nil, false 38 + } 39 + return data, true 40 + } 41 + 42 + // Set stores an avatar in the cache 43 + func (c *Cache) Set(did string, data []byte) error { 44 + c.mu.Lock() 45 + defer c.mu.Unlock() 46 + 47 + path := filepath.Join(c.storePath, didToFilename(did)) 48 + return os.WriteFile(path, data, 0644) 49 + } 50 + 51 + // Delete removes an avatar from the cache 52 + func (c *Cache) Delete(did string) error { 53 + c.mu.Lock() 54 + defer c.mu.Unlock() 55 + 56 + path := filepath.Join(c.storePath, didToFilename(did)) 57 + err := os.Remove(path) 58 + if os.IsNotExist(err) { 59 + return nil 60 + } 61 + return err 62 + }
+82
internal/jetstream/consumer.go
··· 1 + package jetstream 2 + 3 + import ( 4 + "context" 5 + "log" 6 + "log/slog" 7 + "time" 8 + 9 + "github.com/bluesky-social/jetstream/pkg/client" 10 + "github.com/bluesky-social/jetstream/pkg/models" 11 + 12 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/cache" 13 + ) 14 + 15 + // Consumer listens to Jetstream for profile updates and invalidates cache 16 + type Consumer struct { 17 + cache *cache.Cache 18 + jetstreamURL string 19 + logger *slog.Logger 20 + } 21 + 22 + // New creates a new Consumer 23 + func New(c *cache.Cache, jetstreamURL string) *Consumer { 24 + return &Consumer{ 25 + cache: c, 26 + jetstreamURL: jetstreamURL, 27 + logger: slog.Default(), 28 + } 29 + } 30 + 31 + // Start begins consuming Jetstream events 32 + func (c *Consumer) Start(ctx context.Context) error { 33 + for { 34 + if err := c.connect(ctx); err != nil { 35 + if ctx.Err() != nil { 36 + return ctx.Err() 37 + } 38 + log.Printf("Jetstream connection error: %v, reconnecting in 5s", err) 39 + select { 40 + case <-ctx.Done(): 41 + return ctx.Err() 42 + case <-time.After(5 * time.Second): 43 + } 44 + } 45 + } 46 + } 47 + 48 + func (c *Consumer) connect(ctx context.Context) error { 49 + config := client.DefaultClientConfig() 50 + config.WebsocketURL = c.jetstreamURL 51 + config.WantedCollections = []string{"app.bsky.actor.profile"} 52 + config.Compress = true 53 + 54 + scheduler := &cacheInvalidator{cache: c.cache} 55 + 56 + jc, err := client.NewClient(config, c.logger, scheduler) 57 + if err != nil { 58 + return err 59 + } 60 + 61 + log.Printf("Connected to Jetstream at %s", c.jetstreamURL) 62 + return jc.ConnectAndRead(ctx, nil) 63 + } 64 + 65 + // cacheInvalidator implements the client.Scheduler interface 66 + type cacheInvalidator struct { 67 + cache *cache.Cache 68 + } 69 + 70 + func (ci *cacheInvalidator) AddWork(ctx context.Context, repo string, evt *models.Event) error { 71 + if evt.Kind == models.EventKindCommit && evt.Commit != nil { 72 + if evt.Commit.Collection == "app.bsky.actor.profile" { 73 + log.Printf("Invalidating cache for %s (operation: %s)", evt.Did, evt.Commit.Operation) 74 + if err := ci.cache.Delete(evt.Did); err != nil { 75 + log.Printf("Error deleting cache for %s: %v", evt.Did, err) 76 + } 77 + } 78 + } 79 + return nil 80 + } 81 + 82 + func (ci *cacheInvalidator) Shutdown() {}
+72
internal/server/default.go
··· 1 + package server 2 + 3 + import ( 4 + "bytes" 5 + "image" 6 + "image/color" 7 + "image/jpeg" 8 + "math" 9 + "sync" 10 + ) 11 + 12 + var ( 13 + defaultAvatar []byte 14 + defaultAvatarOnce sync.Once 15 + ) 16 + 17 + // GetDefaultAvatar returns a pre-generated default avatar image 18 + func GetDefaultAvatar() []byte { 19 + defaultAvatarOnce.Do(func() { 20 + defaultAvatar = generateDefaultAvatar() 21 + }) 22 + return defaultAvatar 23 + } 24 + 25 + // generateDefaultAvatar creates a simple placeholder avatar: 26 + // a gray circle (representing a head) on a light gray background 27 + func generateDefaultAvatar() []byte { 28 + const size = 128 29 + 30 + img := image.NewRGBA(image.Rect(0, 0, size, size)) 31 + 32 + bgColor := color.RGBA{R: 230, G: 230, B: 230, A: 255} 33 + circleColor := color.RGBA{R: 180, G: 180, B: 180, A: 255} 34 + 35 + for y := 0; y < size; y++ { 36 + for x := 0; x < size; x++ { 37 + img.Set(x, y, bgColor) 38 + } 39 + } 40 + 41 + centerX, centerY := float64(size)/2, float64(size)/2 42 + headRadius := float64(size) * 0.25 43 + headCenterY := centerY - float64(size)*0.1 44 + 45 + for y := 0; y < size; y++ { 46 + for x := 0; x < size; x++ { 47 + dx := float64(x) - centerX 48 + dy := float64(y) - headCenterY 49 + if math.Sqrt(dx*dx+dy*dy) <= headRadius { 50 + img.Set(x, y, circleColor) 51 + } 52 + } 53 + } 54 + 55 + bodyTopY := headCenterY + headRadius + float64(size)*0.05 56 + bodyRadius := float64(size) * 0.4 57 + bodyCenterY := bodyTopY + bodyRadius 58 + 59 + for y := int(bodyTopY); y < size; y++ { 60 + for x := 0; x < size; x++ { 61 + dx := float64(x) - centerX 62 + dy := float64(y) - bodyCenterY 63 + if math.Sqrt(dx*dx+dy*dy) <= bodyRadius { 64 + img.Set(x, y, circleColor) 65 + } 66 + } 67 + } 68 + 69 + var buf bytes.Buffer 70 + jpeg.Encode(&buf, img, &jpeg.Options{Quality: 95}) 71 + return buf.Bytes() 72 + }
+110
internal/server/server.go
··· 1 + package server 2 + 3 + import ( 4 + "context" 5 + "log" 6 + "net/http" 7 + "strings" 8 + "time" 9 + 10 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/avatar" 11 + "tangled.org/angrydutchman.peedee.es/blavatar/internal/cache" 12 + ) 13 + 14 + const avatarPathPattern = "GET /{identifier}" 15 + 16 + // Server handles HTTP requests for avatars 17 + type Server struct { 18 + cache *cache.Cache 19 + fetcher *avatar.Fetcher 20 + addr string 21 + server *http.Server 22 + } 23 + 24 + // New creates a new Server 25 + func New(c *cache.Cache, f *avatar.Fetcher, addr string) *Server { 26 + return &Server{ 27 + cache: c, 28 + fetcher: f, 29 + addr: addr, 30 + } 31 + } 32 + 33 + // Start starts the HTTP server 34 + func (s *Server) Start() error { 35 + mux := http.NewServeMux() 36 + mux.HandleFunc(avatarPathPattern, s.handleAvatar) 37 + 38 + s.server = &http.Server{ 39 + Addr: s.addr, 40 + Handler: mux, 41 + } 42 + 43 + log.Printf("Starting HTTP server on %s", s.addr) 44 + return s.server.ListenAndServe() 45 + } 46 + 47 + // Shutdown gracefully shuts down the server 48 + func (s *Server) Shutdown(ctx context.Context) error { 49 + if s.server != nil { 50 + return s.server.Shutdown(ctx) 51 + } 52 + return nil 53 + } 54 + 55 + func (s *Server) handleAvatar(w http.ResponseWriter, r *http.Request) { 56 + filename := r.PathValue("identifier") 57 + if !strings.HasSuffix(filename, ".jpg") { 58 + http.Error(w, "Not found", http.StatusNotFound) 59 + return 60 + } 61 + 62 + identifier := strings.TrimSuffix(filename, ".jpg") 63 + if identifier == "" { 64 + http.Error(w, "Not found", http.StatusNotFound) 65 + return 66 + } 67 + 68 + ctx, cancel := context.WithTimeout(r.Context(), 30*time.Second) 69 + defer cancel() 70 + 71 + did, err := s.fetcher.ResolveDID(ctx, identifier) 72 + if err != nil { 73 + log.Printf("Error resolving DID for %s: %v", identifier, err) 74 + http.Error(w, "Not found", http.StatusNotFound) 75 + return 76 + } 77 + 78 + if data, ok := s.cache.Get(did); ok { 79 + s.serveAvatar(w, data, true) 80 + return 81 + } 82 + 83 + result, err := s.fetcher.Fetch(ctx, identifier) 84 + if err != nil { 85 + log.Printf("Error fetching avatar for %s: %v", identifier, err) 86 + http.Error(w, "Internal server error", http.StatusInternalServerError) 87 + return 88 + } 89 + 90 + if !result.HasAvatar { 91 + s.serveAvatar(w, GetDefaultAvatar(), false) 92 + return 93 + } 94 + 95 + if err := s.cache.Set(result.DID, result.Avatar); err != nil { 96 + log.Printf("Error caching avatar for %s: %v", result.DID, err) 97 + } 98 + 99 + s.serveAvatar(w, result.Avatar, true) 100 + } 101 + 102 + func (s *Server) serveAvatar(w http.ResponseWriter, data []byte, cacheable bool) { 103 + w.Header().Set("Content-Type", "image/jpeg") 104 + if cacheable { 105 + w.Header().Set("Cache-Control", "public, max-age=7200") 106 + } else { 107 + w.Header().Set("Cache-Control", "no-cache") 108 + } 109 + w.Write(data) 110 + }