opendnsmyip

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 2 Imported by: 0

README

opendnsmyip

A Go package that returns the public-facing IPv4 address of the client by querying the Cisco OpenDNS servers.

License GoVersion PkgGoDev GoReportCard LocCount GitHubCodeSize CoverageStatus CodacyBadge CodeBeat CodeClimateMaintainability TickgitTODOs DeepSource

Availability

Security

Original Authors

Credits

This package was inspired by:

Usage

package main

import (
 "fmt"
 myip "github.com/johnsonjh/opendnsmyip"
)

func main() {
 myIpAddr, err := myip.GetIP()
 if err != nil {
  fmt.Errorf("Error getting IPv4 address: %v", err)
 } else {
  fmt.Printf("Public IPv4 address is: %s", myIpAddr)
 }
}

Documentation

Overview

Package opendnsmyip returns the public-facing IPv4 address of the requesting client by querying Cisco OpenDNS servers.

Example:

package main

import (
	"fmt"
	myip "github.com/johnsonjh/opendnsmyip"
)

func main() {
	myIpAddr, err := myip.GetMyIP()
	if err != nil {
		fmt.Errorf("failure getting IP address: %s\n", err)
	} else {
		fmt.Printf("Public IPv4 address is: %s\n", myIpAddr)
	}
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMyIP added in v1.2.0

func GetMyIP() (string, error)

GetMyIP returns the public-facing IPv4 address of the caller client by querying the Cisco OpenDNS servers.

func MyIPDNSLookup added in v1.2.0

func MyIPDNSLookup(
	config dns.ClientConfig,
	client *dns.Client,
	message *dns.Msg,
) (string, error)

MyIPDNSLookup performs a DNS lookup using the "miekg/dns" package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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