{"modulePath":"github.com/EternizedLab/utils","version":"v1.0.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package requests\n\n## Variables\n\n```go\nvar Direct = direct{}\n```\nDirect is a direct proxy: one that makes network connections directly.\n\n```go\nvar HttpsDialer = httpsDialer{}\n```\nHTTPSDialer is a https proxy: one that makes network connections on tls.\n\n```go\nvar TlsConfig = \u0026tls.Config{}\n```\n\n## Functions\n\n```go\nfunc ExistsUrl(remoteURL string) bool\n```\n\n```go\nfunc FilterIPs(cidrs []string, h http.Handler) http.Handler\n```\nFilterIPs is a middleware to filter requests by IP. cidrs is a list of CIDR strings. For example, \"23.102.140.112/28\" openai or \"127.0.0.1/32\" for local test.\n\n```go\nfunc FromEnvironment() proxy.Dialer\n```\n\n```go\nfunc FromHTTPProxy(proxyURI string) (proxy.Dialer, error)\n```\nFromHTTPProxy returns HTTP tunnel dialer proxying tcp connection. Copy from [https://gist.github.com/jim3ma/3750675f141669ac4702bc9deaf31c6b](https://gist.github.com/jim3ma/3750675f141669ac4702bc9deaf31c6b) Usage: dialer, err := DialWithHTTPProxy(\"[http://your](http://your) http proxy:3128\") lg.PanicError(err) conn, err := httpDialer.Dial(\"tcp\", \"google.com:80\") lg.PanicError(err) fmt.Printf(\"Create http tunnel OK: %+v\\\\n\", conn)\n\n```go\nfunc FromURL(u *url.URL, forward proxy.Dialer) (proxy.Dialer, error)\n```\n\n```go\nfunc Get(ctx context.Context, url string) *http.Request\n```\n\n```go\nfunc InjectHTTPClientMonitor()\n```\n\n```go\nfunc JSON(w http.ResponseWriter, code int, v interface{}) error\n```\n\n```go\nfunc Post(posturl string, req interface{}, headers ...url.Values) (resp *http.Response, err error)\n```\n\n```go\nfunc PostStruct(posturl string, req interface{}, response interface{}, headers ...url.Values) (err error)\n```\n\n```go\nfunc ReadBytes(resp *http.Response, err error) ([]byte, error)\n```\n\n```go\nfunc ReadJson(resp *http.Response, err error, i interface{}) error\n```\n\n```go\nfunc WrapHTTPServerMonitor(handler http.Handler) http.Handler\n```\n\n## Types\n\n```go\ntype FuzzyPathStore struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewFuzzyPathStore() *FuzzyPathStore\n```\n\n```go\nfunc (fps *FuzzyPathStore) CleanPath(path string) string\n```\n\n```go\ntype HTTPResponseInterceptor struct {\n\thttp.ResponseWriter\n\tStatusCode int\n}\n```\n\n```go\nfunc NewHTTPResponseInterceptor(w http.ResponseWriter) *HTTPResponseInterceptor\n```\nNewHTTPResponseInterceptor create new httpInterceptor\n\n```go\nfunc (i *HTTPResponseInterceptor) Hijack() (net.Conn, *bufio.ReadWriter, error)\n```\nImplemented Hijack interface to be compatible with websocket. [https://pkg.go.dev/net/http#Hijacker](https://pkg.go.dev/net/http#Hijacker)\n\n```go\nfunc (i *HTTPResponseInterceptor) WriteHeader(code int)\n```\nWriteHeader override response WriteHeader\n\n","path":"github.com/EternizedLab/utils/requests","name":"requests","synopsis":"","isRedistributable":true}
