mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 01:27:34 +02:00
add domain whois/dns support, refactor codebase
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/oschwald/maxminddb-golang"
|
||||
)
|
||||
|
||||
// GetCityDB retrieves the city database reader.
|
||||
func (g *GeoIPManager) GetCityDB() *maxminddb.Reader {
|
||||
g.mu.RLock()
|
||||
defer g.mu.RUnlock()
|
||||
return g.cityDB
|
||||
}
|
||||
|
||||
// GetASNDB retrieves the ASN database reader.
|
||||
func (g *GeoIPManager) GetASNDB() *maxminddb.Reader {
|
||||
g.mu.RLock()
|
||||
defer g.mu.RUnlock()
|
||||
return g.asnDB
|
||||
}
|
||||
|
||||
// GetASNPrefixes retrieves the list of IP prefixes for a given ASN.
|
||||
func (g *GeoIPManager) GetASNPrefixes(asn uint) []*net.IPNet {
|
||||
g.mu.RLock()
|
||||
defer g.mu.RUnlock()
|
||||
return g.asnPrefixMap[asn]
|
||||
}
|
||||
Reference in New Issue
Block a user