iputil

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP added in v1.8.2

func ClientIP(r *http.Request) string

ClientIP returns client ip

func DefaultEndpoint4Protocol

func DefaultEndpoint4Protocol(proto string) string

DefaultEndpoint4Protocol : To ensure consistency, we generate default addr for listenAddress and advertiseAddress by one method. To avoid unnecessary port allocation work, we allocate fixed port for user defined protocol.

func DefaultPort4Protocol

func DefaultPort4Protocol(proto string) string

DefaultPort4Protocol returns the default port for different protocols

func ForwardedIPs added in v1.8.2

func ForwardedIPs(r *http.Request) []string

ForwardedIPs returns forwarded for ips

func GetLocalIP

func GetLocalIP() string

GetLocalIP 获得本机IP

func GetLocalIPv6 added in v1.2.2

func GetLocalIPv6() string

GetLocalIPv6 Get IPv6 address of NIC.

func IsIPv6Address added in v1.2.2

func IsIPv6Address(ip net.IP) bool

IsIPv6Address check whether the IP is IPv6 address.

func Localhost

func Localhost() string

Localhost is a function which returns localhost IP address

func RealIP added in v1.8.2

func RealIP(r *http.Request) string

RealIP returns real ip

func RemoteIP added in v1.8.2

func RemoteIP(r *http.Request) string

RemoteIP returns remote ip

func StartListener added in v1.3.0

func StartListener(listenAddress string, tlsConfig *tls.Config) (listener net.Listener, listenedIP string, port string, err error)

StartListener start listener with address and tls(if has), returns the listener and the real listened ip/port

func URIs2Hosts

func URIs2Hosts(uris []string) ([]string, string, error)

URIs2Hosts returns hosts and schema

Types

This section is empty.

Jump to

Keyboard shortcuts

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