Documentation
¶
Index ¶
- func IsValidCredentials(username, password string) bool
- func IsValidHostnamePort(hnp string) bool
- func IsValidScheme(s ProxyScheme) bool
- type Proxy
- func (p *Proxy) ExportURL() *url.URL
- func (p *Proxy) GetHost() string
- func (p *Proxy) GetPassword() string
- func (p *Proxy) GetScheme() ProxyScheme
- func (p *Proxy) GetUsername() string
- func (p *Proxy) IsCredentialFilled() bool
- func (p *Proxy) IsValid() bool
- func (p Proxy) IsZero() bool
- func (p *Proxy) Reset()
- func (p *Proxy) SetHost(s string)
- func (p *Proxy) SetPassword(s string)
- func (p *Proxy) SetScheme(pt ProxyScheme)
- func (p *Proxy) SetUsername(s string)
- type ProxyGetter
- type ProxyProvider
- type ProxyResetter
- type ProxyScheme
- type ProxySetter
- type ProxyValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidCredentials ¶
IsValidCredentials performs basic validation on username and password: a non-empty password requires a username, both must be <=255 bytes, contain no CTL bytes, and be printable ASCII. Returns true if all checks pass.
func IsValidHostnamePort ¶
IsValidHostnamePort validates a <dns>:<port> combination for fields typically used for socket address.
func IsValidScheme ¶
func IsValidScheme(s ProxyScheme) bool
IsValidScheme reports whether s is a supported proxy scheme. It returns true for the supported schemes: HTTP, HTTPS, SOCKS5 and SOCKS5H. For any other ProxyScheme value it returns false.
Types ¶
type Proxy ¶
type Proxy struct {
Scheme ProxyScheme `json:"scheme,omitempty" validate:"required_with=Host,omitempty,lowercase,oneof=http https socks5 socks5h"`
Host string `json:"host,omitempty" validate:"required_with=Scheme,omitempty,hostname_port"`
Username string `json:"username,omitempty" validate:"required_with_all=Scheme Host Password,omitempty,printascii,max=255"`
Password string `json:"password,omitempty" validate:"omitempty,printascii,max=255"`
}
func (*Proxy) GetPassword ¶
Retrieves the password from the proxy struct.
func (*Proxy) GetScheme ¶
func (p *Proxy) GetScheme() ProxyScheme
Retrieves the scheme from the proxy struct.
func (*Proxy) GetUsername ¶
Retrieves the username from the proxy struct.
func (*Proxy) IsCredentialFilled ¶
Checks if the proxy credential has been set.
func (*Proxy) SetPassword ¶
Sets the password on the proxy struct.
func (*Proxy) SetScheme ¶
func (p *Proxy) SetScheme(pt ProxyScheme)
Sets the scheme on the proxy struct.
func (*Proxy) SetUsername ¶
Sets the username on the proxy struct.
type ProxyGetter ¶
type ProxyGetter interface {
ExportURL() *url.URL
GetHost() string
GetPassword() string
GetScheme() ProxyScheme
GetUsername() string
ProxyValidator
}
type ProxyProvider ¶
type ProxyProvider interface {
ProxyGetter
ProxySetter
}
type ProxyResetter ¶
type ProxyResetter interface {
Reset()
}
type ProxyScheme ¶
type ProxyScheme string
const ( HTTP ProxyScheme = "http" HTTPS ProxyScheme = "https" SOCKS5 ProxyScheme = "socks5" SOCKS5H ProxyScheme = "socks5h" )
func (ProxyScheme) String ¶
func (pt ProxyScheme) String() string
type ProxySetter ¶
type ProxySetter interface {
SetHost(s string)
SetPassword(s string)
SetScheme(s string)
SetUsername(s string)
ProxyResetter
}
type ProxyValidator ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package proxypool implements a cheap, read-only proxy iterator backed by a text file and a side-car index.
|
Package proxypool implements a cheap, read-only proxy iterator backed by a text file and a side-car index. |