Documentation
¶
Index ¶
- func ClientIP(r *http.Request) string
- func ClientPublicIP(r *http.Request) string
- func HasLocalIP(ip net.IP) bool
- func HasLocalIPddr(ip string) bool
- func IP2Long(ip net.IP) (uint, error)
- func IPString2Long(ip string) (uint, error)
- func Long2IP(i uint) (net.IP, error)
- func Long2IPString(i uint) (string, error)
- func MapToQuery(params map[string]interface{}, urlEncode ...bool) (string, error)
- func RemoteIP(r *http.Request) string
- type AliyunLog
- type GocoreLog
- type HttpClient
- type Log
- type LogObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientIP ¶
ClientIP 尽最大努力实现获取客户端 IP 的算法。 解析 X-Real-IP 和 X-Forwarded-For 以便于反向代理(nginx 或 haproxy)可以正常工作。
func ClientPublicIP ¶
ClientPublicIP 尽最大努力实现获取客户端公网 IP 的算法。 解析 X-Real-IP 和 X-Forwarded-For 以便于反向代理(nginx 或 haproxy)可以正常工作。
func HasLocalIP ¶
HasLocalIP 检测 IP 地址是否是内网地址 通过直接对比ip段范围效率更高,详见:https://github.com/thinkeridea/go-extend/issues/2
func MapToQuery ¶
@desc 编译http参数 @auth liuguoqiang 2020-03-20 @param @return
Types ¶
type AliyunLog ¶
type AliyunLog struct {
// contains filtered or unexported fields
}
func NewAliyunLog ¶
type HttpClient ¶
func New ¶
func New() *HttpClient
func (*HttpClient) SetLog ¶
func (h *HttpClient) SetLog(log Log) *HttpClient
func (*HttpClient) SetTrace ¶
func (h *HttpClient) SetTrace(header interface{}) *HttpClient
type LogObject ¶
type LogObject struct {
Url string `json:"url"`
Method string `json:"method"`
RequestHders http.Header `json:"request_headers"`
RequestRawBody interface{} `json:"request_raw_body"`
ResponseHeaders http.Header `json:"response_headers"`
ResponseBody string `json:"response_body"`
StartTime string `json:"start_time"`
Duration time.Duration `json:"duration"`
Status int `json:"status"`
}
Click to show internal directories.
Click to hide internal directories.