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
aa711425
Commit
aa711425
authored
Jun 27, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using jni based to WAR Android L issue
parent
2475d7e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
21 deletions
+33
-21
build-ndk.sh
build-ndk.sh
+1
-1
jni/Android.mk
jni/Android.mk
+24
-9
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+3
-2
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+5
-9
No files found.
build-ndk.sh
View file @
aa711425
...
...
@@ -4,7 +4,7 @@ ndk-build
mkdir
-p
src/main/assets/armeabi
mkdir
-p
src/main/assets/armeabi-v7a
mkdir
-p
src/main/assets/x86
for
app
in
ip6tables iptables pdnsd redsocks ss-
local ss-tunnel tun2socks
for
app
in
ip6tables iptables pdnsd redsocks ss-
tunnel
do
mv
libs/armeabi/
$app
src/main/assets/armeabi/
mv
libs/armeabi-v7a/
$app
src/main/assets/armeabi-v7a/
...
...
jni/Android.mk
View file @
aa711425
...
...
@@ -143,16 +143,30 @@ LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd
include
$(BUILD_EXECUTABLE)
########################################################
## shadowsocks local
## pdnsd library
########################################################
include
$(CLEAR_VARS)
PDNSD_SOURCES
:=
$(
wildcard
$(LOCAL_PATH)
/pdnsd/src/
*
.c
)
main-jni.cpp
LOCAL_MODULE
:=
pdnsd-jni
LOCAL_SRC_FILES
:=
$
(
PDNSD_SOURCES:
$(LOCAL_PATH)
/%
=
%
)
LOCAL_CFLAGS
:=
-Wall
-O2
-DPDNSD_JNI
-I
$(LOCAL_PATH)
/pdnsd
include
$(BUILD_SHARED_LIBRARY)
########################################################
## shadowsocks local library
########################################################
include
$(CLEAR_VARS)
SHADOWSOCKS_SOURCES
:=
local.c cache.c udprelay.c encrypt.c utils.c json.c jconf.c acl.c
LOCAL_MODULE
:=
ss-local
LOCAL_SRC_FILES
:=
$(
addprefix
shadowsocks/src/,
$(SHADOWSOCKS_SOURCES)
)
LOCAL_CFLAGS
:=
-Wall
-O2
-fno-strict-aliasing
-DUDPRELAY_LOCAL
\
LOCAL_MODULE
:=
ss-local
-jni
LOCAL_SRC_FILES
:=
$(
addprefix
shadowsocks/src/,
$(SHADOWSOCKS_SOURCES)
)
main-jni.cpp
LOCAL_CFLAGS
:=
-Wall
-O2
-fno-strict-aliasing
-DUDPRELAY_LOCAL
-DSSLOCAL_JNI
\
-DUSE_CRYPTO_OPENSSL
-DANDROID
-DHAVE_CONFIG_H
\
-I
$(LOCAL_PATH)
/libev/
\
-I
$(LOCAL_PATH)
/openssl/include
\
...
...
@@ -163,7 +177,7 @@ LOCAL_STATIC_LIBRARIES := libev libcrypto libipset libcork
LOCAL_LDLIBS
:=
-llog
include
$(BUILD_
EXECUTABLE
)
include
$(BUILD_
SHARED_LIBRARY
)
########################################################
## shadowsocks tunnel
...
...
@@ -204,7 +218,7 @@ LOCAL_STATIC_LIBRARIES := cpufeatures
include
$(BUILD_SHARED_LIBRARY)
########################################################
## tun2socks
## tun2socks
-library
########################################################
include
$(CLEAR_VARS)
...
...
@@ -214,6 +228,7 @@ LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR
LOCAL_CFLAGS
+=
-DBADVPN_USE_SELFPIPE
-DBADVPN_USE_EPOLL
LOCAL_CFLAGS
+=
-DBADVPN_LITTLE_ENDIAN
-DBADVPN_THREAD_SAFE
LOCAL_CFLAGS
+=
-DNDEBUG
-DANDROID
LOCAL_CFLAGS
+=
-DTUN2SOCKS_JNI
LOCAL_C_INCLUDES
:=
\
$(LOCAL_PATH)
/badvpn/lwip/src/include/ipv4
\
...
...
@@ -283,13 +298,13 @@ TUN2SOCKS_SOURCES := \
tun2socks/SocksUdpGwClient.c
\
udpgw_client/UdpGwClient.c
LOCAL_MODULE
:=
tun2socks
LOCAL_MODULE
:=
tun2socks
-jni
LOCAL_LDLIBS
:=
-ldl
-llog
LOCAL_SRC_FILES
:=
$(
addprefix
badvpn/,
$(TUN2SOCKS_SOURCES)
)
LOCAL_SRC_FILES
:=
$(
addprefix
badvpn/,
$(TUN2SOCKS_SOURCES)
)
main-jni.cpp
include
$(BUILD_
EXECUTABLE
)
include
$(BUILD_
SHARED_LIBRARY
)
# OpenSSL
openssl_subdirs
:=
$(
addprefix
$(LOCAL_PATH)
/openssl/,
$(
addsuffix
/Android.mk,
\
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
aa711425
...
...
@@ -119,12 +119,13 @@ class ShadowsocksNatService extends Service with BaseService {
}
val
args
=
(
Path
.
BASE
+
"ss-local -b 127.0.0.1 -s
'%s' -p '%d' -l '%d' -k ''%s' -m '%s'
-f "
+
"ss-local -b 127.0.0.1 -s
%s -p %d -l %d -k %s -m %s
-f "
+
Path
.
BASE
+
"ss-local.pid"
)
.
format
(
config
.
proxy
,
config
.
remotePort
,
config
.
localPort
,
config
.
sitekey
,
config
.
encMethod
)
val
cmd
=
if
(
config
.
isGFWList
&&
isACLEnabled
)
args
+
" --acl "
+
Path
.
BASE
+
"chn.acl"
else
args
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
Console
.
runCommand
(
cmd
)
Core
.
sslocal
(
cmd
.
split
(
" "
))
}
def
startDnsDaemon
()
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
aa711425
...
...
@@ -82,11 +82,11 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def
startShadowsocksDaemon
()
{
val
cmd
:
String
=
(
Path
.
BASE
+
"ss-local -b 127.0.0.1 -s
'%s' -p '%d' -l '%d' -k '%s' -m '%s'
-u -f "
+
"ss-local -b 127.0.0.1 -s
%s -p %d -l %d -k %s -m %s
-u -f "
+
Path
.
BASE
+
"ss-local.pid"
)
.
format
(
config
.
proxy
,
config
.
remotePort
,
config
.
localPort
,
config
.
sitekey
,
config
.
encMethod
)
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
)
Core
.
sslocal
(
cmd
.
split
(
" "
)
)
}
def
startDnsDaemon
()
{
...
...
@@ -101,7 +101,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
})
val
cmd
=
Path
.
BASE
+
"pdnsd -c "
+
Path
.
BASE
+
"pdnsd.conf"
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
)
Core
.
pdnsd
(
cmd
.
split
(
" "
)
)
}
def
getVersionName
:
String
=
{
...
...
@@ -202,10 +202,9 @@ class ShadowsocksVpnService extends VpnService with BaseService {
else
cmd
+=
" --dnsgw %s:8153"
.
format
(
PRIVATE_VLAN
.
format
(
"1"
))
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
)
Core
.
tun2socks
(
cmd
.
split
(
" "
)
)
}
/** Called when the activity is first created. */
...
...
@@ -260,11 +259,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
val
ab
=
new
ArrayBuffer
[
String
]
ab
.
append
(
"kill -9 `cat "
+
Path
.
BASE
+
"ss-local.pid`"
)
ab
.
append
(
"killall -9 ss-local"
)
ab
.
append
(
"kill -9 `cat "
+
Path
.
BASE
+
"tun2socks.pid`"
)
ab
.
append
(
"killall -9 tun2socks"
)
ab
.
append
(
"kill -15 `cat "
+
Path
.
BASE
+
"pdnsd.pid`"
)
ab
.
append
(
"killall -15 pdnsd"
)
Console
.
runCommand
(
ab
.
toArray
)
}
...
...
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