blobd

command module
v0.0.0-...-5564d8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 12 Imported by: 0

README

blobd

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.

Features
  • automatic blob discovery (using atscan api)
  • MIME type detection (supported types)
  • on-fly image transfomations (webp support)
  • file storage/cache
  • blob inspection endpoint
TODO
  • transport compression
  • storage/cache compression (zstd?)
  • pre-fetching of blobs from PDS
  • metrics (HTTP server, processing)
  • custom PLCs or PDS

Endpoints

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)

Usage

Requires:

  • go 1.20+
  • libwebp
Install Dependencies
Linux
sudo apt-get update
sudo apt-get install libwebp-dev
Mac OS
brew install webp
Install

You can install the application using this command:

go install github.com/atscan/blobd@latest
How to start

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 |
+-----------------------------------------+

Authors

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL