-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add method to get database infos #28
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test or two, also?
geoip.go
Outdated
|
||
cdbinfo := C.GeoIP_database_info(gi.db) | ||
if cdbinfo != nil { | ||
databaseInfos = C.GoString(cdbinfo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this also need
defer C.free(unsafe.Pointer(cdbinfo))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an unexpected destroy in my copy/paste... Fixing...
geoip.go
Outdated
@@ -338,3 +338,19 @@ func (gi *GeoIP) GetCountry_v6(ip string) (cc string, netmask int) { | |||
} | |||
return | |||
} | |||
|
|||
func (gi *GeoIP) GetDatabaseInfo() (databaseInfos string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to complain about the named return variable, but it looks like I was doing that elsewhere here too. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied/pasted one of your methods, but I prefer the unnamed return version
OK for the tests, but the test-db files don't provided these database informations. So checking with empty string would not be an appropriate test |
No description provided.