Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d016ab06d4 | ||
|
|
4d9aced5a4 | ||
|
|
62b928e6a0 | ||
|
|
0ce60eae73 | ||
|
|
5930a6a9eb | ||
|
|
a360310be2 | ||
|
|
820e6cdf36 |
@@ -68,17 +68,17 @@ data class V2rayConfig(
|
||||
|
||||
data class OutSettingsBean(var vnext: List<VnextBean>? = null,
|
||||
var servers: List<ServersBean>? = null,
|
||||
/*Blackhole*/
|
||||
/*Blackhole*/
|
||||
var response: Response? = null,
|
||||
/*DNS*/
|
||||
/*DNS*/
|
||||
val network: String? = null,
|
||||
val address: String? = null,
|
||||
val port: Int? = null,
|
||||
/*Freedom*/
|
||||
/*Freedom*/
|
||||
val domainStrategy: String? = null,
|
||||
val redirect: String? = null,
|
||||
val userLevel: Int? = null,
|
||||
/*Loopback*/
|
||||
/*Loopback*/
|
||||
val inboundTag: String? = null) {
|
||||
|
||||
data class VnextBean(var address: String = "",
|
||||
@@ -99,6 +99,8 @@ data class V2rayConfig(
|
||||
var password: String = "",
|
||||
var port: Int = DEFAULT_PORT,
|
||||
var level: Int = DEFAULT_LEVEL,
|
||||
val email: String? = null,
|
||||
val flow: String? = null,
|
||||
var users: List<SocksUsersBean>? = null) {
|
||||
|
||||
|
||||
@@ -172,15 +174,20 @@ data class V2rayConfig(
|
||||
var sni = ""
|
||||
network = transport
|
||||
when (network) {
|
||||
"tcp" -> if (headerType == HTTP) {
|
||||
"tcp" -> {
|
||||
val tcpSetting = TcpSettingsBean()
|
||||
tcpSetting.header.type = HTTP
|
||||
if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(path)) {
|
||||
val requestObj = TcpSettingsBean.HeaderBean.RequestBean()
|
||||
requestObj.headers.Host = (host ?: "").split(",").map { it.trim() }
|
||||
requestObj.path = (path ?: "").split(",").map { it.trim() }
|
||||
tcpSetting.header.request = requestObj
|
||||
sni = requestObj.headers.Host.getOrNull(0) ?: sni
|
||||
if (headerType == HTTP) {
|
||||
tcpSetting.header.type = HTTP
|
||||
if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(path)) {
|
||||
val requestObj = TcpSettingsBean.HeaderBean.RequestBean()
|
||||
requestObj.headers.Host = (host ?: "").split(",").map { it.trim() }
|
||||
requestObj.path = (path ?: "").split(",").map { it.trim() }
|
||||
tcpSetting.header.request = requestObj
|
||||
sni = requestObj.headers.Host.getOrNull(0) ?: sni
|
||||
}
|
||||
} else {
|
||||
tcpSetting.header.type = "none"
|
||||
sni = host ?: ""
|
||||
}
|
||||
tcpSettings = tcpSetting
|
||||
}
|
||||
@@ -286,7 +293,7 @@ data class V2rayConfig(
|
||||
if (protocol.equals(EConfigType.VMESS.name, true)
|
||||
|| protocol.equals(EConfigType.VLESS.name, true)) {
|
||||
val transport = streamSettings?.network ?: return null
|
||||
return when(transport) {
|
||||
return when (transport) {
|
||||
"tcp" -> {
|
||||
val tcpSetting = streamSettings?.tcpSettings ?: return null
|
||||
listOf(tcpSetting.header.type,
|
||||
@@ -387,8 +394,9 @@ data class V2rayConfig(
|
||||
fun toPrettyPrinting(): String {
|
||||
return GsonBuilder()
|
||||
.setPrettyPrinting()
|
||||
.disableHtmlEscaping()
|
||||
.registerTypeAdapter( // custom serialiser is needed here since JSON by default parse number as Double, core will fail to start
|
||||
object: TypeToken<Double>() {}.type,
|
||||
object : TypeToken<Double>() {}.type,
|
||||
JsonSerializer { src: Double?, _: Type?, _: JsonSerializationContext? -> JsonPrimitive(src?.toInt()) }
|
||||
)
|
||||
.create()
|
||||
|
||||
@@ -48,7 +48,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
|
||||
if (holder is MainViewHolder) {
|
||||
val guid = mActivity.mainViewModel.serverList.getOrNull(position) ?: return
|
||||
val config = MmkvManager.decodeServerConfig(guid) ?: return
|
||||
val outbound = config.getProxyOutbound() ?: return
|
||||
val outbound = config.getProxyOutbound()
|
||||
val aff = MmkvManager.decodeServerAffiliationInfo(guid)
|
||||
|
||||
holder.name.text = config.remarks
|
||||
@@ -76,7 +76,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
|
||||
} else {
|
||||
holder.type.text = config.configType.name.toLowerCase()
|
||||
}
|
||||
holder.statistics.text = "${outbound.getServerAddress()} : ${outbound.getServerPort()}"
|
||||
holder.statistics.text = "${outbound?.getServerAddress()} : ${outbound?.getServerPort()}"
|
||||
|
||||
holder.layout_share.setOnClickListener {
|
||||
AlertDialog.Builder(mActivity).setItems(shareOptions.toTypedArray()) { _, i ->
|
||||
|
||||
@@ -65,7 +65,7 @@ object AngConfigManager {
|
||||
AppConfig.PREF_V2RAY_ROUTING_AGENT,
|
||||
AppConfig.PREF_V2RAY_ROUTING_BLOCKED,
|
||||
AppConfig.PREF_V2RAY_ROUTING_DIRECT,).forEach { key ->
|
||||
settingsStorage?.encode(key, sharedPreferences.getString(key, ""))
|
||||
settingsStorage?.encode(key, sharedPreferences.getString(key, null))
|
||||
}
|
||||
listOf(AppConfig.PREF_SPEED_ENABLED,
|
||||
AppConfig.PREF_SNIFFING_ENABLED,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<item>aes-128-gcm</item>
|
||||
<item>auto</item>
|
||||
<item>none</item>
|
||||
<item>zero</item>
|
||||
</string-array>
|
||||
<string-array name="ss_securitys" translatable="false">
|
||||
<item>aes-256-cfb</item>
|
||||
@@ -98,6 +99,7 @@
|
||||
<item>xtls-rprx-direct</item>
|
||||
<item>xtls-rprx-direct-udp443</item>
|
||||
<item>xtls-rprx-splice</item>
|
||||
<item>xtls-rprx-splice-udp443</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user