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 ¶
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.
Click to show internal directories.
Click to hide internal directories.