Summary: See FBPortForwarding/README.md for an explanation of what this is. It's required for the upcoming support for physical iOS devices. To simplify development of the JS app, We're going to bundle the pre-built PortForwardingMacApp inside the repo, and inside the electron app (static/PortForwardingMacApp.app). Adding this source so users can build it from source if they choose to. Reviewed By: danielbuechele Differential Revision: D13276022 fbshipit-source-id: 99b18e0412cf443bb4a67eb4846cc780e0014de1
35 lines
1.1 KiB
Objective-C
35 lines
1.1 KiB
Objective-C
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <FKPortForwarding/FKPortForwardingClient.h>
|
|
|
|
static const char kPortForwardParamPrefix[] = "-portForward=";
|
|
static const char kMultiplexChannelPortParamPrefix[] = "-multiplexChannelPort=";
|
|
|
|
static BOOL prefix(const char *pre, const char *str) {
|
|
return strncmp(pre, str, strlen(pre)) == 0;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
long connectionsPort = 8081;
|
|
long multiplexPort = 8025;
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
if (prefix(kPortForwardParamPrefix, argv[i])) {
|
|
connectionsPort = strtol(argv[i] + strlen(kPortForwardParamPrefix), NULL, 10);
|
|
} else if (prefix(kMultiplexChannelPortParamPrefix, argv[i])) {
|
|
multiplexPort = strtol(argv[i] + strlen(kMultiplexChannelPortParamPrefix), NULL, 10);
|
|
}
|
|
}
|
|
|
|
FKPortForwardingClient *client = [FKPortForwardingClient new];
|
|
[client forwardConnectionsToPort:connectionsPort];
|
|
[client connectToMultiplexingChannelOnPort:multiplexPort];
|
|
|
|
[[NSRunLoop currentRunLoop] run];
|
|
client = nil;
|
|
return 0;
|
|
}
|