Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrRateLimitReached = errors.New("rate limit reached")
)
Functions ¶
This section is empty.
Types ¶
type IPHub ¶
type IPHub struct {
// contains filtered or unexported fields
}
IPHub implemets the VPNApi interface and checks whether a given IP is a vpn
type ProxyCheck ¶
type ProxyCheck struct {
// contains filtered or unexported fields
}
ProxyCheck implemets the VPNApi interface and checks whether a given IP is a vpn
func NewProxyCheck ¶
func NewProxyCheck(c *http.Client, apikey string) *ProxyCheck
NewProxyCheck reates a new api that can be checked for VPN IPs
func (*ProxyCheck) IsVPN ¶
func (ih *ProxyCheck) IsVPN(IP string) (bool, error)
IsVPN tests if a given IP is a VPN IP
func (*ProxyCheck) String ¶
func (ih *ProxyCheck) String() string
String implements the stringer interface
type ProxyCheckInfoResponseData ¶
type ProxyCheckInfoResponseData struct { Asn string Provider string Continent string Country string Isocode string Region string Regioncode string City string Latitude float32 Longitude float32 Proxy string Type string }
responseData : structure of the response from this API (IP information)
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter can be used to limit requests within a specific period of time. initialized with Init(...) and used with Allow()
func NewRateLimiter ¶
func NewRateLimiter(expirationDuration time.Duration, rateLimit int) *RateLimiter
NewRateLimiter initializes the RateLimiter with the current time expirationDuration What is the time duration each token expires in rateLimit is the amount of requests per expirationDiration, like 1000 requests per Day
func (*RateLimiter) Allow ¶
func (r *RateLimiter) Allow() bool
Allow returns true if the rate has not yet been exceeded, returns false otherwise. Info: goroutine safe
type VPNAPI ¶ added in v0.3.1
type VPNAPI struct {
// contains filtered or unexported fields
}
VPNAPI implements the VPNApi and allows to check if an ip is a vpn
func NewVPNAPI ¶ added in v0.3.1
NewVPNAPI creates a new api endpoint that can check IPs for whether they are VPNs or not.
type VPNChecker ¶
type VPNChecker struct { Apis []VPN Offline bool Threshold float64 // contains filtered or unexported fields }
VPNChecker encapsulates the redis database as cache and the implemented api endpoints in order to determine, whether an ip is a vpn based on either the caching information or based on the implemented api endpoints, whether an ip is a vpn.
func NewVPNChecker ¶
func NewVPNChecker(ctx context.Context, ripr *goripr.Client, vpns []VPN, offline bool, permabanThreshold float64) *VPNChecker
newVPNChecker creates a new checker that can be asked for VPN IPs. it connects to the redis database for caching and requests information from all existing API endpoints that provode free VPN detections.
func (*VPNChecker) Close ¶
func (rdb *VPNChecker) Close() error