add a mobileconfig(not working now)

This commit is contained in:
clowwindy
2013-06-06 14:24:46 +08:00
committed by clowwindy
parent abe296f352
commit 5bbc225d30
3 changed files with 78 additions and 0 deletions

View File

@@ -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 = "<group>"; };
62CD119B175E3E17008C4D0C /* table.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = table.m; sourceTree = "<group>"; };
62CD119D175E3E23008C4D0C /* table.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = table.h; sourceTree = "<group>"; };
EB1897A8F80969EC7477F89D /* shadowsocks.mobileconfig */ = {isa = PBXFileReference; lastKnownFileType = file.mobileconfig; path = shadowsocks.mobileconfig; sourceTree = "<group>"; };
/* 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 = "<group>";
@@ -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;
};

View File

@@ -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, ^{

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>DefaultsData</key>
<dict>
<key>apns</key>
<array>
<dict>
<key>apn</key>
<string>3GNET</string>
<key>proxy</key>
<string>127.0.0.1</string>
<key>proxyPort</key>
<integer>8080</integer>
</dict>
</array>
</dict>
<key>DefaultsDomainName</key>
<string>com.apple.managedCarrier</string>
</dict>
</array>
<key>PayloadDescription</key>
<string>Provides customization of carrier Access Point Name.</string>
<key>PayloadDisplayName</key>
<string>APN</string>
<key>PayloadIdentifier</key>
<string>shadowsocks.</string>
<key>PayloadOrganization</key>
<string></string>
<key>PayloadType</key>
<string>com.apple.apn.managed</string>
<key>PayloadUUID</key>
<string>A12D2F19-60E2-42EC-8A34-E0AD051358D5</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</array>
<key>PayloadDescription</key>
<string>Profile description.</string>
<key>PayloadDisplayName</key>
<string>shadowsocks</string>
<key>PayloadIdentifier</key>
<string>shadowsocks</string>
<key>PayloadOrganization</key>
<string></string>
<key>PayloadRemovalDisallowed</key>
<false/>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>82A1355E-926F-477D-BEAC-2CB5E919A68B</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>