Documentation ¶
Index ¶
- Variables
- func Base64Encode(s string) string
- func CacheConnection(c net.Conn, p string)
- func Dial(proxy string, formatProxy bool) fasthttp.DialFunc
- func EstablishConnection(addr string, _proxy *string, formatProxy bool) (net.Conn, error)
- func FormatProxy(proxy *string) *string
- func FormatProxyAuth(proxy *string) *string
- func GenerateConnectUrl(addr string, proxy *string, formatProxy bool) (string, *string)
- func GetConnection(addr string, proxy *string, formatProxy bool) (net.Conn, error)
- func SendRequest(FastProxyRequest Request) (*fasthttp.Response, error)
- func SetResponse(sB bool) *fasthttp.Response
- func ValidProxy(proxy string) bool
- type Request
Constants ¶
This section is empty.
Variables ¶
var ( ConnectionCache map[string]net.Conn = map[string]net.Conn{} FormattedProxyCache map[string]*string = map[string]*string{} )
Cache Map Variables
- ConnectionCache holds the proxy connections
- FormattedProxyCache holds the formatted proxies
Functions ¶
func CacheConnection ¶
The CacheConnection() function will add the proxy to the
ConnectionCache with it's pre-made connection
func Dial ¶
Function to use a proxy dia [user:pass@proxy:port] Usage -> Dial(proxy, (whether to format proxy if using auth))
func EstablishConnection ¶
The EstablishConnection() function is the dial function that returns
a fasthttp.Dial object
This function will create a connection url then send a connection request
func FormatProxy ¶
The FormatProxy() function will check whether the provided proxy
is already in the formatted proxy cache
If the provided proxy is not already in the cache, it will reformat it
and add it to the cache
func FormatProxyAuth ¶
The FormatProxyAuth() function will split the proxy+auth by the @
then it will determine which side is the ip:port and which side is the user:password
After it has reformatted the proxy to ip:port@user:pass, it will add the
formatted proxy to the cache for any later use
func GenerateConnectUrl ¶
The GenerateConnectUrl() function will create the Dial Url for the proxy If the proxy contains an @user:pass, it will split the proxy and format it
if formatProxy is set to true
After the proxy is or is not formatted, it will base64 encode it for the
Proxy-Authentication
func GetConnection ¶
The GetConnection() function will iterate through the ConnectionCache If the proxy exists in the ConnectionCache, it will return it, else
it will establish a new connection
func SendRequest ¶
The SendRequest() function takes in the Request struct as it's sole parameter It will then make an ordinary fasthttp client request and return the response
and request error
func ValidProxy ¶
The ValidProxy() function will iterate through the provided proxy
and check how many periods are in the string
If there are 3 periods and no letters, then the provided proxy is valid
Types ¶
type Request ¶
type Request struct { Client *fasthttp.Client Request *fasthttp.Request Response *fasthttp.Response FormatProxy bool Proxy string }
Request Structure The Request Structure holds five keys
- Client: *fasthttp.Client -> The fasthttp client to use
- Request: *fasthttp.Request -> The fasthttp request object to act off of
- Response: *fasthttp.Response -> The fasthttp response object to return
- FormatProxy: bool -> Whether the user wants the provided proxy formatted
- Proxy: string -> The proxy to connect to