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
8923c93b
Commit
8923c93b
authored
Jun 28, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update travis
parent
ccd01333
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
37 deletions
+93
-37
.gitignore
.gitignore
+2
-0
.travis.yml
.travis.yml
+2
-1
build-ndk.sh
build-ndk.sh
+18
-0
jni/Application.mk.16
jni/Application.mk.16
+4
-0
jni/Application.mk.9
jni/Application.mk.9
+0
-0
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+45
-28
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+22
-8
No files found.
.gitignore
View file @
8923c93b
...
...
@@ -28,6 +28,8 @@ src/main/libs
src/main/assets/armeabi
src/main/assets/armeabi-v7a
src/main/assets/x86
src/main/assets/api-16/
src/main/jni
jni/Application.mk
obj
libs
.travis.yml
View file @
8923c93b
...
...
@@ -18,7 +18,8 @@ before_install:
-
export ANDROID_NDK_HOME=`pwd`/android-ndk-r9d
-
export ANDROID_HOME=`pwd`/android-sdk-linux
-
export PATH=${PATH}:${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
-
echo -e "y\ny\ny" | android update sdk --filter tools,platform-tools,build-tools-19.0.3,android-19,extra-google-m2repository,extra-android-m2repository --no-ui --no-https -a
-
echo "y" | android update sdk --filter tools,platform-tools,build-tools-19.0.3,android-19,extra-google-m2repository --no-ui --no-https -a
-
echo "y" | android update sdk --filter extra-android-m2repository --no-ui --no-https -a
-
ln -s $ANDROID_HOME/build-tools/20.0.0/zipalign $ANDROID_HOME/tools/
install
:
-
gem install --version 0.8.9 faraday
...
...
build-ndk.sh
View file @
8923c93b
#!/bin/bash
# Target 9
cp
jni/Application.mk.9 jni/Application.mk
ndk-build clean
ndk-build
mkdir
-p
src/main/assets/armeabi
...
...
@@ -12,3 +15,18 @@ do
done
rm
-rf
src/main/jni
mv
libs src/main/jni
# Target 16
cp
jni/Application.mk.16 jni/Application.mk
ndk-build clean
ndk-build
mkdir
-p
src/main/assets/api-16/armeabi
mkdir
-p
src/main/assets/api-16/armeabi-v7a
mkdir
-p
src/main/assets/api-16/x86
for
app
in
pdnsd redsocks ss-tunnel
do
mv
libs/armeabi/
$app
src/main/assets/api-16/armeabi/
mv
libs/armeabi-v7a/
$app
src/main/assets/api-16/armeabi-v7a/
mv
libs/x86/
$app
src/main/assets/api-16/x86/
done
jni/Application.mk.16
0 → 100644
View file @
8923c93b
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-16
APP_STL := stlport_static
NDK_TOOLCHAIN_VERSION := 4.8
jni/Application.mk
→
jni/Application.mk
.9
View file @
8923c93b
File moved
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
8923c93b
...
...
@@ -38,41 +38,37 @@
*/
package
com.github.shadowsocks
import
java.util
import
java.io.
{
OutputStream
,
InputStream
,
ByteArrayInputStream
,
ByteArrayOutputStream
,
IOException
,
FileOutputStream
}
import
android.app.backup.BackupManager
import
android.app.
{
Activity
,
AlertDialog
,
ProgressDialog
}
import
android.content._
import
android.content.pm.
{
PackageInfo
,
PackageManager
}
import
android.content.res.AssetManager
import
android.graphics.
{
Color
,
Bitmap
,
Typeface
}
import
android.graphics.
{
Bitmap
,
Color
,
Typeface
}
import
android.net.
{
Uri
,
VpnService
}
import
android.os._
import
android.preference._
import
android.util.
{
Log
,
DisplayMetrics
}
import
android.util.
{
DisplayMetrics
,
Log
}
import
android.view._
import
android.webkit.
{
WebView
,
WebViewClient
}
import
android.widget._
import
com.google.analytics.tracking.android.
{
MapBuilder
,
EasyTracker
}
import
de.keyboardsurfer.android.widget.crouton.
{
Crouton
,
Style
,
Configuration
}
import
java.util.Hashtable
import
com.actionbarsherlock.app.SherlockPreferenceActivity
import
org.jraf.android.backport.switchwidget.Switch
import
android.content.pm.
{
PackageInfo
,
PackageManager
}
import
android.net.
{
Uri
,
VpnService
}
import
android.webkit.
{
WebViewClient
,
WebView
}
import
android.app.backup.BackupManager
import
scala.concurrent.ops._
import
com.github.shadowsocks.aidl.
{
IShadowsocksService
,
IShadowsocksServiceCallback
}
import
com.github.shadowsocks.database._
import
com.github.shadowsocks.preferences.
{
PasswordEditTextPreference
,
ProfileEditTextPreference
,
SummaryEditTextPreference
}
import
com.github.shadowsocks.utils._
import
com.google.analytics.tracking.android.
{
EasyTracker
,
MapBuilder
}
import
com.google.android.gms.ads.
{
AdRequest
,
AdSize
,
AdView
}
import
com.google.zxing.integration.android.IntentIntegrator
import
com.nostra13.universalimageloader.core.download.BaseImageDownloader
import
de.keyboardsurfer.android.widget.crouton.
{
Configuration
,
Crouton
,
Style
}
import
net.simonvt.menudrawer.MenuDrawer
import
org.jraf.android.backport.switchwidget.Switch
import
com.github.shadowsocks.database._
import
scala.collection.mutable.
{
ArrayBuffer
,
ListBuffer
}
import
com.github.shadowsocks.database.Profile
import
com.nostra13.universalimageloader.core.download.BaseImageDownloader
import
com.github.shadowsocks.preferences.
{
ProfileEditTextPreference
,
PasswordEditTextPreference
,
SummaryEditTextPreference
}
import
com.github.shadowsocks.utils._
import
com.google.zxing.integration.android.IntentIntegrator
import
com.github.shadowsocks.aidl.
{
IShadowsocksServiceCallback
,
IShadowsocksService
}
import
java.io._
import
scala.Some
import
com.github.shadowsocks.database.Item
import
com.github.shadowsocks.database.Category
import
com.github.shadowsocks.utils.Console
import
scala.concurrent.ops._
class
ProfileIconDownloader
(
context
:
Context
,
connectTimeout
:
Int
,
readTimeout
:
Int
)
extends
BaseImageDownloader
(
context
,
connectTimeout
,
readTimeout
)
{
...
...
@@ -113,7 +109,7 @@ object Typefaces {
}
private
final
val
TAG
=
"Typefaces"
private
final
val
cache
=
new
Hashtable
[
String
,
Typeface
]
private
final
val
cache
=
new
util
.
Hashtable
[
String
,
Typeface
]
}
object
Shadowsocks
{
...
...
@@ -128,8 +124,8 @@ object Shadowsocks {
val
FEATRUE_PREFS
=
Array
(
Key
.
isGFWList
,
Key
.
isGlobalProxy
,
Key
.
proxyedApps
,
Key
.
isTrafficStat
,
Key
.
isUdpDns
,
Key
.
isAutoConnect
)
val
EXECUTABLES
=
Array
(
Executable
.
IPTABLES
,
Executable
.
PDNSD
,
Executable
.
REDSOCKS
,
Executable
.
SS_LOCAL
,
Executable
.
SS_TUNNEL
,
Executable
.
TUN2SOCKS
)
val
SYSTEM_EXECUTABLES
=
Array
(
Executable
.
PDNSD
,
Executable
.
REDSOCKS
,
Executable
.
SS_TUNNEL
)
val
EXECUTABLES
=
Array
(
Executable
.
IPTABLES
)
++
SYSTEM_EXECUTABLES
// Helper functions
def
updateListPreference
(
pref
:
Preference
,
value
:
String
)
{
...
...
@@ -427,7 +423,7 @@ class Shadowsocks
if
(
settings
.
getString
(
Key
.
proxy
,
""
)
==
"198.199.101.152"
)
{
val
layoutView
=
{
if
(
Build
.
VERSION
.
SDK_INT
>
10
)
{
drawer
.
getContentContainer
.
asInstanceOf
[
ViewGroup
].
getChildAt
(
0
)
drawer
.
getContentContainer
.
getChildAt
(
0
)
}
else
{
getLayoutView
(
drawer
.
getContentContainer
.
getParent
)
}
...
...
@@ -803,9 +799,30 @@ class Shadowsocks
new
BackupManager
(
this
).
dataChanged
()
}
def
copyToSystem
()
{
val
ab
=
new
ArrayBuffer
[
String
]
ab
.
append
(
"mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system"
)
for
(
executable
<-
Shadowsocks
.
SYSTEM_EXECUTABLES
)
{
ab
.
append
(
"cp %s%s /system/bin/"
.
format
(
Path
.
BASE
,
executable
))
}
ab
.
append
(
"mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system"
)
Console
.
runRootCommand
(
ab
.
toArray
)
}
def
reset
()
{
crash_recovery
()
copyAssets
(
System
.
getABI
)
if
(
Build
.
VERSION
.
SDK_INT
>=
16
)
{
copyAssets
(
"api-16/"
+
System
.
getABI
)
}
else
{
copyAssets
(
System
.
getABI
)
}
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
copyToSystem
()
}
val
ab
=
new
ArrayBuffer
[
String
]
for
(
executable
<-
Shadowsocks
.
EXECUTABLES
)
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
8923c93b
...
...
@@ -118,10 +118,14 @@ 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 "
+
val
raw_args
=
(
"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
args
=
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
raw_args
}
else
{
Path
.
BASE
+
raw_args
}
val
cmd
=
if
(
config
.
isGFWList
&&
isACLEnabled
)
args
+
" --acl "
+
Path
.
BASE
+
"chn.acl"
else
args
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
...
...
@@ -129,9 +133,8 @@ class ShadowsocksNatService extends Service with BaseService {
}
def
startDnsDaemon
()
{
val
cmd
=
if
(
config
.
isUdpDns
)
{
(
Path
.
BASE
+
"ss-tunnel -b 127.0.0.1 -s '%s' -p '%d' -l '%d' -k '%s' -m '%s' -L 8.8.8.8:53 -u -f "
+
val
args
=
if
(
config
.
isUdpDns
)
{
(
"ss-tunnel -b 127.0.0.1 -s '%s' -p '%d' -l '%d' -k '%s' -m '%s' -L 8.8.8.8:53 -u -f "
+
Path
.
BASE
+
"ss-tunnel.pid"
)
.
format
(
config
.
proxy
,
config
.
remotePort
,
8153
,
config
.
sitekey
,
config
.
encMethod
)
}
else
{
...
...
@@ -144,7 +147,13 @@ class ShadowsocksNatService extends Service with BaseService {
ConfigUtils
.
printToFile
(
new
File
(
Path
.
BASE
+
"pdnsd.conf"
))(
p
=>
{
p
.
println
(
conf
)
})
Path
.
BASE
+
"pdnsd -c "
+
Path
.
BASE
+
"pdnsd.conf"
"pdnsd -c "
+
Path
.
BASE
+
"pdnsd.conf"
}
val
cmd
=
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
args
}
else
{
Path
.
BASE
+
args
}
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
Console
.
runRootCommand
(
cmd
)
...
...
@@ -164,11 +173,16 @@ class ShadowsocksNatService extends Service with BaseService {
def
startRedsocksDaemon
()
{
val
conf
=
ConfigUtils
.
REDSOCKS
.
format
(
config
.
localPort
)
val
cmd
=
"%s
redsocks -p %sredsocks.pid -c %sredsocks.conf"
.
format
(
Path
.
BASE
,
Path
.
BASE
,
Path
.
BASE
)
val
args
=
"
redsocks -p %sredsocks.pid -c %sredsocks.conf"
.
format
(
Path
.
BASE
,
Path
.
BASE
)
ConfigUtils
.
printToFile
(
new
File
(
Path
.
BASE
+
"redsocks.conf"
))(
p
=>
{
p
.
println
(
conf
)
})
val
cmd
=
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
args
}
else
{
Path
.
BASE
+
args
}
Console
.
runRootCommand
(
cmd
)
}
...
...
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