A simple and self-hosted pastebin service written in Go. Can use a variety of storage backends.
Designed to optionally remove pastes after a certain period of time. If using a persistent storage backend, pastes will be kept between runs.
Set up an alias:
$ alias pcat='curl -F "paste=<-" http://my.site'
Upload a new paste:
$ echo foo | pcat
http://my.site/a63d03b9
Fetch it:
$ curl http://my.site/a63d03b9
foo
Doing a POST
on /redirect
will send you directly to the paste instead of
returning its url.
$ pastecat -u http://my.site -l :80
- -u - URL of the site - http://localhost:8080
- -l - Host and port to listen to - :8080
- -t - Lifetime of the pastes - 24h
- -T - Timeout of HTTP requests - 5s
- -m - Maximum number of pastes to store at once - 0
- -s - Maximum size of pastes - 1M
- -M - Maximum storage size to use at once - 1G
Any of the options requiring quantities can take a zero value as infinity.
- fs [directory] - filesystem structure (default)
- fs-mmap [directory] - mmapped filesystem structure (requires mmap)
- mem - standard in-memory map (non-persistent)
Note that options must go first.
Should be handled at a lower level. Filesystems like Btrfs already support compression.
A pastebin service is, by definition, aimed at plaintext only. All content is stored and served in UTF-8.
You can build one on top with pastecat as the backend. The builtin web interface is only a fallback for when the command line is not available.
This includes syntax highlighting of any kind.
Even though you could encrypt pastes with tools like GnuPG, for privacy reasons you might want to support HTTPS too.
In such cases, you can run pastecat behind a reverse proxy like Nginx.
Like HTTPS, you can use software like Nginx to add compression on top of pastecat.