Make Starscream a dependency
This commit is contained in:
		
							parent
							
								
									781a9e32ca
								
							
						
					
					
						commit
						b3ea49f7fd
					
				
							
								
								
									
										4
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
[submodule "Source/Starscream"]
 | 
			
		||||
	path = Source/Starscream
 | 
			
		||||
	url = https://github.com/nuclearace/Starscream
 | 
			
		||||
	branch = socket.io
 | 
			
		||||
@ -3,7 +3,6 @@ import PackageDescription
 | 
			
		||||
let package = Package(
 | 
			
		||||
    name: "SocketIO",
 | 
			
		||||
    dependencies: [
 | 
			
		||||
        .Package(url: "https://github.com/daltoniam/zlib-spm.git", majorVersion: 1),
 | 
			
		||||
        .Package(url: "https://github.com/IBM-Swift/CommonCrypto.git", majorVersion: 0),
 | 
			
		||||
        .Package(url: "https://github.com/nuclearace/Starscream", majorVersion: 8),
 | 
			
		||||
    ]
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
Pod::Spec.new do |s|
 | 
			
		||||
  s.name         = "Socket.IO-Client-Swift"
 | 
			
		||||
  s.module_name  = "SocketIO"
 | 
			
		||||
  s.version      = "10.2.0"
 | 
			
		||||
  s.version      = "11.0.0"
 | 
			
		||||
  s.summary      = "Socket.IO-client for iOS and OS X"
 | 
			
		||||
  s.description  = <<-DESC
 | 
			
		||||
                   Socket.IO-client for iOS and OS X.
 | 
			
		||||
@ -14,14 +14,12 @@ Pod::Spec.new do |s|
 | 
			
		||||
  s.ios.deployment_target = '8.0'
 | 
			
		||||
  s.osx.deployment_target = '10.10'
 | 
			
		||||
  s.tvos.deployment_target = '9.0'
 | 
			
		||||
  s.source       = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v10.2.0' }
 | 
			
		||||
  s.source_files  = "Source/**/*.swift"
 | 
			
		||||
  s.libraries = 'z'
 | 
			
		||||
  s.preserve_paths = 'zlib/*'
 | 
			
		||||
  s.requires_arc = true
 | 
			
		||||
  s.pod_target_xcconfig = {
 | 
			
		||||
    'SWIFT_VERSION' => '3.1',
 | 
			
		||||
    'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/Socket.IO-Client-Swift/zlib'
 | 
			
		||||
  s.source = {
 | 
			
		||||
    :git => "https://github.com/socketio/socket.io-client-swift.git",
 | 
			
		||||
    :tag => 'v11.0.0',
 | 
			
		||||
    :submodules => true
 | 
			
		||||
  }
 | 
			
		||||
  # s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
 | 
			
		||||
  s.source_files  = "Source/*.swift"
 | 
			
		||||
  s.dependency "StarscreamSocketIO", "~> 8.0.0"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -89,26 +89,14 @@
 | 
			
		||||
		747BC59A1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */; };
 | 
			
		||||
		747BC59B1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */; };
 | 
			
		||||
		747BC59F1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC59E1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift */; };
 | 
			
		||||
		749642B51D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; };
 | 
			
		||||
		749642B61D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; };
 | 
			
		||||
		749642B71D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; };
 | 
			
		||||
		749642B81D3FCE5500DD32D1 /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B41D3FCE5500DD32D1 /* WebSocket.swift */; };
 | 
			
		||||
		749642B91D3FCE5500DD32D1 /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B41D3FCE5500DD32D1 /* WebSocket.swift */; };
 | 
			
		||||
		749642BA1D3FCE5500DD32D1 /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B41D3FCE5500DD32D1 /* WebSocket.swift */; };
 | 
			
		||||
		74ABF7771C3991C10078C657 /* SocketIOClientSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74ABF7761C3991C10078C657 /* SocketIOClientSpec.swift */; };
 | 
			
		||||
		74BC45AB1D0C6675008CC431 /* SocketClientManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74BC45AA1D0C6675008CC431 /* SocketClientManager.swift */; };
 | 
			
		||||
		74BC45AC1D0C6675008CC431 /* SocketClientManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74BC45AA1D0C6675008CC431 /* SocketClientManager.swift */; };
 | 
			
		||||
		74BC45AD1D0C6675008CC431 /* SocketClientManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74BC45AA1D0C6675008CC431 /* SocketClientManager.swift */; };
 | 
			
		||||
		74DA216E1F0943EE009C19EE /* include.h in Headers */ = {isa = PBXBuildFile; fileRef = 74DA216C1F09438D009C19EE /* include.h */; };
 | 
			
		||||
		74DA216F1F0943F4009C19EE /* include.h in Headers */ = {isa = PBXBuildFile; fileRef = 74DA216C1F09438D009C19EE /* include.h */; };
 | 
			
		||||
		74DA21701F0943F8009C19EE /* include.h in Headers */ = {isa = PBXBuildFile; fileRef = 74DA216C1F09438D009C19EE /* include.h */; };
 | 
			
		||||
		74DA21721F094408009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21711F094408009C19EE /* libz.tbd */; };
 | 
			
		||||
		74DA21741F09440F009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
 | 
			
		||||
		74DA21761F094417009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21751F094417009C19EE /* libz.tbd */; };
 | 
			
		||||
		74DA217C1F09457B009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
 | 
			
		||||
		74DA21811F094887009C19EE /* Compression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74DA21801F094887009C19EE /* Compression.swift */; };
 | 
			
		||||
		74DA21821F094887009C19EE /* Compression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74DA21801F094887009C19EE /* Compression.swift */; };
 | 
			
		||||
		74DA21831F094887009C19EE /* Compression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74DA21801F094887009C19EE /* Compression.swift */; };
 | 
			
		||||
		74F124F01BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */; };
 | 
			
		||||
		74F124F11BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */; };
 | 
			
		||||
		CEBA569A1CDA0B8200BA0389 /* SocketExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEBA56991CDA0B8200BA0389 /* SocketExtensions.swift */; };
 | 
			
		||||
