AT Protocol Blob-serving HTTP Server in Go
A high-performance web server that provides better access to binary data (called
blobs) from the
AT Protocol. It automatically locates the blob and the
PDS that hosts it using the unique did
identity and cid
reference - then
downloads it, verify it, performs the required transformations, and returns it
to the user (and stores it in the cache for later).
It is recommended to have blobd running behind a reverse proxy such as Caddy or Nginx if you want features such as SSL or load balancing.
You can try the application at blob.atscan.net, which is a publicly accessible instance.
- automatic blob discovery (using atscan api)
- MIME type detection (supported types)
- on-fly image transfomations (webp support)
- file storage/cache
- blob inspection endpoint
- transport compression
- storage/cache compression (zstd?)
- pre-fetching of blobs from PDS
- metrics (HTTP server, processing)
- custom PLCs or PDS
Method | Path | Name | Examples |
---|---|---|---|
GET | /<did>/<cid> |
Get the blob (original) | (1), (2) |
GET | /<did>/<cid>?format=webp&width=200 |
Get transcoded image | (1), (2) |
GET | /<did>/<cid>/inspect |
Inspect blob | (1), (2) |
Requires:
- go 1.20+
- libwebp
sudo apt-get update
sudo apt-get install libwebp-dev
brew install webp
You can install the application using this command:
go install github.com/atscan/blobd@latest
Starting the server on port 3000
and caching the blobs in /path/to/data
:
blobd -d /path/to/data -p 3000
Try it out to see if it works:
http localhost:3000/did:plc:ewvi7nxzyoun6zhxrhs64oiz/bafkreibjfgx2gprinfvicegelk5kosd6y2frmqpqzwqkg7usac74l3t2v4
Result:
HTTP/1.1 200 OK
Content-Length: 86984
Content-Type: image/jpeg
Date: Fri, 14 Jul 2023 09:38:55 GMT
+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+
MIT