mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-26 23:52:30 +01:00
Add published
line to @type bridge-network-status
documents.
This modifies the format of the bridge networkstatus documents produced by the BridgeAuth. The new format adds a `published` line to the header of the file, before the `flag-thresholds` line. This is done once per networkstatus file that is written. The timestamp in the `published` line is the standard ISO 8601 format (with a space as the separator) used throughout the rest of tor. * FIXES #12951 https://bugs.torproject.org/12951
This commit is contained in:
parent
72ba1739e2
commit
374b531dba
1 changed files with 10 additions and 5 deletions
|
@ -1672,17 +1672,22 @@ networkstatus_dump_bridge_status_to_file(time_t now)
|
||||||
char *status = networkstatus_getinfo_by_purpose("bridge", now);
|
char *status = networkstatus_getinfo_by_purpose("bridge", now);
|
||||||
const or_options_t *options = get_options();
|
const or_options_t *options = get_options();
|
||||||
char *fname = NULL;
|
char *fname = NULL;
|
||||||
char *thresholds = NULL, *thresholds_and_status = NULL;
|
char *thresholds = NULL;
|
||||||
|
char *published_thresholds_and_status = NULL;
|
||||||
routerlist_t *rl = router_get_routerlist();
|
routerlist_t *rl = router_get_routerlist();
|
||||||
|
char published[ISO_TIME_LEN+1];
|
||||||
|
|
||||||
|
format_iso_time(published, now);
|
||||||
dirserv_compute_bridge_flag_thresholds(rl);
|
dirserv_compute_bridge_flag_thresholds(rl);
|
||||||
thresholds = dirserv_get_flag_thresholds_line();
|
thresholds = dirserv_get_flag_thresholds_line();
|
||||||
tor_asprintf(&thresholds_and_status, "flag-thresholds %s\n%s",
|
tor_asprintf(&published_thresholds_and_status,
|
||||||
thresholds, status);
|
"published %s\nflag-thresholds %s\n%s",
|
||||||
|
published, thresholds, status);
|
||||||
tor_asprintf(&fname, "%s"PATH_SEPARATOR"networkstatus-bridges",
|
tor_asprintf(&fname, "%s"PATH_SEPARATOR"networkstatus-bridges",
|
||||||
options->DataDirectory);
|
options->DataDirectory);
|
||||||
write_str_to_file(fname,thresholds_and_status,0);
|
write_str_to_file(fname,published_thresholds_and_status,0);
|
||||||
tor_free(thresholds);
|
tor_free(thresholds);
|
||||||
tor_free(thresholds_and_status);
|
tor_free(published_thresholds_and_status);
|
||||||
tor_free(fname);
|
tor_free(fname);
|
||||||
tor_free(status);
|
tor_free(status);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue