Skip to content

anyone-protocol/AnyoneKit

 
 

Repository files navigation

AnyoneKit

Version License Platform

AnyoneKit is the easiest way to embed the Anyone/anon network in your iOS and macOS application.

Currently, the framework contains the following versions of anon, libevent, openssl, and liblzma:

Component Version
anon 0.4.9.11
libevent 2.1.12
OpenSSL 3.5.1
liblzma 5.8.1

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 12.0 or later
  • MacOS 10.13 or later
  • Xcode 15.0 or later

Installation

AnyoneKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!
pod 'AnyoneKit', '~> 409'

Preparing a new release

For maintainers/contributors of AnyoneKit, a new release should be prepared by doing the following:

brew bundle
  • Update the version numbers of the libraries used in build-xcframework.sh.

  • Run build-xcframework.sh, check the logs and test the created anon.xcframework with the contained example apps.

  • Update info and version numbers in README.md and AnyoneKit.podspec!

  • Commit, tag and push new release.

  • Zip anon.framework:

zip -r -9 anon.xcframework.zip anon.xcframework
pod lib lint --allow-warnings
  • If the linting went well, publish to CocoaPods:
pod trunk push --allow-warnings
  • Then update the release in GitHub, setting it as the latest release.

Usage

Starting an instance of the anon client involves using three classes: AnonThread, AnonConfiguration and AnonController.

Here is an example of integrating anon with NSURLSession:

AnonConfiguration *configuration = [AnonConfiguration new];
configuration.ignoreMissingAnonrc = YES;
configuration.cookieAuthentication = YES;
configuration.dataDirectory = [NSURL fileURLWithPath:NSTemporaryDirectory()];
configuration.controlSocket = [configuration.dataDirectory URLByAppendingPathComponent:@"control_port"];

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

NSData *cookie = configuration.cookie;
AnonController *controller = [[AnonController alloc] initWithSocketURL:configuration.controlSocket];

NSError *error;
[controller connect:&error];

if (error) {
    NSLog(@"Error: %@", error);
    return;
}

[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];
            ...
        }];
    }];
}];

You might also want to have a look at the example iOS and macOS apps contained in the repository: https://github.com/anyone-protocol/AnyoneKit/tree/pure_pod/Example

GeoIP

If you want to use the provided GeoIP files, add this to your configuration:

AnonConfiguration *configuration = [AnonConfiguration new];
configuration.geoipFile = NSBundle.geoIpBundle.geoipFile;
configuration.geoip6File = NSBundle.geoIpBundle.geoip6File;

Authors

The original Tor.framework

AnyoneKit

License

AnyoneKit is available under the MIT license. See the LICENSE file for more info.

About

Anyone iOS/macOS SDK

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Objective-C 87.1%
  • Shell 9.4%
  • C 2.2%
  • Ruby 1.3%