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
1c1a8ed9
Commit
1c1a8ed9
authored
Feb 17, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flatten ACL with openConnection
parent
0c93a0eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
+3
-2
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
View file @
1c1a8ed9
...
@@ -32,6 +32,7 @@ import java.io.File
...
@@ -32,6 +32,7 @@ import java.io.File
import
java.io.IOException
import
java.io.IOException
import
java.io.Reader
import
java.io.Reader
import
java.net.URL
import
java.net.URL
import
java.net.URLConnection
class
Acl
{
class
Acl
{
companion
object
{
companion
object
{
...
@@ -151,11 +152,11 @@ class Acl {
...
@@ -151,11 +152,11 @@ class Acl {
fromReader
(
getFile
(
id
).
bufferedReader
())
fromReader
(
getFile
(
id
).
bufferedReader
())
}
catch
(
_
:
IOException
)
{
this
}
}
catch
(
_
:
IOException
)
{
this
}
fun
flatten
(
depth
:
Int
):
Acl
{
suspend
fun
flatten
(
depth
:
Int
,
connect
:
suspend
(
URL
)
->
URLConnection
):
Acl
{
if
(
depth
>
0
)
for
(
url
in
urls
.
asIterable
())
{
if
(
depth
>
0
)
for
(
url
in
urls
.
asIterable
())
{
val
child
=
Acl
()
val
child
=
Acl
()
try
{
try
{
child
.
fromReader
(
url
.
openStream
().
bufferedReader
(),
bypass
).
flatten
(
depth
-
1
)
child
.
fromReader
(
connect
(
url
).
getInputStream
().
bufferedReader
(),
bypass
).
flatten
(
depth
-
1
,
connect
)
}
catch
(
e
:
IOException
)
{
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
continue
continue
...
...
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
1c1a8ed9
...
@@ -80,7 +80,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
...
@@ -80,7 +80,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
profile
.
method
=
proxy
[
3
].
trim
()
profile
.
method
=
proxy
[
3
].
trim
()
}
}
if
(
route
==
Acl
.
CUSTOM_RULES
)
Acl
.
save
(
Acl
.
CUSTOM_RULES
,
Acl
.
customRules
.
flatten
(
10
))
if
(
route
==
Acl
.
CUSTOM_RULES
)
Acl
.
save
(
Acl
.
CUSTOM_RULES
,
Acl
.
customRules
.
flatten
(
10
,
service
::
openConnection
))
// it's hard to resolve DNS on a specific interface so we'll do it here
// it's hard to resolve DNS on a specific interface so we'll do it here
if
(
profile
.
host
.
parseNumericAddress
()
==
null
)
profile
.
host
=
withTimeoutOrNull
(
10_000
)
{
if
(
profile
.
host
.
parseNumericAddress
()
==
null
)
profile
.
host
=
withTimeoutOrNull
(
10_000
)
{
...
...
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