telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 8243341afd38a96c93509ac219717b9d886973ca
parent 95f32461b93acca2e9ab3162838e2a965534b5e3
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 29 Mar 2021 13:08:45 +0200

Allow telize_getdata() to handle boolean values from MMDB databases.

Diffstat:
Msrc/telize.h | 3++-
Msrc/utils.c | 6+++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/telize.h b/src/telize.h @@ -4,7 +4,7 @@ * https://www.telize.com * * Created: 2013-08-15 - * Last Updated: 2020-03-25 + * Last Updated: 2021-03-29 * * Telize is released under the BSD 2-Clause license. * See LICENSE file for details. @@ -21,6 +21,7 @@ #define ENTRY_TYPE_UINT32 0 #define ENTRY_TYPE_STRING 1 #define ENTRY_TYPE_DOUBLE 2 +#define ENTRY_TYPE_BOOLEAN 3 int request_ip(struct http_request *); int request_json_ip(struct http_request *); diff --git a/src/utils.c b/src/utils.c @@ -4,7 +4,7 @@ * https://www.telize.com * * Created: 2013-08-15 - * Last Updated: 2019-03-13 + * Last Updated: 2021-03-29 * * Telize is released under the BSD 2-Clause license. * See LICENSE file for details. @@ -59,6 +59,10 @@ telize_getdata(struct kore_buf *json, MMDB_lookup_result_s *lookup, kore_buf_appendf(json, ",\"%s\":%.4f", field, entry_data->double_value); break; + case ENTRY_TYPE_BOOLEAN: + kore_buf_appendf(json, ",\"%s\":%s", + field, entry_data->boolean ? "true" : "false"); + break; } }