Gopher Squeeze
log streaming experiment
Gopher Squeeze is a program written in Go that takes input from STDIN in chunks, compresses the data with gzip, and sends it to an HTTP endpoint. The server receives the compressed data, decompresses it, and logs it to STDOUT.
Requirements
- Go 1.20 or higher
Installation
-
Clone the repository:
git clone https://github.com/daxxog/gopher-squeeze.git
-
Navigate to the project directory:
cd gopher-squeeze
-
Build the client and server binaries:
make
Usage
Server
-
Set the
WEBHOOK_SECRET
environment variable with the desired secret value:export WEBHOOK_SECRET=your-secret export WEBHOOK_LISTEN=127.0.0.1:8000
-
Start the server:
./gopher-squeeze
-
The server will start listening on
localhost:8000
(default). It will receive the compressed data, decompress it, and log it to STDOUT.
Client
-
Set the
WEBHOOK_ENDPOINT
environment variable with the same secret value used for the server:export WEBHOOK_ENDPOINT=http://localhost:8000/log/your-secret
-
Pipe the input data to the client binary:
cat input.txt | ./gopher-squeeze
-
The client will read the input from STDIN in chunks, compress each chunk with gzip, and send it to the server. It will receive a response from the server (optional) and log it to STDOUT.
License
This project is licensed under the Apache License Version 2.0. See the LICENSE file for details.