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
9517d1f3
Commit
9517d1f3
authored
Jun 04, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up
parent
8a66df52
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
23 deletions
+22
-23
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
+7
-4
src/main/scala/com/github/shadowsocks/ShadowsocksService.scala
...ain/scala/com/github/shadowsocks/ShadowsocksService.scala
+5
-3
src/main/scala/com/github/shadowsocks/Utils.scala
src/main/scala/com/github/shadowsocks/Utils.scala
+10
-16
No files found.
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
View file @
9517d1f3
...
...
@@ -141,8 +141,9 @@ class ShadowVpnService extends VpnService {
val
cmd
:
String
=
(
BASE
+
"shadowsocks -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" -m \"%s\" -f "
+
BASE
+
"shadowsocks.pid"
).
format
(
config
.
proxy
,
config
.
remotePort
,
config
.
localPort
,
config
.
sitekey
,
config
.
encMethod
)
"shadowsocks.pid"
)
.
format
(
config
.
proxy
,
config
.
remotePort
,
config
.
localPort
,
config
.
sitekey
,
config
.
encMethod
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
)
}
...
...
@@ -188,7 +189,8 @@ class ShadowVpnService extends VpnService {
// Resolve server address
var
resolved
:
Boolean
=
false
if
(!
InetAddressUtils
.
isIPv4Address
(
config
.
proxy
)
&&
!
InetAddressUtils
.
isIPv6Address
(
config
.
proxy
))
{
if
(!
InetAddressUtils
.
isIPv4Address
(
config
.
proxy
)
&&
!
InetAddressUtils
.
isIPv6Address
(
config
.
proxy
))
{
Utils
.
resolve
(
config
.
proxy
,
enableIPv6
=
true
)
match
{
case
Some
(
addr
)
=>
config
.
proxy
=
addr
...
...
@@ -313,7 +315,8 @@ class ShadowVpnService extends VpnService {
+
"--socks-server-addr 127.0.0.1:%d "
+
"--tunfd %d "
+
"--tunmtu %d "
+
"--pid %stun2socks.pid"
).
format
(
localAddress
.
format
(
2
),
udpgw
,
config
.
localPort
,
fd
,
VPN_MTU
,
BASE
)
+
"--pid %stun2socks.pid"
)
.
format
(
localAddress
.
format
(
2
),
udpgw
,
config
.
localPort
,
fd
,
VPN_MTU
,
BASE
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
)
}
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksService.scala
View file @
9517d1f3
...
...
@@ -163,8 +163,9 @@ class ShadowsocksService extends Service {
val
cmd
:
String
=
(
BASE
+
"shadowsocks -s \"%s\" -p \"%d\" -l \"%d\" -k \"%s\" -m \"%s\" -f "
+
BASE
+
"shadowsocks.pid"
).
format
(
config
.
proxy
,
config
.
remotePort
,
config
.
localPort
,
config
.
sitekey
,
config
.
encMethod
)
"shadowsocks.pid"
)
.
format
(
config
.
proxy
,
config
.
remotePort
,
config
.
localPort
,
config
.
sitekey
,
config
.
encMethod
)
Log
.
d
(
TAG
,
cmd
)
System
.
exec
(
cmd
)
}
...
...
@@ -217,7 +218,8 @@ class ShadowsocksService extends Service {
killProcesses
()
var
resolved
:
Boolean
=
false
if
(!
InetAddressUtils
.
isIPv4Address
(
config
.
proxy
)
&&
!
InetAddressUtils
.
isIPv6Address
(
config
.
proxy
))
{
if
(!
InetAddressUtils
.
isIPv4Address
(
config
.
proxy
)
&&
!
InetAddressUtils
.
isIPv6Address
(
config
.
proxy
))
{
Utils
.
resolve
(
config
.
proxy
,
enableIPv6
=
true
)
match
{
case
Some
(
a
)
=>
config
.
proxy
=
a
...
...
src/main/scala/com/github/shadowsocks/Utils.scala
View file @
9517d1f3
...
...
@@ -70,16 +70,8 @@ object Key {
val
localPort
=
"port"
}
case
class
Config
(
isGlobalProxy
:
Boolean
,
isGFWList
:
Boolean
,
isBypassApps
:
Boolean
,
var
proxy
:
String
,
sitekey
:
String
,
encMethod
:
String
,
remotePort
:
Int
,
localPort
:
Int
)
case
class
Config
(
isGlobalProxy
:
Boolean
,
isGFWList
:
Boolean
,
isBypassApps
:
Boolean
,
var
proxy
:
String
,
sitekey
:
String
,
encMethod
:
String
,
remotePort
:
Int
,
localPort
:
Int
)
object
State
{
val
INIT
=
0
...
...
@@ -124,8 +116,8 @@ object Extra {
val
remotePort
=
intent
.
getIntExtra
(
Key
.
remotePort
,
1984
)
val
localPort
=
intent
.
getIntExtra
(
Key
.
localPort
,
1984
)
new
Config
(
isGlobalProxy
,
isGFWList
,
isBypassApps
,
proxy
,
sitekey
,
encMethod
,
remotePort
,
localPort
)
new
Config
(
isGlobalProxy
,
isGFWList
,
isBypassApps
,
proxy
,
sitekey
,
encMethod
,
remotePort
,
localPort
)
}
def
put
(
settings
:
SharedPreferences
,
intent
:
Intent
)
{
...
...
@@ -192,7 +184,9 @@ object Utils {
def
isServiceStarted
(
name
:
String
,
context
:
Context
)
:
Boolean
=
{
import
scala.collection.JavaConversions._
val
activityManager
=
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
).
asInstanceOf
[
ActivityManager
]
val
activityManager
=
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
.
asInstanceOf
[
ActivityManager
]
val
services
=
activityManager
.
getRunningServices
(
Integer
.
MAX_VALUE
)
for
(
service
<-
services
)
{
...
...
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