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
122ca599
Commit
122ca599
authored
Sep 08, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GFWList support
parent
96fcec78
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
4073 additions
and
18 deletions
+4073
-18
.gitmodules
.gitmodules
+3
-0
src/main/assets/acl/gfwlist.acl
src/main/assets/acl/gfwlist.acl
+3993
-0
src/main/jni/Android.mk
src/main/jni/Android.mk
+49
-5
src/main/jni/pcre
src/main/jni/pcre
+1
-0
src/main/jni/shadowsocks-libev
src/main/jni/shadowsocks-libev
+1
-1
src/main/res/values/arrays.xml
src/main/res/values/arrays.xml
+2
-0
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+1
-0
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+14
-8
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+8
-4
src/main/scala/com/github/shadowsocks/utils/Constants.scala
src/main/scala/com/github/shadowsocks/utils/Constants.scala
+1
-0
No files found.
.gitmodules
View file @
122ca599
...
...
@@ -30,3 +30,6 @@
[submodule "src/main/jni/mbedtls"]
path = src/main/jni/mbedtls
url = https://github.com/ARMmbed/mbedtls
[submodule "src/main/jni/pcre"]
path = src/main/jni/pcre
url = https://android.googlesource.com/platform/external/pcre
src/main/assets/acl/gfwlist.acl
0 → 100644
View file @
122ca599
This diff is collapsed.
Click to expand it.
src/main/jni/Android.mk
View file @
122ca599
...
...
@@ -381,7 +381,9 @@ include $(BUILD_EXECUTABLE)
include
$(CLEAR_VARS)
SHADOWSOCKS_SOURCES
:=
local.c cache.c udprelay.c encrypt.c utils.c netutils.c json.c jconf.c acl.c android.c
SHADOWSOCKS_SOURCES
:=
local.c cache.c udprelay.c encrypt.c
\
utils.c netutils.c json.c jconf.c acl.c http.c tls.c rule.c
\
android.c
LOCAL_MODULE
:=
ss-local
LOCAL_SRC_FILES
:=
$(
addprefix
shadowsocks-libev/src/,
$(SHADOWSOCKS_SOURCES)
)
...
...
@@ -391,6 +393,7 @@ LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DMODULE_LOCAL \
-I
$(LOCAL_PATH)
/include
\
-I
$(LOCAL_PATH)
/libancillary
\
-I
$(LOCAL_PATH)
/mbedtls/include
\
-I
$(LOCAL_PATH)
/pcre
\
-I
$(LOCAL_PATH)
/shadowsocks-libev/libudns
\
-I
$(LOCAL_PATH)
/shadowsocks-libev/libcork/include
\
-I
$(LOCAL_PATH)
/shadowsocks-libev/libsodium/src/libsodium/include
\
...
...
@@ -399,7 +402,8 @@ LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DMODULE_LOCAL \
-I
$(LOCAL_PATH)
/shadowsocks-libev/libev
\
-I
$(LOCAL_PATH)
/include/shadowsocks-libev
LOCAL_STATIC_LIBRARIES
:=
libev libmbedtls libipset libcork libudns libsodium libancillary
LOCAL_STATIC_LIBRARIES
:=
libev libmbedtls libipset libcork libudns
\
libsodium libancillary libpcre
LOCAL_LDLIBS
:=
-llog
...
...
@@ -551,15 +555,55 @@ include $(BUILD_EXECUTABLE)
include
$(CLEAR_VARS)
LOCAL_MODULE
:=
mbedtls
LOCAL_MODULE
:=
mbedtls
LOCAL_C_INCLUDES
:=
$(LOCAL_PATH)
/mbedtls/include
LOCAL_C_INCLUDES
:=
$(LOCAL_PATH)
/mbedtls/include
MBEDTLS_SOURCES
:=
$(
wildcard
$(LOCAL_PATH)
/mbedtls/library/
*
.c
)
MBEDTLS_SOURCES
:=
$(
wildcard
$(LOCAL_PATH)
/mbedtls/library/
*
.c
)
LOCAL_SRC_FILES
:=
$
(
MBEDTLS_SOURCES:
$(LOCAL_PATH)
/%
=
%
)
include
$(BUILD_STATIC_LIBRARY)
########################################################
## pcre
########################################################
include
$(CLEAR_VARS)
LOCAL_MODULE
:=
pcre
LOCAL_CFLAGS
+=
-DHAVE_CONFIG_H
LOCAL_C_INCLUDES
:=
$(LOCAL_PATH)
/pcre/dist
$(LOCAL_PATH)
/pcre
libpcre_src_files
:=
\
pcre_chartables.c
\
dist/pcre_byte_order.c
\
dist/pcre_compile.c
\
dist/pcre_config.c
\
dist/pcre_dfa_exec.c
\
dist/pcre_exec.c
\
dist/pcre_fullinfo.c
\
dist/pcre_get.c
\
dist/pcre_globals.c
\
dist/pcre_jit_compile.c
\
dist/pcre_maketables.c
\
dist/pcre_newline.c
\
dist/pcre_ord2utf8.c
\
dist/pcre_refcount.c
\
dist/pcre_string_utils.c
\
dist/pcre_study.c
\
dist/pcre_tables.c
\
dist/pcre_ucd.c
\
dist/pcre_valid_utf8.c
\
dist/pcre_version.c
\
dist/pcre_xclass.c
LOCAL_SRC_FILES
:=
$(
addprefix
pcre/,
$(libpcre_src_files)
)
include
$(BUILD_STATIC_LIBRARY)
# Import cpufeatures
$(call
import-module,android/cpufeatures)
pcre
@
0ea98836
Subproject commit 0ea9883633b5d1fcfc777d57427bbf9b0098397e
shadowsocks-libev
@
42d9b68d
Subproject commit
d31210c21731ba9b055faccdc26c77b10773fe6
7
Subproject commit
42d9b68dcc1c6ccd9d766b3755e674c2d0c45a5
7
src/main/res/values/arrays.xml
View file @
122ca599
...
...
@@ -43,6 +43,7 @@
<item>
Bypass LAN
</item>
<item>
Bypass China
</item>
<item>
Bypass LAN
&
China
</item>
<item>
GFW List
</item>
</string-array>
<string-array
name=
"route_value"
>
...
...
@@ -50,6 +51,7 @@
<item>
bypass-lan
</item>
<item>
bypass-china
</item>
<item>
bypass-lan-china
</item>
<item>
gfwlist
</item>
</string-array>
<string-array
name=
"private_route"
>
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
122ca599
...
...
@@ -514,6 +514,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
crashRecovery
()
copyAssets
(
System
.
getABI
)
copyAssets
(
"acl"
)
val
ab
=
new
ArrayBuffer
[
String
]
for
(
executable
<-
EXECUTABLES
)
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
122ca599
...
...
@@ -71,7 +71,7 @@ class ShadowsocksNatService extends BaseService {
var
su
:
Shell.Interactive
=
_
def
startShadowsocksDaemon
()
{
if
(
profile
.
route
!=
Route
.
ALL
)
{
if
(
profile
.
route
!=
Route
.
ALL
&&
profile
.
route
!=
Route
.
GFWLIST
)
{
val
acl
:
Array
[
Array
[
String
]]
=
profile
.
route
match
{
case
Route
.
BYPASS_LAN
=>
Array
(
getResources
.
getStringArray
(
R
.
array
.
private_route
))
case
Route
.
BYPASS_CHN
=>
Array
(
getResources
.
getStringArray
(
R
.
array
.
chn_route
))
...
...
@@ -108,7 +108,10 @@ class ShadowsocksNatService extends BaseService {
if
(
profile
.
route
!=
Route
.
ALL
)
{
cmd
+=
"--acl"
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/acl.list"
)
if
(
profile
.
route
==
Route
.
GFWLIST
)
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/gfwlist.acl"
)
else
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/acl.list"
)
}
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
.
mkString
(
" "
))
...
...
@@ -184,12 +187,15 @@ class ShadowsocksNatService extends BaseService {
def
startDnsDaemon
()
{
val
conf
=
if
(
profile
.
route
==
Route
.
BYPASS_CHN
||
profile
.
route
==
Route
.
BYPASS_LAN_CHN
)
{
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
getBlackList
,
profile
.
localPort
+
63
,
""
)
}
else
{
ConfigUtils
.
PDNSD_LOCAL
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
profile
.
localPort
+
63
,
""
)
val
conf
=
profile
.
route
match
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
|
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
getBlackList
,
profile
.
localPort
+
63
,
""
)
}
case
_
=>
{
ConfigUtils
.
PDNSD_LOCAL
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
profile
.
localPort
+
63
,
""
)
}
}
Utils
.
printToFile
(
new
File
(
getApplicationInfo
.
dataDir
+
"/pdnsd-nat.conf"
))(
p
=>
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
122ca599
...
...
@@ -262,7 +262,10 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if
(
profile
.
route
!=
Route
.
ALL
)
{
cmd
+=
"--acl"
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/acl.list"
)
if
(
profile
.
route
==
Route
.
GFWLIST
)
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/gfwlist.acl"
)
else
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/acl.list"
)
}
if
(
TcpFastOpen
.
sendEnabled
)
cmd
+=
"--fast-open"
...
...
@@ -302,11 +305,12 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def
startDnsDaemon
()
{
val
ipv6
=
if
(
profile
.
ipv6
)
""
else
"reject = ::/0;"
val
conf
=
{
if
(
profile
.
route
==
Route
.
BYPASS_CHN
||
profile
.
route
==
Route
.
BYPASS_LAN_CHN
)
{
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
,
getBlackList
,
profile
.
localPort
+
63
,
ipv6
)
}
else
{
}
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 @
122ca599
...
...
@@ -194,4 +194,5 @@ object Route {
val
BYPASS_LAN
=
"bypass-lan"
val
BYPASS_CHN
=
"bypass-china"
val
BYPASS_LAN_CHN
=
"bypass-lan-china"
val
GFWLIST
=
"gfwlist"
}
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