mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Prop210: Add router_digest_is_fallback_dir
router_digest_is_fallback_dir returns 1 if the digest is in the currently loaded list of fallback directories, and 0 otherwise. This function is for future use.
This commit is contained in:
parent
2212530bf5
commit
d72af1085a
@ -1362,7 +1362,9 @@ router_get_trusteddirserver_by_digest(const char *digest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Return the dir_server_t for the fallback dirserver whose identity
|
/** Return the dir_server_t for the fallback dirserver whose identity
|
||||||
* key hashes to <b>digest</b>, or NULL if no such authority is known.
|
* key hashes to <b>digest</b>, or NULL if no such fallback is in the list of
|
||||||
|
* fallback_dir_servers. (fallback_dir_servers is affected by the FallbackDir
|
||||||
|
* and UseDefaultFallbackDirs torrc options.)
|
||||||
*/
|
*/
|
||||||
dir_server_t *
|
dir_server_t *
|
||||||
router_get_fallback_dirserver_by_digest(const char *digest)
|
router_get_fallback_dirserver_by_digest(const char *digest)
|
||||||
@ -1370,6 +1372,9 @@ router_get_fallback_dirserver_by_digest(const char *digest)
|
|||||||
if (!fallback_dir_servers)
|
if (!fallback_dir_servers)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!digest)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
SMARTLIST_FOREACH(fallback_dir_servers, dir_server_t *, ds,
|
SMARTLIST_FOREACH(fallback_dir_servers, dir_server_t *, ds,
|
||||||
{
|
{
|
||||||
if (tor_memeq(ds->digest, digest, DIGEST_LEN))
|
if (tor_memeq(ds->digest, digest, DIGEST_LEN))
|
||||||
@ -1379,6 +1384,17 @@ router_get_fallback_dirserver_by_digest(const char *digest)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return 1 if any fallback dirserver's identity key hashes to <b>digest</b>,
|
||||||
|
* or 0 if no such fallback is in the list of fallback_dir_servers.
|
||||||
|
* (fallback_dir_servers is affected by the FallbackDir and
|
||||||
|
* UseDefaultFallbackDirs torrc options.)
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
router_digest_is_fallback_dir(const char *digest)
|
||||||
|
{
|
||||||
|
return (router_get_fallback_dirserver_by_digest(digest) != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/** Return the dir_server_t for the directory authority whose
|
/** Return the dir_server_t for the directory authority whose
|
||||||
* v3 identity key hashes to <b>digest</b>, or NULL if no such authority
|
* v3 identity key hashes to <b>digest</b>, or NULL if no such authority
|
||||||
* is known.
|
* is known.
|
||||||
|
@ -50,6 +50,7 @@ const routerstatus_t *router_pick_directory_server(dirinfo_type_t type,
|
|||||||
dir_server_t *router_get_trusteddirserver_by_digest(const char *d);
|
dir_server_t *router_get_trusteddirserver_by_digest(const char *d);
|
||||||
dir_server_t *router_get_fallback_dirserver_by_digest(
|
dir_server_t *router_get_fallback_dirserver_by_digest(
|
||||||
const char *digest);
|
const char *digest);
|
||||||
|
int router_digest_is_fallback_dir(const char *digest);
|
||||||
dir_server_t *trusteddirserver_get_by_v3_auth_digest(const char *d);
|
dir_server_t *trusteddirserver_get_by_v3_auth_digest(const char *d);
|
||||||
const routerstatus_t *router_pick_trusteddirserver(dirinfo_type_t type,
|
const routerstatus_t *router_pick_trusteddirserver(dirinfo_type_t type,
|
||||||
int flags);
|
int flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user