Compare commits

...
15 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
Max Lv 792870b289 Update ACL 2016-09-29 11:53:40 +08:00
Max Lv 3b6eff6d9d Fix #905 2016-09-28 14:36:36 +08:00
28 changed files with 134 additions and 58 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? ### What did you do?
@@ -14,5 +35,3 @@ Please answer these questions before submitting your issue. Thanks!
### What did you see instead? ### 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 ### LICENSE
Copyright (C) 2016 by Max Lv <<max.c.lv@gmail.com>> 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 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 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" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks" xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
android:versionCode="160" android:versionCode="164"
android:versionName="3.2.0"> android:versionName="3.2.4">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+1
View File
@@ -8213,6 +8213,7 @@
.*\.eu .*\.eu
.*\.ru .*\.ru
.*\.au .*\.au
.*\.google\.cn
.*\.google\.com .*\.google\.com
.*\.google\.ad .*\.google\.ad
.*\.google\.ae .*\.google\.ae
+1
View File
@@ -8227,6 +8227,7 @@
.*\.eu .*\.eu
.*\.ru .*\.ru
.*\.au .*\.au
.*\.google\.cn
.*\.google\.com .*\.google\.com
.*\.google\.ad .*\.google\.ad
.*\.google\.ae .*\.google\.ae
+1
View File
@@ -3795,6 +3795,7 @@
.*\.eu .*\.eu
.*\.ru .*\.ru
.*\.au .*\.au
.*\.google\.cn
.*\.google\.com .*\.google\.com
.*\.google\.ad .*\.google\.ad
.*\.google\.ae .*\.google\.ae
+1 -1
View File
@@ -275,7 +275,7 @@ img {
<body> <body>
<p>A <a href="http://shadowsocks.org">Shadowsocks</a> client for Android, written in Scala.</p> <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 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 <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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
-1
View File
@@ -116,6 +116,5 @@
<item>196.0.0.0/6</item> <item>196.0.0.0/6</item>
<item>200.0.0.0/5</item> <item>200.0.0.0/5</item>
<item>208.0.0.0/4</item> <item>208.0.0.0/4</item>
<item>224.0.0.0/3</item>
</string-array> </string-array>
</resources> </resources>
+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:fadeScrollbars">true</item>
<item name="android:scrollbars">vertical</item> <item name="android:scrollbars">vertical</item>
</style> </style>
<style name="NumberPickerStyle">
<item name="android:textSize">14sp</item>
</style>
</resources> </resources>
+15 -15
View File
@@ -2,34 +2,34 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.github.shadowsocks"> xmlns:app="http://schemas.android.com/apk/res/com.github.shadowsocks">
<tk.mygod.preference.PreferenceCategory <be.mygod.preference.PreferenceCategory
android:title="@string/proxy_cat"> android:title="@string/proxy_cat">
<tk.mygod.preference.EditTextPreference <be.mygod.preference.EditTextPreference
android:key="profileName" android:key="profileName"
android:persistent="false" android:persistent="false"
android:summary="%s" android:summary="%s"
android:title="@string/profile_name"/> android:title="@string/profile_name"/>
<tk.mygod.preference.EditTextPreference <be.mygod.preference.EditTextPreference
android:key="proxy" android:key="proxy"
android:persistent="false" android:persistent="false"
android:summary="%s" android:summary="%s"
android:title="@string/proxy"/> android:title="@string/proxy"/>
<tk.mygod.preference.NumberPickerPreference <be.mygod.preference.NumberPickerPreference
app:min="1" app:min="1"
app:max="65535" app:max="65535"
android:key="remotePortNum" android:key="remotePortNum"
android:persistent="false" android:persistent="false"
android:summary="%d" android:summary="%d"
android:title="@string/remote_port"/> android:title="@string/remote_port"/>
<tk.mygod.preference.NumberPickerPreference <be.mygod.preference.NumberPickerPreference
app:min="1025" app:min="1025"
app:max="65535" app:max="65535"
android:key="localPortNum" android:key="localPortNum"
android:persistent="false" android:persistent="false"
android:summary="%d" android:summary="%d"
android:title="@string/port"/> android:title="@string/port"/>
<tk.mygod.preference.EditTextPreference <be.mygod.preference.EditTextPreference
android:inputType="textPassword" android:inputType="textPassword"
android:key="sitekey" android:key="sitekey"
android:persistent="false" android:persistent="false"
@@ -48,9 +48,9 @@
android:summary="@string/onetime_auth_summary" android:summary="@string/onetime_auth_summary"
android:title="@string/onetime_auth"/> 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:title="@string/feature_cat">
<android.support.v7.preference.DropDownPreference <android.support.v7.preference.DropDownPreference
@@ -76,9 +76,9 @@
android:summary="@string/udp_dns_summary" android:summary="@string/udp_dns_summary"
android:title="@string/udp_dns"/> 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"> android:title="@string/kcp">
<SwitchPreference <SwitchPreference
@@ -87,7 +87,7 @@
android:summary="@string/kcp_summary" android:summary="@string/kcp_summary"
android:title="@string/kcp"/> android:title="@string/kcp"/>
<tk.mygod.preference.NumberPickerPreference <be.mygod.preference.NumberPickerPreference
app:min="1" app:min="1"
app:max="65535" app:max="65535"
android:key="kcpPort" android:key="kcpPort"
@@ -95,15 +95,15 @@
android:summary="@string/kcp_port_summary" android:summary="@string/kcp_port_summary"
android:title="@string/kcp_port"/> android:title="@string/kcp_port"/>
<tk.mygod.preference.EditTextPreference <be.mygod.preference.EditTextPreference
android:key="kcpcli" android:key="kcpcli"
android:persistent="false" android:persistent="false"
android:summary="%s" android:summary="%s"
android:title="@string/kcpcli"/> 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 <SwitchPreference
android:key="isAutoConnect" android:key="isAutoConnect"
@@ -126,7 +126,7 @@
android:summary="@string/flush_dnscache_summary"/> android:summary="@string/flush_dnscache_summary"/>
<Preference android:key="about" android:title="@string/about"/> <Preference android:key="about" android:title="@string/about"/>
</tk.mygod.preference.PreferenceCategory> </be.mygod.preference.PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
@@ -1,4 +1,4 @@
package tk.mygod.preference package be.mygod.preference
import android.content.Context import android.content.Context
import android.support.v7.preference.{EditTextPreference => Parent} 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.content.Context
import android.support.v14.preference.PreferenceDialogFragment 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.Context
import android.content.res.TypedArray import android.content.res.TypedArray
import android.support.v7.preference.DialogPreference import android.support.v7.preference.DialogPreference
import android.util.AttributeSet import android.util.AttributeSet
import android.view.ContextThemeWrapper
import android.widget.NumberPicker import android.widget.NumberPicker
import com.github.shadowsocks.R import com.github.shadowsocks.R
class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null) class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null)
extends DialogPreference(context, attrs) with SummaryPreference { 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 = _ private var value: Int = _
{ {
@@ -1,4 +1,4 @@
package tk.mygod.preference package be.mygod.preference
import android.content.Context import android.content.Context
import android.support.v14.preference.PreferenceDialogFragment import android.support.v14.preference.PreferenceDialogFragment
@@ -1,4 +1,4 @@
package tk.mygod.preference package be.mygod.preference
import android.content.Context import android.content.Context
import android.support.v7.preference.{PreferenceViewHolder, PreferenceCategory => Base} 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.app.DialogFragment
import android.os.Bundle import android.os.Bundle
@@ -1,4 +1,4 @@
package tk.mygod.preference package be.mygod.preference
import java.lang.reflect.Field import java.lang.reflect.Field
import java.util.List import java.util.List
@@ -1,4 +1,4 @@
package tk.mygod.preference package be.mygod.preference
import android.support.v7.preference.Preference import android.support.v7.preference.Preference
@@ -70,6 +70,7 @@ trait BaseService extends Service {
var callbacksCount: Int = _ var callbacksCount: Int = _
lazy val handler = new Handler(getMainLooper) lazy val handler = new Handler(getMainLooper)
lazy val restartHanlder = new Handler(getMainLooper) lazy val restartHanlder = new Handler(getMainLooper)
lazy val protectPath = getApplicationInfo.dataDir + "/protect_path"
private val closeReceiver: BroadcastReceiver = (context: Context, intent: Intent) => { private val closeReceiver: BroadcastReceiver = (context: Context, intent: Intent) => {
Toast.makeText(context, R.string.stopping, Toast.LENGTH_SHORT).show() Toast.makeText(context, R.string.stopping, Toast.LENGTH_SHORT).show()
@@ -298,4 +299,16 @@ trait BaseService extends Service {
state = s 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" , "-u"
, "-t" , "10" , "-t" , "10"
, "-b" , "127.0.0.1" , "-b" , "127.0.0.1"
, "-L" , "8.8.8.8:53"
, "-l" , (profile.localPort + 53).toString , "-l" , (profile.localPort + 53).toString
, "-P" , getApplicationInfo.dataDir , "-P" , getApplicationInfo.dataDir
, "-c" , getApplicationInfo.dataDir + "/ss-tunnel-nat.conf") , "-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 (profile.auth) cmd += "-A"
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" ")) if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
@@ -178,18 +183,22 @@ class ShadowsocksNatService extends BaseService {
def startDnsDaemon() { def startDnsDaemon() {
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
val conf = profile.route match { val conf = profile.route match {
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => { 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", "", profile.localPort + 63, "") "127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
getBlackList, reject, profile.localPort + 63, reject)
} }
case Route.CHINALIST => { 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", "", profile.localPort + 63, "") "127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
"", reject, profile.localPort + 63, reject)
} }
case _ => { 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, "") "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.database.Profile
import com.github.shadowsocks.preferences.KcpCliPreferenceDialogFragment import com.github.shadowsocks.preferences.KcpCliPreferenceDialogFragment
import com.github.shadowsocks.utils.{Key, TcpFastOpen, Utils} import com.github.shadowsocks.utils.{Key, TcpFastOpen, Utils}
import tk.mygod.preference._ import be.mygod.preference._
object ShadowsocksSettings { object ShadowsocksSettings {
// Constants // Constants
@@ -193,7 +193,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
val cmd = ArrayBuffer(getApplicationInfo.dataDir + "/kcptun" val cmd = ArrayBuffer(getApplicationInfo.dataDir + "/kcptun"
, "-r", profile.host + ":" + profile.kcpPort , "-r", profile.host + ":" + profile.kcpPort
, "-l", "127.0.0.1:" + (profile.localPort + 90) , "-l", "127.0.0.1:" + (profile.localPort + 90)
, "--path", getApplicationInfo.dataDir + "/protect_path") , "--path", protectPath)
try cmd ++= Utils.translateCommandline(profile.kcpcli) catch { try cmd ++= Utils.translateCommandline(profile.kcpcli) catch {
case exc: Exception => throw KcpcliParseException(exc) case exc: Exception => throw KcpcliParseException(exc)
} }
@@ -284,10 +284,15 @@ class ShadowsocksVpnService extends VpnService with BaseService {
, "-V" , "-V"
, "-t", "10" , "-t", "10"
, "-b", "127.0.0.1" , "-b", "127.0.0.1"
, "-L", "8.8.8.8:53"
, "-P", getApplicationInfo.dataDir , "-P", getApplicationInfo.dataDir
, "-c", getApplicationInfo.dataDir + "/ss-tunnel-vpn.conf") , "-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 (profile.auth) cmd += "-A"
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" ")) if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
@@ -296,19 +301,22 @@ class ShadowsocksVpnService extends VpnService with BaseService {
} }
def startDnsDaemon() { def startDnsDaemon() {
val ipv6 = if (profile.ipv6) "" else "reject = ::/0;" 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 { val conf = profile.route match {
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => { case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114", ipv6, profile.localPort + 63, ipv6) "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 => { case Route.CHINALIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, protect, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 208.67.222.222", ipv6, profile.localPort + 63, ipv6) "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 _ => { 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, ipv6) "0.0.0.0", profile.localPort + 53, profile.localPort + 63, reject)
} }
} }
Utils.printToFile(new File(getApplicationInfo.dataDir + "/pdnsd-vpn.conf"))(p => { Utils.printToFile(new File(getApplicationInfo.dataDir + "/pdnsd-vpn.conf"))(p => {
@@ -3,7 +3,7 @@ package com.github.shadowsocks.preferences
import android.app.AlertDialog import android.app.AlertDialog
import android.content.DialogInterface import android.content.DialogInterface
import eu.chainfire.libsuperuser.Shell import eu.chainfire.libsuperuser.Shell
import tk.mygod.preference.EditTextPreferenceDialogFragment import be.mygod.preference.EditTextPreferenceDialogFragment
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._
@@ -69,6 +69,7 @@ object ConfigUtils {
""" """
|global { |global {
| perm_cache = 2048; | perm_cache = 2048;
| %s
| cache_dir = "%s"; | cache_dir = "%s";
| server_ip = %s; | server_ip = %s;
| server_port = %d; | server_port = %d;
@@ -83,7 +84,7 @@ object ConfigUtils {
| label = "local"; | label = "local";
| ip = 127.0.0.1; | ip = 127.0.0.1;
| port = %d; | port = %d;
| %s | reject = %s;
| reject_policy = negate; | reject_policy = negate;
| reject_recursively = on; | reject_recursively = on;
|} |}
@@ -101,6 +102,7 @@ object ConfigUtils {
""" """
|global { |global {
| perm_cache = 2048; | perm_cache = 2048;
| %s
| cache_dir = "%s"; | cache_dir = "%s";
| server_ip = %s; | server_ip = %s;
| server_port = %d; | server_port = %d;
@@ -118,7 +120,9 @@ object ConfigUtils {
| timeout = 3; | timeout = 3;
| query_method = udp_only; | query_method = udp_only;
| %s | %s
| reject_policy = negate; | policy = included;
| reject = %s;
| reject_policy = fail;
| reject_recursively = on; | reject_recursively = on;
|} |}
| |
@@ -127,7 +131,7 @@ object ConfigUtils {
| ip = 127.0.0.1; | ip = 127.0.0.1;
| query_method = tcp_only; | query_method = tcp_only;
| port = %d; | port = %d;
| %s | reject = %s;
| reject_policy = negate; | reject_policy = negate;
| reject_recursively = on; | reject_recursively = on;
|} |}
@@ -77,8 +77,7 @@ object Utils {
new String(Base64.encode(mdg.digest, 0)) new String(Base64.encode(mdg.digest, 0))
} }
def dpToPx(context: Context, dp: Int): Int = def dpToPx(context: Context, dp: Int): Int = Math.round(dp * context.getResources.getDisplayMetrics.density)
Math.round(dp * (context.getResources.getDisplayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT))
/* /*
* round or floor depending on whether you are using offsets(floor) or * round or floor depending on whether you are using offsets(floor) or