File tree 1 file changed +11
-5
lines changed
V2rayNG/app/src/main/kotlin/com/v2ray/ang/util
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ import com.v2ray.ang.extension.defaultDPreference
19
19
import org.jetbrains.anko.toast
20
20
import java.net.URLDecoder
21
21
import java.util.*
22
-
22
+ import java.net.*
23
+ import java.math.BigInteger
23
24
24
25
object AngConfigManager {
25
26
private lateinit var app: AngApplication
@@ -295,18 +296,23 @@ object AngConfigManager {
295
296
result = Utils .decode(result)
296
297
}
297
298
299
+ // method:password@ipaddr:port
298
300
val arr1 = result.split(' @' )
299
301
if (arr1.count() != 2 ) {
300
302
return R .string.toast_incorrect_protocol
301
303
}
302
304
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 ) {
305
311
return R .string.toast_incorrect_protocol
306
312
}
307
313
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
310
316
vmess.security = arr21[0 ]
311
317
vmess.id = arr21[1 ]
312
318
vmess.subid = subid
You can’t perform that action at this time.
0 commit comments