ipflare

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 8 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ipflare

Find your public IP address according to Cloudflare

GoDev CI

Install

Binaries

Releases Releases

See the latest release or download and install it now with curl https://i.jpillora.com/ipflare! | bash

Usage
$ mycfip
203.33.122.99
Go API
  • ipflare.Pop() returns the public IP, airport data for the Cloudflare data center's colo code, and all raw fields in Trace.
  • ipflare.My() returns the public IP. ipflare.Loc() returns the airport coordinates and reports an error if the colo code has no entry.
  • iata.Lookup("SYD") returns an IATA with a Code, a Loc, and an IANA time zone in TZ. Loc.Distance and IATA.Distance return great-circle distances in kilometers.

The IATA table is checked in for offline lookup. Update the source revision in iata/generate.go to refresh the airport data, then run go generate ./iata. airportsdata

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loc added in v1.1.0

func Loc() (loc.Loc, error)

Loc returns the airport coordinates for the Cloudflare data center's colo code. It returns an error if the code has no airport entry.

func My

func My() (net.IP, error)

My returns the public IPv4 or IPv6 address Cloudflare sees for the request.

Types

type PointOfPresence added in v1.1.0

type PointOfPresence struct {
	IP    net.IP
	IATA  iata.IATA         // Zero value if the colo code is unknown.
	Trace map[string]string // All fields from Cloudflare, keyed by their original names.
}

PointOfPresence describes the Cloudflare data center that handled a trace request.

func Pop added in v1.1.0

func Pop() (PointOfPresence, error)

Pop fetches Cloudflare's trace and looks up the airport for its colo code.

Directories

Path Synopsis
cmd
mycfip command
Package iata looks up airport coordinates and IANA time zones by IATA code.
Package iata looks up airport coordinates and IANA time zones by IATA code.
Package loc represents geographic coordinates and computes distances between them.
Package loc represents geographic coordinates and computes distances between them.

Jump to

Keyboard shortcuts

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