Compare commits

..
5 Commits
Author SHA1 Message Date
Max Lv c2c7cabbaf refine dns resolve 2015-07-30 13:35:04 +08:00
Max Lv 092d880c7d refine binary install 2015-07-29 13:49:08 +08:00
Max Lv c208c4bf50 refine profile initilizing 2015-07-28 15:49:05 +08:00
Max Lv 34af6aeef5 refine the IPC to tun2socks 2015-07-28 14:48:21 +08:00
Max Lv d9af2f93e0 fix plugin 2015-07-27 11:09:52 +08:00
7 changed files with 83 additions and 40 deletions
+14 -12
View File
@@ -10,20 +10,21 @@ import IPy
def main():
china_list_set = IPy.IPSet()
for line in sys.stdin:
line_params = line.split("|")
if len(line_params) < 5 or line_params[2] != "ipv4" or line_params[1] != "CN":
continue
ip_addr = line_params[3]
ip_length = float(line_params[4])
ip_mask = 32 - int(math.ceil(math.log(ip_length, 2)))
china_list_set.add(IPy.IP("%s/%d" % (ip_addr, ip_mask)))
# for line in sys.stdin:
# line_params = line.split("|")
# if len(line_params) < 5 or line_params[2] != "ipv4" or line_params[1] != "CN":
# continue
# ip_addr = line_params[3]
# ip_length = float(line_params[4])
# ip_mask = 32 - int(math.ceil(math.log(ip_length, 2)))
# china_list_set.add(IPy.IP("%s/%d" % (ip_addr, ip_mask)))
# 添加内网地址
internal_list = IPy.IPSet(map(IPy.IP, [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"114.114.114.0/24",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
@@ -34,6 +35,7 @@ def main():
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"223.5.5.0/24",
"224.0.0.0/4",
"240.0.0.0/4",
]))
@@ -45,10 +47,10 @@ def main():
for ip in china_list_set:
all.discard(ip)
filter = itertools.ifilter(lambda x: len(x) <= 65536, all)
for ip in filter:
all.discard(ip)
all.add(IPy.IP(ip.strNormal(0)).make_net('255.255.0.0'))
# filter = itertools.ifilter(lambda x: len(x) <= 65536, all)
# for ip in filter:
# all.discard(ip)
# all.add(IPy.IP(ip.strNormal(0)).make_net('255.255.0.0'))
# 输出结果
for ip in all:
+3 -3
View File
@@ -1,7 +1,7 @@
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.6")
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.7")
resolvers += Resolver.sbtPluginRepo("snapshots")
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("com.hanhuy.sbt" % "sbt-idea" % "1.7.0-SNAPSHOT")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.7.0-SNAPSHOT")
+2 -2
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:versionCode="110"
android:versionName="2.7.2">
android:versionCode="112"
android:versionName="2.7.4">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+39 -2
View File
@@ -85,7 +85,25 @@
<item>101.0.0.0/8</item>
<item>102.0.0.0/7</item>
<item>104.0.0.0/5</item>
<item>112.0.0.0/5</item>
<item>112.0.0.0/7</item>
<item>114.0.0.0/10</item>
<item>114.64.0.0/11</item>
<item>114.96.0.0/12</item>
<item>114.112.0.0/15</item>
<item>114.114.0.0/18</item>
<item>114.114.64.0/19</item>
<item>114.114.96.0/20</item>
<item>114.114.112.0/23</item>
<item>114.114.115.0/24</item>
<item>114.114.116.0/22</item>
<item>114.114.120.0/21</item>
<item>114.114.128.0/17</item>
<item>114.115.0.0/16</item>
<item>114.116.0.0/14</item>
<item>114.120.0.0/13</item>
<item>114.128.0.0/9</item>
<item>115.0.0.0/8</item>
<item>116.0.0.0/6</item>
<item>120.0.0.0/6</item>
<item>124.0.0.0/7</item>
<item>126.0.0.0/8</item>
@@ -190,6 +208,25 @@
<item>203.64.0.0/10</item>
<item>203.128.0.0/9</item>
<item>204.0.0.0/6</item>
<item>208.0.0.0/4</item>
<item>208.0.0.0/5</item>
<item>216.0.0.0/6</item>
<item>220.0.0.0/7</item>
<item>222.0.0.0/8</item>
<item>223.0.0.0/14</item>
<item>223.4.0.0/16</item>
<item>223.5.0.0/22</item>
<item>223.5.4.0/24</item>
<item>223.5.6.0/23</item>
<item>223.5.8.0/21</item>
<item>223.5.16.0/20</item>
<item>223.5.32.0/19</item>
<item>223.5.64.0/18</item>
<item>223.5.128.0/17</item>
<item>223.6.0.0/15</item>
<item>223.8.0.0/13</item>
<item>223.16.0.0/12</item>
<item>223.32.0.0/11</item>
<item>223.64.0.0/10</item>
<item>223.128.0.0/9</item>
</string-array>
</resources>
@@ -474,22 +474,22 @@ class Shadowsocks
addPreferencesFromResource(R.xml.pref_all)
// Initialize the profile
currentProfile = {
profileManager.getProfile(settings.getInt(Key.profileId, -1)) getOrElse currentProfile
}
// Update the profile
if (!status.getBoolean(getVersionName, false)) {
val h = showProgress(getString(R.string.initializing))
status.edit.putBoolean(getVersionName, true).apply()
currentProfile = profileManager.create()
spawn {
reset()
currentProfile = profileManager.create()
install()
h.sendEmptyMessage(0)
}
}
// Initialize the profile
currentProfile = {
profileManager.getProfile(settings.getInt(Key.profileId, -1)) getOrElse currentProfile
}
// Initialize drawer
menuAdapter.setActiveId(settings.getInt(Key.profileId, -1))
menuAdapter.setListener(this)
@@ -916,10 +916,7 @@ class Shadowsocks
Console.runRootCommand(ab.toArray)
}
def reset() {
crashRecovery()
def install() {
copyAssets(System.getABI)
val ab = new ArrayBuffer[String]
@@ -927,7 +924,13 @@ class Shadowsocks
ab.append("chmod 755 " + Path.BASE + executable)
}
Console.runCommand(ab.toArray)
}
def reset() {
crashRecovery()
install()
}
private def recovery() {
@@ -266,17 +266,18 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
val fd = startVpn()
if (fd == -1) {
false
} else {
Thread.sleep(1000)
if (System.sendfd(fd) == -1) {
false
} else {
true
if (fd != -1) {
var tries = 1
while (tries < 5) {
Thread.sleep(1000 * tries)
if (System.sendfd(fd) != -1) {
return true
}
tries += 1
}
}
false
}
def startShadowsocksDaemon() {