Skip to content
Permalink
Browse files

Hostname bug and package exclusions

  • Loading branch information...
s32x committed Apr 7, 2019
1 parent b76c124 commit 88e88c84a8f5c202f29e7e3e8f51ec655f5bee10
Showing with 11 additions and 3 deletions.
  1. +5 −2 .gitignore
  2. +4 −0 .upignore
  3. +2 −1 ipdata/lookup.go
@@ -1,2 +1,5 @@
vendor
bin
/vendor
/bin
/out
out.zip
server
@@ -0,0 +1,4 @@
*
!server
!db/**
!static/**
@@ -2,6 +2,7 @@ package ipdata /* import "s32x.com/ipdata/ipdata" */

import (
"net"
"strings"

"github.com/mmcloughlin/geohash"
)
@@ -30,7 +31,7 @@ func (c *Client) Lookup(ipStr string) *IPData {
// Reverse lookup the passed IP to retrieve any hostname that exists
var hostname string
if hs, _ := net.LookupAddr(ipStr); len(hs) > 0 {
hostname = hs[0][:len(hs[0])-1]
hostname = strings.TrimSuffix(hs[0], ".")
}

// Parse the IP address string passed

0 comments on commit 88e88c8

Please sign in to comment.
You can’t perform that action at this time.