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
253b4c7e
Commit
253b4c7e
authored
Mar 22, 2020
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up
parent
e919a584
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
57 deletions
+6
-57
core/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
...rc/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
+0
-51
core/src/main/java/com/github/shadowsocks/bg/TransproxyService.kt
.../main/java/com/github/shadowsocks/bg/TransproxyService.kt
+2
-2
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
+3
-3
core/src/main/rust/shadowsocks-rust
core/src/main/rust/shadowsocks-rust
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
deleted
100644 → 0
View file @
e919a584
/*******************************************************************************
* *
* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> *
* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod.be> *
* *
* 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/>. *
* *
*******************************************************************************/
package
com.github.shadowsocks.bg
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.acl.AclMatcher
import
com.github.shadowsocks.net.HostsFile
import
com.github.shadowsocks.net.LocalDnsServer
import
com.github.shadowsocks.net.Socks5Endpoint
import
com.github.shadowsocks.preference.DataStore
import
kotlinx.coroutines.CoroutineScope
import
java.net.InetSocketAddress
import
java.net.URI
import
java.net.URISyntaxException
import
java.util.*
object
LocalDnsService
{
private
val
servers
=
WeakHashMap
<
Interface
,
LocalDnsServer
>()
interface
Interface
:
BaseService
.
Interface
{
override
suspend
fun
startProcesses
(
hosts
:
HostsFile
)
{
super
.
startProcesses
(
hosts
)
LocalDnsServer
(
this
::
resolver
,
hosts
).
also
{
servers
[
this
]
=
it
}.
start
(
InetSocketAddress
(
DataStore
.
listenAddress
,
8153
))
}
override
fun
killProcesses
(
scope
:
CoroutineScope
)
{
servers
.
remove
(
this
)
?.
shutdown
(
scope
)
super
.
killProcesses
(
scope
)
}
}
}
core/src/main/java/com/github/shadowsocks/bg/TransproxyService.kt
View file @
253b4c7e
...
...
@@ -27,7 +27,7 @@ import com.github.shadowsocks.net.HostsFile
import
com.github.shadowsocks.preference.DataStore
import
java.io.File
class
TransproxyService
:
Service
(),
LocalDns
Service
.
Interface
{
class
TransproxyService
:
Service
(),
Base
Service
.
Interface
{
override
val
data
=
BaseService
.
Data
(
this
)
override
val
tag
:
String
get
()
=
"ShadowsocksTransproxyService"
override
fun
createNotification
(
profileName
:
String
):
ServiceNotification
=
...
...
@@ -35,7 +35,7 @@ class TransproxyService : Service(), LocalDnsService.Interface {
override
fun
onBind
(
intent
:
Intent
)
=
super
.
onBind
(
intent
)
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
=
super
<
LocalDns
Service
.
Interface
>.
onStartCommand
(
intent
,
flags
,
startId
)
super
<
Base
Service
.
Interface
>.
onStartCommand
(
intent
,
flags
,
startId
)
private
fun
startRedsocksDaemon
()
{
File
(
Core
.
deviceStorage
.
noBackupFilesDir
,
"redsocks.conf"
).
writeText
(
"""base {
...
...
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
View file @
253b4c7e
...
...
@@ -49,7 +49,7 @@ import java.io.*
import
java.net.URL
import
android.net.VpnService
as
BaseVpnService
class
VpnService
:
BaseVpnService
(),
LocalDns
Service
.
Interface
{
class
VpnService
:
BaseVpnService
(),
Base
Service
.
Interface
{
companion
object
{
private
const
val
VPN_MTU
=
1500
private
const
val
PRIVATE_VLAN4_CLIENT
=
"172.19.0.1"
...
...
@@ -148,7 +148,7 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
override
fun
onBind
(
intent
:
Intent
)
=
when
(
intent
.
action
)
{
SERVICE_INTERFACE
->
super
<
BaseVpnService
>.
onBind
(
intent
)
else
->
super
<
LocalDns
Service
.
Interface
>.
onBind
(
intent
)
else
->
super
<
Base
Service
.
Interface
>.
onBind
(
intent
)
}
override
fun
onRevoke
()
=
stopRunner
()
...
...
@@ -169,7 +169,7 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
if
(
DataStore
.
serviceMode
==
Key
.
modeVpn
)
{
if
(
prepare
(
this
)
!=
null
)
{
startActivity
(
Intent
(
this
,
VpnRequestActivity
::
class
.
java
).
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
))
}
else
return
super
<
LocalDns
Service
.
Interface
>.
onStartCommand
(
intent
,
flags
,
startId
)
}
else
return
super
<
Base
Service
.
Interface
>.
onStartCommand
(
intent
,
flags
,
startId
)
}
stopRunner
()
return
Service
.
START_NOT_STICKY
...
...
shadowsocks-rust
@
63208f94
Subproject commit
7ec11dfe1713424d064d0a136a1f1edf4795e30a
Subproject commit
63208f941129c7338e54e6339d33ed01cdec6c6f
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