static int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
static void entry_guards_changed(void);
+static void transport_free(transport_info_t *transport);
/**
* This function decides if CBT learning should be disabled. It returns
return NULL;
}
+/** If <b>addr</b> and <b>port</b> match one of our known bridges,
+ * returns it's transport protocol if it has one, else returns NULL.
+ */
+transport_info_t *
+find_bridge_transport_by_addrport(const tor_addr_t *addr, uint16_t port)
+{
+ SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, bridge)
+ {
+ if (tor_addr_eq(&bridge->addr, addr) &&
+ (bridge->port == port)) {
+ if (bridge->transport) {
+ log_debug(LD_GENERAL, "Found matching bridge!\n");
+ return bridge->transport;
+ } else /* bridge found, but it had no transport */
+ return NULL;
+ }
+ } SMARTLIST_FOREACH_END(bridge);
+ return NULL;
+}
+
/** We need to ask <b>bridge</b> for its server descriptor. */
static void
launch_direct_bridge_descriptor_fetch(bridge_info_t *bridge)
int match_bridges_with_transports(void);
void transport_add_from_config(const tor_addr_t *addr, uint16_t port,
const char *name, int socks_ver);
+transport_info_t *
+find_bridge_transport_by_addrport(const tor_addr_t *addr, uint16_t port);
+
#endif
proxy_type = PROXY_SOCKS4;
else if (get_options()->Socks5Proxy)
proxy_type = PROXY_SOCKS5;
+ else if (get_options()->UseBridges) {
+ transport_info_t *transport;
+ transport = find_bridge_transport_by_addrport(&conn->addr,conn->port);
+ if (transport) { /* this bridge supports transports. use proxy. */
+ log_warn(LD_GENERAL, "Setting up pluggable transport plugin proxy type!\n");
+ proxy_type = transport->socks_version;
+ }
+ }
if (proxy_type != PROXY_NONE) {
/* start proxy handshake */
using_proxy = 1;
tor_addr_copy(&addr, &options->Socks5ProxyAddr);
port = options->Socks5ProxyPort;
+ } else if (options->ClientTransportPlugin) {
+ transport_info_t *transport;
+ transport = find_bridge_transport_by_addrport(&addr, port);
+ if (transport) {
+ log_warn(LD_GENERAL, "Our bridge uses a pluggable transport plugin. "
+ "Setting up proxying!");
+ using_proxy = 1;
+ tor_addr_copy(&addr, &transport->addr);
+ port = transport->port;
+ }
}
switch (connection_connect(TO_CONN(conn), conn->_base.address,