Compare commits

..
13 Commits
Author SHA1 Message Date
Max Lv 89f073cc49 Merge pull request #922 from Mygod/master
Refine GitHub templates
2016-10-06 10:00:36 -05:00
Max Lv 07ac8fb839 Bump version 2016-10-06 22:58:01 +08:00
Mygod 57b75ad971 Refine GitHub templates 2016-10-06 21:59:39 +08:00
Mygod 1d6a0b0f2b Use styling to fix #910 2016-10-05 23:12:25 +08:00
Mygod abcbc98ce3 Refine MyNumberPicker 2016-10-05 22:58:18 +08:00
Mygod 2722b1aa78 Rename package 2016-10-05 22:47:56 +08:00
Mygod 4bfc5ee070 Update email 2016-10-05 13:39:51 +08:00
Max Lv c842f7fd41 Bump version 2016-10-03 19:47:53 +08:00
Max Lv c2f02994f8 Refine DNS server with China List 2016-10-02 19:36:53 +08:00
Max Lv 54247d6b2b Update DNS 2016-09-30 20:48:20 +08:00
Max Lv e7fbfd668d Update config name 2016-09-30 19:43:30 +08:00
Max Lv b6d0af1ec3 Fix #910 2016-09-30 19:28:03 +08:00
Max Lv f58301b80b Bump version 2016-09-30 13:49:16 +08:00
24 changed files with 121 additions and 53 deletions
+24 -5
View File
@@ -1,10 +1,31 @@
Please answer these questions before submitting your issue. Thanks!
Please read FAQ in wiki then answer these questions before submitting your issue. Thanks!
### What version of Shadowsocks are you using?
### Environment
* Android version: *e.g. "7.0.0_r14", more detailed description is preferred*
* Device: *e.g. Google Pixel XL*
* Shadowsocks version: *version code "v3.0.0" or commit ID "a073f85"*
### What Android OS version and device are you using?
### Configuration
_Put an `x` inside the [ ] that applies._
* [ ] IPv4 server address
* [ ] IPv6 server address
* [ ] Client IPv4 availability
* [ ] Client IPv6 availability
* Local port: 1080
* Encrypt method:
* [ ] One-time authentication
* Route:
* [ ] IPv6 route
* [ ] Per-App Proxy
* [ ] Bypass mode
* [ ] UDP Forwarding
* KCP Parameters: (leave blank if not enabled)
* [ ] Auto Connect
* [ ] TCP Fast Open
* [ ] NAT mode
### What did you do?
@@ -14,5 +35,3 @@ Please answer these questions before submitting your issue. Thanks!
### What did you see instead?
### What is your config in detail (with all sensitive info masked)?
+14
View File
@@ -0,0 +1,14 @@
### Type of changes
_Put an `x` inside the [ ] that applies._
* [ ] Bugfix
* [ ] New feature
* [ ] Translation
* [ ] General refinement
* Other:
### Details
Please provide more details about changes if necessary.
+1 -1
View File
@@ -49,7 +49,7 @@ A [shadowsocks](http://shadowsocks.org) client for Android, written in Scala.
### LICENSE
Copyright (C) 2016 by Max Lv <<max.c.lv@gmail.com>>
Copyright (C) 2016 by Mygod Studio <<mygodstudio@gmail.com>>
Copyright (C) 2016 by Mygod Studio <<contact-shadowsocks-android@mygod.be>>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+2 -2
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
android:versionCode="161"
android:versionName="3.2.1">
android:versionCode="164"
android:versionName="3.2.4">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+1 -1
View File
@@ -275,7 +275,7 @@ img {
<body>
<p>A <a href="http://shadowsocks.org">Shadowsocks</a> client for Android, written in Scala.</p>
<p>Copyright (C) 2016 by Max Lv <a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#x3a;&#x6d;&#97;x&#46;&#99;.&#108;&#118;&#x40;&#103;&#109;&#97;&#x69;&#108;&#46;&#x63;&#x6f;&#109;">&#x6d;&#97;&#x78;.&#x63;&#x2e;&#108;v&#64;&#x67;&#109;&#x61;&#x69;&#108;&#x2e;&#99;&#111;&#109;</a></p>
<p>Copyright (C) 2016 by Mygod Studio <a href="mygodstudio@gmail.com">mygodstudio@gmail.com</a></p>
<p>Copyright (C) 2016 by Mygod Studio <a href="contact-shadowsocks-android@mygod.be">contact-shadowsocks-android@mygod.be</a></p>
<p>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="black_list" translatable="false">".appspot.com",".blogspot.com",".blogspot.kr",".blogspot.sg",".cdninstagram.com",".connect.facebook.net",".facebook.br",".facebook.com",".facebook.hu",".facebook.nl",".facebook.se",".fbcdn.net",".google.co.kr",".google.com",".google.com",".google.com.hk",".google.com.sg",".google.com.tw",".googleapis.com",".googleapps.com",".googleartproject.com",".googleblog.com",".googlecode.com",".googlecommerce.com",".googledomains.com",".googledrive.com",".googleearth.com",".googlegroups.com",".googlehosted.com",".googleideas.com",".googlelabs.com",".googlemail.com",".googleplay.com",".googleplus.com",".googlesile.com",".googlesource.com",".googleusercontent.com",".googlevideo.com",".googlezip.net",".gstatic.com",".yahoo.com",".igoogle.com",".instagram.com",".institut-tibetain.org",".nic.google",".registry.google",".thinkwithgoogle.com",".withgoogle.com",".youtube-nocookie.com",".youtube.com",".gvt1.com",".gvt2.com",".gvt3.com",".1e100.net"</string>
</resources>
+3
View File
@@ -44,5 +44,8 @@
<item name="android:fadeScrollbars">true</item>
<item name="android:scrollbars">vertical</item>
</style>
<style name="NumberPickerStyle">
<item name="android:textSize">14sp</item>
</style>
</resources>
+15 -15
View File
@@ -2,34 +2,34 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.github.shadowsocks">
<tk.mygod.preference.PreferenceCategory
<be.mygod.preference.PreferenceCategory
android:title="@string/proxy_cat">
<tk.mygod.preference.EditTextPreference
<be.mygod.preference.EditTextPreference
android:key="profileName"
android:persistent="false"
android:summary="%s"
android:title="@string/profile_name"/>
<tk.mygod.preference.EditTextPreference
<be.mygod.preference.EditTextPreference
android:key="proxy"
android:persistent="false"
android:summary="%s"
android:title="@string/proxy"/>
<tk.mygod.preference.NumberPickerPreference
<be.mygod.preference.NumberPickerPreference
app:min="1"
app:max="65535"
android:key="remotePortNum"
android:persistent="false"
android:summary="%d"
android:title="@string/remote_port"/>
<tk.mygod.preference.NumberPickerPreference
<be.mygod.preference.NumberPickerPreference
app:min="1025"
app:max="65535"
android:key="localPortNum"
android:persistent="false"
android:summary="%d"
android:title="@string/port"/>
<tk.mygod.preference.EditTextPreference
<be.mygod.preference.EditTextPreference
android:inputType="textPassword"
android:key="sitekey"
android:persistent="false"
@@ -48,9 +48,9 @@
android:summary="@string/onetime_auth_summary"
android:title="@string/onetime_auth"/>
</tk.mygod.preference.PreferenceCategory>
</be.mygod.preference.PreferenceCategory>
<tk.mygod.preference.PreferenceCategory
<be.mygod.preference.PreferenceCategory
android:title="@string/feature_cat">
<android.support.v7.preference.DropDownPreference
@@ -76,9 +76,9 @@
android:summary="@string/udp_dns_summary"
android:title="@string/udp_dns"/>
</tk.mygod.preference.PreferenceCategory>
</be.mygod.preference.PreferenceCategory>
<tk.mygod.preference.PreferenceCategory
<be.mygod.preference.PreferenceCategory
android:title="@string/kcp">
<SwitchPreference
@@ -87,7 +87,7 @@
android:summary="@string/kcp_summary"
android:title="@string/kcp"/>
<tk.mygod.preference.NumberPickerPreference
<be.mygod.preference.NumberPickerPreference
app:min="1"
app:max="65535"
android:key="kcpPort"
@@ -95,15 +95,15 @@
android:summary="@string/kcp_port_summary"
android:title="@string/kcp_port"/>
<tk.mygod.preference.EditTextPreference
<be.mygod.preference.EditTextPreference
android:key="kcpcli"
android:persistent="false"
android:summary="%s"
android:title="@string/kcpcli"/>
</tk.mygod.preference.PreferenceCategory>
</be.mygod.preference.PreferenceCategory>
<tk.mygod.preference.PreferenceCategory android:title="@string/misc_cat">
<be.mygod.preference.PreferenceCategory android:title="@string/misc_cat">
<SwitchPreference
android:key="isAutoConnect"
@@ -126,7 +126,7 @@
android:summary="@string/flush_dnscache_summary"/>
<Preference android:key="about" android:title="@string/about"/>
</tk.mygod.preference.PreferenceCategory>
</be.mygod.preference.PreferenceCategory>
</PreferenceScreen>
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import android.content.Context
import android.support.v7.preference.{EditTextPreference => Parent}
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import android.content.Context
import android.support.v14.preference.PreferenceDialogFragment
@@ -1,15 +1,16 @@
package tk.mygod.preference
package be.mygod.preference
import android.content.Context
import android.content.res.TypedArray
import android.support.v7.preference.DialogPreference
import android.util.AttributeSet
import android.view.ContextThemeWrapper
import android.widget.NumberPicker
import com.github.shadowsocks.R
class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null)
extends DialogPreference(context, attrs) with SummaryPreference {
private[preference] val picker = new NumberPicker(context)
private[preference] val picker = new NumberPicker(new ContextThemeWrapper(context, R.style.NumberPickerStyle))
private var value: Int = _
{
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import android.content.Context
import android.support.v14.preference.PreferenceDialogFragment
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import android.content.Context
import android.support.v7.preference.{PreferenceViewHolder, PreferenceCategory => Base}
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import android.app.DialogFragment
import android.os.Bundle
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import java.lang.reflect.Field
import java.util.List
@@ -1,4 +1,4 @@
package tk.mygod.preference
package be.mygod.preference
import android.support.v7.preference.Preference
@@ -70,6 +70,7 @@ trait BaseService extends Service {
var callbacksCount: Int = _
lazy val handler = new Handler(getMainLooper)
lazy val restartHanlder = new Handler(getMainLooper)
lazy val protectPath = getApplicationInfo.dataDir + "/protect_path"
private val closeReceiver: BroadcastReceiver = (context: Context, intent: Intent) => {
Toast.makeText(context, R.string.stopping, Toast.LENGTH_SHORT).show()
@@ -298,4 +299,16 @@ trait BaseService extends Service {
state = s
})
}
def getBlackList = {
val default = getString(R.string.black_list)
try {
val container = app.containerHolder.getContainer
val update = container.getString("black_list_lite")
val list = if (update == null || update.isEmpty) default else update
"exclude = " + list + ";"
} catch {
case ex: Exception => "exclude = " + default + ";"
}
}
}
@@ -136,11 +136,16 @@ class ShadowsocksNatService extends BaseService {
, "-u"
, "-t" , "10"
, "-b" , "127.0.0.1"
, "-L" , "8.8.8.8:53"
, "-l" , (profile.localPort + 53).toString
, "-P" , getApplicationInfo.dataDir
, "-c" , getApplicationInfo.dataDir + "/ss-tunnel-nat.conf")
cmd += "-L"
if (profile.route == Route.CHINALIST)
cmd += "114.114.114.114:53"
else
cmd += "8.8.8.8:53"
if (profile.auth) cmd += "-A"
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
@@ -182,17 +187,17 @@ class ShadowsocksNatService extends BaseService {
val conf = profile.route match {
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, "", getApplicationInfo.dataDir,
"127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
reject, profile.localPort + 63, reject)
getBlackList, reject, profile.localPort + 63, reject)
}
case Route.CHINALIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, "", getApplicationInfo.dataDir,
"127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
reject, profile.localPort + 63, reject)
"", reject, profile.localPort + 63, reject)
}
case _ => {
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, "", getApplicationInfo.dataDir,
"127.0.0.1", profile.localPort + 53, profile.localPort + 63, reject)
}
}
@@ -15,7 +15,7 @@ import com.github.shadowsocks.ShadowsocksApplication.app
import com.github.shadowsocks.database.Profile
import com.github.shadowsocks.preferences.KcpCliPreferenceDialogFragment
import com.github.shadowsocks.utils.{Key, TcpFastOpen, Utils}
import tk.mygod.preference._
import be.mygod.preference._
object ShadowsocksSettings {
// Constants
@@ -193,7 +193,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
val cmd = ArrayBuffer(getApplicationInfo.dataDir + "/kcptun"
, "-r", profile.host + ":" + profile.kcpPort
, "-l", "127.0.0.1:" + (profile.localPort + 90)
, "--path", getApplicationInfo.dataDir + "/protect_path")
, "--path", protectPath)
try cmd ++= Utils.translateCommandline(profile.kcpcli) catch {
case exc: Exception => throw KcpcliParseException(exc)
}
@@ -284,10 +284,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {
, "-V"
, "-t", "10"
, "-b", "127.0.0.1"
, "-L", "8.8.8.8:53"
, "-P", getApplicationInfo.dataDir
, "-c", getApplicationInfo.dataDir + "/ss-tunnel-vpn.conf")
cmd += "-L"
if (profile.route == Route.CHINALIST)
cmd += "114.114.114.114:53"
else
cmd += "8.8.8.8:53"
if (profile.auth) cmd += "-A"
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
@@ -297,19 +302,20 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def startDnsDaemon() {
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
val protect = "protect = \"" + protectPath +"\";"
val conf = profile.route match {
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
reject, profile.localPort + 63, reject)
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "114.114.114.114, 119.29.29.29, 1.2.4.8",
getBlackList, reject, profile.localPort + 63, reject)
}
case Route.CHINALIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
reject, profile.localPort + 63, reject)
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 8.8.4.4, 208.67.222.222",
"", reject, profile.localPort + 63, reject)
}
case _ => {
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, profile.localPort + 63, reject)
}
}
@@ -3,7 +3,7 @@ package com.github.shadowsocks.preferences
import android.app.AlertDialog
import android.content.DialogInterface
import eu.chainfire.libsuperuser.Shell
import tk.mygod.preference.EditTextPreferenceDialogFragment
import be.mygod.preference.EditTextPreferenceDialogFragment
import scala.collection.JavaConverters._
@@ -69,6 +69,7 @@ object ConfigUtils {
"""
|global {
| perm_cache = 2048;
| %s
| cache_dir = "%s";
| server_ip = %s;
| server_port = %d;
@@ -101,6 +102,7 @@ object ConfigUtils {
"""
|global {
| perm_cache = 2048;
| %s
| cache_dir = "%s";
| server_ip = %s;
| server_port = %d;
@@ -117,6 +119,8 @@ object ConfigUtils {
| ip = %s;
| timeout = 3;
| query_method = udp_only;
| %s
| policy = included;
| reject = %s;
| reject_policy = fail;
| reject_recursively = on;
@@ -77,8 +77,7 @@ object Utils {
new String(Base64.encode(mdg.digest, 0))
}
def dpToPx(context: Context, dp: Int): Int =
Math.round(dp * (context.getResources.getDisplayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT))
def dpToPx(context: Context, dp: Int): Int = Math.round(dp * context.getResources.getDisplayMetrics.density)
/*
* round or floor depending on whether you are using offsets(floor) or