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
2f6f991e
Commit
2f6f991e
authored
Mar 11, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix literal IPv6 address handling in URIs
parent
90e00a38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala
.../main/scala/com/github/shadowsocks/database/Profile.scala
+2
-1
mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala
.../src/main/scala/com/github/shadowsocks/utils/Parser.scala
+9
-3
No files found.
mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala
View file @
2f6f991e
...
...
@@ -98,7 +98,8 @@ class Profile {
.
scheme
(
"ss"
)
.
encodedAuthority
(
"%s@%s:%d"
.
formatLocal
(
Locale
.
ENGLISH
,
Base64
.
encodeToString
(
"%s:%s"
.
formatLocal
(
Locale
.
ENGLISH
,
method
,
password
).
getBytes
,
Base64
.
NO_PADDING
|
Base64
.
NO_WRAP
|
Base64
.
URL_SAFE
),
host
,
remotePort
))
Base64
.
NO_PADDING
|
Base64
.
NO_WRAP
|
Base64
.
URL_SAFE
),
if
(
host
.
contains
(
':'
))
'['
+
host
+
']'
else
host
,
remotePort
))
val
configuration
=
new
PluginConfiguration
(
plugin
)
if
(
configuration
.
selected
.
nonEmpty
)
builder
.
appendQueryParameter
(
Key
.
plugin
,
configuration
.
selectedOptions
.
toString
(
false
))
...
...
mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala
View file @
2f6f991e
...
...
@@ -20,13 +20,15 @@
package
com.github.shadowsocks.utils
import
java.net.URI
import
android.net.Uri
import
android.util.
{
Base64
,
Log
}
import
com.github.shadowsocks.database.Profile
object
Parser
{
val
TAG
=
"ShadowParser"
private
val
pattern
=
"(?i)ss://[-a-zA-Z0-9+&@#/%?=~_|!:,.;
]*[-a-zA-Z0-9+&@#/%=~_|
]"
.
r
private
val
pattern
=
"(?i)ss://[-a-zA-Z0-9+&@#/%?=~_|!:,.;
\\[\\]]*[-a-zA-Z0-9+&@#/%=~_|\\[\\]
]"
.
r
private
val
userInfoPattern
=
"^(.+?):(.*)$"
.
r
private
val
legacyPattern
=
"^(.+?):(.*)@(.+?):(\\d+?)$"
.
r
...
...
@@ -54,8 +56,12 @@ object Parser {
val
profile
=
new
Profile
profile
.
method
=
method
profile
.
password
=
password
profile
.
host
=
uri
.
getHost
profile
.
remotePort
=
uri
.
getPort
// bug in Android: https://code.google.com/p/android/issues/detail?id=192855
val
javaURI
=
new
URI
(
m
.
matched
)
profile
.
host
=
javaURI
.
getHost
if
(
profile
.
host
.
headOption
.
contains
(
'['
)
&&
profile
.
host
.
lastOption
.
contains
(
']'
))
profile
.
host
=
profile
.
host
.
substring
(
1
,
profile
.
host
.
length
-
1
)
profile
.
remotePort
=
javaURI
.
getPort
profile
.
plugin
=
uri
.
getQueryParameter
(
Key
.
plugin
)
profile
.
name
=
uri
.
getFragment
profile
...
...
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