httputils

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

ClientIP 尽最大努力实现获取客户端 IP 的算法。 解析 X-Real-IP 和 X-Forwarded-For 以便于反向代理(nginx 或 haproxy)可以正常工作。

func GetResponseBodyFormUrl

func GetResponseBodyFormUrl(method, reqUrl, proxyUrl string, customHeader map[string]string, reqBody io.Reader) ([]byte, error)

func HttpProxyClient

func HttpProxyClient(rawURL string) *http.Client

HttpProxyClient local proxy: "http://127.0.0.1:7890"

func RemoteIP

func RemoteIP(r *http.Request) string

RemoteIP 通过 RemoteAddr 获取 IP 地址, 只是一个快速解析方法。

func SubmitFormData added in v0.1.7

func SubmitFormData(reqUrl, proxyUrl string, fileFields, formData map[string]string) ([]byte, error)

SubmitFormData 提交表单,上传文件

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL