Latest 0.0.1-alpha1
Homepage https://github.com/igorlira/relay
License MIT
Platforms ios 10.0, requires ARC
Dependencies CocoaAsyncSocket
Authors


Relay

⚠️ This is an experimental project and might make your app crash. Do not use on production builds.

💕 Contributions are welcome and appreciated.

How it works

Client-side (iOS)

Relay will create one or more sockets listening on an arbitrary, user-specified port. All the communication in that port will be forwarded to and from your computer through a USB connection.

Server-side (macOS)

When running on your machine, Relay will listen for connections over USB and route the client’s traffic to and from localhost at the requested port.

Installing

Client-side (iOS)

If you’d rather install manually, check ExampleRelayClient for an example.

Relay is available on CocoaPods. Add the following line on your Podfile:

pod 'RelayClient', '0.0.1-alpha1'

After running pod install, Add the following lines to your AppDelegate.m:

+#import <RelayClient/RelayConnectionManager.h>

 @interface AppDelegate ()

[email protected] (nonatomic, strong) RelayConnectionManager* relayManager;

 @end

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    self.relayManager = [[RelayConnectionManager alloc] init];

+    // Use hangIfNotConnected to prevent incoming connections from being refused if we're not connected over USB
+    self.relayManager.hangIfNotConnected = YES;

+    // Will relay iOS(localhost:80) to macOS(localhost:8081)
+    [self.relayManager addLocalPort:@(80) relayPort:@(8081)];

+    [self.relayManager start];
 }

 - (void)applicationDidEnterBackground:(UIApplication *)application {
+    [self.relayManager stop];
 }

 - (void)applicationWillEnterForeground:(UIApplication *)application {
+    [self.relayManager start];
 }

✅ Done!

Server-side (macOS)

You can either build the target RelayServer directly from the source code, or download a precompiled version here.

Relay will add an icon to your menu bar indicating if it’s connected to a device:


Relay menu

Contributions

All contributions are welcome and appreciated. Thank you!

Latest podspec

{
    "name": "RelayClient",
    "version": "0.0.1-alpha1",
    "summary": "A tool to relay iOS sockets over a USB tunnel.",
    "description": "A tool to relay iOS sockets over a USB tunnel.",
    "homepage": "https://github.com/igorlira/relay",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Igor Lira": "[email protected]"
    },
    "social_media_url": "https://twitter.com/igorlira",
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/igorlira/relay.git",
        "tag": "0.0.1-alpha1"
    },
    "source_files": [
        "RelayClient-iOS",
        "RelayClient-iOS/**/*.{h,m}",
        "Shared",
        "Shared/**/*.{h,m}"
    ],
    "exclude_files": "RelayClient-iOS/Exclude",
    "public_header_files": "RelayClient-iOS/**/*.h",
    "vendored_frameworks": "Peertalk.framework",
    "requires_arc": true,
    "dependencies": {
        "CocoaAsyncSocket": []
    }
}

Pin It on Pinterest

Share This