proxy

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ProxyTypeSingle = "single"

Variables

View Source
var AvailableProxyServices = make(map[string]ProxyService)

Functions

This section is empty.

Types

type Proxy added in v0.2.0

type Proxy struct {
	// Stragy of the proxy usage.
	Strategy string

	// Set this field if ProxyStrategy is single
	Addr *url.URL

	// Dynamic field for other proxy strategies.
	Others map[string]interface{}
}

Proxy struct is used for initializing the ProxyService implementations.

type ProxyService

type ProxyService interface {
	Init(Proxy) error
	GetAll() []*url.URL
	GetProxy() *url.URL
	ReportProxy(addr *url.URL, reason string) *url.URL
	GetProxyCountry(*url.URL) string
	Done() error
}

ProvideService is the interface that abstracts different proxy implementations. Strategy field in types.Proxy determines which implementation to use.

func NewProxyService

func NewProxyService(s string) (service ProxyService, err error)

NewProxyService is the factory method of the ProxyService.

Jump to

Keyboard shortcuts

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