diff options
author | Alexander Færøy <ahf@torproject.org> | 2020-11-23 23:41:17 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-12-09 10:03:11 -0500 |
commit | ed3f46a38559eead8ff70bcb935c17b1b23cc78d (patch) | |
tree | d42cd00f2065b14a98f4d4c58fb2bac5c3741562 /src | |
parent | bff3c6f48db0144e8b2c5646daba867300c08ad3 (diff) | |
download | tor-ed3f46a38559eead8ff70bcb935c17b1b23cc78d.tar.gz tor-ed3f46a38559eead8ff70bcb935c17b1b23cc78d.zip |
Announce URL to bridge status page when starting Tor as a bridge relay.
This patch makes Tor announce the relay specific bridge status page URL
when Tor is starting up before bootstrap occours.
See: tor#30477
Diffstat (limited to 'src')
-rw-r--r-- | src/feature/relay/router.c | 23 | ||||
-rw-r--r-- | src/feature/relay/router.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 89ac40bb4d..04ffe8e48e 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -831,6 +831,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, @@ -1133,6 +1152,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 f71ada8eb7..f9df1f5637 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); #ifdef TOR_UNIT_TESTS extern time_t desc_clean_since; |