<commit_before>#include <kore/kore.h>
#include <kore/http.h>

int		ip(struct http_request *);

int
ip(struct http_request *req)
{
	http_response(req, 200, NULL, 0);
	return (KORE_RESULT_OK);
}
<commit_msg>Return the client IP address in the 'ip' endpoint<commit_after>/*****************************************************************************/
/*                                                                           */
/* Telize 2.0.0                                                              */
/* Copyright (c) 2013-2018, <NAME>                                  */
/* https://www.telize.com                                                    */
/*                                                                           */
/* Created:      2013-08-15                                                  */
/* Last Updated: 2018-10-04                                                  */
/*                                                                           */
/* Telize is released under the BSD 2-Clause license.                        */
/* See LICENSE file for details.                                             */
/*                                                                           */
/*****************************************************************************/

#include <sys/socket.h>

#include <kore/kore.h>
#include <kore/http.h>

int		ip(struct http_request *);

int
ip(struct http_request *req)
{
	char addr[INET6_ADDRSTRLEN];

	if (req->owner->addrtype == AF_INET) {
		inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv4.sin_addr), addr, sizeof(addr));
	} else {
		inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv6.sin6_addr), addr, sizeof(addr));
	}

	http_response(req, 200, addr, strlen(addr));

	return (KORE_RESULT_OK);
}

{'fraction_non_alphanumeric': 0.19764177428411006, 'fraction_numerical': 0.021897810218978103, 'mean_word_length': 1.1811505507955937, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3882037', 'n_tokens_mistral': 452, 'n_tokens_neox': 410, 'n_words': 84}