[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/maint-0.3.5] Announce URL to bridge status page when starting Tor as a bridge relay.



commit 73727397652f933c710d701c5b2e27cbac12af49
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Mon Nov 23 23:41:17 2020 +0000

    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
---
 changes/ticket30477        |  4 ++++
 src/feature/relay/router.c | 23 +++++++++++++++++++++++
 src/feature/relay/router.h |  1 +
 3 files changed, 28 insertions(+)

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 283f7c326b..7ea2a4e719 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -803,6 +803,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,
@@ -1103,6 +1122,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 ab1f771017..2d9ff3f8f3 100644
--- a/src/feature/relay/router.h
+++ b/src/feature/relay/router.h
@@ -119,6 +119,7 @@ void router_free_all(void);
 /* Used only by router.c and test.c */
 STATIC void get_platform_str(char *platform, size_t len);
 STATIC int router_write_fingerprint(int hashed);
+STATIC void router_announce_bridge_status_page(void);
 #endif
 
 #endif /* !defined(TOR_ROUTER_H) */

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits