Skip to content

About

Varnish modules to help interacting with Varnish

Resources

Stars

8 stars

Watchers

1 watching

Forks

Repository files navigation

Go SDK for Varnish

CI Go Reference

Important: this is a work-in-progress. Bugs and feature requests welcome via issues or pull requests.

All packages require libvarnishapi (varnish-dev or varnish-devel) (open-source or Enterprise) and CGo.

Packages

vtest — spawn Varnish instances for testing

Go-native alternative to the varnishtest tool. Spin up a real Varnish process, make HTTP requests against it, and inspect VSL logs — all from regular Go tests.

go get github.com/varnish/varnish-go/vtest

log — stream VSL transactions

Read and filter Varnish Shared Log transactions from a live instance or a binary file, equivalent to varnishlog.

log/tags.go exposes named variables for every known VSL tag across Varnish OSS and Enterprise (e.g. log.TagReqURL). Values are resolved at startup; tags absent from the installed Varnish version are left as zero.

go get github.com/varnish/varnish-go/log

stat — read statistics counters

Poll VSC counters from Varnish Shared Memory, equivalent to varnishstat.

go get github.com/varnish/varnish-go/stat

adm — admin socket client

Send CLI commands to a running Varnish instance, equivalent to varnishadm.

go get github.com/varnish/varnish-go/adm

version — installed Varnish version

Reports the installed Varnish edition (open-source or Enterprise), version string, and commit hash, resolved at compile time from vmod_abi.h.

go get github.com/varnish/varnish-go/version

vcl — parse and render VCL

Parses Varnish Configuration Language (VCL) source into an AST, and renders it back. Pure Go, no CGo and no libvarnishapi required — unlike the other packages above.

v, err := vcl.NewParser(input).Parse()
if err != nil {
    // handle error
}
fmt.Print(v.String()) // re-rendered VCL
prog := v.AST()        // the parsed *ast.Program
go get github.com/varnish/varnish-go/vcl

About

Varnish modules to help interacting with Varnish

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages