vascoClient

package
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SourceDeployTag string = "Not set"
View Source
var SourceRevision string = "Not set"

These will be set by the linker when built using the standard tools

Functions

func HostURL

func HostURL(path string) func(*VascoClient)

func Logger

func Logger(logger *log.Entry) func(*VascoClient)

options functions

func MyIP

func MyIP(ip string) func(*VascoClient)

func Refresh

func Refresh(t time.Duration) func(*VascoClient)

func VascoAddress

func VascoAddress(addr string) func(*VascoClient)

Types

type RequestCounter

type RequestCounter struct {
	// contains filtered or unexported fields
}

func NewRequestCounter

func NewRequestCounter(dur time.Duration) *RequestCounter

func (*RequestCounter) Count

func (rc *RequestCounter) Count() int

func (*RequestCounter) N

func (rc *RequestCounter) N() int

type Status

type Status struct {
	StartTime        time.Time `json:"starttime"`
	Uptime           string    `json:"uptime"`
	Revision         string    `json:"revision"`
	DeployTag        string    `json:"deploytag"`
	DeployType       string    `json:"configtype"`
	ConfigVersion    string    `json:"configversion"`
	IP               string    `json:"ip"`
	PID              int       `json:"pid"`
	Requests         int       `json:"requests"`
	UserErrors       int       `json:"usererrors"`
	ServerErrors     int       `json:"servererrors"`
	RequestsLastHour int       `json:"requestslasthour"`
	RequestsLast5Min int       `json:"requestslast5min"`
	// contains filtered or unexported fields
}

func (*Status) FillStatus

func (st *Status) FillStatus()

type VascoClient

type VascoClient struct {
	Logger *log.Entry
	// contains filtered or unexported fields
}

func New

func New(options ...func(*VascoClient)) *VascoClient

New creates a new client and supports an arbitrary collection of initialization option functions (see above)

func (*VascoClient) CL

func (vc *VascoClient) CL(handler http.HandlerFunc) http.HandlerFunc

CL is middleware that composes LogRequests and CountRequests

func (*VascoClient) CountQuery

func (vc *VascoClient) CountQuery()

func (*VascoClient) CountRequests

func (vc *VascoClient) CountRequests(handler http.HandlerFunc) http.HandlerFunc

CountRequests is middleware for standard handler functions

func (*VascoClient) CountServerError

func (vc *VascoClient) CountServerError()

func (*VascoClient) CountUserError

func (vc *VascoClient) CountUserError()

func (*VascoClient) GetPort

func (vc *VascoClient) GetPort() string

fetch a port number as a string from vasco's port service

func (*VascoClient) GetProxyUrl

func (vc *VascoClient) GetProxyUrl(path string) url.URL

Return a URL ready for a Vasco proxy query (instead of going through the external load balancer, apps behind Vasco can talk to its proxy port directly).

func (*VascoClient) GetStatus

func (vc *VascoClient) GetStatus() Status

func (*VascoClient) LogRequests

func (vc *VascoClient) LogRequests(handler http.HandlerFunc) http.HandlerFunc

LogRequests is middleware

func (*VascoClient) MaxClients

func (vc *VascoClient) MaxClients(handler http.HandlerFunc, n int) http.HandlerFunc

MaxClients is middleware that allows limiting the number of simultaneous requests to a given endpoint.

func (*VascoClient) MyIP

func (vc *VascoClient) MyIP() (string, error)

func (*VascoClient) Refresh

func (vc *VascoClient) Refresh() error

func (*VascoClient) RefreshAndSetTimer

func (vc *VascoClient) RefreshAndSetTimer()

func (*VascoClient) Register

func (vc *VascoClient) Register(name, port, pattern, status string) error

func (*VascoClient) Unregister

func (vc *VascoClient) Unregister() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL