Rewritten backend of bandwidth-hero-proxy.
Requirements:
Install:
go install -v github.com/Yonle/go-bwhero@latestOr use the ready-to-use Docker image:
docker run -d -p 8080:8080 --name bwhero yonle/bwheroOr with Docker Compose:
docker compose up --buildgo-bwhero \
-listen localhost:8080You can increase the libvips concurrency level with:
go-bwhero \
-vipsConcurrencyLevel 4Larger files take more time and CPU resources to process. By default, go-bwhero does not limit the file size.
You can set the following limits:
-imgSizeLimit— Maximum image size in bytes-animSizeLimit— Maximum animation size in bytes-videoSizeLimit— Maximum video size in bytes
For example:
# Maximum image size: 50 MB
# Maximum animation size: 50 MB
go-bwhero \
-imgSizeLimit 50000000 \
-animSizeLimit 50000000Set -animSizeLimit to -2 to disable animation processing completely.
-videoSizeLimit works similarly, but only affects video thumbnailing.
FFmpeg is required for animation processing. You can run go-bwhero without FFmpeg by disabling animation processing.
You can adjust Go's memory and garbage collection behavior with the following environment variables:
GOMEMLIMIT— Soft memory limit, e.g.512MiBGOGC— Garbage collection target percentage, e.g.50oroffGOMAXPROCS— Maximum number of CPUs available to Go, e.g.2
Example:
GOMEMLIMIT=512MiB GOMAXPROCS=2 GOGC=30 ./go-bwheroThe default user agent is:
Mozilla/5.0; go-bwhero [https://github.com/Yonle/bwhero]
You can change it with the -userAgent flag:
go-bwhero \
-userAgent "My User Agent"By default, go-bwhero redirects to the original image URL when it detects that the user is opening the image in a new tab.
To prevent this behavior during testing, add the nr query parameter:
http://localhost:8080/?url=....&nr=1