Skip to content

jsignanini/foxyproxy-reseller-go

Repository files navigation

foxyproxy-reseller-go

GoDoc Build Status Go Report Card Coverage Status

FoxyProxy Reseller API bindings for Go.

Installation

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"

Usage

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)
	}
}

About

FoxyProxy Reseller API bindings for Go.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages