upstream

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IP

type IP struct {
	Original string
	Host     string
	// contains filtered or unexported fields
}

IP : IP with counter

type Upstream

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

Upstream struct

func New

func New(upstream, balancing string, maxFails int, interval time.Duration, logger *zap.Logger) (*Upstream, error)

New :

func (*Upstream) Fail

func (u *Upstream) Fail(o *IP)

Fail : Increment counter

func (*Upstream) GetN

func (u *Upstream) GetN(maxIP int, remote, path string) ([]*IP, error)

GetN :

func (*Upstream) RefreshIP

func (u *Upstream) RefreshIP(ctx context.Context) ([]*IP, error)

RefreshIP : resolve hostname

func (*Upstream) Release

func (u *Upstream) Release(o *IP)

Release : decrement counter

func (*Upstream) Run

func (u *Upstream) Run(ctx context.Context, interval time.Duration)

Run : resolv hostname in background

func (*Upstream) Stop

func (u *Upstream) Stop()

Stop : stop upstream updater

func (*Upstream) Use

func (u *Upstream) Use(o *IP)

Use : Increment counter

Jump to

Keyboard shortcuts

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