Onion Browser is a free web browser for iPhone and iPad that encrypts and tunnels web traffic through the Tor network , with extra features to help you browse the internet privately.
The build scripts for Tor and other dependencies are based on build-libssl.sh from x2on/OpenSSL-for-iPhone . The scripts are configured to compile universal binaries for armv7 and i386 (for the iOS Simulator).
Because iOS applications cannot launch subprocesses or otherwise execute other binaries, the tor client is run in-process in a
NSThread subclass which executes the
tor_main() function (as an external
tor executable would) and attempts to safely wrap Tor within the app. (
libtor.a , intermediate binaries created when compiling Tor, are used to provide Tor.) Side-effects of this method have not yet been fully evaluated. Management of most tor functionality (status checks, reloading tor on connection changes) is handled by accessing the Tor control port in an internal, telnet-like session from the
The app uses a
NSURLProtocol subclass (
ProxyURLProtocol ), registered to handle HTTP/HTTPS requests. That protocol uses the
CKHTTPConnection class which nearly matches the
NSURLConnection class, providing wrappers and access to the underlying
CFHTTP Core Framework connection bits. This connection class is where SOCKS5 connectivity is enabled. (Because we are using SOCKS5, DNS requests are sent over the Tor network, as well.)