Compare commits

..

11 Commits

Author SHA1 Message Date
2dust
a211bc24cb up 1.7.31 2022-12-30 12:47:09 +08:00
2dust
6f47aa33e8 Convert idn domain 2022-12-30 12:46:51 +08:00
2dust
90636bb294 Merge pull request #1800 from zjudongze/master
restart tun2socks process if exited abnormally
2022-12-30 10:35:00 +08:00
2dust
ff98ff02c5 up 1.7.30 2022-12-13 19:49:59 +08:00
2dust
dc36986255 up 1.7.28 2022-12-05 20:36:29 +08:00
2dust
5651e002c4 Merge pull request #1822 from yuhan6665/xtls-rv
Add Wireguard outbound (custom config)
2022-12-05 20:00:40 +08:00
yuhan6665
4e7849d1cb Add Wireguard outbound (custom config) 2022-12-04 18:15:17 -05:00
2dust
9e3dba8dbe up 1.7.27 2022-11-28 20:18:17 +08:00
derek.dong
3a1daf1888 restart tun2socks process if exited abnormally 2022-11-23 16:25:38 +08:00
2dust
79ba41354e Merge pull request #1784 from DanielBlackBeard/master
fix Persian language dictation
2022-11-19 11:33:25 +08:00
dany pm
85e866d462 fix Persian language dictation 2022-11-18 17:28:01 +03:30
9 changed files with 55 additions and 15 deletions

View File

