Refactor to move PortForwardingMacApp under /desktop
This commit is contained in:
committed by
Lorenzo Blasa
parent
1e1cc37c3b
commit
b26997af00
13
desktop/PortForwardingMacApp/Podfile
Normal file
13
desktop/PortForwardingMacApp/Podfile
Normal file
@@ -0,0 +1,13 @@
|
||||
# Uncomment the next line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
target 'PortForwardingMacApp' do
|
||||
# Comment the next line if you don't want to use dynamic frameworks
|
||||
#use_frameworks!
|
||||
platform :osx, '11'
|
||||
|
||||
# Pods for PortForwardingMacApp
|
||||
pod 'Flipper-PeerTalk', '~>0.0'
|
||||
pod 'CocoaAsyncSocket', '~>7.6'
|
||||
|
||||
end
|
||||
20
desktop/PortForwardingMacApp/Podfile.lock
Normal file
20
desktop/PortForwardingMacApp/Podfile.lock
Normal file
@@ -0,0 +1,20 @@
|
||||
PODS:
|
||||
- CocoaAsyncSocket (7.6.5)
|
||||
- Flipper-PeerTalk (0.0.4)
|
||||
|
||||
DEPENDENCIES:
|
||||
- CocoaAsyncSocket (~> 7.6)
|
||||
- Flipper-PeerTalk (~> 0.0)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- CocoaAsyncSocket
|
||||
- Flipper-PeerTalk
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
|
||||
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
|
||||
|
||||
PODFILE CHECKSUM: 861e0c9ba6cbdc85168a923850426dcf49e444fa
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
@@ -0,0 +1,417 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
3B3526C92757197400D803F9 /* FKPortForwardingClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B61AC1A2756C3D30017E050 /* FKPortForwardingClient.m */; };
|
||||
3B3526CA2757197400D803F9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3FD2F527565B8000D731DB /* main.m */; };
|
||||
3B3526CF275721B500D803F9 /* FBPortForwardingMacApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0A99AA5350C20B2CFA072E3 /* FBPortForwardingMacApp.framework */; };
|
||||
49AE9D8F5494BB1BC5BF2B9E /* libPods-PortForwardingMacApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFC73B0CB918678127B57C88 /* libPods-PortForwardingMacApp.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
3B3526D1275721B500D803F9 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
339253FD0D50C9D90FA019FF /* Pods-PortForwardingMacApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PortForwardingMacApp.release.xcconfig"; path = "../../Pods/Target Support Files/Pods-PortForwardingMacApp/Pods-PortForwardingMacApp.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3B3526B9275718D700D803F9 /* PortForwardingMacApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PortForwardingMacApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3FD2F527565B8000D731DB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
3B61AC192756C3D30017E050 /* FKPortForwardingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FKPortForwardingClient.h; path = iOS/FlipperKit/FKPortForwarding/FKPortForwardingClient.h; sourceTree = SOURCE_ROOT; };
|
||||
3B61AC1A2756C3D30017E050 /* FKPortForwardingClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FKPortForwardingClient.m; path = iOS/FlipperKit/FKPortForwarding/FKPortForwardingClient.m; sourceTree = SOURCE_ROOT; };
|
||||
95395DC97D1F23A7B72F2FB8 /* Pods-PortForwardingMacApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PortForwardingMacApp.debug.xcconfig"; path = "Target Support Files/Pods-PortForwardingMacApp/Pods-PortForwardingMacApp.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
B0A99AA5350C20B2CFA072E3 /* FBPortForwardingMacApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FBPortForwardingMacApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BFC73B0CB918678127B57C88 /* libPods-PortForwardingMacApp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PortForwardingMacApp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
3B3526B6275718D700D803F9 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3B3526CF275721B500D803F9 /* FBPortForwardingMacApp.framework in Frameworks */,
|
||||
49AE9D8F5494BB1BC5BF2B9E /* libPods-PortForwardingMacApp.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
3B3FD2E927565B8000D731DB = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B3FD2F427565B8000D731DB /* PortForwardingMacApp */,
|
||||
3B3FD2F327565B8000D731DB /* Products */,
|
||||
3BDD19D5275661C600E99F80 /* Frameworks */,
|
||||
FE7B3BC513417A34A3909022 /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B3FD2F327565B8000D731DB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B3526B9275718D700D803F9 /* PortForwardingMacApp.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B3FD2F427565B8000D731DB /* PortForwardingMacApp */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3BB802F8275852CD00A82E32 /* FKPortForwarding */,
|
||||
3B3FD2F527565B8000D731DB /* main.m */,
|
||||
);
|
||||
path = PortForwardingMacApp;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3BB802F8275852CD00A82E32 /* FKPortForwarding */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3BB802FF2758545200A82E32 /* FKPortForwardingClient.h */,
|
||||
3BB803002758545200A82E32 /* FKPortForwardingClient.m */,
|
||||
3BB802FE2758545200A82E32 /* FKPortForwardingCommon.h */,
|
||||
);
|
||||
name = FKPortForwarding;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3BDD19D5275661C600E99F80 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B0A99AA5350C20B2CFA072E3 /* FBPortForwardingMacApp.framework */,
|
||||
BFC73B0CB918678127B57C88 /* libPods-PortForwardingMacApp.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE7B3BC513417A34A3909022 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95395DC97D1F23A7B72F2FB8 /* Pods-PortForwardingMacApp.debug.xcconfig */,
|
||||
339253FD0D50C9D90FA019FF /* Pods-PortForwardingMacApp.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = iOS/Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3B3526B8275718D700D803F9 /* PortForwardingMacApp */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3B3526C6275718D800D803F9 /* Build configuration list for PBXNativeTarget "PortForwardingMacApp" */;
|
||||
buildPhases = (
|
||||
B95B3E164CB7F2CE4005C454 /* [CP] Check Pods Manifest.lock */,
|
||||
3B3526B5275718D700D803F9 /* Sources */,
|
||||
3B3526B6275718D700D803F9 /* Frameworks */,
|
||||
3B3526B7275718D700D803F9 /* Resources */,
|
||||
3B3526D1275721B500D803F9 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = PortForwardingMacApp;
|
||||
productName = PortForwardingMacApp;
|
||||
productReference = 3B3526B9275718D700D803F9 /* PortForwardingMacApp.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
3B3FD2EA27565B8000D731DB /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastUpgradeCheck = 1310;
|
||||
TargetAttributes = {
|
||||
3B3526B8275718D700D803F9 = {
|
||||
CreatedOnToolsVersion = 13.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 3B3FD2ED27565B8000D731DB /* Build configuration list for PBXProject "PortForwardingMacApp" */;
|
||||
compatibilityVersion = "Xcode 13.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 3B3FD2E927565B8000D731DB;
|
||||
productRefGroup = 3B3FD2F327565B8000D731DB /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3B3526B8275718D700D803F9 /* PortForwardingMacApp */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
3B3526B7275718D700D803F9 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
B95B3E164CB7F2CE4005C454 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-PortForwardingMacApp-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
3B3526B5275718D700D803F9 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3B2385EB275850F100789041 /* main.m in Sources */,
|
||||
3BB803012758545200A82E32 /* FKPortForwardingClient.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
3B3526C7275718D800D803F9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 95395DC97D1F23A7B72F2FB8 /* Pods-PortForwardingMacApp.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "";
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"${PODS_ROOT}/Headers/Public\"",
|
||||
"\"${PODS_ROOT}/Headers/Public/CocoaAsyncSocket\"",
|
||||
"\"${PODS_ROOT}/Headers/Public/Flipper-PeerTalk\"",
|
||||
"${SRCROOT}/**",
|
||||
);
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2013-present Facebook. All rights reserved.";
|
||||
INFOPLIST_KEY_NSMainNibFile = MainMenu;
|
||||
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.PortForwardingMacApp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3B3526C8275718D800D803F9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 339253FD0D50C9D90FA019FF /* Pods-PortForwardingMacApp.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "";
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"${PODS_ROOT}/Headers/Public\"",
|
||||
"\"${PODS_ROOT}/Headers/Public/CocoaAsyncSocket\"",
|
||||
"\"${PODS_ROOT}/Headers/Public/Flipper-PeerTalk\"",
|
||||
"${SRCROOT}/**",
|
||||
);
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2013-present Facebook. All rights reserved.";
|
||||
INFOPLIST_KEY_NSMainNibFile = MainMenu;
|
||||
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.PortForwardingMacApp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3B3FD2F727565B8000D731DB /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3B3FD2F827565B8000D731DB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
3B3526C6275718D800D803F9 /* Build configuration list for PBXNativeTarget "PortForwardingMacApp" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3B3526C7275718D800D803F9 /* Debug */,
|
||||
3B3526C8275718D800D803F9 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3B3FD2ED27565B8000D731DB /* Build configuration list for PBXProject "PortForwardingMacApp" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3B3FD2F727565B8000D731DB /* Debug */,
|
||||
3B3FD2F827565B8000D731DB /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 3B3FD2EA27565B8000D731DB /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3B3526B8275718D700D803F9"
|
||||
BuildableName = "PortForwardingMacApp.app"
|
||||
BlueprintName = "PortForwardingMacApp"
|
||||
ReferencedContainer = "container:PortForwardingMacApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3B3526B8275718D700D803F9"
|
||||
BuildableName = "PortForwardingMacApp.app"
|
||||
BlueprintName = "PortForwardingMacApp"
|
||||
ReferencedContainer = "container:PortForwardingMacApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3B3526B8275718D700D803F9"
|
||||
BuildableName = "PortForwardingMacApp.app"
|
||||
BlueprintName = "PortForwardingMacApp"
|
||||
ReferencedContainer = "container:PortForwardingMacApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface FKPortForwardingClient : NSObject
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
- (void)forwardConnectionsToPort:(NSUInteger)port;
|
||||
- (void)connectToMultiplexingChannelOnPort:(NSUInteger)port;
|
||||
- (void)close;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "FKPortForwardingClient.h"
|
||||
|
||||
#import <CocoaAsyncSocket/GCDAsyncSocket.h>
|
||||
#import <peertalk/PTChannel.h>
|
||||
#import <peertalk/PTUSBHub.h>
|
||||
|
||||
#import "FKPortForwardingCommon.h"
|
||||
|
||||
static const NSTimeInterval ReconnectDelay = 1.0;
|
||||
|
||||
@interface FKPortForwardingClient ()<
|
||||
GCDAsyncSocketDelegate,
|
||||
PTChannelDelegate> {
|
||||
NSUInteger _destPort;
|
||||
NSUInteger _channelPort;
|
||||
NSNumber* _connectingToDeviceID;
|
||||
NSNumber* _connectedDeviceID;
|
||||
NSDictionary* _connectedDeviceProperties;
|
||||
BOOL _notConnectedQueueSuspended;
|
||||
PTChannel* _connectedChannel;
|
||||
dispatch_queue_t _notConnectedQueue;
|
||||
dispatch_queue_t _clientSocketsQueue;
|
||||
NSMutableDictionary* _clientSockets;
|
||||
}
|
||||
|
||||
@property(atomic, readonly) NSNumber* connectedDeviceID;
|
||||
@property(atomic, assign) PTChannel* connectedChannel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FKPortForwardingClient
|
||||
|
||||
@synthesize connectedDeviceID = _connectedDeviceID;
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_notConnectedQueue = dispatch_queue_create(
|
||||
"FKPortForwarding.notConnectedQueue", DISPATCH_QUEUE_SERIAL);
|
||||
_clientSocketsQueue = dispatch_queue_create(
|
||||
"FKPortForwarding.clients", DISPATCH_QUEUE_SERIAL);
|
||||
_clientSockets = [NSMutableDictionary dictionary];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)forwardConnectionsToPort:(NSUInteger)port {
|
||||
_destPort = port;
|
||||
}
|
||||
|
||||
- (void)connectToMultiplexingChannelOnPort:(NSUInteger)port {
|
||||
_channelPort = port;
|
||||
[self startListeningForDevices];
|
||||
[self enqueueConnectToLocalIPv4Port];
|
||||
}
|
||||
|
||||
- (void)close {
|
||||
[self.connectedChannel close];
|
||||
}
|
||||
|
||||
- (PTChannel*)connectedChannel {
|
||||
return _connectedChannel;
|
||||
}
|
||||
|
||||
- (void)setConnectedChannel:(PTChannel*)connectedChannel {
|
||||
_connectedChannel = connectedChannel;
|
||||
|
||||
if (!_connectedChannel) {
|
||||
for (GCDAsyncSocket* sock in [_clientSockets objectEnumerator]) {
|
||||
[sock setDelegate:nil];
|
||||
[sock disconnect];
|
||||
}
|
||||
[_clientSockets removeAllObjects];
|
||||
}
|
||||
|
||||
// Toggle the notConnectedQueue_ depending on if we are connected or not
|
||||
if (!_connectedChannel && _notConnectedQueueSuspended) {
|
||||
dispatch_resume(_notConnectedQueue);
|
||||
_notConnectedQueueSuspended = NO;
|
||||
} else if (_connectedChannel && !_notConnectedQueueSuspended) {
|
||||
dispatch_suspend(_notConnectedQueue);
|
||||
_notConnectedQueueSuspended = YES;
|
||||
}
|
||||
|
||||
if (!_connectedChannel && _connectingToDeviceID) {
|
||||
[self enqueueConnectToUSBDevice];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - PTChannelDelegate
|
||||
|
||||
- (void)ioFrameChannel:(PTChannel*)channel
|
||||
didReceiveFrameOfType:(uint32_t)type
|
||||
tag:(uint32_t)tag
|
||||
payload:(PTData*)payload {
|
||||
// NSLog(@"received %@, %u, %u, %@", channel, type, tag, payload);
|
||||
|
||||
if (type == FKPortForwardingFrameTypeOpenPipe) {
|
||||
GCDAsyncSocket* sock =
|
||||
[[GCDAsyncSocket alloc] initWithDelegate:self
|
||||
delegateQueue:_clientSocketsQueue];
|
||||
sock.userData = @(tag);
|
||||
_clientSockets[@(tag)] = sock;
|
||||
|
||||
NSError* connectError;
|
||||
if (![sock connectToHost:@"localhost"
|
||||
onPort:_destPort
|
||||
error:&connectError]) {
|
||||
FBPFLog(
|
||||
@"Failed to connect to local %lu - %@",
|
||||
(unsigned long)_destPort,
|
||||
connectError);
|
||||
}
|
||||
|
||||
FBPFTrace(@"open socket (%d)", tag);
|
||||
}
|
||||
|
||||
if (type == FKPortForwardingFrameTypeWriteToPipe) {
|
||||
GCDAsyncSocket* sock = _clientSockets[@(tag)];
|
||||
[sock writeData:[NSData dataWithBytes:payload.data length:payload.length]
|
||||
withTimeout:-1
|
||||
tag:0];
|
||||
FBPFTrace(@"channel -> socket (%d) %zu bytes", tag, payload.length);
|
||||
}
|
||||
|
||||
if (type == FKPortForwardingFrameTypeClosePipe) {
|
||||
GCDAsyncSocket* sock = _clientSockets[@(tag)];
|
||||
[sock disconnectAfterWriting];
|
||||
FBPFTrace(@"close socket (%d)", tag);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)ioFrameChannel:(PTChannel*)channel didEndWithError:(NSError*)error {
|
||||
if (_connectedDeviceID &&
|
||||
[_connectedDeviceID isEqualToNumber:channel.userInfo]) {
|
||||
[self didDisconnectFromDevice:_connectedDeviceID];
|
||||
}
|
||||
|
||||
if (_connectedChannel == channel) {
|
||||
FBPFTrace(@"Disconnected from %@", channel.userInfo);
|
||||
self.connectedChannel = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - GCDAsyncSocketDelegate
|
||||
|
||||
- (void)socket:(GCDAsyncSocket*)sock
|
||||
didConnectToHost:(NSString*)host
|
||||
port:(uint16_t)port {
|
||||
FBPFTrace(
|
||||
@"socket (%ld) connected to %@",
|
||||
(long)[sock.userData integerValue],
|
||||
host);
|
||||
[sock readDataWithTimeout:-1 tag:0];
|
||||
}
|
||||
|
||||
- (void)socketDidDisconnect:(GCDAsyncSocket*)sock withError:(NSError*)err {
|
||||
UInt32 tag = [sock.userData unsignedIntValue];
|
||||
[_clientSockets removeObjectForKey:@(tag)];
|
||||
FBPFTrace(@"socket (%d) disconnected", (unsigned int)tag);
|
||||
|
||||
[_connectedChannel sendFrameOfType:FKPortForwardingFrameTypeClosePipe
|
||||
tag:tag
|
||||
withPayload:nil
|
||||
callback:nil];
|
||||
}
|
||||
|
||||
- (void)socket:(GCDAsyncSocket*)sock didReadData:(NSData*)data withTag:(long)_ {
|
||||
UInt32 tag = [sock.userData unsignedIntValue];
|
||||
[_connectedChannel sendFrameOfType:FKPortForwardingFrameTypeWriteToPipe
|
||||
tag:tag
|
||||
withPayload:NSDataToGCDData(data)
|
||||
callback:^(NSError* error) {
|
||||
FBPFTrace(
|
||||
@"channel -> socket (%d), %lu bytes",
|
||||
(unsigned int)tag,
|
||||
(unsigned long)data.length);
|
||||
[sock readDataWithTimeout:-1 tag:0];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Wired device connections
|
||||
|
||||
- (void)startListeningForDevices {
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
[nc addObserverForName:PTUSBDeviceDidAttachNotification
|
||||
object:PTUSBHub.sharedHub
|
||||
queue:nil
|
||||
usingBlock:^(NSNotification* note) {
|
||||
NSNumber* deviceID = [note.userInfo objectForKey:@"DeviceID"];
|
||||
// NSLog(@"PTUSBDeviceDidAttachNotification: %@",
|
||||
// note.userInfo);
|
||||
FBPFTrace(@"PTUSBDeviceDidAttachNotification: %@", deviceID);
|
||||
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch_async(strongSelf->_notConnectedQueue, ^{
|
||||
[strongSelf didAttachToDevice:deviceID note:note];
|
||||
});
|
||||
}];
|
||||
|
||||
[nc addObserverForName:PTUSBDeviceDidDetachNotification
|
||||
object:PTUSBHub.sharedHub
|
||||
queue:nil
|
||||
usingBlock:^(NSNotification* note) {
|
||||
NSNumber* deviceID = [note.userInfo objectForKey:@"DeviceID"];
|
||||
// NSLog(@"PTUSBDeviceDidDetachNotification: %@",
|
||||
// note.userInfo);
|
||||
FBPFTrace(@"PTUSBDeviceDidDetachNotification: %@", deviceID);
|
||||
|
||||
[weakSelf didDetachFromDevice:deviceID];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didAttachToDevice:(NSNumber*)deviceID note:(NSNotification*)note {
|
||||
if (!_connectingToDeviceID ||
|
||||
![deviceID isEqualToNumber:_connectingToDeviceID]) {
|
||||
[self disconnectFromCurrentChannel];
|
||||
_connectingToDeviceID = deviceID;
|
||||
_connectedDeviceProperties = [note.userInfo objectForKey:@"Properties"];
|
||||
[self enqueueConnectToUSBDevice];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didDetachFromDevice:(NSNumber*)deviceID {
|
||||
if ([_connectingToDeviceID isEqualToNumber:deviceID]) {
|
||||
_connectedDeviceProperties = nil;
|
||||
_connectingToDeviceID = nil;
|
||||
if (_connectedChannel) {
|
||||
[_connectedChannel close];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didDisconnectFromDevice:(NSNumber*)deviceID {
|
||||
FBPFLog(@"Disconnected from device #%@", deviceID);
|
||||
if ([_connectedDeviceID isEqualToNumber:deviceID]) {
|
||||
[self willChangeValueForKey:@"connectedDeviceID"];
|
||||
_connectedDeviceID = nil;
|
||||
[self didChangeValueForKey:@"connectedDeviceID"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)disconnectFromCurrentChannel {
|
||||
if (_connectedDeviceID && _connectedChannel) {
|
||||
[_connectedChannel close];
|
||||
self.connectedChannel = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enqueueConnectToLocalIPv4Port {
|
||||
dispatch_async(_notConnectedQueue, ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self connectToLocalIPv4Port];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)connectToLocalIPv4Port {
|
||||
PTChannel* channel = [PTChannel channelWithDelegate:self];
|
||||
channel.userInfo =
|
||||
[NSString stringWithFormat:@"127.0.0.1:%lu", (unsigned long)_channelPort];
|
||||
[channel
|
||||
connectToPort:_channelPort
|
||||
IPv4Address:INADDR_LOOPBACK
|
||||
callback:^(NSError* error, PTAddress* address) {
|
||||
if (error) {
|
||||
if (error.domain == NSPOSIXErrorDomain &&
|
||||
(error.code == ECONNREFUSED || error.code == ETIMEDOUT)) {
|
||||
// this is an expected state
|
||||
} else {
|
||||
FBPFTrace(
|
||||
@"Failed to connect to 127.0.0.1:%lu: %@",
|
||||
(unsigned long)_channelPort,
|
||||
error);
|
||||
}
|
||||
} else {
|
||||
[self disconnectFromCurrentChannel];
|
||||
self.connectedChannel = channel;
|
||||
channel.userInfo = address;
|
||||
FBPFLog(@"Connected to %@", address);
|
||||
}
|
||||
[self performSelector:@selector(enqueueConnectToLocalIPv4Port)
|
||||
withObject:nil
|
||||
afterDelay:ReconnectDelay];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)enqueueConnectToUSBDevice {
|
||||
dispatch_async(_notConnectedQueue, ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self connectToUSBDevice];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)connectToUSBDevice {
|
||||
PTChannel* channel = [PTChannel channelWithDelegate:self];
|
||||
channel.userInfo = _connectingToDeviceID;
|
||||
channel.delegate = self;
|
||||
|
||||
[channel connectToPort:(int)_channelPort
|
||||
overUSBHub:PTUSBHub.sharedHub
|
||||
deviceID:_connectingToDeviceID
|
||||
callback:^(NSError* error) {
|
||||
[self didConnectToChannel:channel withError:error];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didConnectToChannel:(PTChannel*)channel withError:(NSError*)error {
|
||||
if (error) {
|
||||
FBPFTrace(@"Failed to connect to device #%@: %@", channel.userInfo, error);
|
||||
if (channel.userInfo == _connectingToDeviceID) {
|
||||
[self performSelector:@selector(enqueueConnectToUSBDevice)
|
||||
withObject:nil
|
||||
afterDelay:ReconnectDelay];
|
||||
}
|
||||
} else {
|
||||
_connectedDeviceID = _connectingToDeviceID;
|
||||
self.connectedChannel = channel;
|
||||
FBPFLog(
|
||||
@"Connected to device #%@\n%@",
|
||||
_connectingToDeviceID,
|
||||
_connectedDeviceProperties);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define FBPFTrace(...) /*NSLog(__VA_ARGS__)*/
|
||||
#define FBPFLog(...) NSLog(__VA_ARGS__)
|
||||
|
||||
enum {
|
||||
FKPortForwardingFrameTypeOpenPipe = 201,
|
||||
FKPortForwardingFrameTypeWriteToPipe = 202,
|
||||
FKPortForwardingFrameTypeClosePipe = 203,
|
||||
};
|
||||
|
||||
static dispatch_data_t NSDataToGCDData(NSData* data) {
|
||||
__block NSData* retainedData = data;
|
||||
return dispatch_data_create(data.bytes, data.length, nil, ^{
|
||||
retainedData = nil;
|
||||
});
|
||||
(void)retainedData;
|
||||
}
|
||||
40
desktop/PortForwardingMacApp/PortForwardingMacApp/main.m
Normal file
40
desktop/PortForwardingMacApp/PortForwardingMacApp/main.m
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user