ggtip

package module
v0.0.0-...-67379b3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 14 Imported by: 0

README

获取本机 IP 以及 外部IP

资料

  1. GlenDC/go-external-ip

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Endpoints = []string{
	"https://api.maao.cc/ip/",
	"https://d5k.top/ping",
	"https://api.ipify.org?format=json",
	"https://alanwei.azurewebsites.net/api/tool/ip",
	"https://httpbin.org/ip",
	"https://ident.me",
	"ip.gs",
	"ip.sb",
	"cip.cc",
	"icanhazip.com",
	"ipv4.icanhazip.com",
	"api.ipify.org",
	"ifconfig.me",
	"ifconfig.co",
	"ipecho.net/plain",
	"whatismyip.akamai.com",
	"inet-ip.info",
	"myip.ipip.net",
	"ipinfo.io",
	"ifcfg.cn",
	"4.ipw.cn",
	"members.3322.org/dyndns/getip",
	"curlmyip.com",
	"ip.appspot.com",
	"www.trackip.net/ip",

	"https://myexternalip.com/raw",
	"http://checkip.amazonaws.com",
	"http://myip.dnsomatic.com/",
	"http://diagnostic.opendns.com/myip",
}

Functions

func CheckPublicIP

func CheckPublicIP()

func FormatDuration

func FormatDuration(d time.Duration) time.Duration

FormatDuration formats a duration with a precision of 3 digits if it is less than 100s. https://stackoverflow.com/a/68870075

func ListIfaces

func ListIfaces(v4, v6 bool, ifaceName string)

ListIfaces 根据mode 列出本机所有IP和网卡名称.

func Run

func Run()

func StunAddr

func StunAddr(uriStr string) (string, error)

func StunPublicIP

func StunPublicIP(stunServers []string) ([]string, error)

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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