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
d8f721db
Commit
d8f721db
authored
Sep 19, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine DNS resolve of GFWList and ChinaList, #887
parent
28339ce7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
6 deletions
+67
-6
src/main/jni/Android.mk
src/main/jni/Android.mk
+3
-1
src/main/jni/pdnsd
src/main/jni/pdnsd
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+13
-3
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+9
-1
src/main/scala/com/github/shadowsocks/utils/Constants.scala
src/main/scala/com/github/shadowsocks/utils/Constants.scala
+41
-0
No files found.
src/main/jni/Android.mk
View file @
d8f721db
...
...
@@ -371,7 +371,9 @@ PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
LOCAL_MODULE
:=
pdnsd
LOCAL_SRC_FILES
:=
$
(
PDNSD_SOURCES:
$(LOCAL_PATH)
/%
=
%
)
LOCAL_CFLAGS
:=
-DANDROID
-Wall
-O2
-I
$(LOCAL_PATH)
/pdnsd
\
-I
$(LOCAL_PATH)
/include/pdnsd
-I
$(LOCAL_PATH)
/include/pdnsd
-I
$(LOCAL_PATH)
/libancillary
LOCAL_STATIC_LIBRARIES
:=
libancillary
LOCAL_LDLIBS
:=
-llog
include
$(BUILD_EXECUTABLE)
...
...
pdnsd
@
69827590
Subproject commit
7a769627959ab2e27f0eadafcc89aed14d364ffd
Subproject commit
698275907b0c038b4eb40acbc067c8bf143e548f
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
d8f721db
...
...
@@ -190,10 +190,18 @@ class ShadowsocksNatService extends BaseService {
def
startDnsDaemon
()
{
val
conf
=
profile
.
route
match
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
|
Route
.
GFWLIST
=>
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
=>
{
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
getBlackList
,
profile
.
localPort
+
63
,
""
)
}
case
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
"119.29.29.29, 1.2.4.8"
,
profile
.
localPort
+
63
,
""
)
}
case
Route
.
CHINALIST
=>
{
ConfigUtils
.
PDNSD_UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
"8.8.8.8, 208.67.222.222"
,
profile
.
localPort
+
63
,
""
)
}
case
_
=>
{
ConfigUtils
.
PDNSD_LOCAL
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
profile
.
localPort
+
63
,
""
)
...
...
@@ -284,8 +292,10 @@ class ShadowsocksNatService extends BaseService {
init_sb
.
append
(
cmd_bypass
.
replace
(
"-p tcp -d 0.0.0.0"
,
"-m owner --uid-owner "
+
myUid
))
init_sb
.
append
(
cmd_bypass
.
replace
(
"-d 0.0.0.0"
,
"--dport 53"
))
init_sb
.
append
(
"iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:"
+
(
profile
.
localPort
+
53
))
if
(
profile
.
route
!=
Route
.
GFWLIST
&&
profile
.
route
!=
Route
.
CHINALIST
)
{
init_sb
.
append
(
"iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:"
+
(
profile
.
localPort
+
53
))
}
if
(!
profile
.
proxyApps
||
profile
.
bypass
)
{
http_sb
.
append
(
CMD_IPTABLES_DNAT_ADD_SOCKS
)
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
d8f721db
...
...
@@ -309,10 +309,18 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def
startDnsDaemon
()
{
val
ipv6
=
if
(
profile
.
ipv6
)
""
else
"reject = ::/0;"
val
conf
=
profile
.
route
match
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
|
Route
.
GFWLIST
=>
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
=>
{
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
getBlackList
,
profile
.
localPort
+
63
,
ipv6
)
}
case
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
"119.29.29.29, 1.2.4.8"
,
profile
.
localPort
+
63
,
ipv6
)
}
case
Route
.
CHINALIST
=>
{
ConfigUtils
.
PDNSD_UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
"8.8.8.8, 208.67.222.222"
,
profile
.
localPort
+
63
,
ipv6
)
}
case
_
=>
{
ConfigUtils
.
PDNSD_LOCAL
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
profile
.
localPort
+
63
,
ipv6
)
...
...
src/main/scala/com/github/shadowsocks/utils/Constants.scala
View file @
d8f721db
...
...
@@ -141,6 +141,47 @@ object ConfigUtils {
| soa=localhost,root.localhost,42,86400,900,86400,86400;
|}
"""
.
stripMargin
val
PDNSD_UDP
=
"""
|global {
| perm_cache = 2048;
| cache_dir = "%s";
| server_ip = %s;
| server_port = %d;
| query_method = udp_tcp;
| run_ipv4 = on;
| min_ttl = 15m;
| max_ttl = 1w;
| timeout = 10;
| daemon = off;
|}
|
|server {
| label = "remote-servers";
| ip = %s;
| timeout = 5;
| uptest = none;
| preset = on;
|}
|
|server {
| label = "local-server";
| ip = 127.0.0.1;
| port = %d;
| %s
| reject_policy = negate;
| reject_recursively = on;
|}
|
|rr {
| name=localhost;
| reverse=on;
| a=127.0.0.1;
| owner=localhost;
| soa=localhost,root.localhost,42,86400,900,86400,86400;
|}
"""
.
stripMargin
}
object
Key
{
...
...
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