Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
d197ec2f
Commit
d197ec2f
authored
Nov 30, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add remote DNS setting #991
parent
a7c72988
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
8 deletions
+38
-8
src/main/res/values-zh-rCN/strings.xml
src/main/res/values-zh-rCN/strings.xml
+2
-0
src/main/res/values-zh-rTW/strings.xml
src/main/res/values-zh-rTW/strings.xml
+2
-0
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+2
-0
src/main/res/xml/pref_all.xml
src/main/res/xml/pref_all.xml
+6
-0
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+4
-3
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+9
-1
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+4
-3
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
...main/scala/com/github/shadowsocks/database/DBHelper.scala
+5
-1
src/main/scala/com/github/shadowsocks/database/Profile.scala
src/main/scala/com/github/shadowsocks/database/Profile.scala
+3
-0
src/main/scala/com/github/shadowsocks/utils/Constants.scala
src/main/scala/com/github/shadowsocks/utils/Constants.scala
+1
-0
No files found.
src/main/res/values-zh-rCN/strings.xml
View file @
d197ec2f
...
...
@@ -68,6 +68,8 @@
<string
name=
"nat"
>
NAT 模式 (仅限调试)
</string>
<string
name=
"nat_summary"
>
从 VPN 模式切换为 NAT 模式,需要 ROOT 权限
</string>
<string
name=
"remote_dns"
>
远程 DNS
</string>
<string
name=
"remote_dns_summary"
>
用于远程域名解析的 DNS 服务器 (默认为 8.8.8.8)
</string>
<string
name=
"udp_dns"
>
UDP 转发
</string>
<string
name=
"udp_dns_summary"
>
由远程服务器转发 UDP 协议的数据包
</string>
...
...
src/main/res/values-zh-rTW/strings.xml
View file @
d197ec2f
...
...
@@ -69,6 +69,8 @@
<string
name=
"nat"
>
NAT 模式 (已過時)
</string>
<string
name=
"nat_summary"
>
使用 NAT 模式代替 VPN 模式,需要 ROOT 權限
</string>
<string
name=
"remote_dns"
>
遠程 DNS
</string>
<string
name=
"remote_dns_summary"
>
用於遠程域名解析的 DNS 伺服器 (默認為 8.8.8.8)
</string>
<string
name=
"udp_dns"
>
UDP 轉送
</string>
<string
name=
"udp_dns_summary"
>
向遠端轉送 UDP 封包
</string>
...
...
src/main/res/values/strings.xml
View file @
d197ec2f
...
...
@@ -10,6 +10,8 @@
<string
name=
"profile_summary"
>
Switch to another profile or add new profiles
</string>
<string
name=
"nat"
>
NAT mode (deprecated)
</string>
<string
name=
"nat_summary"
>
Use NAT mode instead of VPN mode. Requires ROOT permission.
</string>
<string
name=
"remote_dns"
>
Remote DNS
</string>
<string
name=
"remote_dns_summary"
>
DNS server for remote hostname resolution. (Default 8.8.8.8)
</string>
<string
name=
"stat"
>
Network Traffic
</string>
<string
name=
"stat_summary"
>
Sent: \t\t\t\t\t%3$s\t↑\t%1$s/s\nReceived: \t%4$s\t↓\t%2$s/s
</string>
<string
name=
"stat_profiles"
>
\n%1$s↑\t%2$s↓
</string>
...
...
src/main/res/xml/pref_all.xml
View file @
d197ec2f
...
...
@@ -60,6 +60,10 @@
android:entryValues=
"@array/route_value"
android:summary=
"%s"
android:title=
"@string/route_list"
/>
<be.mygod.preference.EditTextPreference
android:key=
"remoteDns"
android:title=
"@string/remote_dns"
android:summary=
"@string/remote_dns_summary"
/>
<SwitchPreference
android:key=
"isIpv6"
android:persistent=
"false"
...
...
@@ -119,8 +123,10 @@
<SwitchPreference
android:key=
"isNAT"
android:title=
"@string/nat"
android:summary=
"@string/nat_summary"
/>
<Preference
android:key=
"recovery"
android:title=
"@string/recovery"
android:summary=
"@string/recovery_summary"
/>
<Preference
android:key=
"about"
android:title=
"@string/about"
/>
</be.mygod.preference.PreferenceCategory>
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
d197ec2f
...
...
@@ -123,10 +123,11 @@ class ShadowsocksNatService extends BaseService {
,
"-c"
,
getApplicationInfo
.
dataDir
+
"/ss-tunnel-nat.conf"
)
cmd
+=
"-L"
if
(
profile
.
route
==
Route
.
CHINALIST
)
cmd
+=
"114.114.114.114:53"
else
if
(
profile
.
remoteDns
==
null
)
cmd
+=
"8.8.8.8:53"
else
cmd
+=
profile
.
remoteDns
+
":53"
if
(
profile
.
auth
)
cmd
+=
"-A"
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
d197ec2f
...
...
@@ -42,7 +42,7 @@ object ShadowsocksSettings {
private
final
val
TAG
=
"ShadowsocksSettings"
private
val
PROXY_PREFS
=
Array
(
Key
.
name
,
Key
.
host
,
Key
.
remotePort
,
Key
.
localPort
,
Key
.
password
,
Key
.
method
,
Key
.
auth
,
Key
.
kcp
,
Key
.
kcpPort
,
Key
.
kcpcli
)
private
val
FEATURE_PREFS
=
Array
(
Key
.
route
,
Key
.
proxyApps
,
Key
.
udpdns
,
Key
.
ipv6
)
private
val
FEATURE_PREFS
=
Array
(
Key
.
route
,
Key
.
remoteDns
,
Key
.
proxyApps
,
Key
.
udpdns
,
Key
.
ipv6
)
// Helper functions
def
updateDropDownPreference
(
pref
:
Preference
,
value
:
String
)
{
...
...
@@ -76,6 +76,10 @@ object ShadowsocksSettings {
case
Key
.
password
=>
updateEditTextPreference
(
pref
,
profile
.
password
)
pref
.
setSummary
(
if
(
demo
)
"\u2022"
*
32
else
"%s"
)
case
Key
.
remoteDns
=>
updateEditTextPreference
(
pref
,
profile
.
remoteDns
)
if
(
profile
.
remoteDns
!=
null
)
pref
.
setSummary
(
if
(
demo
)
"8.8.8.8"
else
"%s"
)
case
Key
.
method
=>
updateDropDownPreference
(
pref
,
profile
.
method
)
case
Key
.
route
=>
updateDropDownPreference
(
pref
,
profile
.
route
)
case
Key
.
proxyApps
=>
updateSwitchPreference
(
pref
,
profile
.
proxyApps
)
...
...
@@ -129,6 +133,10 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
profile
.
route
=
value
.
asInstanceOf
[
String
]
app
.
profileManager
.
updateProfile
(
profile
)
})
findPreference
(
Key
.
remoteDns
).
setOnPreferenceChangeListener
((
_
,
value
)
=>
{
profile
.
remoteDns
=
value
.
asInstanceOf
[
String
]
app
.
profileManager
.
updateProfile
(
profile
)
})
findPreference
(
Key
.
kcp
).
setOnPreferenceChangeListener
((
_
,
value
)
=>
{
profile
.
kcp
=
value
.
asInstanceOf
[
Boolean
]
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
d197ec2f
...
...
@@ -274,10 +274,11 @@ class ShadowsocksVpnService extends VpnService with BaseService {
,
"-c"
,
getApplicationInfo
.
dataDir
+
"/ss-tunnel-vpn.conf"
)
cmd
+=
"-L"
if
(
profile
.
route
==
Route
.
CHINALIST
)
cmd
+=
"114.114.114.114:53"
else
if
(
profile
.
remoteDns
==
null
)
cmd
+=
"8.8.8.8:53"
else
cmd
+=
profile
.
remoteDns
+
":53"
if
(
profile
.
auth
)
cmd
+=
"-A"
...
...
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
View file @
d197ec2f
...
...
@@ -46,7 +46,7 @@ object DBHelper {
}
class
DBHelper
(
val
context
:
Context
)
extends
OrmLiteSqliteOpenHelper
(
context
,
DBHelper
.
PROFILE
,
null
,
2
0
)
{
extends
OrmLiteSqliteOpenHelper
(
context
,
DBHelper
.
PROFILE
,
null
,
2
1
)
{
import
DBHelper._
lazy
val
profileDao
:
Dao
[
Profile
,
Int
]
=
getDao
(
classOf
[
Profile
])
...
...
@@ -125,6 +125,10 @@ class DBHelper(val context: Context)
}
else
if
(
oldVersion
<
19
)
{
profileDao
.
executeRawNoArgs
(
"UPDATE `profile` SET kcpPort = 8399 WHERE kcpPort = 0;"
)
}
if
(
oldVersion
<
21
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN remoteDns VARCHAR DEFAULT '8.8.8.8';"
)
}
}
catch
{
case
ex
:
Exception
=>
app
.
track
(
ex
)
...
...
src/main/scala/com/github/shadowsocks/database/Profile.scala
View file @
d197ec2f
...
...
@@ -52,6 +52,9 @@ class Profile {
@DatabaseField
var
route
:
String
=
"all"
@DatabaseField
var
remoteDns
:
String
=
"8.8.8.8"
@DatabaseField
var
proxyApps
:
Boolean
=
false
...
...
src/main/scala/com/github/shadowsocks/utils/Constants.scala
View file @
d197ec2f
...
...
@@ -149,6 +149,7 @@ object Key {
val
method
=
"encMethod"
val
remotePort
=
"remotePortNum"
val
localPort
=
"localPortNum"
val
remoteDns
=
"remoteDns"
val
profileTip
=
"profileTip"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment