recently, I want to analysis the Tor source code,but I don't known how and where to begin. If any volunteer knows how to do it, please share some experience with me. I'd like to know the details of Tor's work through source code analysis, such as which part of the source code is the link selection, which part of the source code is the relay node from the directory server, which part of the source code is the exit node selection, and so on.There is also a question to make some changes about the Tor source code and to recompile. thank you very much if you can give me some suggestions
You can find Tor's source code on Github. Most of the cool stuff is in the src folder. Some parts of the code are accompanied by comments that tell you what it does. This is a sample code snippet from src/feature/relay/dns.h
/** How long do we cache/tell clients to cache DNS records when no TTL is * known? */ #define DEFAULT_DNS_TTL (30*60) int dns_init(void); int has_dns_init_failed(void);
Alternatively, check out this paper which analyses Tor's code step by step. Here, you can see functions and explanations of what they do. To see the code under each function, simply search it in Tor's Github repo. Here's an example screenshot from the paper:
To make edits to the code, you can either fork or download Tor's repo from Github.