iputil

package
v0.0.0-...-5807ea9 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

获取客户ip 解析 X-Real-IP 和 X-Forwarded-For 以便于反向代理(nginx 或 haproxy)可以正常工作。

func ClientPublicIP

func ClientPublicIP() string

ClientPublicIP 获取公网ip

func GetClientIPAddress

func GetClientIPAddress(r *http.Request) string

GetClientIP - returns IP address string; The IP address if known, defaulting to empty string if unknown.

func GetClientIp

func GetClientIp() string

获取客户ip地址

func GetLocalHost

func GetLocalHost() string

获取局域网ip地址

func GetLocalIP

func GetLocalIP() (ip string, err error)

func GetServerIP

func GetServerIP() string

获取服务端ip

func RemoteIP

func RemoteIP(r *http.Request) string

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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