strategy

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Strategy         string
	CheckWebSite     string
	CheckWebSitePath string
	CheckWebSiteLen  int
	CheckInterval    int
	CheckTimeout     int
	CheckThreshold   int
	MaxFailures      int
	IntFace          string
}

Config is strategy config struct.

type Forwarder added in v0.9.3

type Forwarder struct {
	proxy.Dialer
	// contains filtered or unexported fields
}

Forwarder is a forwarder

func DirectForwarder added in v0.9.3

func DirectForwarder(intface string) *Forwarder

DirectForwarder returns a direct forwarder

func ForwarderFromURL added in v0.9.3

func ForwarderFromURL(s, intface string) (f *Forwarder, err error)

ForwarderFromURL parses `forward=` command value and returns a new forwarder

func (*Forwarder) AddHandler added in v0.9.3

func (f *Forwarder) AddHandler(h StatusHandler)

AddHandler adds a custom handler to handle the status change event

func (*Forwarder) Addr added in v0.9.3

func (f *Forwarder) Addr() string

Addr .

func (*Forwarder) Dial added in v0.9.3

func (f *Forwarder) Dial(network, addr string) (c net.Conn, err error)

Dial .

func (*Forwarder) Disable added in v0.9.3

func (f *Forwarder) Disable()

Disable the forwarder

func (*Forwarder) Enable added in v0.9.3

func (f *Forwarder) Enable()

Enable the forwarder

func (*Forwarder) Enabled added in v0.9.3

func (f *Forwarder) Enabled() bool

Enabled returns the status of forwarder

func (*Forwarder) Failures added in v0.9.3

func (f *Forwarder) Failures() uint32

Failures returns the failuer count of forwarder

func (*Forwarder) IncFailures added in v0.9.3

func (f *Forwarder) IncFailures()

IncFailures increase the failuer count by 1

func (*Forwarder) Latency added in v0.9.3

func (f *Forwarder) Latency() int64

Latency returns the latency of forwarder

func (*Forwarder) MaxFailures added in v0.9.3

func (f *Forwarder) MaxFailures() uint32

MaxFailures returns the maxFailures of forwarder

func (*Forwarder) Priority added in v0.9.3

func (f *Forwarder) Priority() uint32

Priority returns the priority of forwarder

func (*Forwarder) SetLatency added in v0.9.3

func (f *Forwarder) SetLatency(l int64)

SetLatency sets the latency of forwarder

func (*Forwarder) SetMaxFailures added in v0.9.3

func (f *Forwarder) SetMaxFailures(l uint32)

SetMaxFailures sets the maxFailures of forwarder

func (*Forwarder) SetPriority added in v0.9.3

func (f *Forwarder) SetPriority(l uint32)

SetPriority sets the priority of forwarder

type Proxy added in v0.9.3

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

Proxy is base proxy struct.

func NewProxy added in v0.9.3

func NewProxy(s []string, c *Config) *Proxy

NewProxy returns a new strategy proxy.

func (*Proxy) Check added in v0.9.3

func (p *Proxy) Check()

Check implements the Checker interface.

func (*Proxy) Dial added in v0.9.3

func (p *Proxy) Dial(network, addr string) (net.Conn, string, error)

Dial connects to the address addr on the network net.

func (*Proxy) DialUDP added in v0.9.3

func (p *Proxy) DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error)

DialUDP connects to the given address.

func (*Proxy) NextDialer added in v0.9.3

func (p *Proxy) NextDialer(dstAddr string) proxy.Dialer

NextDialer returns the next dialer.

type StatusHandler added in v0.9.3

type StatusHandler func(*Forwarder)

StatusHandler function will be called when the forwarder's status changed

Jump to

Keyboard shortcuts

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