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
aa533184
Commit
aa533184
authored
Dec 10, 2017
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine #1489
parent
7688cbe2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
mobile/src/main/java/com/github/shadowsocks/acl/Acl.kt
mobile/src/main/java/com/github/shadowsocks/acl/Acl.kt
+2
-0
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
...le/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+16
-0
mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
...rc/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
+1
-1
No files found.
mobile/src/main/java/com/github/shadowsocks/acl/Acl.kt
View file @
aa533184
...
@@ -46,6 +46,7 @@ class Acl {
...
@@ -46,6 +46,7 @@ class Acl {
val
networkAclParser
=
"^IMPORT_URL\\s*<(.+)>\\s*$"
.
toRegex
()
val
networkAclParser
=
"^IMPORT_URL\\s*<(.+)>\\s*$"
.
toRegex
()
fun
getFile
(
id
:
String
)
=
File
(
app
.
filesDir
,
id
+
".acl"
)
fun
getFile
(
id
:
String
)
=
File
(
app
.
filesDir
,
id
+
".acl"
)
val
customRules
:
Acl
get
()
{
val
customRules
:
Acl
get
()
{
val
acl
=
Acl
()
val
acl
=
Acl
()
try
{
try
{
...
@@ -143,6 +144,7 @@ class Acl {
...
@@ -143,6 +144,7 @@ class Acl {
for
(
item
in
(
if
(
bypass
)
proxySubnets
else
bypassSubnets
).
asIterable
())
this
.
subnets
.
add
(
item
)
for
(
item
in
(
if
(
bypass
)
proxySubnets
else
bypassSubnets
).
asIterable
())
this
.
subnets
.
add
(
item
)
return
this
return
this
}
}
fun
fromId
(
id
:
String
):
Acl
=
fromReader
(
Acl
.
getFile
(
id
).
bufferedReader
())
fun
fromId
(
id
:
String
):
Acl
=
fromReader
(
Acl
.
getFile
(
id
).
bufferedReader
())
fun
flatten
(
depth
:
Int
):
Acl
{
fun
flatten
(
depth
:
Int
):
Acl
{
...
...
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
aa533184
...
@@ -238,6 +238,22 @@ object BaseService {
...
@@ -238,6 +238,22 @@ object BaseService {
Acl
.
getFile
(
if
(
route
==
Acl
.
CUSTOM_RULES
)
Acl
.
CUSTOM_RULES_FLATTENED
else
route
)
Acl
.
getFile
(
if
(
route
==
Acl
.
CUSTOM_RULES
)
Acl
.
CUSTOM_RULES_FLATTENED
else
route
)
}
}
fun
getListFile
():
File
?
{
val
aclFile
=
getAclFile
()
?:
return
null
val
listFile
=
File
(
aclFile
.
absolutePath
+
".lst"
)
val
list
=
StringBuilder
()
aclFile
.
bufferedReader
().
useLines
{
for
(
line
in
it
)
{
if
(
line
.
startsWith
(
"^(.*\\.)?"
))
{
list
.
append
(
line
.
substring
(
8
).
replace
(
"\\"
,
""
).
replace
(
"$"
,
""
))
list
.
append
(
"\n"
)
}
}
}
listFile
.
bufferedWriter
().
use
{
it
.
write
(
list
.
toString
())
}
return
listFile
}
fun
createNotification
():
ServiceNotification
fun
createNotification
():
ServiceNotification
fun
startRunner
()
{
fun
startRunner
()
{
...
...
mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
View file @
aa533184
...
@@ -89,7 +89,7 @@ object LocalDnsService {
...
@@ -89,7 +89,7 @@ object LocalDnsService {
.
put
(
"PrimaryDNS"
,
localDns
)
.
put
(
"PrimaryDNS"
,
localDns
)
.
put
(
"AlternativeDNS"
,
remoteDns
)
.
put
(
"AlternativeDNS"
,
remoteDns
)
.
put
(
"IPNetworkFile"
,
"china_ip_list.txt"
)
.
put
(
"IPNetworkFile"
,
"china_ip_list.txt"
)
.
put
(
"DomainFile"
,
get
Acl
File
()
!!
.
absolutePath
)
.
put
(
"DomainFile"
,
get
List
File
()
!!
.
absolutePath
)
Acl
.
CHINALIST
->
config
Acl
.
CHINALIST
->
config
.
put
(
"PrimaryDNS"
,
localDns
)
.
put
(
"PrimaryDNS"
,
localDns
)
.
put
(
"AlternativeDNS"
,
remoteDns
)
.
put
(
"AlternativeDNS"
,
remoteDns
)
...
...
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