This article analyze maxmind/geoipupdate protocol stack design

HTTP API Link to heading

Request Link to heading

GET /geoip/databases/<edition-id>/update?db_md5=<local-hash>
Host: <host>
User-Agent: geoipupdate/<version>
Authentication: Basic <account-id:license-key>


Response: 200 OK Link to heading

Response Body:

MUST use gzipped compression

Response Headers:

  • Content-Encoding: gzip: The updater NOT CHECK this field, but suggest set the field.
  • X-Database-MD5: <new-md5>: This is MUST field, The is new hash (MD5), use hexadecimal encoded, see L193
  • Last-Modified: <last-modified>: This is MUST field, The is last-modified time, format RFC1123, see L198

Response Body: ip database file binary
(NOT VERIFY PAYLOAD FORMAT is MaxMind Database file format)

Response: 304 (Not Modified) Link to heading

Abort Update, see L162-L167

Response: Redirect Link to heading

Use new location download update, see L148

see Golang builtin http client supports auto follow redirects:

Response: Not OK Link to heading

Download first 256 bytes on error messsage, see L170-L175