Is there any way I can see what each file does in Tor source code? A simple file with a list for example?I do not want to read and surf through whole code.

  • Your question have my upvote.
    – Roya
    Commented Jul 11, 2014 at 17:33

2 Answers 2


Gitweb allows you to browse through the code. Especially the src/or directory has relevant source code. Some of the files contain a description what this file does:

 * \file directory.c
 * \brief Code to send and fetch directories and router
 * descriptors via HTTP. Directories use dirserv.c to generate the
 * results; clients use routers.c to parse them.

This belongs tosrc/or/directory.c.


Yes, this way, for example:

(sorry, do not know how to hide it)


Helper for directory authority ops. When somebody sends us a private key, this utility converts the private key into a fingerprint so you can de-list that fingerprint


Appends src to string dst of size siz


Copy src to string dst of size siz


Async DNS Library


Welcome to the example file for tinytest




Curve25519 elliptic curve, public key function


Curve25519 elliptic curve, public key function




Formatting and parsing code for crypto-related data structures


Wrapper code for a curve25519 implementation


Functions to send messages to log files or the console


Return a string describing the digest of the source files in src/common/


Process-termination monitor functions


Implements a smartlist (a resizable array) along with helper functions to use smartlists. Also includes hash table implementations of a string-to-void* map, and of a digest-to-void* map


Functions for data-independent operations


Wrappers to handle porting between different versions of libevent


Implementation for memarea_t, an allocator for allocating lots of small objects that will be freed all at once


Wrapper functions to present a consistent interface to public-key and symmetric cryptography operations from OpenSSL


Wrapper functions to present a consistent interface to TLS, SSL, and X.509 functions from OpenSSL


Functions to use and manipulate the tor_addr_t structure


A simple in-memory gzip implementation


Implements a counter-mode stream cipher on top of AES


This is an implementation of memory pools for Tor cells


Common functions for strings, IO, network, data structures, process control


Wrappers to make calls more portable








Unit tests for many pieces of the lower level Tor modules






Benchmarks for lower level Tor modules
















Trivial test program which prints out its command line arguments




Functions and structures for handling network status documents as a client or cache


Implements a local cache for DNS results for Tor servers


Rendezvous implementation: shared code between introducers, services, clients, and rendezvous points


Code to parse and interpret configuration files


Self-scrubbing replay cache for rendservice.c


Functions for processing incoming cells


Pluggable Transports related code


Functions to handle OR connections, TLS handshaking, and cells on the network


Keep status information and log the heartbeat messages


The actual details of building circuits


Manage the global circuit list


A routerset specifies constraints on a set of possible routerinfos


Functions to parse config options


A client-side struct to remember requests to rewrite addresses to new addresses


A list of all the nodes


Circuit mux/cell selection abstraction


Implement introductions points and rendezvous points


Return a string describing the digest of the source files in src/or/




Code to parse and validate router descriptors and directories


Directory server core implementation


Handle edge streams


Implements client-side DNS proxy server code


Functions to implement the original Tor circuit extension handshake


Implements a generic interface buffer


Client code to access location-hidden services






Handle relay cell encryption/decryption, plus packaging and receiving from circuits, plus queuing on circuits




Functions to close listeners, stop allowing new circuits, etc


Launch the right sort of circuits and attach streams to them


Code to manage our fixed first nodes for various functions


OR functionality, including key maintenance, generating and uploading server descriptors, retrying OR connections


General high-level functions to handle reading and writing on connections


Convert circuit, stream, and orconn error reasons to and/or from strings and errno values




Stub module containing a main() function. Allows unit test binary to link against main.c


Toplevel module. Handles signals, multiplexes between connections, implements main loop, and drives scheduled events


EWMA circuit selection as a circuitmux_t policy


Code to parse and use address policies and exit policies


Implements a farm of 'CPU worker' processes to perform CPU-intensive tasks in another thread or process, to not interrupt the main thread


Code to send and fetch directories and router descriptors via HTTP


Implementation for Tor's control-socket interface


Functions implement the CREATE_FAST circuit handshake


channel_t concrete subclass using or_connection_t


The hidden-service side of rendezvous functionality


Functions to compute directory consensus, and schedule voting


Functions to queue create cells, wrap the various onionskin types, and parse and create the CREATE cell and its allies


Global list of circuit build times


Functions related to maintaining an IP-to-country database


OR-to-OR channel abstraction layer


Code to maintain and access the global list of routerinfos for known servers


Basic history and "reputation" functionality to remember which servers have worked in the past, how much bandwidth we've been using, which ports we tend to want, and so on




The main wrapper around our firewall helper logic


The implementation of our UPnP firewall helper


The implementation of our NAT-PMP firewall helper





But there might be stuff that you must read from source code files.

  • Interesting, your answer have my upvote.
    – Roya
    Commented Jul 11, 2014 at 17:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .