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
357130cd
Commit
357130cd
authored
Nov 30, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine #989
parent
d197ec2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
src/main/scala/com/github/shadowsocks/database/Profile.scala
src/main/scala/com/github/shadowsocks/database/Profile.scala
+3
-1
src/main/scala/com/github/shadowsocks/utils/Parser.scala
src/main/scala/com/github/shadowsocks/utils/Parser.scala
+4
-2
No files found.
src/main/scala/com/github/shadowsocks/database/Profile.scala
View file @
357130cd
...
...
@@ -20,6 +20,7 @@
package
com.github.shadowsocks.database
import
java.net.URLEncoder
import
java.util.Locale
import
android.os.Binder
...
...
@@ -95,7 +96,8 @@ class Profile {
var
kcpcli
:
String
=
"--crypt none --mode normal --mtu 1200 --nocomp --dscp 46 --parityshard 0"
override
def
toString
=
"ss://"
+
Base64
.
encodeToString
(
"%s%s:%s@%s:%d"
.
formatLocal
(
Locale
.
ENGLISH
,
method
,
if
(
auth
)
"-auth"
else
""
,
password
,
host
,
remotePort
).
getBytes
,
Base64
.
NO_PADDING
|
Base64
.
NO_WRAP
)
method
,
if
(
auth
)
"-auth"
else
""
,
password
,
host
,
remotePort
).
getBytes
,
Base64
.
NO_PADDING
|
Base64
.
NO_WRAP
)
+
'#'
+
URLEncoder
.
encode
(
name
,
"utf-8"
)
def
isMethodUnsafe
=
"table"
.
equalsIgnoreCase
(
method
)
||
"rc4"
.
equalsIgnoreCase
(
method
)
}
src/main/scala/com/github/shadowsocks/utils/Parser.scala
View file @
357130cd
...
...
@@ -20,12 +20,14 @@
package
com.github.shadowsocks.utils
import
java.net.URLDecoder
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+-/=_]+)(#
.+
)?"
.
r
private
val
pattern
=
"(?i)ss://([A-Za-z0-9+-/=_]+)(#
(.+)
)?"
.
r
private
val
decodedPattern
=
"(?i)^((.+?)(-auth)??:(.*)@(.+?):(\\d+?))$"
.
r
def
findAll
(
data
:
CharSequence
)
=
pattern
.
findAllMatchIn
(
if
(
data
==
null
)
""
else
data
).
map
(
m
=>
try
...
...
@@ -38,7 +40,7 @@ object Parser {
profile
.
name
=
ss
.
group
(
5
)
profile
.
host
=
profile
.
name
profile
.
remotePort
=
ss
.
group
(
6
).
toInt
if
(
m
.
group
(
2
)
!=
null
)
profile
.
name
=
m
.
group
(
2
).
substring
(
1
)
if
(
m
.
group
(
2
)
!=
null
)
profile
.
name
=
URLDecoder
.
decode
(
m
.
group
(
3
),
"utf-8"
)
profile
case
_
=>
null
}
...
...
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