@@ -18,8 +18,8 @@ android {
minSdkVersion 21
targetSdkVersion Integer.parseInt("$targetSdkVer")
multiDexEnabled true
versionCode 486
versionName "1.7.26"
versionCode 492
versionName "1.7.31"
}
if (props["sign"]) {

View File

@@ -6,7 +6,8 @@ enum class EConfigType(val value: Int, val protocolScheme: String) {
SHADOWSOCKS(3, "ss://"),
SOCKS(4, "socks://"),
VLESS(5, "vless://"),
TROJAN(6, "trojan://");
TROJAN(6, "trojan://"),
WIREGUARD(7, "wireguard://");
companion object {
fun fromInt(value: Int) = values().firstOrNull { it.value == value }

View File

@@ -26,7 +26,7 @@ data class ServerConfig(
vnext = listOf(V2rayConfig.OutboundBean.OutSettingsBean.VnextBean(
users = listOf(V2rayConfig.OutboundBean.OutSettingsBean.VnextBean.UsersBean())))),
streamSettings = V2rayConfig.OutboundBean.StreamSettingsBean()))
EConfigType.CUSTOM ->
EConfigType.CUSTOM, EConfigType.WIREGUARD ->
return ServerConfig(configType = configType)
EConfigType.SHADOWSOCKS, EConfigType.SOCKS, EConfigType.TROJAN ->
return ServerConfig(

View File

@@ -74,14 +74,18 @@ data class V2rayConfig(
var response: Response? = null,
/*DNS*/
val network: String? = null,
val address: String? = null,
val address: Any? = null,
val port: Int? = null,
/*Freedom*/
var domainStrategy: String? = null,
val redirect: String? = null,
val userLevel: Int? = null,
/*Loopback*/
val inboundTag: String? = null) {
val inboundTag: String? = null,
/*Wireguard*/
val secretKey: String? = null,
val peers: List<WireGuardBean>? = null,
) {
data class VnextBean(var address: String = "",
var port: Int = DEFAULT_PORT,
@@ -113,6 +117,9 @@ data class V2rayConfig(
}
data class Response(var type: String)
data class WireGuardBean(var publicKey: String = "",
var endpoint: String = "")
}
data class StreamSettingsBean(var network: String = DEFAULT_NETWORK,
@@ -286,6 +293,8 @@ data class V2rayConfig(
|| protocol.equals(EConfigType.SOCKS.name, true)
|| protocol.equals(EConfigType.TROJAN.name, true)) {
return settings?.servers?.get(0)?.address
} else if (protocol.equals(EConfigType.WIREGUARD.name, true)) {
return settings?.peers?.get(0)?.endpoint?.substringBeforeLast(":")
}
return null
}
@@ -298,6 +307,8 @@ data class V2rayConfig(
|| protocol.equals(EConfigType.SOCKS.name, true)
|| protocol.equals(EConfigType.TROJAN.name, true)) {
return settings?.servers?.get(0)?.port
} else if (protocol.equals(EConfigType.WIREGUARD.name, true)) {
return settings?.peers?.get(0)?.endpoint?.substringAfterLast(":")?.toInt()
}
return null
}
@@ -311,6 +322,8 @@ data class V2rayConfig(
return settings?.servers?.get(0)?.password
} else if (protocol.equals(EConfigType.SOCKS.name, true)) {
return settings?.servers?.get(0)?.users?.get(0)?.pass
} else if (protocol.equals(EConfigType.WIREGUARD.name, true)) {
return settings?.secretKey
}
return null
}
@@ -426,12 +439,10 @@ data class V2rayConfig(
fun getProxyOutbound(): OutboundBean? {
outbounds.forEach { outbound ->
if (outbound.protocol.equals(EConfigType.VMESS.name, true) ||
outbound.protocol.equals(EConfigType.VLESS.name, true) ||
outbound.protocol.equals(EConfigType.SHADOWSOCKS.name, true) ||
outbound.protocol.equals(EConfigType.SOCKS.name, true) ||
outbound.protocol.equals(EConfigType.TROJAN.name, true)) {
return outbound
EConfigType.values().forEach {
if (outbound.protocol.equals(it.name, true)) {
return outbound
}
}
}
return null

View File

@@ -36,6 +36,7 @@ class V2RayVpnService : VpnService(), ServiceControl {
private val settingsStorage by lazy { MMKV.mmkvWithID(MmkvManager.ID_SETTING, MMKV.MULTI_PROCESS_MODE) }
private lateinit var mInterface: ParcelFileDescriptor
private var isRunning = false
//val fd: Int get() = mInterface.fd
private lateinit var process: Process
@@ -183,6 +184,7 @@ class V2RayVpnService : VpnService(), ServiceControl {
// Create a new interface using the builder and save the parameters.
try {
mInterface = builder.establish()!!
isRunning = true
runTun2socks()
} catch (e: Exception) {
// non-nullable lateinit var
@@ -219,6 +221,15 @@ class V2RayVpnService : VpnService(), ServiceControl {
process = proBuilder
.directory(applicationContext.filesDir)
.start()
Thread(Runnable {
Log.d(packageName,"$TUN2SOCKS check")
process.waitFor()
Log.d(packageName,"$TUN2SOCKS exited")
if (isRunning) {
Log.d(packageName,"$TUN2SOCKS restart")
runTun2socks()
}
}).start()
Log.d(packageName, process.toString())
sendFd()
@@ -262,6 +273,7 @@ class V2RayVpnService : VpnService(), ServiceControl {
// val emptyInfo = VpnNetworkInfo()
// val info = loadVpnNetworkInfo(configName, emptyInfo)!! + (lastNetworkInfo ?: emptyInfo)
// saveVpnNetworkInfo(configName, info)
isRunning = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
try {
connectivity.unregisterNetworkCallback(defaultNetworkCallback)

View File

@@ -488,7 +488,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
if (!it.second.enabled) {
return@forEach
}
val url = it.second.url
val url = Utils.idnToASCII(it.second.url)
if (!Utils.isValidUrl(url)) {
return@forEach
}

View File

@@ -486,7 +486,7 @@ object AngConfigManager {
val json = Gson().toJson(vmessQRCode)
Utils.encode(json)
}
EConfigType.CUSTOM -> ""
EConfigType.CUSTOM, EConfigType.WIREGUARD -> ""
EConfigType.SHADOWSOCKS -> {
val remark = "#" + Utils.urlEncode(config.remarks)
val pw = Utils.encode("${outbound.getSecurityEncryption()}:${outbound.getPassword()}")

View File

@@ -429,5 +429,21 @@ object Utils {
fun removeWhiteSpace(str: String?): String? {
return str?.replace(" ", "")
}
fun idnToASCII(str: String): String {
var url = str
var prot = ""
if (url.startsWith(AppConfig.HTTPS_PROTOCOL)) {
url = url.substring(8)
prot = AppConfig.HTTPS_PROTOCOL
} else if (url.startsWith(AppConfig.HTTP_PROTOCOL)) {
url = url.substring(7)
prot = AppConfig.HTTP_PROTOCOL
}
url = prot + IDN.toASCII(url, IDN.ALLOW_UNASSIGNED)
if (url != str) return url else {
return str
}
}
}

View File

@@ -46,7 +46,7 @@
<string name="server_lab_more_function">انتقال</string>
<string name="server_lab_head_type">نوع head</string>
<string name="server_lab_mode_type">حالت gRPC</string>
<string name="server_lab_request_host">درخواست میزبان (میزبان/میزبان ws/ یزبان h2)/امنیت QUIC</string>
<string name="server_lab_request_host">درخواست میزبان (میزبان/میزبان ws/ میزبان h2)/امنیت QUIC</string>
<string name="server_lab_path">مسیر (مسیر ws/ مسیر h2) کلید QUIC/دانه kcp/نام‌خدمات gRPC</string>
<string name="server_lab_stream_security">tls</string>
<string name="server_lab_stream_fingerprint" translatable="false">uTLS</string>