diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-06-06 17:10:34 +0200 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-06-06 18:27:04 +0200 |
commit | 4b37bdabec56aadda803c0cf2c5f6d25d178eb96 (patch) | |
tree | 407f2fcb7bae3cc81a13c3048e98a5fc7a4b7372 /geoip | |
parent | 8b5bfdd64db9ed0b304e67302b41dcb3e5a37df8 (diff) | |
download | scratch-4b37bdabec56aadda803c0cf2c5f6d25d178eb96.tar.gz scratch-4b37bdabec56aadda803c0cf2c5f6d25d178eb96.tar.bz2 scratch-4b37bdabec56aadda803c0cf2c5f6d25d178eb96.zip |
lookup test
Diffstat (limited to 'geoip')
-rw-r--r-- | geoip/ip.lisp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/geoip/ip.lisp b/geoip/ip.lisp index dfdabc0..6b8fad7 100644 --- a/geoip/ip.lisp +++ b/geoip/ip.lisp @@ -275,9 +275,16 @@ (defun close-mmdb (mmdb) (with-slots (ptr fd size) mmdb (mmap:munmap ptr fd size))) + (defvar *mmdb* (make-mmdb "GeoLite2-Country.mmdb")) (with-slots (metadata) *mmdb* (with-slots (build-epoch) metadata (local-time:unix-to-timestamp build-epoch))) + +(lookup-ip *mmdb* (integer-to-bits (parse-ipv4 "28.8.8.8") 128)) +(lookup-ip *mmdb* (integer-to-bits (parse-ipv4 "89.244.127.3") 128)) +(lookup-ip *mmdb* (integer-to-bits (parse-ipv6 "2001:9e8:3d0f:2600:f081:c212:46c9:7cef") 128)) + + |