FoxyProxy Reseller API bindings for Go.
Install foxyproxy-reseller-go with:
go get -u github.com/jsignanini/foxyproxy-reseller-go
Then, import it using:
import "github.com/jsignanini/foxyproxy-reseller-go"
package main
import (
"fmt"
"github.com/jsignanini/foxyproxy-reseller-go"
)
func main() {
client := foxyproxy.NewClient(&foxyproxy.NewClientParams{
DomainHeader: "x-domain-header-provided-by-foxyproxy",
EndpointBaseURL: "https://reseller.test.api.foxyproxy.com",
Username: "foxyproxy-username",
Password: "foxyproxy-password",
})
// get all nodes
nodes, err := client.GetAllNodes(0, 10)
if err != nil {
panic(err)
}
// iterate nodes and print active connections
for _, node := range nodes {
actives, err := node.GetActiveConnectionTotals()
if err != nil {
panic(err)
}
fmt.Printf("Node: %s, Total Active Connections: %d\n", node.Name, actives)
}
}