Skip to content

Commit 14891a1

Browse files
authored
Merge pull request 2dust#249 from boypt/ssv6
fix: ss v6 addr import error
2 parents 4ef21e2 + 596a856 commit 14891a1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt

+11-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import com.v2ray.ang.extension.defaultDPreference
1919
import org.jetbrains.anko.toast
2020
import java.net.URLDecoder
2121
import java.util.*
22-
22+
import java.net.*
23+
import java.math.BigInteger
2324

2425
object AngConfigManager {
2526
private lateinit var app: AngApplication
@@ -295,18 +296,23 @@ object AngConfigManager {
295296
result = Utils.decode(result)
296297
}
297298

299+
// method:password@ipaddr:port
298300
val arr1 = result.split('@')
299301
if (arr1.count() != 2) {
300302
return R.string.toast_incorrect_protocol
301303
}
302304
val arr21 = arr1[0].split(':')
303-
val arr22 = arr1[1].split(':')
304-
if (arr21.count() != 2 || arr21.count() != 2) {
305+
if (arr21.count() != 2) {
306+
return R.string.toast_incorrect_protocol
307+
}
308+
309+
val host = Utils.ipAddressParse(arr1[1])
310+
if ( host == Utils.INVALID || host.port == -1) {
305311
return R.string.toast_incorrect_protocol
306312
}
307313

308-
vmess.address = arr22[0]
309-
vmess.port = Utils.parseInt(arr22[1])
314+
vmess.address = InetAddress.getByAddress(host.address.toByteArray()).getHostAddress()
315+
vmess.port = host.port
310316
vmess.security = arr21[0]
311317
vmess.id = arr21[1]
312318
vmess.subid = subid

0 commit comments

Comments
 (0)