- Getting Started
- Building Your Vagrant VM
- Logging in to Your VM
- Inspecting Your Database
- Refactoring Your Code
A Vagrantfile
has been provided in order to make this code more convenient to
run. To get started via Vagrant
, you'll need:
- A working
Vagrant
environment - A
git checkout
of this repository - A copy of
GeoLite2-Country.mmdb
in the root of this repository
After you have checked out this repository and added a GeoLite2-Country.mmdb
to
the root directory of the repository, run this command from the root directory.
vagrant up
This will build your Vagrant VM, build your Go
code and also run the example
code for you. To log in to your container, run this command:.
vagrant ssh
cd /vagrant
Once you have logged in, you can test out your freshly created database:
mmdbinspect -db GeoLite2-Country.mmdb \
-db GeoLite2-Country-with-Department-Data.mmdb \
56.0.0.1 56.1.0.0/24 56.2.0.54 56.3.0.1 | less
You can now freely edit the code outside of the Vagrant VM and re-run it from inside the VM.
After you have edited the files, log in to your VM using the instructions above and run the following code:
go build && ./mmdb-from-go-blogpost