@ -138,6 +126,69 @@
 | 
			
		||||
			remoteGlobalIDString = 576349FA1BD9B46A00E19CD7;
 | 
			
		||||
			remoteInfo = "SocketIO-tvOS";
 | 
			
		||||
		};
 | 
			
		||||
		745225EC1F1BA89E007EA874 /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 1;
 | 
			
		||||
			remoteGlobalIDString = 6B3E79E519D48B7F006071F7;
 | 
			
		||||
			remoteInfo = "Starscream iOS";
 | 
			
		||||
		};
 | 
			
		||||
		74638B631F111CD000F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 2;
 | 
			
		||||
			remoteGlobalIDString = 6B3E79E619D48B7F006071F7;
 | 
			
		||||
			remoteInfo = "Starscream iOS";
 | 
			
		||||
		};
 | 
			
		||||
		74638B651F111CD000F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 2;
 | 
			
		||||
			remoteGlobalIDString = 6B3E79F119D48B7F006071F7;
 | 
			
		||||
			remoteInfo = "Starscream iOSTests";
 | 
			
		||||
		};
 | 
			
		||||
		74638B671F111CD000F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 2;
 | 
			
		||||
			remoteGlobalIDString = D9C3E35F19E48FF1009FC285;
 | 
			
		||||
			remoteInfo = "Starscream OSX";
 | 
			
		||||
		};
 | 
			
		||||
		74638B691F111CD000F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 2;
 | 
			
		||||
			remoteGlobalIDString = D9C3E36919E48FF1009FC285;
 | 
			
		||||
			remoteInfo = "Starscream OSXTests";
 | 
			
		||||
		};
 | 
			
		||||
		74638B6B1F111CD000F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 2;
 | 
			
		||||
			remoteGlobalIDString = 091277971BD673A70003036D;
 | 
			
		||||
			remoteInfo = "Starscream tvOS";
 | 
			
		||||
		};
 | 
			
		||||
		74638B6D1F111CD000F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 2;
 | 
			
		||||
			remoteGlobalIDString = 091277A01BD673A70003036D;
 | 
			
		||||
			remoteInfo = "Starscream tvOSTests";
 | 
			
		||||
		};
 | 
			
		||||
		74638B711F111CF100F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 1;
 | 
			
		||||
			remoteGlobalIDString = D9C3E35E19E48FF1009FC285;
 | 
			
		||||
			remoteInfo = "Starscream OSX";
 | 
			
		||||
		};
 | 
			
		||||
		74638B731F111CF600F5E1FF /* PBXContainerItemProxy */ = {
 | 
			
		||||
			isa = PBXContainerItemProxy;
 | 
			
		||||
			containerPortal = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
			proxyType = 1;
 | 
			
		||||
			remoteGlobalIDString = 091277961BD673A70003036D;
 | 
			
		||||
			remoteInfo = "Starscream tvOS";
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXContainerItemProxy section */
 | 
			
		||||
 | 
			
		||||
/* Begin PBXFileReference section */
 | 
			
		||||
@ -177,21 +228,17 @@
 | 
			
		||||
		742D150B1CA5794B00BD987D /* SocketObjectiveCTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocketObjectiveCTest.m; sourceTree = "<group>"; };
 | 
			
		||||
		74321DC91C2D939A00CF6F43 /* SocketAckManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketAckManagerTest.swift; sourceTree = "<group>"; };
 | 
			
		||||
		74321DCA1C2D939A00CF6F43 /* SocketParserTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketParserTest.swift; sourceTree = "<group>"; };
 | 
			
		||||
		74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Starscream.xcodeproj; path = Source/Starscream/Starscream.xcodeproj; sourceTree = "<group>"; };
 | 
			
		||||
		7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketNamespacePacketTest.swift; sourceTree = "<group>"; };
 | 
			
		||||
		7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketSideEffectTest.swift; sourceTree = "<group>"; };
 | 
			
		||||
		747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClientConfiguration.swift; path = Source/SocketIOClientConfiguration.swift; sourceTree = "<group>"; };
 | 
			
		||||
		747BC59E1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketIOClientConfigurationTest.swift; sourceTree = "<group>"; };
 | 
			
		||||
		749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SSLSecurity.swift; path = Source/SSLSecurity.swift; sourceTree = "<group>"; };
 | 
			
		||||
		749642B41D3FCE5500DD32D1 /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebSocket.swift; path = Source/WebSocket.swift; sourceTree = "<group>"; };
 | 
			
		||||
		74ABF7761C3991C10078C657 /* SocketIOClientSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClientSpec.swift; path = Source/SocketIOClientSpec.swift; sourceTree = "<group>"; };
 | 
			
		||||
		74BC45AA1D0C6675008CC431 /* SocketClientManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketClientManager.swift; path = Source/SocketClientManager.swift; sourceTree = "<group>"; };
 | 
			
		||||
		74DA216C1F09438D009C19EE /* include.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = include.h; path = zlib/include.h; sourceTree = "<group>"; };
 | 
			
		||||
		74DA21711F094408009C19EE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };
 | 
			
		||||
		74DA21731F09440F009C19EE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
 | 
			
		||||
		74DA21751F094417009C19EE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.2.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };
 | 
			
		||||
		74DA21771F09444E009C19EE /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; name = module.modulemap; path = zlib/module.modulemap; sourceTree = "<group>"; };
 | 
			
		||||
		74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcommonCrypto.tbd; path = usr/lib/system/libcommonCrypto.tbd; sourceTree = SDKROOT; };
 | 
			
		||||
		74DA21801F094887009C19EE /* Compression.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Compression.swift; path = Source/Compression.swift; sourceTree = "<group>"; };
 | 
			
		||||
		74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketBasicPacketTest.swift; sourceTree = "<group>"; };
 | 
			
		||||
		CEBA56991CDA0B8200BA0389 /* SocketExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketExtensions.swift; path = Source/SocketExtensions.swift; sourceTree = "<group>"; };
 | 
			
		||||
/* End PBXFileReference section */
 | 
			
		||||
@ -255,7 +302,7 @@
 | 
			
		||||
		572EF20D1B51F12F00EEBB58 = {
 | 
			
		||||
			isa = PBXGroup;
 | 
			
		||||
			children = (
 | 
			
		||||
				74DA216B1F094371009C19EE /* zlib */,
 | 
			
		||||
				74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */,
 | 
			
		||||
				6CA08A9B1D615C190061FD2A /* Frameworks */,
 | 
			
		||||
				572EF21A1B51F16C00EEBB58 /* Products */,
 | 
			
		||||
				572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */,
 | 
			
		||||
@ -361,7 +408,6 @@
 | 
			
		||||
				74171E5E1C10CD240062D398 /* SocketParsable.swift */,
 | 
			
		||||
				74171E5F1C10CD240062D398 /* SocketStringReader.swift */,
 | 
			
		||||
				74171E601C10CD240062D398 /* SocketTypes.swift */,
 | 
			
		||||
				74B4AD1B1D09A5C30062A523 /* Websocket */,
 | 
			
		||||
			);
 | 
			
		||||
			name = Source;
 | 
			
		||||
			sourceTree = "<group>";
 | 
			
		||||
@ -404,23 +450,17 @@
 | 
			
		||||
			name = tvOS;
 | 
			
		||||
			sourceTree = "<group>";
 | 
			
		||||
		};
 | 
			
		||||
		74B4AD1B1D09A5C30062A523 /* Websocket */ = {
 | 
			
		||||
		74638B5B1F111CD000F5E1FF /* Products */ = {
 | 
			
		||||
			isa = PBXGroup;
 | 
			
		||||
			children = (
 | 
			
		||||
				74DA21801F094887009C19EE /* Compression.swift */,
 | 
			
		||||
				749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */,
 | 
			
		||||
				749642B41D3FCE5500DD32D1 /* WebSocket.swift */,
 | 
			
		||||
				74638B641F111CD000F5E1FF /* StarscreamSocketIO.framework */,
 | 
			
		||||
				74638B661F111CD000F5E1FF /* Starscream iOSTests.xctest */,
 | 
			
		||||
				74638B681F111CD000F5E1FF /* StarscreamSocketIO.framework */,
 | 
			
		||||
				74638B6A1F111CD000F5E1FF /* Starscream OSXTests.xctest */,
 | 
			
		||||
				74638B6C1F111CD000F5E1FF /* StarscreamSocketIO.framework */,
 | 
			
		||||
				74638B6E1F111CD000F5E1FF /* Starscream tvOSTests.xctest */,
 | 
			
		||||
			);
 | 
			
		||||
			name = Websocket;
 | 
			
		||||
			sourceTree = "<group>";
 | 
			
		||||
		};
 | 
			
		||||
		74DA216B1F094371009C19EE /* zlib */ = {
 | 
			
		||||
			isa = PBXGroup;
 | 
			
		||||
			children = (
 | 
			
		||||
				74DA216C1F09438D009C19EE /* include.h */,
 | 
			
		||||
				74DA21771F09444E009C19EE /* module.modulemap */,
 | 
			
		||||
			);
 | 
			
		||||
			name = zlib;
 | 
			
		||||
			name = Products;
 | 
			
		||||
			sourceTree = "<group>";
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXGroup section */
 | 
			
		||||
@ -431,7 +471,6 @@
 | 
			
		||||
			buildActionMask = 2147483647;
 | 
			
		||||
			files = (
 | 
			
		||||
				572EF21F1B51F16C00EEBB58 /* SocketIO.h in Headers */,
 | 
			
		||||
				74DA21701F0943F8009C19EE /* include.h in Headers */,
 | 
			
		||||
			);
 | 
			
		||||
			runOnlyForDeploymentPostprocessing = 0;
 | 
			
		||||
		};
 | 
			
		||||
@ -440,7 +479,6 @@
 | 
			
		||||
			buildActionMask = 2147483647;
 | 
			
		||||
			files = (
 | 
			
		||||
				572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */,
 | 
			
		||||
				74DA216F1F0943F4009C19EE /* include.h in Headers */,
 | 
			
		||||
			);
 | 
			
		||||
			runOnlyForDeploymentPostprocessing = 0;
 | 
			
		||||
		};
 | 
			
		||||
@ -449,7 +487,6 @@
 | 
			
		||||
			buildActionMask = 2147483647;
 | 
			
		||||
			files = (
 | 
			
		||||
				57634A111BD9B46A00E19CD7 /* SocketIO.h in Headers */,
 | 
			
		||||
				74DA216E1F0943EE009C19EE /* include.h in Headers */,
 | 
			
		||||
			);
 | 
			
		||||
			runOnlyForDeploymentPostprocessing = 0;
 | 
			
		||||
		};
 | 
			
		||||
