tor
master
|
Code to manage bridges and bridge selection. More...
#include "or.h"
#include "bridges.h"
#include "circuitbuild.h"
#include "config.h"
#include "connection.h"
#include "directory.h"
#include "entrynodes.h"
#include "nodelist.h"
#include "policies.h"
#include "router.h"
#include "routerlist.h"
#include "routerset.h"
#include "transports.h"
Data Structures | |
struct | bridge_info_t |
Macros | |
#define | TOR_BRIDGES_PRIVATE |
#define | bridge_free(bridge) FREE_AND_NULL(bridge_info_t, bridge_free_, (bridge)) |
Code to manage bridges and bridge selection.
Bridges are fixed entry nodes, used for censorship circumvention.
int addr_is_a_configured_bridge | ( | const tor_addr_t * | addr, |
uint16_t | port, | ||
const char * | digest | ||
) |
If we have a bridge configured whose digest matches digest, or a bridge with no known digest whose address matches addr:port, return 1. Else return 0. If digest is NULL, check for address/port matches only.
void bridge_add_from_config | ( | bridge_line_t * | bridge_line | ) |
Register the bridge information in bridge_line to the bridge subsystem. Steals reference of bridge_line.
const tor_addr_port_t* bridge_get_addr_port | ( | const bridge_info_t * | bridge | ) |
Given a bridge, return a pointer to its configured addr:port combination.
const uint8_t* bridge_get_rsa_id_digest | ( | const bridge_info_t * | bridge | ) |
Given a bridge, return a pointer to its RSA identity digest, or NULL if we don't know one for it.
const smartlist_t* bridge_list_get | ( | void | ) |
Return a list of all the configured bridges, as bridge_info_t pointers.
STATIC void bridge_resolve_conflicts | ( | const tor_addr_t * | addr, |
uint16_t | port, | ||
const char * | digest, | ||
const char * | transport_name | ||
) |
We are about to add a new bridge at addr:port, with optional digest and transport_name. Mark for removal any previously existing bridge with the same address and port, and warn the user as appropriate.
void bridges_free_all | ( | void | ) |
STATIC void clear_bridge_list | ( | void | ) |
Initialize the bridge list to empty, creating it if needed.
int extend_info_is_a_configured_bridge | ( | const extend_info_t * | ei | ) |
If we have a bridge configured whose digest matches ei->identity_digest, or a bridge with no known digest whose address matches ei->addr:ei->port, return 1. Else return 0. If ei->onion_key is NULL, check for address/port matches only.
void fetch_bridge_descriptors | ( | const or_options_t * | options, |
time_t | now | ||
) |
For each bridge in our list for which we don't currently have a descriptor, fetch a new copy of its descriptor – either directly from the bridge or via a bridge authority.
STATIC bridge_info_t* find_bridge_by_digest | ( | const char * | digest | ) |
If digest is one of our known bridges, return it.
const char* find_transport_name_by_bridge_addrport | ( | const tor_addr_t * | addr, |
uint16_t | port | ||
) |
Given the addr and port of a bridge, if that bridge supports a pluggable transport, return its name. Otherwise, return NULL.
bridge_info_t* get_configured_bridge_by_addr_port_digest | ( | const tor_addr_t * | addr, |
uint16_t | port, | ||
const char * | digest | ||
) |
If we have a bridge configured whose digest matches digest, or a bridge with no known digest whose address matches addr:port, return that bridge. Else return NULL. If digest is NULL, check for address/port matches only.
bridge_info_t* get_configured_bridge_by_exact_addr_port_digest | ( | const tor_addr_t * | addr, |
uint16_t | port, | ||
const char * | digest | ||
) |
As get_configured_bridge_by_addr_port, but require that the address match addr:port, and that the ID digest match digest. (The other function will ignore the address if the digest matches.)
STATIC bridge_info_t* get_configured_bridge_by_orports_digest | ( | const char * | digest, |
const smartlist_t * | orports | ||
) |
If we have a bridge configured whose digest matches digest, or a bridge with no known digest whose address matches any of the tor_addr_port_t's in orports, return that bridge. Else return NULL.
const smartlist_t* get_socks_args_by_bridge_addrport | ( | const tor_addr_t * | addr, |
uint16_t | port | ||
) |
Return a smartlist containing all the SOCKS arguments that we should pass to the SOCKS proxy.
int get_transport_by_bridge_addrport | ( | const tor_addr_t * | addr, |
uint16_t | port, | ||
const transport_t ** | transport | ||
) |
If addr and port match the address and port of a bridge of ours that uses pluggable transports, place its transport in transport.
Return 0 on success (found a transport, or found a bridge with no transport, or found no bridge); return -1 if we should be using a transport, but the transport could not be found.
void learned_bridge_descriptor | ( | routerinfo_t * | ri, |
int | from_cache | ||
) |
We just learned a descriptor for a bridge. See if that digest is in our entry guard list, and add it if not.
void learned_router_identity | ( | const tor_addr_t * | addr, |
uint16_t | port, | ||
const char * | digest, | ||
const ed25519_public_key_t * | ed_id | ||
) |
We made a connection to a router at addr:port without knowing its digest. Its digest turned out to be digest. If it was a bridge, and we still don't know its digest, record it.
void mark_bridge_list | ( | void | ) |
Mark every entry of the bridge list to be removed on our next call to sweep_bridge_list unless it has first been un-marked.
MOCK_IMPL | ( | int | , |
transport_is_needed | , | ||
(const char *transport_name) | |||
) |
Return True if we have a bridge that uses a transport with name transport_name.
MOCK_IMPL | ( | smartlist_t * | , |
list_bridge_identities | , | ||
(void) | |||
) |
Return a smartlist containing all bridge identity digests
MOCK_IMPL | ( | download_status_t * | , |
get_bridge_dl_status_by_id | , | ||
(const char *digest) | |||
) |
Get the download status for a bridge descriptor given its identity
int node_is_a_configured_bridge | ( | const node_t * | node | ) |
Return 1 if node is one of our configured bridges, else 0.
void retry_bridge_descriptor_fetch_directly | ( | const char * | digest | ) |
Fetching the bridge descriptor from the bridge authority returned a "not found". Fall back to trying a direct fetch.
int routerinfo_is_a_configured_bridge | ( | const routerinfo_t * | ri | ) |
Return 1 if ri is one of our known bridges, else 0.
void sweep_bridge_list | ( | void | ) |
Remove every entry of the bridge list that was marked with mark_bridge_list if it has not subsequently been un-marked.