This commit is contained in:
Mygod
2016-03-16 22:31:07 +08:00
parent e99a0eaafc
commit 555f4f6854
4 changed files with 43 additions and 55 deletions
@@ -39,8 +39,6 @@
package com.github.shadowsocks.utils
import java.util.Locale
import android.util.{Base64, Log}
import com.github.shadowsocks.database.Profile
@@ -48,9 +46,6 @@ object Parser {
val TAG = "ShadowParser"
private val pattern = "(?i)ss://([A-Za-z0-9+-/=_]+)".r
def generate (profile: Profile): String = "ss://" + Base64.encodeToString("%s:%s@%s:%d".formatLocal(Locale.ENGLISH,
profile.method, profile.password, profile.host, profile.remotePort).getBytes, Base64.NO_PADDING | Base64.NO_WRAP)
def findAll(data: CharSequence) = pattern.findAllMatchIn(data).map(m => try {
val content = new String(Base64.decode(m.group(1), Base64.NO_PADDING), "UTF-8")
val methodIdx = content.indexOf(':')