Documentation ¶
Index ¶
- func ClientIp(r *http.Request) string
- func ExternalIp() (string, error)
- func GetHeadersString(i interface{}) string
- func GetRandomUserAgent() string
- type Headers
- type Response
- func Get(url string, params map[string]interface{}) (httpResponse Response, err error)
- func GetJsonHeader(url string, params map[string]interface{}, headers Headers) (httpResponse Response, err error)
- func PostForm(targetUrl string, params map[string]interface{}) (httpResponse Response, err error)
- func PostJson(targetUrl string, paramsStr []byte) (httpResponse Response, err error)
- func PostJsonHeader(targetUrl string, paramsStr []byte, headers Headers) (httpResponse Response, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientIp ¶
ClientIp 尽最大努力实现获取客户端 IP 的算法。 解析 X-Real-IP 和 X-Forwarded-For 以便于反向代理(nginx 或 haproxy)可以正常工作。
func ExternalIp ¶
func GetHeadersString ¶
func GetHeadersString(i interface{}) string
Types ¶
type Headers ¶
type Headers map[string]interface{}
func NewHeaders ¶
func NewHeaders() Headers
func (Headers) SetHeaders ¶
Click to show internal directories.
Click to hide internal directories.