@ -468,6 +505,7 @@
 | 
			
		||||
			buildRules = (
 | 
			
		||||
			);
 | 
			
		||||
			dependencies = (
 | 
			
		||||
				745225ED1F1BA89E007EA874 /* PBXTargetDependency */,
 | 
			
		||||
			);
 | 
			
		||||
			name = "SocketIO-iOS";
 | 
			
		||||
			productName = "SocketIO-iOS";
 | 
			
		||||
@ -504,6 +542,7 @@
 | 
			
		||||
			buildRules = (
 | 
			
		||||
			);
 | 
			
		||||
			dependencies = (
 | 
			
		||||
				74638B721F111CF100F5E1FF /* PBXTargetDependency */,
 | 
			
		||||
			);
 | 
			
		||||
			name = "SocketIO-Mac";
 | 
			
		||||
			productName = "SocketIO-Mac";
 | 
			
		||||
@ -540,6 +579,7 @@
 | 
			
		||||
			buildRules = (
 | 
			
		||||
			);
 | 
			
		||||
			dependencies = (
 | 
			
		||||
				74638B741F111CF600F5E1FF /* PBXTargetDependency */,
 | 
			
		||||
			);
 | 
			
		||||
			name = "SocketIO-tvOS";
 | 
			
		||||
			productName = "SocketIO-iOS";
 | 
			
		||||
