Skip to content

wnke/myip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

myip

Small utility to find one's IP. Can also be used a as library! Get it from the github releases or build it yourself with

go clone https://github.com/wnke/myip
cd myip
go build -o myip ./cmd
cp myip $HOME/.local/bin/myip

Usage

Command line

$ myip
123.123.111.111

Library

import 	"github.com/wnke/myip"

//...
ipa, err := myip.NewIPDiscover()
if err != nil {
    return err
}

ip, err := ipa.Discover()
if err != nil {
    return err
}
fmt.Print(ip.String())