Documentation ¶
Overview ¶
Package provider implements protocols to detect public IP addresses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Provider ¶
type Provider interface { Name() string ShouldWeCheck1111() bool GetIP(ctx context.Context, ppfmt pp.PP, ipNet ipnet.Type, use1001 bool) (netip.Addr, bool) }
Provider is the abstraction of a protocol to detect public IP addresses.
func MustNewCustom ¶ added in v1.10.0
MustNewCustom creates a HTTP provider and panics if it fails.
func NewCloudflareDOH ¶
func NewCloudflareDOH() Provider
NewCloudflareDOH creates a new provider that queries whoami.cloudflare. via Cloudflare DNS over HTTPS. If use1001 is true, 1.0.0.1 is used instead of 1.1.1.1.
func NewCloudflareTrace ¶
func NewCloudflareTrace() Provider
NewCloudflareTrace creates a specialized CloudflareTrace provider that parses https://1.1.1.1/cdn-cgi/trace. If use1001 is true, 1.0.0.1 is used instead of 1.1.1.1.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.