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
8b4b2409
Commit
8b4b2409
authored
Dec 14, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize Acl.parse
parent
8f5a460b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
+11
-8
core/src/main/java/com/github/shadowsocks/bg/TransproxyService.kt
.../main/java/com/github/shadowsocks/bg/TransproxyService.kt
+0
-1
No files found.
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
View file @
8b4b2409
...
@@ -74,10 +74,13 @@ class Acl {
...
@@ -74,10 +74,13 @@ class Acl {
var
subnets
:
MutableList
<
Subnet
>?
=
if
(
defaultBypass
)
proxySubnets
else
bypassSubnets
var
subnets
:
MutableList
<
Subnet
>?
=
if
(
defaultBypass
)
proxySubnets
else
bypassSubnets
reader
.
useLines
{
reader
.
useLines
{
for
(
line
in
it
)
{
for
(
line
in
it
)
{
val
input
=
(
if
(
urls
==
null
)
line
else
{
val
blocks
=
line
.
split
(
'#'
,
limit
=
2
)
val
blocks
=
line
.
split
(
'#'
,
limit
=
2
)
val
url
=
networkAclParser
.
matchEntire
(
blocks
.
getOrElse
(
1
)
{
""
})
?.
groupValues
?.
getOrNull
(
1
)
val
url
=
networkAclParser
.
matchEntire
(
blocks
.
getOrElse
(
1
)
{
""
})
?.
groupValues
?.
getOrNull
(
1
)
if
(
url
!=
null
)
urls
!!
(
URL
(
url
))
if
(
url
!=
null
)
urls
(
URL
(
url
))
when
(
val
input
=
blocks
[
0
].
trim
())
{
blocks
[
0
]
}).
trim
()
if
(
input
.
getOrNull
(
0
)
==
'['
)
when
(
input
)
{
"[outbound_block_list]"
->
{
"[outbound_block_list]"
->
{
hostnames
=
null
hostnames
=
null
subnets
=
null
subnets
=
null
...
@@ -92,13 +95,13 @@ class Acl {
...
@@ -92,13 +95,13 @@ class Acl {
}
}
"[reject_all]"
,
"[bypass_all]"
->
bypass
=
true
"[reject_all]"
,
"[bypass_all]"
->
bypass
=
true
"[accept_all]"
,
"[proxy_all]"
->
bypass
=
false
"[accept_all]"
,
"[proxy_all]"
->
bypass
=
false
else
->
if
(
subnets
!=
null
&&
input
.
isNotEmpty
())
{
else
->
error
(
"Unrecognized block: $input"
)
}
else
if
(
subnets
!=
null
&&
input
.
isNotEmpty
())
{
val
subnet
=
Subnet
.
fromString
(
input
)
val
subnet
=
Subnet
.
fromString
(
input
)
if
(
subnet
==
null
)
hostnames
!!
(
input
)
else
subnets
!!
.
add
(
subnet
)
if
(
subnet
==
null
)
hostnames
!!
(
input
)
else
subnets
!!
.
add
(
subnet
)
}
}
}
}
}
}
}
return
bypass
to
if
(
bypass
)
proxySubnets
else
bypassSubnets
return
bypass
to
if
(
bypass
)
proxySubnets
else
bypassSubnets
}
}
}
}
...
...
core/src/main/java/com/github/shadowsocks/bg/TransproxyService.kt
View file @
8b4b2409
...
@@ -23,7 +23,6 @@ package com.github.shadowsocks.bg
...
@@ -23,7 +23,6 @@ package com.github.shadowsocks.bg
import
android.app.Service
import
android.app.Service
import
android.content.Intent
import
android.content.Intent
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.net.HostsFile
import
com.github.shadowsocks.net.HostsFile
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.preference.DataStore
import
java.io.File
import
java.io.File
...
...
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