provider

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReservedName = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompatibleProvider

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

for auto gc

func NewCompatibleProvider

func NewCompatibleProvider(name string, proxies []C.Proxy, hc *HealthCheck) (*CompatibleProvider, error)

func (CompatibleProvider) HealthCheck

func (cp CompatibleProvider) HealthCheck()

func (CompatibleProvider) Initial

func (cp CompatibleProvider) Initial() error

func (CompatibleProvider) MarshalJSON

func (cp CompatibleProvider) MarshalJSON() ([]byte, error)

func (CompatibleProvider) Name

func (cp CompatibleProvider) Name() string

func (CompatibleProvider) Proxies

func (cp CompatibleProvider) Proxies() []C.Proxy

func (CompatibleProvider) Type

func (cp CompatibleProvider) Type() ProviderType

func (CompatibleProvider) Update

func (cp CompatibleProvider) Update() error

func (CompatibleProvider) VehicleType

func (cp CompatibleProvider) VehicleType() VehicleType

type FileVehicle

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

func NewFileVehicle

func NewFileVehicle(path string) *FileVehicle

func (*FileVehicle) Path

func (f *FileVehicle) Path() string

func (*FileVehicle) Read

func (f *FileVehicle) Read() ([]byte, error)

func (*FileVehicle) Type

func (f *FileVehicle) Type() VehicleType

type HTTPVehicle

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

func NewHTTPVehicle

func NewHTTPVehicle(url string, path string) *HTTPVehicle

func (*HTTPVehicle) Path

func (h *HTTPVehicle) Path() string

func (*HTTPVehicle) Read

func (h *HTTPVehicle) Read() ([]byte, error)

func (*HTTPVehicle) Type

func (h *HTTPVehicle) Type() VehicleType

type HealthCheck

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

func NewHealthCheck

func NewHealthCheck(proxies []C.Proxy, url string, interval uint) *HealthCheck

type HealthCheckOption

type HealthCheckOption struct {
	URL      string
	Interval uint
}

type Provider

type Provider interface {
	Name() string
	VehicleType() VehicleType
	Type() ProviderType
	Initial() error
	Update() error
}

Provider interface

type ProviderType

type ProviderType int

ProviderType defined

const (
	Proxy ProviderType = iota
	Rule
)

Provider Type

func (ProviderType) String

func (pt ProviderType) String() string

type ProxyProvider

type ProxyProvider interface {
	Provider
	Proxies() []C.Proxy
	HealthCheck()
}

ProxyProvider interface

func ParseProxyProvider

func ParseProxyProvider(name string, mapping map[string]interface{}) (ProxyProvider, error)

type ProxySchema

type ProxySchema struct {
	Proxies []map[string]interface{} `yaml:"proxies"`
}

type ProxySetProvider

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

for auto gc

func NewProxySetProvider

func NewProxySetProvider(name string, interval time.Duration, vehicle Vehicle, hc *HealthCheck) *ProxySetProvider

func (ProxySetProvider) HealthCheck

func (pp ProxySetProvider) HealthCheck()

func (ProxySetProvider) Initial

func (pp ProxySetProvider) Initial() error

func (ProxySetProvider) MarshalJSON

func (pp ProxySetProvider) MarshalJSON() ([]byte, error)

func (ProxySetProvider) Name

func (pp ProxySetProvider) Name() string

func (ProxySetProvider) Proxies

func (pp ProxySetProvider) Proxies() []C.Proxy

func (ProxySetProvider) Type

func (pp ProxySetProvider) Type() ProviderType

func (ProxySetProvider) Update

func (pp ProxySetProvider) Update() error

type Vehicle

type Vehicle interface {
	Read() ([]byte, error)
	Path() string
	Type() VehicleType
}

type VehicleType

type VehicleType int

VehicleType defined

const (
	File VehicleType = iota
	HTTP
	Compatible
)

Vehicle Type

func (VehicleType) String

func (v VehicleType) String() string

Jump to

Keyboard shortcuts

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