Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector interface {
// DetectPublicIPs returns the system's public IPs (IPv4 and/or IPv6 as available) or an error if none or both can be
// detected.
DetectPublicIPs(ctx context.Context, log logr.Logger) ([]net.IP, error)
}
Detector can detect the system's public IPs.
type IpifyDetector ¶
type IpifyDetector struct {
// Client is the http client to use, defaults to http.DefaultClient.
Client *http.Client
}
IpifyDetector implements Detector using https://ipify.org/.
func (IpifyDetector) DetectPublicIPs ¶
func (i IpifyDetector) DetectPublicIPs(ctx context.Context, parentLog logr.Logger) ([]net.IP, error)
DetectPublicIPs tries both api4.ipify.org and api6.ipify.org. If both return an error, the result is an empty slice and a combined error. Otherwise, it returns either or both detected IP addresses.
Click to show internal directories.
Click to hide internal directories.