myip

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 7 Imported by: 0

README

myip

Go Reference Go Report Card CI

myip is a Go library for retrieving the public IP address of the machine running the code.

Installation

go get -u github.com/aethiopicuschan/myip

Usage

We have prepared multiple methods as follows.

Example
package main

import (
	"github.com/aethiopicuschan/myip"
)

func main() {
	getter := myip.NewIpifyClient()
	ip, err := getter.GetMyIP()
	if err != nil {
		panic(err)
	}
	println("My public IP address is:", ip)
	// Output: My public IP address is: <your-public-ip>
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGeoIpifyClient

func NewGeoIpifyClient(apiKey string) *geoIpifyClient

func NewIfconfigClient

func NewIfconfigClient() *ifconfigClient

func NewIpifyClient

func NewIpifyClient() *ipifyClient

func NewSTUNClient

func NewSTUNClient() *stunClient

Types

This section is empty.

Jump to

Keyboard shortcuts

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