@ -600,6 +640,12 @@
 | 
			
		||||
			mainGroup = 572EF20D1B51F12F00EEBB58;
 | 
			
		||||
			productRefGroup = 572EF21A1B51F16C00EEBB58 /* Products */;
 | 
			
		||||
			projectDirPath = "";
 | 
			
		||||
			projectReferences = (
 | 
			
		||||
				{
 | 
			
		||||
					ProductGroup = 74638B5B1F111CD000F5E1FF /* Products */;
 | 
			
		||||
					ProjectRef = 74638B5A1F111CD000F5E1FF /* Starscream.xcodeproj */;
 | 
			
		||||
				},
 | 
			
		||||
			);
 | 
			
		||||
			projectRoot = "";
 | 
			
		||||
			targets = (
 | 
			
		||||
				572EF2181B51F16C00EEBB58 /* SocketIO-iOS */,
 | 
			
		||||
@ -612,6 +658,51 @@
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXProject section */
 | 
			
		||||
 | 
			
		||||
/* Begin PBXReferenceProxy section */
 | 
			
		||||
		74638B641F111CD000F5E1FF /* StarscreamSocketIO.framework */ = {
 | 
			
		||||
			isa = PBXReferenceProxy;
 | 
			
		||||
			fileType = wrapper.framework;
 | 
			
		||||
			path = StarscreamSocketIO.framework;
 | 
			
		||||
			remoteRef = 74638B631F111CD000F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
			sourceTree = BUILT_PRODUCTS_DIR;
 | 
			
		||||
		};
 | 
			
		||||
		74638B661F111CD000F5E1FF /* Starscream iOSTests.xctest */ = {
 | 
			
		||||
			isa = PBXReferenceProxy;
 | 
			
		||||
			fileType = wrapper.cfbundle;
 | 
			
		||||
			path = "Starscream iOSTests.xctest";
 | 
			
		||||
			remoteRef = 74638B651F111CD000F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
			sourceTree = BUILT_PRODUCTS_DIR;
 | 
			
		||||
		};
 | 
			
		||||
		74638B681F111CD000F5E1FF /* StarscreamSocketIO.framework */ = {
 | 
			
		||||
			isa = PBXReferenceProxy;
 | 
			
		||||
			fileType = wrapper.framework;
 | 
			
		||||
			path = StarscreamSocketIO.framework;
 | 
			
		||||
			remoteRef = 74638B671F111CD000F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
			sourceTree = BUILT_PRODUCTS_DIR;
 | 
			
		||||
		};
 | 
			
		||||
		74638B6A1F111CD000F5E1FF /* Starscream OSXTests.xctest */ = {
 | 
			
		||||
			isa = PBXReferenceProxy;
 | 
			
		||||
			fileType = wrapper.cfbundle;
 | 
			
		||||
			path = "Starscream OSXTests.xctest";
 | 
			
		||||
			remoteRef = 74638B691F111CD000F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
			sourceTree = BUILT_PRODUCTS_DIR;
 | 
			
		||||
		};
 | 
			
		||||
		74638B6C1F111CD000F5E1FF /* StarscreamSocketIO.framework */ = {
 | 
			
		||||
			isa = PBXReferenceProxy;
 | 
			
		||||
			fileType = wrapper.framework;
 | 
			
		||||
			path = StarscreamSocketIO.framework;
 | 
			
		||||
			remoteRef = 74638B6B1F111CD000F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
			sourceTree = BUILT_PRODUCTS_DIR;
 | 
			
		||||
		};
 | 
			
		||||
		74638B6E1F111CD000F5E1FF /* Starscream tvOSTests.xctest */ = {
 | 
			
		||||
			isa = PBXReferenceProxy;
 | 
			
		||||
			fileType = wrapper.cfbundle;
 | 
			
		||||
			path = "Starscream tvOSTests.xctest";
 | 
			
		||||
			remoteRef = 74638B6D1F111CD000F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
			sourceTree = BUILT_PRODUCTS_DIR;
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXReferenceProxy section */
 | 
			
		||||
 | 
			
		||||
/* Begin PBXResourcesBuildPhase section */
 | 
			
		||||
		572EF2171B51F16C00EEBB58 /* Resources */ = {
 | 
			
		||||
			isa = PBXResourcesBuildPhase;
 | 
			
		||||
@ -675,14 +766,11 @@
 | 
			
		||||
				74171EC31C10CD240062D398 /* SocketTypes.swift in Sources */,
 | 
			
		||||
				74171EAB1C10CD240062D398 /* SocketLogger.swift in Sources */,
 | 
			
		||||
				74171E991C10CD240062D398 /* SocketIOClient.swift in Sources */,
 | 
			
		||||
				749642B81D3FCE5500DD32D1 /* WebSocket.swift in Sources */,
 | 
			
		||||
				74171E8D1C10CD240062D398 /* SocketEventHandler.swift in Sources */,
 | 
			
		||||
				74171E7B1C10CD240062D398 /* SocketEngineClient.swift in Sources */,
 | 
			
		||||
				74171EB11C10CD240062D398 /* SocketPacket.swift in Sources */,
 | 
			
		||||
				749642B51D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */,
 | 
			
		||||
				74171EB71C10CD240062D398 /* SocketParsable.swift in Sources */,
 | 
			
		||||
				74171E811C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
 | 
			
		||||
				74DA21811F094887009C19EE /* Compression.swift in Sources */,
 | 
			
		||||
				74171E6F1C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
 | 
			
		||||
				747BC5991D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */,
 | 
			
		||||
				74171E9F1C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
 | 
			
		||||
@ -718,14 +806,11 @@
 | 
			
		||||
				74171EC51C10CD240062D398 /* SocketTypes.swift in Sources */,
 | 
			
		||||
				74171EAD1C10CD240062D398 /* SocketLogger.swift in Sources */,
 | 
			
		||||
				74171E9B1C10CD240062D398 /* SocketIOClient.swift in Sources */,
 | 
			
		||||
				749642B91D3FCE5500DD32D1 /* WebSocket.swift in Sources */,
 | 
			
		||||
				74171E8F1C10CD240062D398 /* SocketEventHandler.swift in Sources */,
 | 
			
		||||
				74171E7D1C10CD240062D398 /* SocketEngineClient.swift in Sources */,
 | 
			
		||||
				74171EB31C10CD240062D398 /* SocketPacket.swift in Sources */,
 | 
			
		||||
				749642B61D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */,
 | 
			
		||||
				74171EB91C10CD240062D398 /* SocketParsable.swift in Sources */,
 | 
			
		||||
				74171E831C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
 | 
			
		||||
				74DA21821F094887009C19EE /* Compression.swift in Sources */,
 | 
			
		||||
				74171E711C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
 | 
			
		||||
				747BC59A1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */,
 | 
			
		||||
				74171EA11C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
 | 
			
		||||
@ -765,14 +850,11 @@
 | 
			
		||||
				74171EC71C10CD240062D398 /* SocketTypes.swift in Sources */,
 | 
			
		||||
				74171EAF1C10CD240062D398 /* SocketLogger.swift in Sources */,
 | 
			
		||||
				74171E9D1C10CD240062D398 /* SocketIOClient.swift in Sources */,
 | 
			
		||||
				749642BA1D3FCE5500DD32D1 /* WebSocket.swift in Sources */,
 | 
			
		||||
				74171E911C10CD240062D398 /* SocketEventHandler.swift in Sources */,
 | 
			
		||||
				74171E7F1C10CD240062D398 /* SocketEngineClient.swift in Sources */,
 | 
			
		||||
				74171EB51C10CD240062D398 /* SocketPacket.swift in Sources */,
 | 
			
		||||
				749642B71D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */,
 | 
			
		||||
				74171EBB1C10CD240062D398 /* SocketParsable.swift in Sources */,
 | 
			
		||||
				74171E851C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
 | 
			
		||||
				74DA21831F094887009C19EE /* Compression.swift in Sources */,
 | 
			
		||||
				74171E731C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
 | 
			
		||||
				747BC59B1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */,
 | 
			
		||||
				74171EA31C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
 | 
			
		||||
@ -809,6 +891,21 @@
 | 
			
		||||
			target = 576349FA1BD9B46A00E19CD7 /* SocketIO-tvOS */;
 | 
			
		||||
			targetProxy = 57634A3D1BD9B4B800E19CD7 /* PBXContainerItemProxy */;
 | 
			
		||||
		};
 | 
			
		||||
		745225ED1F1BA89E007EA874 /* PBXTargetDependency */ = {
 | 
			
		||||
			isa = PBXTargetDependency;
 | 
			
		||||
			name = "Starscream iOS";
 | 
			
		||||
			targetProxy = 745225EC1F1BA89E007EA874 /* PBXContainerItemProxy */;
 | 
			
		||||
		};
 | 
			
		||||
		74638B721F111CF100F5E1FF /* PBXTargetDependency */ = {
 | 
			
		||||
			isa = PBXTargetDependency;
 | 
			
		||||
			name = "Starscream OSX";
 | 
			
		||||
			targetProxy = 74638B711F111CF100F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
		};
 | 
			
		||||
		74638B741F111CF600F5E1FF /* PBXTargetDependency */ = {
 | 
			
		||||
			isa = PBXTargetDependency;
 | 
			
		||||
			name = "Starscream tvOS";
 | 
			
		||||
			targetProxy = 74638B731F111CF600F5E1FF /* PBXContainerItemProxy */;
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXTargetDependency section */
 | 
			
		||||
 | 
			
		||||
/* Begin XCBuildConfiguration section */
 | 
			
		||||
@ -1141,7 +1238,7 @@
 | 
			
		||||
				PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
 | 
			
		||||
				SDKROOT = macosx;
 | 
			
		||||
				SKIP_INSTALL = YES;
 | 
			
		||||
				SWIFT_INCLUDE_PATHS = $SRCROOT/zlib;
 | 
			
		||||
				SWIFT_INCLUDE_PATHS = "";
 | 
			
		||||
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 | 
			
		||||
				SWIFT_VERSION = 3.0;
 | 
			
		||||
				VERSIONING_SYSTEM = "apple-generic";
 | 
			
		||||
@ -1199,7 +1296,7 @@
 | 
			
		||||
				PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
 | 
			
		||||
				SDKROOT = macosx;
 | 
			
		||||
				SKIP_INSTALL = YES;
 | 
			
		||||
				SWIFT_INCLUDE_PATHS = $SRCROOT/zlib;
 | 
			
		||||
				SWIFT_INCLUDE_PATHS = "";
 | 
			
		||||
				SWIFT_VERSION = 3.0;
 | 
			
		||||
				VERSIONING_SYSTEM = "apple-generic";
 | 
			
		||||
				VERSION_INFO_PREFIX = "";
 | 
			
		||||
 | 
			
		||||
@ -1,174 +0,0 @@
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//
 | 
			
		||||
//  Compression.swift
 | 
			
		||||
//
 | 
			
		||||
//  Created by Joseph Ross on 7/16/14.
 | 
			
		||||
//  Copyright © 2017 Joseph Ross.
 | 
			
		||||
//
 | 
			
		||||
//  Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
//  you may not use this file except in compliance with the License.
 | 
			
		||||
//  You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
//  http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
//  Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
//  distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//  See the License for the specific language governing permissions and
 | 
			
		||||
//  limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//
 | 
			
		||||
//  Compression implementation is implemented in conformance with RFC 7692 Compression Extensions
 | 
			
		||||
//  for WebSocket: https://tools.ietf.org/html/rfc7692
 | 
			
		||||
//
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
import Foundation
 | 
			
		||||
import CZLib
 | 
			
		||||
 | 
			
		||||
class Decompressor {
 | 
			
		||||
    private var strm = z_stream()
 | 
			
		||||
    private var buffer = [UInt8](repeating: 0, count: 0x2000)
 | 
			
		||||
    private var inflateInitialized = false
 | 
			
		||||
    private let windowBits:Int
 | 
			
		||||
 | 
			
		||||
    init?(windowBits:Int) {
 | 
			
		||||
        self.windowBits = windowBits
 | 
			
		||||
        guard initInflate() else { return nil }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private func initInflate() -> Bool {
 | 
			
		||||
        if Z_OK == inflateInit2_(&strm, -CInt(windowBits),
 | 
			
		||||
                                 ZLIB_VERSION, CInt(MemoryLayout<z_stream>.size))
 | 
			
		||||
        {
 | 
			
		||||
            inflateInitialized = true
 | 
			
		||||
            return true
 | 
			
		||||
        }
 | 
			
		||||
        return false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func reset() throws {
 | 
			
		||||
        teardownInflate()
 | 
			
		||||
        guard initInflate() else { throw NSError() }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func decompress(_ data: Data, finish: Bool) throws -> Data {
 | 
			
		||||
        return try data.withUnsafeBytes { (bytes:UnsafePointer<UInt8>) -> Data in
 | 
			
		||||
            return try decompress(bytes: bytes, count: data.count, finish: finish)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func decompress(bytes: UnsafePointer<UInt8>, count: Int, finish: Bool) throws -> Data {
 | 
			
		||||
        var decompressed = Data()
 | 
			
		||||
        try decompress(bytes: bytes, count: count, out: &decompressed)
 | 
			
		||||
 | 
			
		||||
        if finish {
 | 
			
		||||
            let tail:[UInt8] = [0x00, 0x00, 0xFF, 0xFF]
 | 
			
		||||
            try decompress(bytes: tail, count: tail.count, out: &decompressed)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return decompressed
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private func decompress(bytes: UnsafePointer<UInt8>, count: Int, out:inout Data) throws {
 | 
			
		||||
        var res:CInt = 0
 | 
			
		||||
        strm.next_in = UnsafeMutablePointer<UInt8>(mutating: bytes)
 | 
			
		||||
        strm.avail_in = CUnsignedInt(count)
 | 
			
		||||
 | 
			
		||||
        repeat {
 | 
			
		||||
            strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
 | 
			
		||||
            strm.avail_out = CUnsignedInt(buffer.count)
 | 
			
		||||
 | 
			
		||||
            res = inflate(&strm, 0)
 | 
			
		||||
 | 
			
		||||
            let byteCount = buffer.count - Int(strm.avail_out)
 | 
			
		||||
            out.append(buffer, count: byteCount)
 | 
			
		||||
        } while res == Z_OK && strm.avail_out == 0
 | 
			
		||||
 | 
			
		||||
        guard (res == Z_OK && strm.avail_out > 0)
 | 
			
		||||
            || (res == Z_BUF_ERROR && Int(strm.avail_out) == buffer.count)
 | 
			
		||||
            else {
 | 
			
		||||
                throw NSError(domain: WebSocket.ErrorDomain, code: Int(WebSocket.InternalErrorCode.compressionError.rawValue), userInfo: nil)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private func teardownInflate() {
 | 
			
		||||
        if inflateInitialized, Z_OK == inflateEnd(&strm) {
 | 
			
		||||
            inflateInitialized = false
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    deinit {
 | 
			
		||||
        teardownInflate()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Compressor {
 | 
			
		||||
    private var strm = z_stream()
 | 
			
		||||
    private var buffer = [UInt8](repeating: 0, count: 0x2000)
 | 
			
		||||
    private var deflateInitialized = false
 | 
			
		||||
    private let windowBits:Int
 | 
			
		||||
 | 
			
		||||
    init?(windowBits: Int) {
 | 
			
		||||
        self.windowBits = windowBits
 | 
			
		||||
        guard initDeflate() else { return nil }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private func initDeflate() -> Bool {
 | 
			
		||||
        if Z_OK == deflateInit2_(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
 | 
			
		||||
                                 -CInt(windowBits), 8, Z_DEFAULT_STRATEGY,
 | 
			
		||||
                                 ZLIB_VERSION, CInt(MemoryLayout<z_stream>.size))
 | 
			
		||||
        {
 | 
			
		||||
            deflateInitialized = true
 | 
			
		||||
            return true
 | 
			
		||||
        }
 | 
			
		||||
        return false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func reset() throws {
 | 
			
		||||
        teardownDeflate()
 | 
			
		||||
        guard initDeflate() else { throw NSError() }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func compress(_ data: Data) throws -> Data {
 | 
			
		||||
        var compressed = Data()
 | 
			
		||||
        var res:CInt = 0
 | 
			
		||||
        data.withUnsafeBytes { (ptr:UnsafePointer<UInt8>) -> Void in
 | 
			
		||||
            strm.next_in = UnsafeMutablePointer<UInt8>(mutating: ptr)
 | 
			
		||||
            strm.avail_in = CUnsignedInt(data.count)
 | 
			
		||||
 | 
			
		||||
            repeat {
 | 
			
		||||
                strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
 | 
			
		||||
                strm.avail_out = CUnsignedInt(buffer.count)
 | 
			
		||||
 | 
			
		||||
                res = deflate(&strm, Z_SYNC_FLUSH)
 | 
			
		||||
 | 
			
		||||
                let byteCount = buffer.count - Int(strm.avail_out)
 | 
			
		||||
                compressed.append(buffer, count: byteCount)
 | 
			
		||||
            }
 | 
			
		||||
                while res == Z_OK && strm.avail_out == 0
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        guard res == Z_OK && strm.avail_out > 0
 | 
			
		||||
            || (res == Z_BUF_ERROR && Int(strm.avail_out) == buffer.count)
 | 
			
		||||
            else {
 | 
			
		||||
                throw NSError(domain: WebSocket.ErrorDomain, code: Int(WebSocket.InternalErrorCode.compressionError.rawValue), userInfo: nil)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        compressed.removeLast(4)
 | 
			
		||||
        return compressed
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private func teardownDeflate() {
 | 
			
		||||
        if deflateInitialized, Z_OK == deflateEnd(&strm) {
 | 
			
		||||
            deflateInitialized = false
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    deinit {
 | 
			
		||||
        teardownDeflate()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,259 +0,0 @@
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//
 | 
			
		||||
//  SSLSecurity.swift
 | 
			
		||||
//  Starscream
 | 
			
		||||
//
 | 
			
		||||
//  Created by Dalton Cherry on 5/16/15.
 | 
			
		||||
//  Copyright (c) 2014-2016 Dalton Cherry.
 | 
			
		||||
//
 | 
			
		||||
//  Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
//  you may not use this file except in compliance with the License.
 | 
			
		||||
//  You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
//  http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
//  Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
//  distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//  See the License for the specific language governing permissions and
 | 
			
		||||
//  limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
//////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
import Foundation
 | 
			
		||||
import Security
 | 
			
		||||
 | 
			
		||||
public protocol SSLTrustValidator {
 | 
			
		||||
    func isValid(_ trust: SecTrust, domain: String?) -> Bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
open class SSLCert : NSObject {
 | 
			
		||||
    var certData: Data?
 | 
			
		||||
    var key: SecKey?
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Designated init for certificates
 | 
			
		||||
     
 | 
			
		||||
     - parameter data: is the binary data of the certificate
 | 
			
		||||
     
 | 
			
		||||
     - returns: a representation security object to be used with
 | 
			
		||||
     */
 | 
			
		||||
    public init(data: Data) {
 | 
			
		||||
        self.certData = data
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Designated init for public keys
 | 
			
		||||
     
 | 
			
		||||
     - parameter key: is the public key to be used
 | 
			
		||||
     
 | 
			
		||||
     - returns: a representation security object to be used with
 | 
			
		||||
     */
 | 
			
		||||
    public init(key: SecKey) {
 | 
			
		||||
        self.key = key
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
open class SSLSecurity : SSLTrustValidator {
 | 
			
		||||
    public var validatedDN = true //should the domain name be validated?
 | 
			
		||||
    
 | 
			
		||||
    var isReady = false //is the key processing done?
 | 
			
		||||
    var certificates: [Data]? //the certificates
 | 
			
		||||
    @nonobjc var pubKeys: [SecKey]? //the public keys
 | 
			
		||||
    var usePublicKeys = false //use public keys or certificate validation?
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Use certs from main app bundle
 | 
			
		||||
     
 | 
			
		||||
     - parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation
 | 
			
		||||
     
 | 
			
		||||
     - returns: a representation security object to be used with
 | 
			
		||||
     */
 | 
			
		||||
    public convenience init(usePublicKeys: Bool = false) {
 | 
			
		||||
        let paths = Bundle.main.paths(forResourcesOfType: "cer", inDirectory: ".")
 | 
			
		||||
        
 | 
			
		||||
        let certs = paths.reduce([SSLCert]()) { (certs: [SSLCert], path: String) -> [SSLCert] in
 | 
			
		||||
            var certs = certs
 | 
			
		||||
            if let data = NSData(contentsOfFile: path) {
 | 
			
		||||
                certs.append(SSLCert(data: data as Data))
 | 
			
		||||
            }
 | 
			
		||||
            return certs
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        self.init(certs: certs, usePublicKeys: usePublicKeys)
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Designated init
 | 
			
		||||
     
 | 
			
		||||
     - parameter certs: is the certificates or public keys to use
 | 
			
		||||
     - parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation
 | 
			
		||||
     
 | 
			
		||||
     - returns: a representation security object to be used with
 | 
			
		||||
     */
 | 
			
		||||
    public init(certs: [SSLCert], usePublicKeys: Bool) {
 | 
			
		||||
        self.usePublicKeys = usePublicKeys
 | 
			
		||||
        
 | 
			
		||||
        if self.usePublicKeys {
 | 
			
		||||
            DispatchQueue.global(qos: .default).async {
 | 
			
		||||
                let pubKeys = certs.reduce([SecKey]()) { (pubKeys: [SecKey], cert: SSLCert) -> [SecKey] in
 | 
			
		||||
                    var pubKeys = pubKeys
 | 
			
		||||
                    if let data = cert.certData, cert.key == nil {
 | 
			
		||||
                        cert.key = self.extractPublicKey(data)
 | 
			
		||||
                    }
 | 
			
		||||
                    if let key = cert.key {
 | 
			
		||||
                        pubKeys.append(key)
 | 
			
		||||
                    }
 | 
			
		||||
                    return pubKeys
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                self.pubKeys = pubKeys
 | 
			
		||||
                self.isReady = true
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            let certificates = certs.reduce([Data]()) { (certificates: [Data], cert: SSLCert) -> [Data] in
 | 
			
		||||
                var certificates = certificates
 | 
			
		||||
                if let data = cert.certData {
 | 
			
		||||
                    certificates.append(data)
 | 
			
		||||
                }
 | 
			
		||||
                return certificates
 | 
			
		||||
            }
 | 
			
		||||
            self.certificates = certificates
 | 
			
		||||
            self.isReady = true
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Valid the trust and domain name.
 | 
			
		||||
     
 | 
			
		||||
     - parameter trust: is the serverTrust to validate
 | 
			
		||||
     - parameter domain: is the CN domain to validate
 | 
			
		||||
     
 | 
			
		||||
     - returns: if the key was successfully validated
 | 
			
		||||
     */
 | 
			
		||||
    public func isValid(_ trust: SecTrust, domain: String?) -> Bool {
 | 
			
		||||
        
 | 
			
		||||
        var tries = 0
 | 
			
		||||
        while !self.isReady {
 | 
			
		||||
            usleep(1000)
 | 
			
		||||
            tries += 1
 | 
			
		||||
            if tries > 5 {
 | 
			
		||||
                return false //doesn't appear it is going to ever be ready...
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        var policy: SecPolicy
 | 
			
		||||
        if self.validatedDN {
 | 
			
		||||
            policy = SecPolicyCreateSSL(true, domain as NSString?)
 | 
			
		||||
        } else {
 | 
			
		||||
            policy = SecPolicyCreateBasicX509()
 | 
			
		||||
        }
 | 
			
		||||
        SecTrustSetPolicies(trust,policy)
 | 
			
		||||
        if self.usePublicKeys {
 | 
			
		||||
            if let keys = self.pubKeys {
 | 
			
		||||
                let serverPubKeys = publicKeyChain(trust)
 | 
			
		||||
                for serverKey in serverPubKeys as [AnyObject] {
 | 
			
		||||
                    for key in keys as [AnyObject] {
 | 
			
		||||
                        if serverKey.isEqual(key) {
 | 
			
		||||
                            return true
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } else if let certs = self.certificates {
 | 
			
		||||
            let serverCerts = certificateChain(trust)
 | 
			
		||||
            var collect = [SecCertificate]()
 | 
			
		||||
            for cert in certs {
 | 
			
		||||
                collect.append(SecCertificateCreateWithData(nil,cert as CFData)!)
 | 
			
		||||
            }
 | 
			
		||||
            SecTrustSetAnchorCertificates(trust,collect as NSArray)
 | 
			
		||||
            var result: SecTrustResultType = .unspecified
 | 
			
		||||
            SecTrustEvaluate(trust,&result)
 | 
			
		||||
            if result == .unspecified || result == .proceed {
 | 
			
		||||
                var trustedCount = 0
 | 
			
		||||
                for serverCert in serverCerts {
 | 
			
		||||
                    for cert in certs {
 | 
			
		||||
                        if cert == serverCert {
 | 
			
		||||
                            trustedCount += 1
 | 
			
		||||
                            break
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                if trustedCount == serverCerts.count {
 | 
			
		||||
                    return true
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Get the public key from a certificate data
 | 
			
		||||
     
 | 
			
		||||
     - parameter data: is the certificate to pull the public key from
 | 
			
		||||
     
 | 
			
		||||
     - returns: a public key
 | 
			
		||||
     */
 | 
			
		||||
    func extractPublicKey(_ data: Data) -> SecKey? {
 | 
			
		||||
        guard let cert = SecCertificateCreateWithData(nil, data as CFData) else { return nil }
 | 
			
		||||
        
 | 
			
		||||
        return extractPublicKey(cert, policy: SecPolicyCreateBasicX509())
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Get the public key from a certificate
 | 
			
		||||
     
 | 
			
		||||
     - parameter data: is the certificate to pull the public key from
 | 
			
		||||
     
 | 
			
		||||
     - returns: a public key
 | 
			
		||||
     */
 | 
			
		||||
    func extractPublicKey(_ cert: SecCertificate, policy: SecPolicy) -> SecKey? {
 | 
			
		||||
        var possibleTrust: SecTrust?
 | 
			
		||||
        SecTrustCreateWithCertificates(cert, policy, &possibleTrust)
 | 
			
		||||
        
 | 
			
		||||
        guard let trust = possibleTrust else { return nil }
 | 
			
		||||
        var result: SecTrustResultType = .unspecified
 | 
			
		||||
        SecTrustEvaluate(trust, &result)
 | 
			
		||||
        return SecTrustCopyPublicKey(trust)
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Get the certificate chain for the trust
 | 
			
		||||
     
 | 
			
		||||
     - parameter trust: is the trust to lookup the certificate chain for
 | 
			
		||||
     
 | 
			
		||||
     - returns: the certificate chain for the trust
 | 
			
		||||
     */
 | 
			
		||||
    func certificateChain(_ trust: SecTrust) -> [Data] {
 | 
			
		||||
        let certificates = (0..<SecTrustGetCertificateCount(trust)).reduce([Data]()) { (certificates: [Data], index: Int) -> [Data] in
 | 
			
		||||
            var certificates = certificates
 | 
			
		||||
            let cert = SecTrustGetCertificateAtIndex(trust, index)
 | 
			
		||||
            certificates.append(SecCertificateCopyData(cert!) as Data)
 | 
			
		||||
            return certificates
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return certificates
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     Get the public key chain for the trust
 | 
			
		||||
     
 | 
			
		||||
     - parameter trust: is the trust to lookup the certificate chain and extract the public keys
 | 
			
		||||
     
 | 
			
		||||
     - returns: the public keys from the certifcate chain for the trust
 | 
			
		||||
     */
 | 
			
		||||
    @nonobjc func publicKeyChain(_ trust: SecTrust) -> [SecKey] {
 | 
			
		||||
        let policy = SecPolicyCreateBasicX509()
 | 
			
		||||
        let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKey]()) { (keys: [SecKey], index: Int) -> [SecKey] in
 | 
			
		||||
            var keys = keys
 | 
			
		||||
            let cert = SecTrustGetCertificateAtIndex(trust, index)
 | 
			
		||||
            if let key = extractPublicKey(cert!, policy: policy) {
 | 
			
		||||
                keys.append(key)
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            return keys
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return keys
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
@ -24,6 +24,7 @@
 | 
			
		||||
 | 
			
		||||
import Dispatch
 | 
			
		||||
import Foundation
 | 
			
		||||
import StarscreamSocketIO
 | 
			
		||||
 | 
			
		||||
/// The class that handles the engine.io protocol and transports.
 | 
			
		||||
/// See `SocketEnginePollable` and `SocketEngineWebsocket` for transport specific methods.
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,7 @@
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
import Foundation
 | 
			
		||||
import StarscreamSocketIO
 | 
			
		||||
 | 
			
		||||
/// Specifies a SocketEngine.
 | 
			
		||||
@objc public protocol SocketEngineSpec {
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,7 @@
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
import Foundation
 | 
			
		||||
import StarscreamSocketIO
 | 
			
		||||
 | 
			
		||||
/// Protocol that is used to implement socket.io WebSocket support
 | 
			
		||||
public protocol SocketEngineWebsocket : SocketEngineSpec, WebSocketDelegate {
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,7 @@
 | 
			
		||||
//  THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
import Foundation
 | 
			
		||||
import StarscreamSocketIO
 | 
			
		||||
 | 
			
		||||
enum JSONError : Error {
 | 
			
		||||
    case notArray
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,7 @@
 | 
			
		||||
//  THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
import Foundation
 | 
			
		||||
import StarscreamSocketIO
 | 
			
		||||
 | 
			
		||||
protocol ClientOption : CustomStringConvertible, Equatable {
 | 
			
		||||
    func getSocketIOOptionValue() -> Any
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								Source/Starscream
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								Source/Starscream
									
									
									
									
									
										Submodule
									
								
							@ -0,0 +1 @@
 | 
			
		||||
Subproject commit eb7f7da02ef367433d9d282e82add1c7321a8780
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,2 +0,0 @@
 | 
			
		||||
#include <zlib.h>
 | 
			
		||||
#include <CommonCrypto/CommonCrypto.h>
 | 
			
		||||
@ -1,9 +0,0 @@
 | 
			
		||||
module CZLib [system] {
 | 
			
		||||
    header "include.h"
 | 
			
		||||
    link "z"
 | 
			
		||||
    export *
 | 
			
		||||
}
 | 
			
		||||
module CommonCrypto [system] {
 | 
			
		||||
    header "include.h"
 | 
			
		||||
    export *
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user