diff --git a/ShadowWeb.xcodeproj/project.pbxproj b/ShadowWeb.xcodeproj/project.pbxproj index acb83e3..781be5d 100644 --- a/ShadowWeb.xcodeproj/project.pbxproj +++ b/ShadowWeb.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ 628693FE16DA2983008B1A26 /* ev.c in Sources */ = {isa = PBXBuildFile; fileRef = 628693FD16DA2983008B1A26 /* ev.c */; }; 62CD119A175E3BD7008C4D0C /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 62CD1199175E3BD7008C4D0C /* libcrypto.a */; }; 62CD119C175E3E17008C4D0C /* table.m in Sources */ = {isa = PBXBuildFile; fileRef = 62CD119B175E3E17008C4D0C /* table.m */; }; + EB189A01F66776EC1714F32D /* shadowsocks.mobileconfig in Resources */ = {isa = PBXBuildFile; fileRef = EB1897A8F80969EC7477F89D /* shadowsocks.mobileconfig */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -116,6 +117,7 @@ 62CD1199175E3BD7008C4D0C /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "OpenSSL-for-iPhone/lib/libcrypto.a"; sourceTree = ""; }; 62CD119B175E3E17008C4D0C /* table.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = table.m; sourceTree = ""; }; 62CD119D175E3E23008C4D0C /* table.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = table.h; sourceTree = ""; }; + EB1897A8F80969EC7477F89D /* shadowsocks.mobileconfig */ = {isa = PBXFileReference; lastKnownFileType = file.mobileconfig; path = shadowsocks.mobileconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -200,6 +202,7 @@ 621571BC16CF6BCB003D96B4 /* Default@2x.png */, 621571BE16CF6BCB003D96B4 /* Default-568h@2x.png */, 621FCBF617603E5100411E5F /* proxy.pac */, + EB1897A8F80969EC7477F89D /* shadowsocks.mobileconfig */, ); name = "Supporting Files"; sourceTree = ""; @@ -371,6 +374,7 @@ 621571BD16CF6BCB003D96B4 /* Default@2x.png in Resources */, 621571BF16CF6BCB003D96B4 /* Default-568h@2x.png in Resources */, 621FCBF717603E5100411E5F /* proxy.pac in Resources */, + EB189A01F66776EC1714F32D /* shadowsocks.mobileconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ShadowWeb/SWBAppDelegate.m b/ShadowWeb/SWBAppDelegate.m index 058d4bb..ee015f5 100644 --- a/ShadowWeb/SWBAppDelegate.m +++ b/ShadowWeb/SWBAppDelegate.m @@ -26,6 +26,9 @@ NSData *pacData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"proxy" withExtension:@"pac"]]; GCDWebServer *webServer = [[GCDWebServer alloc] init]; + [webServer addHandlerForMethod:@"GET" path:@"/proxy.pac" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) { + return nil; + }]; [webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) { @@ -34,6 +37,15 @@ } ]; + NSData *mobileconfig = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"shadowsocks" withExtension:@"mobileconfig"]]; + [webServer addDefaultHandlerForMethod:@"GET" + requestClass:[GCDWebServerRequest class] + processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) { + return [GCDWebServerDataResponse responseWithData:mobileconfig contentType:@"application/x-apple-aspen-config"]; + + } + ]; + dispatch_queue_t web = dispatch_queue_create("web", NULL); dispatch_async(web, ^{ diff --git a/ShadowWeb/shadowsocks.mobileconfig b/ShadowWeb/shadowsocks.mobileconfig new file mode 100644 index 0000000..6cb0e51 --- /dev/null +++ b/ShadowWeb/shadowsocks.mobileconfig @@ -0,0 +1,62 @@ + + + + + PayloadContent + + + PayloadContent + + + DefaultsData + + apns + + + apn + 3GNET + proxy + 127.0.0.1 + proxyPort + 8080 + + + + DefaultsDomainName + com.apple.managedCarrier + + + PayloadDescription + Provides customization of carrier Access Point Name. + PayloadDisplayName + APN + PayloadIdentifier + shadowsocks. + PayloadOrganization + + PayloadType + com.apple.apn.managed + PayloadUUID + A12D2F19-60E2-42EC-8A34-E0AD051358D5 + PayloadVersion + 1 + + + PayloadDescription + Profile description. + PayloadDisplayName + shadowsocks + PayloadIdentifier + shadowsocks + PayloadOrganization + + PayloadRemovalDisallowed + + PayloadType + Configuration + PayloadUUID + 82A1355E-926F-477D-BEAC-2CB5E919A68B + PayloadVersion + 1 + +