diff options
author | Alexander Færøy <ahf@torproject.org> | 2021-10-20 21:47:26 +0000 |
---|---|---|
committer | Alexander Færøy <ahf@torproject.org> | 2021-10-20 21:47:26 +0000 |
commit | d6b6cd7cd7b9fedb1b2955b1bd7a4ec8b0218e89 (patch) | |
tree | 9b6f934d65627bf89fa12634b962db456525234c | |
parent | 04886b339331e0e5e9daebb2acd54dc5ffa8fb9b (diff) | |
parent | 5717b88bcb88d374b7b934622f0b7bf62cdab05c (diff) | |
download | tor-d6b6cd7cd7b9fedb1b2955b1bd7a4ec8b0218e89.tar.gz tor-d6b6cd7cd7b9fedb1b2955b1bd7a4ec8b0218e89.zip |
Merge branch 'maint-0.4.5' into release-0.4.5
-rw-r--r-- | changes/ticket30477 | 4 | ||||
-rw-r--r-- | src/feature/relay/router.c | 23 | ||||
-rw-r--r-- | src/feature/relay/router.h | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/changes/ticket30477 b/changes/ticket30477 new file mode 100644 index 0000000000..379fc4e7eb --- /dev/null +++ b/changes/ticket30477 @@ -0,0 +1,4 @@ + o Minor features (bridge): + - We now announce the URL to Tor's new bridge status at + https://bridges.torproject.org/ when Tor is configured to run as a bridge + relay. Closes ticket 30477. diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 2696b8633b..0589786619 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -843,6 +843,25 @@ router_initialize_tls_context(void) (unsigned int)lifetime); } +/** Announce URL to bridge status page. */ +STATIC void +router_announce_bridge_status_page(void) +{ + char fingerprint[FINGERPRINT_LEN + 1]; + + if (crypto_pk_get_hashed_fingerprint(get_server_identity_key(), + fingerprint) < 0) { + // LCOV_EXCL_START + log_err(LD_GENERAL, "Unable to compute bridge fingerprint"); + return; + // LCOV_EXCL_STOP + } + + log_notice(LD_GENERAL, "You can check the status of your bridge relay at " + "https://bridges.torproject.org/status?id=%s", + fingerprint); +} + /** Compute fingerprint (or hashed fingerprint if hashed is 1) and write * it to 'fingerprint' (or 'hashed-fingerprint'). Return 0 on success, or * -1 if Tor should die, @@ -1145,6 +1164,10 @@ init_keys(void) return -1; } + /* Display URL to bridge status page. */ + if (! public_server_mode(options)) + router_announce_bridge_status_page(); + if (!authdir_mode(options)) return 0; /* 6. [authdirserver only] load approved-routers file */ diff --git a/src/feature/relay/router.h b/src/feature/relay/router.h index aa03c27142..9556a66e68 100644 --- a/src/feature/relay/router.h +++ b/src/feature/relay/router.h @@ -129,6 +129,7 @@ void router_free_all(void); STATIC void get_platform_str(char *platform, size_t len); STATIC int router_write_fingerprint(int hashed, int ed25519_identity); STATIC smartlist_t *get_my_declared_family(const or_options_t *options); +STATIC void router_announce_bridge_status_page(void); STATIC int load_stats_file(const char *filename, const char *ts_tag, time_t now, char **out); |