Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented a more reliable way for detecting the internal ip. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Norbell
Copy link

@Norbell Norbell commented Jul 15, 2016

I have reimplemented the way the internal ip address gets detected. I did this, because the library was on neither of my machines able to detect its internal ip address.

Tested on osx and two different linux-boxes.

@tmm1
Copy link

tmm1 commented Aug 17, 2016

👍

@tmm1
Copy link

tmm1 commented Oct 29, 2016

@oleksandr Please merge this.


for _, address := range iaddrs {
// check the address type and if it is not a loopback the display it
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue here is that it includes ipv6 link-local ips. These can be ignored using && !ipnet.IP.IsLinkLocalUnicast()

@phedoreanu
Copy link

@oleksandr Please merge #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants