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
185e7608
Commit
185e7608
authored
Nov 25, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fake proc name failed on LRX21R
parent
d844fc24
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
20 deletions
+134
-20
build.sh
build.sh
+1
-1
src/main/java/com/github/shadowsocks/Tun2Socks.java
src/main/java/com/github/shadowsocks/Tun2Socks.java
+49
-0
src/main/jni/Android.mk
src/main/jni/Android.mk
+3
-3
src/main/jni/badvpn/tun2socks/tun2socks.c
src/main/jni/badvpn/tun2socks/tun2socks.c
+0
-11
src/main/jni/tun2socks-jni.cpp
src/main/jni/tun2socks-jni.cpp
+80
-0
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+1
-5
No files found.
build.sh
View file @
185e7608
...
@@ -15,7 +15,7 @@ rm -rf assets/armeabi-v7a
...
@@ -15,7 +15,7 @@ rm -rf assets/armeabi-v7a
rm
-rf
assets/x86
rm
-rf
assets/x86
mkdir
-p
assets/armeabi-v7a
mkdir
-p
assets/armeabi-v7a
mkdir
-p
assets/x86
mkdir
-p
assets/x86
for
app
in
pdnsd redsocks ss-local ss-tunnel
tun2socks
for
app
in
pdnsd redsocks ss-local ss-tunnel
do
do
try
mv
libs/armeabi-v7a/
$app
assets/armeabi-v7a/
try
mv
libs/armeabi-v7a/
$app
assets/armeabi-v7a/
try
mv
libs/x86/
$app
assets/x86/
try
mv
libs/x86/
$app
assets/x86/
...
...
src/main/java/com/github/shadowsocks/Tun2Socks.java
0 → 100644
View file @
185e7608
/* Shadowsocks - A shadowsocks client for Android
* Copyright (C) 2014 <max.c.lv@gmail.com>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* ___====-_ _-====___
* _--^^^#####// \\#####^^^--_
* _-^##########// ( ) \\##########^-_
* -############// |\^^/| \\############-
* _/############// (@::@) \\############\_
* /#############(( \\// ))#############\
* -###############\\ (oo) //###############-
* -#################\\ / VV \ //#################-
* -###################\\/ \//###################-
* _#/|##########/\######( /\ )######/\##########|\#_
* |/ |#/\#/\#/\/ \#/\##\ | | /##/\#/ \/\#/\#/\#| \|
* ` |/ V V ` V \#\| | | |/#/ V ' V V \| '
* ` ` ` ` / | | | | \ ' ' ' '
* ( | | | | )
* __\ | | | | /__
* (vvv(VVV)(VVV)vvv)
*
* HERE BE DRAGONS
*
*/
package
com.github.shadowsocks
;
public
class
Tun2Socks
{
static
{
java
.
lang
.
System
.
loadLibrary
(
"tun2socks"
);
}
public
static
native
void
start
(
String
[]
cmd
);
public
static
native
void
stop
();
}
src/main/jni/Android.mk
View file @
185e7608
...
@@ -214,7 +214,7 @@ LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR
...
@@ -214,7 +214,7 @@ LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR
LOCAL_CFLAGS
+=
-DBADVPN_USE_SELFPIPE
-DBADVPN_USE_EPOLL
LOCAL_CFLAGS
+=
-DBADVPN_USE_SELFPIPE
-DBADVPN_USE_EPOLL
LOCAL_CFLAGS
+=
-DBADVPN_LITTLE_ENDIAN
-DBADVPN_THREAD_SAFE
LOCAL_CFLAGS
+=
-DBADVPN_LITTLE_ENDIAN
-DBADVPN_THREAD_SAFE
LOCAL_CFLAGS
+=
-DNDEBUG
-DANDROID
LOCAL_CFLAGS
+=
-DNDEBUG
-DANDROID
#
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
LOCAL_CFLAGS
+=
-DTUN2SOCKS_JNI
LOCAL_C_INCLUDES
:=
\
LOCAL_C_INCLUDES
:=
\
$(LOCAL_PATH)
/badvpn/lwip/src/include/ipv4
\
$(LOCAL_PATH)
/badvpn/lwip/src/include/ipv4
\
...
@@ -288,9 +288,9 @@ LOCAL_MODULE := tun2socks
...
@@ -288,9 +288,9 @@ LOCAL_MODULE := tun2socks
LOCAL_LDLIBS
:=
-ldl
-llog
LOCAL_LDLIBS
:=
-ldl
-llog
LOCAL_SRC_FILES
:=
$(
addprefix
badvpn/,
$(TUN2SOCKS_SOURCES)
)
LOCAL_SRC_FILES
:=
$(
addprefix
badvpn/,
$(TUN2SOCKS_SOURCES)
)
tun2socks-jni.cpp
include
$(BUILD_
EXECUTABLE
)
include
$(BUILD_
SHARED_LIBRARY
)
# OpenSSL
# OpenSSL
openssl_subdirs
:=
$(
addprefix
$(LOCAL_PATH)
/openssl/,
$(
addsuffix
/Android.mk,
\
openssl_subdirs
:=
$(
addprefix
$(LOCAL_PATH)
/openssl/,
$(
addsuffix
/Android.mk,
\
...
...
src/main/jni/badvpn/tun2socks/tun2socks.c
View file @
185e7608
...
@@ -402,13 +402,6 @@ int main (int argc, char **argv)
...
@@ -402,13 +402,6 @@ int main (int argc, char **argv)
goto
fail0
;
goto
fail0
;
}
}
if
(
options
.
fake_proc
)
{
// Fake process name to cheat on Lollipop
strcpy
(
argv
[
0
],
"com.github.shadowsocks"
);
prctl
(
PR_SET_NAME
,
"com.github.shadowsocks"
);
}
// handle --help and --version
// handle --help and --version
if
(
options
.
help
)
{
if
(
options
.
help
)
{
print_version
();
print_version
();
...
@@ -668,7 +661,6 @@ void print_help (const char *name)
...
@@ -668,7 +661,6 @@ void print_help (const char *name)
" [--loglevel <0-5/none/error/warning/notice/info/debug>]
\n
"
" [--loglevel <0-5/none/error/warning/notice/info/debug>]
\n
"
" [--channel-loglevel <channel-name> <0-5/none/error/warning/notice/info/debug>] ...
\n
"
" [--channel-loglevel <channel-name> <0-5/none/error/warning/notice/info/debug>] ...
\n
"
#ifdef ANDROID
#ifdef ANDROID
" [--fake-proc]
\n
"
" [--tunfd <fd>]
\n
"
" [--tunfd <fd>]
\n
"
" [--tunmtu <mtu>]
\n
"
" [--tunmtu <mtu>]
\n
"
" [--dnsgw <dns_gateway_address>]
\n
"
" [--dnsgw <dns_gateway_address>]
\n
"
...
@@ -818,9 +810,6 @@ int parse_arguments (int argc, char *argv[])
...
@@ -818,9 +810,6 @@ int parse_arguments (int argc, char *argv[])
i
+=
2
;
i
+=
2
;
}
}
#ifdef ANDROID
#ifdef ANDROID
else
if
(
!
strcmp
(
arg
,
"--fake-proc"
))
{
options
.
fake_proc
=
1
;
}
else
if
(
!
strcmp
(
arg
,
"--tunfd"
))
{
else
if
(
!
strcmp
(
arg
,
"--tunfd"
))
{
if
(
1
>=
argc
-
i
)
{
if
(
1
>=
argc
-
i
)
{
fprintf
(
stderr
,
"%s: requires an argument
\n
"
,
arg
);
fprintf
(
stderr
,
"%s: requires an argument
\n
"
,
arg
);
...
...
src/main/jni/tun2socks-jni.cpp
0 → 100644
View file @
185e7608
#include <jni.h>
#include <string.h>
#include <unistd.h>
typedef
unsigned
short
char16_t
;
class
String8
{
public:
String8
()
{
mString
=
0
;
}
~
String8
()
{
if
(
mString
)
{
free
(
mString
);
}
}
void
set
(
const
char16_t
*
o
,
size_t
numChars
)
{
if
(
mString
)
{
free
(
mString
);
}
mString
=
(
char
*
)
malloc
(
numChars
+
1
);
if
(
!
mString
)
{
return
;
}
for
(
size_t
i
=
0
;
i
<
numChars
;
i
++
)
{
mString
[
i
]
=
(
char
)
o
[
i
];
}
mString
[
numChars
]
=
'\0'
;
}
const
char
*
string
()
{
return
mString
;
}
private:
char
*
mString
;
};
extern
"C"
{
int
main
(
int
argc
,
char
*
args
[]);
void
terminate
(
void
);
jint
Java_com_github_shadowsocks_Tun2Socks_start
(
JNIEnv
*
env
,
jobject
thiz
,
jobjectArray
argv
)
{
int
argc
=
argv
?
env
->
GetArrayLength
(
argv
)
:
0
;
char
**
args
=
NULL
;
String8
tmp_8
;
if
(
argc
>
0
)
{
args
=
(
char
**
)
malloc
((
argc
+
1
)
*
sizeof
(
char
*
));
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
{
jstring
arg
=
reinterpret_cast
<
jstring
>
(
env
->
GetObjectArrayElement
(
argv
,
i
));
const
jchar
*
str
=
env
->
GetStringCritical
(
arg
,
0
);
tmp_8
.
set
(
str
,
env
->
GetStringLength
(
arg
));
env
->
ReleaseStringCritical
(
arg
,
str
);
args
[
i
]
=
strdup
(
tmp_8
.
string
());
}
args
[
argc
]
=
NULL
;
pid_t
pid
;
pid
=
fork
();
if
(
pid
==
0
)
{
int
ret
=
main
(
argc
,
args
);
return
ret
;
}
if
(
args
!=
NULL
)
free
(
args
);
}
return
0
;
}
jint
Java_com_github_shadowsocks_Tun2Socks_stop
(
JNIEnv
*
env
,
jobject
thiz
)
{
terminate
();
}
}
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
185e7608
...
@@ -320,13 +320,9 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -320,13 +320,9 @@ class ShadowsocksVpnService extends VpnService with BaseService {
else
else
cmd
+=
" --dnsgw %s:8153"
.
format
(
PRIVATE_VLAN
.
format
(
"1"
))
cmd
+=
" --dnsgw %s:8153"
.
format
(
PRIVATE_VLAN
.
format
(
"1"
))
if
(
Utils
.
isLollipopOrAbove
)
{
cmd
+=
" --fake-proc"
;
}
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
);
Tun2Socks
.
start
(
cmd
.
split
(
" "
))
}
}
/** Called when the activity is first created. */
/** Called when the activity is first created. */
...
...
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