mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Merge remote-tracking branch 'tor-gitlab/mr/110'
This commit is contained in:
commit
3eb9331133
5
changes/ticket40039
Normal file
5
changes/ticket40039
Normal file
@ -0,0 +1,5 @@
|
||||
o Minor features (control port, relay):
|
||||
- Introduce "GETINFO address/v4" and "GETINFO address/v6" in the control
|
||||
port to fetch the Tor host's respective IPv4 or IPv6 address. We keep
|
||||
"GETINFO address" for backwords-compatibility which retains the current
|
||||
behavior. Closes ticket 40039. Patch by Neel Chauhan.
|
@ -131,7 +131,7 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
|
||||
smartlist_free(signal_names);
|
||||
} else if (!strcmp(question, "features/names")) {
|
||||
*answer = tor_strdup("VERBOSE_NAMES EXTENDED_EVENTS");
|
||||
} else if (!strcmp(question, "address")) {
|
||||
} else if (!strcmp(question, "address") || !strcmp(question, "address/v4")) {
|
||||
tor_addr_t addr;
|
||||
if (!relay_find_addr_to_publish(get_options(), AF_INET,
|
||||
RELAY_FIND_ADDR_CACHE_ONLY, &addr)) {
|
||||
@ -140,6 +140,15 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
|
||||
}
|
||||
*answer = tor_addr_to_str_dup(&addr);
|
||||
tor_assert_nonfatal(*answer);
|
||||
} else if (!strcmp(question, "address/v6")) {
|
||||
tor_addr_t addr;
|
||||
if (!relay_find_addr_to_publish(get_options(), AF_INET6,
|
||||
RELAY_FIND_ADDR_CACHE_ONLY, &addr)) {
|
||||
*errmsg = "Address unknown";
|
||||
return -1;
|
||||
}
|
||||
*answer = tor_addr_to_str_dup(&addr);
|
||||
tor_assert_nonfatal(*answer);
|
||||
} else if (!strcmp(question, "traffic/read")) {
|
||||
tor_asprintf(answer, "%"PRIu64, (get_bytes_read()));
|
||||
} else if (!strcmp(question, "traffic/written")) {
|
||||
@ -1663,6 +1672,10 @@ static const getinfo_item_t getinfo_items[] = {
|
||||
DOC("status/version/recommended", "List of currently recommended versions."),
|
||||
DOC("status/version/current", "Status of the current version."),
|
||||
ITEM("address", misc, "IP address of this Tor host, if we can guess it."),
|
||||
ITEM("address/v4", misc,
|
||||
"IPv4 address of this Tor host, if we can guess it."),
|
||||
ITEM("address/v6", misc,
|
||||
"IPv6 address of this Tor host, if we can guess it."),
|
||||
ITEM("traffic/read", misc,"Bytes read since the process was started."),
|
||||
ITEM("traffic/written", misc,
|
||||
"Bytes written since the process was started."),
|
||||
|
Loading…
Reference in New Issue
Block a user