Skip to content

lukewar/Tor.framework

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tor.framework

Carthage Compatible

Tor.framework is the easiest way to embed Tor in your iOS application. The API is not stable yet, and subject to change.

Currently, the framework compiles in static versions of tor, libevent and openssl:

tor 0.2.7.6
libevent 2.0.22
OpenSSL 1.0.2g

Requirements

  • iOS 8.0 or later
  • Xcode 7.0 or later
  • autoconf, automake, libtool and gettext in your PATH

Installation

Embedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks (10.9).

If you use brew, make sure to install autoconf, automake, libtool and gettext:

brew install automake autoconf libtool gettext

Carthage

To integrate Tor into your Xcode project using Carthage, specify it in your Cartfile:

github "iCepa/Tor.framework" "master"

Usage

Starting an instance of Tor involves using three classes: TORThread, TORConfiguration and TORController.

Here is an example of integrating Tor with NSURLSession:

TORConfiguration *configuration = [TORConfiguration new];
configuration.cookieAuthentication = @(YES);
configuration.dataDirectory = [NSURL URLWithString:NSTemporaryDirectory()];
configuration.controlSocket = [configuration.dataDirectory URLByAppendingPathComponent:@"control_port"];
configuration.arguments = @[@"--ignore-missing-torrc"];

TORThread *thread = [[TORThread alloc] initWithConfiguration:configuration];
[thread start];

NSURL *cookieURL = [configuration.dataDirectory URLByAppendingPathComponent:@"control_auth_cookie"];
NSData *cookie = [NSData dataWithContentsOfURL:cookieURL];
TORController *controller = [[TORController alloc] initWithSocketURL:configuration.controlSocket];
[controller authenticateWithData:cookie completion:^(BOOL success, NSError *error) {
    if (!success)
        return;
    
    [controller addObserverForCircuitEstablished:^(BOOL established) {
        if (!established)
            return;
        
        [controller getSessionConfiguration:^(NSURLSessionConfiguration *configuration) {
            NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
            ...
        }];
    }];
}];

About

Tor framework for the iCepa project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 74.8%
  • Shell 25.2%