mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-20 15:10:05 +08:00
style: Make the code more beautiful
This commit is contained in:
parent
f839b26ff3
commit
5370f815ec
@ -14,7 +14,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
|
|||||||
|
|
||||||
//////// End of VMess & VLESS ////////
|
//////// End of VMess & VLESS ////////
|
||||||
|
|
||||||
// "V2Ray Transport" tcp/http/ws/quic/grpc/httpupgrade
|
// "V2Ray Transport" tcp/http/ws/quic/grpc/httpUpgrade
|
||||||
public String type;
|
public String type;
|
||||||
|
|
||||||
public String host;
|
public String host;
|
||||||
@ -133,7 +133,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
|
|||||||
case "grpc": {
|
case "grpc": {
|
||||||
output.writeString(path);
|
output.writeString(path);
|
||||||
}
|
}
|
||||||
case "httpupgrade": {
|
case "httpUpgrade": {
|
||||||
output.writeString(host);
|
output.writeString(host);
|
||||||
output.writeString(path);
|
output.writeString(path);
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
|
|||||||
case "grpc": {
|
case "grpc": {
|
||||||
path = input.readString();
|
path = input.readString();
|
||||||
}
|
}
|
||||||
case "httpupgrade": {
|
case "httpUpgrade": {
|
||||||
host = input.readString();
|
host = input.readString();
|
||||||
path = input.readString();
|
path = input.readString();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,19 @@ import com.google.gson.Gson
|
|||||||
import io.nekohasekai.sagernet.fmt.http.HttpBean
|
import io.nekohasekai.sagernet.fmt.http.HttpBean
|
||||||
import io.nekohasekai.sagernet.fmt.trojan.TrojanBean
|
import io.nekohasekai.sagernet.fmt.trojan.TrojanBean
|
||||||
import io.nekohasekai.sagernet.ktx.*
|
import io.nekohasekai.sagernet.ktx.*
|
||||||
import moe.matsuri.nb4a.SingBoxOptions.*
|
import moe.matsuri.nb4a.SingBoxOptions.Outbound
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.OutboundRealityOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.OutboundTLSOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.OutboundUTLSOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.Outbound_HTTPOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.Outbound_TrojanOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.Outbound_VLESSOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.Outbound_VMessOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.V2RayTransportOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.V2RayTransportOptions_GRPCOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.V2RayTransportOptions_HTTPOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.V2RayTransportOptions_HTTPUpgradeOptions
|
||||||
|
import moe.matsuri.nb4a.SingBoxOptions.V2RayTransportOptions_WebsocketOptions
|
||||||
import moe.matsuri.nb4a.utils.NGUtil
|
import moe.matsuri.nb4a.utils.NGUtil
|
||||||
import moe.matsuri.nb4a.utils.listByLineOrComma
|
import moe.matsuri.nb4a.utils.listByLineOrComma
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
@ -117,7 +129,7 @@ fun parseV2Ray(link: String): StandardV2RayBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"httpupgrade" -> {
|
"httpUpgrade" -> {
|
||||||
url.queryParameter("path")?.let {
|
url.queryParameter("path")?.let {
|
||||||
bean.path = it
|
bean.path = it
|
||||||
}
|
}
|
||||||
@ -225,7 +237,7 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"httpupgrade" -> {
|
"httpUpgrade" -> {
|
||||||
url.queryParameter("host")?.let {
|
url.queryParameter("host")?.let {
|
||||||
host = it
|
host = it
|
||||||
}
|
}
|
||||||
@ -454,7 +466,7 @@ fun StandardV2RayBean.toUriVMessVLESSTrojan(isTrojan: Boolean): String {
|
|||||||
|
|
||||||
when (type) {
|
when (type) {
|
||||||
"tcp" -> {}
|
"tcp" -> {}
|
||||||
"ws", "http", "httpupgrade" -> {
|
"ws", "http", "httpUpgrade" -> {
|
||||||
if (host.isNotBlank()) {
|
if (host.isNotBlank()) {
|
||||||
builder.addQueryParameter("host", host)
|
builder.addQueryParameter("host", host)
|
||||||
}
|
}
|
||||||
@ -583,9 +595,9 @@ fun buildSingBoxOutboundStreamSettings(bean: StandardV2RayBean): V2RayTransportO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"httpupgrade" -> {
|
"httpUpgrade" -> {
|
||||||
return V2RayTransportOptions_HTTPUpgradeOptions().apply {
|
return V2RayTransportOptions_HTTPUpgradeOptions().apply {
|
||||||
type = "httpupgrade"
|
type = "httpUpgrade"
|
||||||
host = bean.host
|
host = bean.host
|
||||||
path = bean.path
|
path = bean.path
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,13 +166,15 @@ abstract class StandardV2RaySettingsActivity : ProfileSettingsActivity<StandardV
|
|||||||
path.preference.isVisible = true
|
path.preference.isVisible = true
|
||||||
wsCategory.isVisible = true
|
wsCategory.isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
"grpc" -> {
|
"grpc" -> {
|
||||||
path.preference.setTitle(R.string.grpc_service_name)
|
path.preference.setTitle(R.string.grpc_service_name)
|
||||||
path.preference.isVisible = true
|
path.preference.isVisible = true
|
||||||
}
|
}
|
||||||
"httpupgrade" -> {
|
|
||||||
host.preference.setTitle("HTTPUpgrade Host")
|
"httpUpgrade" -> {
|
||||||
path.preference.setTitle("HTTPUpgrade Path")
|
host.preference.setTitle(R.string.http_upgrade_host)
|
||||||
|
path.preference.setTitle(R.string.http_upgrade_path)
|
||||||
host.preference.isVisible = true
|
host.preference.isVisible = true
|
||||||
path.preference.isVisible = true
|
path.preference.isVisible = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -485,4 +485,6 @@
|
|||||||
<string name="dynamic_record_sizing_disabled">禁用TLS记录的自适应调整大小</string>
|
<string name="dynamic_record_sizing_disabled">禁用TLS记录的自适应调整大小</string>
|
||||||
<string name="dynamic_record_sizing_sum">如果启用,将始终使用最大可能的TLS记录大小。当禁用时,TLS记录的大小可能会进行调整以尝试提高延迟。</string>
|
<string name="dynamic_record_sizing_sum">如果启用,将始终使用最大可能的TLS记录大小。当禁用时,TLS记录的大小可能会进行调整以尝试提高延迟。</string>
|
||||||
<string name="ech_config">ECH 配置</string>
|
<string name="ech_config">ECH 配置</string>
|
||||||
|
<string name="http_upgrade_host">HTTPUpgrade 主机</string>
|
||||||
|
<string name="http_upgrade_path">HTTPUpgrade 端口</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -263,7 +263,7 @@
|
|||||||
<item>http</item>
|
<item>http</item>
|
||||||
<item>quic</item>
|
<item>quic</item>
|
||||||
<item>grpc</item>
|
<item>grpc</item>
|
||||||
<item>httpupgrade</item>
|
<item>httpUpgrade</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="trojan_go_networks_entry">
|
<string-array name="trojan_go_networks_entry">
|
||||||
|
|||||||
@ -526,5 +526,7 @@ Anyone can write advanced plugins, which can control NekoBox. please download an
|
|||||||
<string name="dynamic_record_sizing_disabled">Disables adaptive sizing of TLS records</string>
|
<string name="dynamic_record_sizing_disabled">Disables adaptive sizing of TLS records</string>
|
||||||
<string name="ech_config">ECH Config</string>
|
<string name="ech_config">ECH Config</string>
|
||||||
<string name="dynamic_record_sizing_sum">If enable, the largest possible TLS record size is always used. When disable, the size of TLS records may be adjusted in an attempt to improve latency.</string>
|
<string name="dynamic_record_sizing_sum">If enable, the largest possible TLS record size is always used. When disable, the size of TLS records may be adjusted in an attempt to improve latency.</string>
|
||||||
|
<string name="http_upgrade_host">HTTPUpgrade Host</string>
|
||||||
|
<string name="http_upgrade_path">HTTPUpgrade Path</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue
Block a user