💕 Contributions are welcome and appreciated.
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.
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.
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 ()
+@property (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!
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:
All contributions are welcome and appreciated. Thank you!