routestat

package
v0.0.0-...-5a547ea Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IStats

type IStats interface {
	Start() error
	Record() error
	Accept(ip string) bool
	String() string
	Close() error
}

type RouteStat

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

RouteStat with two modules: Stats and Throttler. Must pass the function NewRouteStat to create

func NewRouteStat

func NewRouteStat(statFreq, tbFreq time.Duration) *RouteStat

NewRouteStat returns a RouteStat with a single filler go-routine for all throttler which ticks every tbFreq, and record stats which ticks every statFreq.

func (*RouteStat) Accept

func (r *RouteStat) Accept(ip string) bool

Accept if stats module accept ip access than return true

func (*RouteStat) Close

func (r *RouteStat) Close() error

Close close stats module

func (*RouteStat) Record

func (r *RouteStat) Record() error

Record stats module record the last node before

func (*RouteStat) Start

func (r *RouteStat) Start() error

Start start service, if want Stats module to take effect

func (*RouteStat) String

func (r *RouteStat) String() string

String debug or print out stats module information

type SimpleMemStats

type SimpleMemStats struct {
	Total        uint64 `json:"total"`
	Count        uint64 `json:"count"`
	Mallocs      uint64 `json:"mallocs"`       // number of mallocs
	Frees        uint64 `json:"frees"`         // number of frees
	HeapInuse    uint64 `json:"heap_inuse"`    // bytes in non-idle span
	HeapReleased uint64 `json:"heap_released"` // bytes released to the OS
}

type Stats

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

func NewStats

func NewStats(freq time.Duration) *Stats

func (*Stats) Accept

func (s *Stats) Accept(ip string) bool

func (*Stats) Close

func (s *Stats) Close() error

func (*Stats) Record

func (s *Stats) Record() error

func (*Stats) Start

func (s *Stats) Start() error

func (*Stats) String

func (s *Stats) String() string

type Throttler

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

func NewThrottler

func NewThrottler(freq time.Duration) *Throttler

func (*Throttler) Accept

func (t *Throttler) Accept(ip string) bool

func (*Throttler) Close

func (t *Throttler) Close() error

func (*Throttler) Record

func (t *Throttler) Record() error

func (*Throttler) Start

func (t *Throttler) Start() error

func (*Throttler) String

func (t *Throttler) String() string

Jump to

Keyboard shortcuts

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