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
a53c9ff5
Commit
a53c9ff5
authored
Dec 16, 2012
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run nodejs in non-root user
parent
d1c75d99
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
483 deletions
+52
-483
AndroidManifest.xml
AndroidManifest.xml
+0
-7
jni/Android.mk
jni/Android.mk
+22
-11
jni/node.c
jni/node.c
+10
-0
res/values-zh/strings.xml
res/values-zh/strings.xml
+1
-451
res/values/strings.xml
res/values/strings.xml
+1
-1
res/xml/shadowsocks_preference.xml
res/xml/shadowsocks_preference.xml
+0
-5
src/com/github/shadowsocks/Node.java
src/com/github/shadowsocks/Node.java
+8
-0
src/com/github/shadowsocks/Shadowsocks.java
src/com/github/shadowsocks/Shadowsocks.java
+0
-4
src/com/github/shadowsocks/ShadowsocksService.java
src/com/github/shadowsocks/ShadowsocksService.java
+10
-4
No files found.
AndroidManifest.xml
View file @
a53c9ff5
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-feature
<uses-feature
...
@@ -40,12 +39,6 @@
...
@@ -40,12 +39,6 @@
android:name=
".ShadowsocksService"
android:name=
".ShadowsocksService"
android:enabled=
"true"
/>
android:enabled=
"true"
/>
<receiver
android:name=
".ShadowsocksReceiver"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
</intent-filter>
</receiver>
</application>
</application>
</manifest>
</manifest>
jni/Android.mk
View file @
a53c9ff5
...
@@ -34,17 +34,17 @@ LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd
...
@@ -34,17 +34,17 @@ LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd
include
$(BUILD_EXECUTABLE)
include
$(BUILD_EXECUTABLE)
include
$(CLEAR_VARS)
#
include $(CLEAR_VARS)
LOCAL_MODULE
:=
shadowsocks
#
LOCAL_MODULE := shadowsocks
LOCAL_SRC_FILES
:=
shadowsocks/local.c shadowsocks/encrypt.c
#
LOCAL_SRC_FILES := shadowsocks/local.c shadowsocks/encrypt.c
LOCAL_CFLAGS
:=
-Wall
-O2
-I
$(LOCAL_PATH)
/libev/
-I
$(LOCAL_PATH)
/openssl/include
-std
=
c99
#
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/libev/ -I$(LOCAL_PATH)/openssl/include -std=c99
LOCAL_STATIC_LIBRARIES
:=
libev libcrypto
#
LOCAL_STATIC_LIBRARIES := libev libcrypto
LOCAL_LDLIBS
:=
-llog
#
LOCAL_LDLIBS := -llog
include
$(BUILD_EXECUTABLE)
#
include $(BUILD_EXECUTABLE)
include
$(CLEAR_VARS)
include
$(CLEAR_VARS)
...
@@ -57,9 +57,20 @@ LOCAL_LDLIBS := -ldl -llog
...
@@ -57,9 +57,20 @@ LOCAL_LDLIBS := -ldl -llog
include
$(BUILD_SHARED_LIBRARY)
include
$(BUILD_SHARED_LIBRARY)
subdirs
:=
$(
addprefix
$(LOCAL_PATH)
/openssl/,
$(
addsuffix
/Android.mk,
\
include
$(CLEAR_VARS)
crypto
\
))
LOCAL_MODULE
:=
node
LOCAL_SRC_FILES
:=
\
node.c
LOCAL_LDLIBS
:=
-ldl
include
$(BUILD_SHARED_LIBRARY)
#subdirs := $(addprefix $(LOCAL_PATH)/openssl/,$(addsuffix /Android.mk, \
#crypto \
#))
include
$(subdirs)
#
include $(subdirs)
jni/node.c
0 → 100644
View file @
a53c9ff5
#include <jni.h>
void
Java_com_github_shadowsocks_Node_exec
(
JNIEnv
*
env
,
jobject
thiz
,
jstring
cmd
)
{
const
char
*
str
=
(
*
env
)
->
GetStringUTFChars
(
env
,
cmd
,
0
);
setenv
(
"LD_LIBRARY_PATH"
,
"/vendor/lib:/system/lib"
,
1
);
setegid
(
getgid
());
seteuid
(
getuid
());
system
(
str
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
cmd
,
str
);
}
res/values-zh/strings.xml
View file @
a53c9ff5
This diff is collapsed.
Click to expand it.
res/values/strings.xml
View file @
a53c9ff5
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
published under
published under
the GPLv3. \n\nIf you have any questions, please visit
the GPLv3. \n\nIf you have any questions, please visit
our project page on
our project page on
googlecode. \n\n(g
aeproxy.googlecode.com
)
googlecode. \n\n(g
ithub.com/clowwindy/shadowsocks
)
</string>
</string>
<string
name=
"about"
>
About
</string>
<string
name=
"about"
>
About
</string>
<string
name=
"proxy_type"
>
Proxy Type
</string>
<string
name=
"proxy_type"
>
Proxy Type
</string>
...
...
res/xml/shadowsocks_preference.xml
View file @
a53c9ff5
...
@@ -36,11 +36,6 @@
...
@@ -36,11 +36,6 @@
</EditTextPreference>
</EditTextPreference>
</PreferenceCategory>
</PreferenceCategory>
<PreferenceCategory
android:title=
"@string/fearute_cat"
>
<PreferenceCategory
android:title=
"@string/fearute_cat"
>
<CheckBoxPreference
android:key=
"isAutoConnect"
android:summary=
"@string/auto_connect_summary"
android:title=
"@string/auto_connect"
>
</CheckBoxPreference>
<CheckBoxPreference
<CheckBoxPreference
android:defaultValue=
"true"
android:defaultValue=
"true"
android:key=
"isGFWList"
android:key=
"isGFWList"
...
...
src/com/github/shadowsocks/Node.java
0 → 100644
View file @
a53c9ff5
package
com.github.shadowsocks
;
public
class
Node
{
static
{
System
.
loadLibrary
(
"node"
);
}
public
static
native
void
exec
(
String
cmd
);
}
src/com/github/shadowsocks/Shadowsocks.java
View file @
a53c9ff5
...
@@ -103,7 +103,6 @@ public class Shadowsocks extends PreferenceActivity implements
...
@@ -103,7 +103,6 @@ public class Shadowsocks extends PreferenceActivity implements
private
static
ProgressDialog
mProgressDialog
=
null
;
private
static
ProgressDialog
mProgressDialog
=
null
;
private
CheckBoxPreference
isAutoConnectCheck
;
private
CheckBoxPreference
isGlobalProxyCheck
;
private
CheckBoxPreference
isGlobalProxyCheck
;
private
EditTextPreference
proxyText
;
private
EditTextPreference
proxyText
;
private
EditTextPreference
portText
;
private
EditTextPreference
portText
;
...
@@ -169,7 +168,6 @@ public class Shadowsocks extends PreferenceActivity implements
...
@@ -169,7 +168,6 @@ public class Shadowsocks extends PreferenceActivity implements
isGFWListCheck
.
setEnabled
(
false
);
isGFWListCheck
.
setEnabled
(
false
);
isBypassAppsCheck
.
setEnabled
(
false
);
isBypassAppsCheck
.
setEnabled
(
false
);
isAutoConnectCheck
.
setEnabled
(
false
);
isGlobalProxyCheck
.
setEnabled
(
false
);
isGlobalProxyCheck
.
setEnabled
(
false
);
}
}
...
@@ -185,7 +183,6 @@ public class Shadowsocks extends PreferenceActivity implements
...
@@ -185,7 +183,6 @@ public class Shadowsocks extends PreferenceActivity implements
isBypassAppsCheck
.
setEnabled
(
true
);
isBypassAppsCheck
.
setEnabled
(
true
);
}
}
isAutoConnectCheck
.
setEnabled
(
true
);
}
}
private
boolean
isTextEmpty
(
String
s
,
String
msg
)
{
private
boolean
isTextEmpty
(
String
s
,
String
msg
)
{
...
@@ -213,7 +210,6 @@ public class Shadowsocks extends PreferenceActivity implements
...
@@ -213,7 +210,6 @@ public class Shadowsocks extends PreferenceActivity implements
proxyedApps
=
findPreference
(
"proxyedApps"
);
proxyedApps
=
findPreference
(
"proxyedApps"
);
isRunningCheck
=
(
CheckBoxPreference
)
findPreference
(
"isRunning"
);
isRunningCheck
=
(
CheckBoxPreference
)
findPreference
(
"isRunning"
);
isAutoConnectCheck
=
(
CheckBoxPreference
)
findPreference
(
"isAutoConnect"
);
isGlobalProxyCheck
=
(
CheckBoxPreference
)
findPreference
(
"isGlobalProxy"
);
isGlobalProxyCheck
=
(
CheckBoxPreference
)
findPreference
(
"isGlobalProxy"
);
isGFWListCheck
=
(
CheckBoxPreference
)
findPreference
(
"isGFWList"
);
isGFWListCheck
=
(
CheckBoxPreference
)
findPreference
(
"isGFWList"
);
isBypassAppsCheck
=
(
CheckBoxPreference
)
findPreference
(
"isBypassApps"
);
isBypassAppsCheck
=
(
CheckBoxPreference
)
findPreference
(
"isBypassApps"
);
...
...
src/com/github/shadowsocks/ShadowsocksService.java
View file @
a53c9ff5
...
@@ -57,6 +57,7 @@ import android.util.Log;
...
@@ -57,6 +57,7 @@ import android.util.Log;
import
com.google.analytics.tracking.android.EasyTracker
;
import
com.google.analytics.tracking.android.EasyTracker
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
...
@@ -183,10 +184,15 @@ public class ShadowsocksService extends Service {
...
@@ -183,10 +184,15 @@ public class ShadowsocksService extends Service {
}
}
public
void
startShadowsocksDaemon
()
{
public
void
startShadowsocksDaemon
()
{
final
String
cmd
=
String
.
format
(
"nohup "
+
BASE
new
Thread
()
{
+
"node "
+
BASE
+
"local.js -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" &"
,
@Override
appHost
,
remotePort
,
port
,
sitekey
);
public
void
run
()
{
Utils
.
runRootCommand
(
cmd
);
final
String
cmd
=
String
.
format
(
BASE
+
"node "
+
BASE
+
"local.js -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\""
,
appHost
,
remotePort
,
port
,
sitekey
);
Node
.
exec
(
cmd
);
}
}.
start
();
}
}
public
void
startDnsDaemon
()
{
public
void
startDnsDaemon
()
{
...
...
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