All Projects → bcicen → Go Haproxy

bcicen / Go Haproxy

Licence: mit
Go library for interacting with HAProxy via command socket

Programming Languages

go
31211 projects - #10 most used programming language

GoDoc codebeat badge

go-haproxy

Go library for interacting with HAProxys stats socket.

Usage

Initialize a client object. Supported address schemas are tcp:// and unix:///

client := &haproxy.HAProxyClient{
  Addr: "tcp://localhost:9999",
}

Fetch results for a built in command(currently supports show stats and show info):

stats, err := client.Stats()
for _, i := range stats {
	fmt.Printf("%s: %s\n", i.SvName, i.Status)
}

Or retrieve the result body from an arbitrary command string:

result, err := h.RunCommand("show info")
fmt.Println(result.String())
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].