New Upstream Snapshot - golang-libgeoip
Ready changes
Summary
Merged new upstream version: 0.0~git20170629.0.d6d4a9a (was: 0.0~git20140312.0.c78e8bd).
Resulting package
Built on 2022-09-29T22:11 (took 3m0s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots golang-libgeoip-dev
Lintian Result
Diff
diff --git a/debian/changelog b/debian/changelog
index 4e311fc..8073d22 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-golang-libgeoip (0.0~git20140312.0.c78e8bd-2) UNRELEASED; urgency=medium
+golang-libgeoip (0.0~git20170629.0.d6d4a9a-1) UNRELEASED; urgency=medium
[ Alexandre Viau ]
* Point Vcs-* urls to salsa.debian.org.
@@ -14,8 +14,9 @@ golang-libgeoip (0.0~git20140312.0.c78e8bd-2) UNRELEASED; urgency=medium
+ golang-libgeoip-dev: Add Multi-Arch: foreign.
* QA Upload.
Orphan package - see bug 836496.
+ * New upstream snapshot.
- -- Alexandre Viau <aviau@debian.org> Mon, 02 Apr 2018 22:25:32 -0400
+ -- Alexandre Viau <aviau@debian.org> Thu, 29 Sep 2022 22:09:03 -0000
golang-libgeoip (0.0~git20140312.0.c78e8bd-1) unstable; urgency=medium
diff --git a/libgeo.go b/libgeo.go
index 4794a55..6cd65f0 100644
--- a/libgeo.go
+++ b/libgeo.go
@@ -31,7 +31,9 @@ package libgeo
// Dependencies
import (
+ "encoding/binary"
"errors"
+ "net"
"os"
)
@@ -202,7 +204,7 @@ func Load(filename string) (gi *GeoIP, err error) {
// Lookup by IP address and return location
func (gi *GeoIP) GetLocationByIP(ip string) *Location {
- return gi.GetLocationByIPNum(AddrToNum(ip))
+ return gi.GetLocationByIPNum(addrToNum(ip))
}
// Lookup by IP number and return location
@@ -319,36 +321,14 @@ func (gi *GeoIP) lookupByIPNum(ip uint32) int {
return 0
}
-// Convert ip address to an int representation
-func AddrToNum(ip string) uint32 {
- octet := uint32(0)
- ipnum := uint32(0)
- i := 3
- for j := 0; j < len(ip); j++ {
- c := byte(ip[j])
- if c == '.' {
- if octet > 255 {
- return 0
- }
- ipnum <<= 8
- ipnum += octet
- i--
- octet = 0
- } else {
- t := octet
- octet <<= 3
- octet += t
- octet += t
- c -= '0'
- if c > 9 {
- return 0
- }
- octet += uint32(c)
- }
+func addrToNum(ip string) uint32 {
+ i := net.ParseIP(ip)
+ if i == nil {
+ return uint32(0)
}
- if (octet > 255) || (i != 0) {
- return 0
+ i = i.To4()
+ if i == nil {
+ return uint32(0)
}
- ipnum <<= 8
- return uint32(ipnum + octet)
+ return binary.BigEndian.Uint32(i)
}
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files