From ea654175105c2a3f7773d23da5600fcbe6fed371 Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Mon, 4 Sep 2023 20:53:49 +0900 Subject: [PATCH] support hysteria2 --- .../java/io/nekohasekai/sagernet/Constants.kt | 2 + .../sagernet/database/DataStore.kt | 4 +- .../nekohasekai/sagernet/fmt/ConfigBuilder.kt | 2 +- .../sagernet/fmt/hysteria/HysteriaBean.java | 56 ++- .../sagernet/fmt/hysteria/HysteriaFmt.kt | 238 ++++++++--- .../io/nekohasekai/sagernet/ktx/Formats.kt | 2 +- .../ui/profile/HysteriaSettingsActivity.kt | 39 +- .../ui/profile/SocksSettingsActivity.kt | 6 +- .../ui/profile/TuicSettingsActivity.kt | 9 +- .../java/moe/matsuri/nb4a/SingBoxOptions.java | 398 +++++++++++++++++- app/src/main/res/values/arrays.xml | 5 + app/src/main/res/xml/hysteria_preferences.xml | 9 + app/src/main/res/xml/tuic_preferences.xml | 2 +- buildScript/lib/core/get_source_env.sh | 2 +- libcore/go.mod | 11 +- libcore/go.sum | 27 +- 16 files changed, 689 insertions(+), 123 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sagernet/Constants.kt b/app/src/main/java/io/nekohasekai/sagernet/Constants.kt index 8a6b06f5..020833cf 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/Constants.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/Constants.kt @@ -78,6 +78,8 @@ object Key { const val SERVER_METHOD = "serverMethod" const val SERVER_PASSWORD1 = "serverPassword1" + const val PROTOCOL_VERSION = "protocolVersion" + const val SERVER_PROTOCOL = "serverProtocol" const val SERVER_OBFS = "serverObfs" diff --git a/app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt b/app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt index a6c23f7b..fc0e96f7 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt @@ -206,7 +206,9 @@ object DataStore : OnPreferenceDataStoreChangeListener { var serverDisableMtuDiscovery by profileCacheStore.boolean(Key.SERVER_DISABLE_MTU_DISCOVERY) var serverHopInterval by profileCacheStore.stringToInt(Key.SERVER_HOP_INTERVAL) { 10 } - var serverProtocolVersion by profileCacheStore.stringToInt(Key.SERVER_PROTOCOL) + var protocolVersion by profileCacheStore.stringToInt(Key.PROTOCOL_VERSION) + + var serverProtocolInt by profileCacheStore.stringToInt(Key.SERVER_PROTOCOL) var serverPrivateKey by profileCacheStore.string(Key.SERVER_PRIVATE_KEY) var serverInsecureConcurrency by profileCacheStore.stringToInt(Key.SERVER_INSECURE_CONCURRENCY) diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt b/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt index 6d6a0b66..65f49db9 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt @@ -385,7 +385,7 @@ fun buildConfig( buildSingBoxOutboundStandardV2RayBean(bean).asMap() is HysteriaBean -> - buildSingBoxOutboundHysteriaBean(bean).asMap() + buildSingBoxOutboundHysteriaBean(bean) is TuicBean -> buildSingBoxOutboundTuicBean(bean).asMap() diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaBean.java b/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaBean.java index 56a8a454..6a5f83c0 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaBean.java +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaBean.java @@ -13,25 +13,17 @@ import kotlin.text.StringsKt; public class HysteriaBean extends AbstractBean { + public Integer protocolVersion; - public static final int TYPE_NONE = 0; - public static final int TYPE_STRING = 1; - public static final int TYPE_BASE64 = 2; - - public Integer authPayloadType; - public String authPayload; - - public static final int PROTOCOL_UDP = 0; - public static final int PROTOCOL_FAKETCP = 1; - public static final int PROTOCOL_WECHAT_VIDEO = 2; + // Use serverPorts instead of serverPort + public String serverPorts; - public Integer protocol; + // HY1 & 2 + public String authPayload; public String obfuscation; public String sni; - public String alpn; public String caText; - public Integer uploadMbps; public Integer downloadMbps; public Boolean allowInsecure; @@ -40,7 +32,19 @@ public class HysteriaBean extends AbstractBean { public Boolean disableMtuDiscovery; public Integer hopInterval; - public String serverPorts; + // HY1 + + public String alpn; + + public static final int TYPE_NONE = 0; + public static final int TYPE_STRING = 1; + public static final int TYPE_BASE64 = 2; + public Integer authPayloadType; + + public static final int PROTOCOL_UDP = 0; + public static final int PROTOCOL_FAKETCP = 1; + public static final int PROTOCOL_WECHAT_VIDEO = 2; + public Integer protocol; @Override public boolean canMapping() { @@ -50,6 +54,8 @@ public boolean canMapping() { @Override public void initializeDefaultValues() { super.initializeDefaultValues(); + if (protocolVersion == null) protocolVersion = 2; + if (authPayloadType == null) authPayloadType = TYPE_NONE; if (authPayload == null) authPayload = ""; if (protocol == null) protocol = PROTOCOL_UDP; @@ -57,11 +63,16 @@ public void initializeDefaultValues() { if (sni == null) sni = ""; if (alpn == null) alpn = ""; if (caText == null) caText = ""; - - if (uploadMbps == null) uploadMbps = 10; - if (downloadMbps == null) downloadMbps = 50; if (allowInsecure == null) allowInsecure = false; + if (protocolVersion == 1) { + if (uploadMbps == null) uploadMbps = 10; + if (downloadMbps == null) downloadMbps = 50; + } else { + if (uploadMbps == null) uploadMbps = 0; + if (downloadMbps == null) downloadMbps = 0; + } + if (streamReceiveWindow == null) streamReceiveWindow = 0; if (connectionReceiveWindow == null) connectionReceiveWindow = 0; if (disableMtuDiscovery == null) disableMtuDiscovery = false; @@ -71,8 +82,11 @@ public void initializeDefaultValues() { @Override public void serialize(ByteBufferOutput output) { - output.writeInt(6); + output.writeInt(7); super.serialize(output); + + output.writeInt(protocolVersion); + output.writeInt(authPayloadType); output.writeString(authPayload); output.writeInt(protocol); @@ -90,13 +104,17 @@ public void serialize(ByteBufferOutput output) { output.writeBoolean(disableMtuDiscovery); output.writeInt(hopInterval); output.writeString(serverPorts); - } @Override public void deserialize(ByteBufferInput input) { int version = input.readInt(); super.deserialize(input); + if (version >= 7) { + protocolVersion = input.readInt(); + } else { + protocolVersion = 1; + } authPayloadType = input.readInt(); authPayload = input.readString(); if (version >= 3) { diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaFmt.kt b/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaFmt.kt index d1d5aeb9..f0637fa6 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaFmt.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaFmt.kt @@ -11,12 +11,15 @@ import java.io.File // hysteria://host:port?auth=123456&peer=sni.domain&insecure=1|0&upmbps=100&downmbps=100&alpn=hysteria&obfs=xplus&obfsParam=123456#remarks - fun parseHysteria(url: String): HysteriaBean { + if (url.startsWith("hysteria2:") || url.startsWith("hy2:")) { + return parseHysteria2(url) + } val link = url.replace("hysteria://", "https://").toHttpUrlOrNull() ?: error( "invalid hysteria link $url" ) return HysteriaBean().apply { + protocolVersion = 1 serverAddress = link.host serverPorts = link.port.toString() name = link.fragment @@ -60,51 +63,114 @@ fun parseHysteria(url: String): HysteriaBean { } } +// hysteria2://[auth@]hostname[:port]/?[key=value]&[key=value]... +fun parseHysteria2(url: String): HysteriaBean { + val link = url + .replace("hysteria2://", "https://") + .replace("hy2://", "https://") + .toHttpUrlOrNull() ?: error("invalid hysteria link $url") + return HysteriaBean().apply { + protocolVersion = 2 + serverAddress = link.host + serverPorts = link.port.toString() + authPayload = if (link.password.isNotBlank()) { + link.username + ":" + link.password + } else { + link.username + } + name = link.fragment + + link.queryParameter("mport")?.also { + serverPorts = it + } + link.queryParameter("sni")?.also { + sni = it + } + link.queryParameter("insecure")?.also { + allowInsecure = it == "1" + } +// link.queryParameter("upmbps")?.also { +// uploadMbps = it.toIntOrNull() ?: uploadMbps +// } +// link.queryParameter("downmbps")?.also { +// downloadMbps = it.toIntOrNull() ?: downloadMbps +// } + link.queryParameter("obfs-password")?.also { + obfuscation = it + } + link.queryParameter("pinSHA256")?.also { + // TODO your box do not support it + } + } +} + fun HysteriaBean.toUri(): String { + var un = "" + var pw = "" + if (protocolVersion == 2) { + if (authPayload.contains(":")) { + un = authPayload.substringBefore(":") + pw = authPayload.substringAfter(":") + } else { + un = authPayload + } + } + // val builder = linkBuilder() .host(serverAddress) .port(getFirstPort(serverPorts)) + .username(un) + .password(pw) if (isMultiPort(displayAddress())) { builder.addQueryParameter("mport", serverPorts) } + if (name.isNotBlank()) { + builder.encodedFragment(name.urlSafe()) + } if (allowInsecure) { builder.addQueryParameter("insecure", "1") } - if (sni.isNotBlank()) { - builder.addQueryParameter("peer", sni) - } - if (authPayload.isNotBlank()) { - builder.addQueryParameter("auth", authPayload) - } - builder.addQueryParameter("upmbps", "$uploadMbps") - builder.addQueryParameter("downmbps", "$downloadMbps") - if (alpn.isNotBlank()) { - builder.addQueryParameter("alpn", alpn) - } - if (obfuscation.isNotBlank()) { - builder.addQueryParameter("obfs", "xplus") - builder.addQueryParameter("obfsParam", obfuscation) - } - when (protocol) { - HysteriaBean.PROTOCOL_FAKETCP -> { - builder.addQueryParameter("protocol", "faketcp") + if (protocolVersion == 1) { + if (sni.isNotBlank()) { + builder.addQueryParameter("peer", sni) + } + if (authPayload.isNotBlank()) { + builder.addQueryParameter("auth", authPayload) + } + builder.addQueryParameter("upmbps", "$uploadMbps") + builder.addQueryParameter("downmbps", "$downloadMbps") + if (alpn.isNotBlank()) { + builder.addQueryParameter("alpn", alpn) + } + if (obfuscation.isNotBlank()) { + builder.addQueryParameter("obfs", "xplus") + builder.addQueryParameter("obfsParam", obfuscation) } + when (protocol) { + HysteriaBean.PROTOCOL_FAKETCP -> { + builder.addQueryParameter("protocol", "faketcp") + } - HysteriaBean.PROTOCOL_WECHAT_VIDEO -> { - builder.addQueryParameter("protocol", "wechat-video") + HysteriaBean.PROTOCOL_WECHAT_VIDEO -> { + builder.addQueryParameter("protocol", "wechat-video") + } + } + } else { + if (sni.isNotBlank()) { + builder.addQueryParameter("sni", sni) + } + if (obfuscation.isNotBlank()) { + builder.addQueryParameter("obfs", "salamander") + builder.addQueryParameter("obfs-password", obfuscation) } } - if (protocol == HysteriaBean.PROTOCOL_FAKETCP) { - builder.addQueryParameter("protocol", "faketcp") - } - if (name.isNotBlank()) { - builder.encodedFragment(name.urlSafe()) - } - return builder.toLink("hysteria") + return builder.toLink(if (protocolVersion == 2) "hy2" else "hysteria") } fun JSONObject.parseHysteria(): HysteriaBean { + // TODO parse HY2 JSON+YAML return HysteriaBean().apply { + protocolVersion = 1 serverAddress = optString("server").substringBeforeLast(":") serverPorts = optString("server").substringAfterLast(":") uploadMbps = getIntNya("up_mbps") @@ -140,6 +206,9 @@ fun JSONObject.parseHysteria(): HysteriaBean { } fun HysteriaBean.buildHysteriaConfig(port: Int, cacheFile: (() -> File)?): String { + if (protocolVersion != 1) { + throw Exception("error version: $protocolVersion") + } return JSONObject().apply { put("server", displayAddress()) when (protocol) { @@ -209,43 +278,86 @@ fun HysteriaBean.canUseSingBox(): Boolean { return true } -fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): SingBoxOptions.Outbound_HysteriaOptions { - return SingBoxOptions.Outbound_HysteriaOptions().apply { - type = "hysteria" - server = bean.serverAddress - val port = bean.serverPorts.toIntOrNull() - if (port != null) { - server_port = port - } else { - hop_ports = bean.serverPorts - } - hop_interval = bean.hopInterval - up_mbps = bean.uploadMbps - down_mbps = bean.downloadMbps - obfs = bean.obfuscation - disable_mtu_discovery = bean.disableMtuDiscovery - when (bean.authPayloadType) { - HysteriaBean.TYPE_BASE64 -> auth = bean.authPayload - HysteriaBean.TYPE_STRING -> auth_str = bean.authPayload - } - if (bean.streamReceiveWindow > 0) { - recv_window_conn = bean.streamReceiveWindow.toLong() - } - if (bean.connectionReceiveWindow > 0) { - recv_window_conn = bean.connectionReceiveWindow.toLong() - } - tls = SingBoxOptions.OutboundTLSOptions().apply { - if (bean.sni.isNotBlank()) { - server_name = bean.sni +fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): MutableMap { + return when (bean.protocolVersion) { + 1 -> SingBoxOptions.Outbound_HysteriaOptions().apply { + type = "hysteria" + server = bean.serverAddress + val port = bean.serverPorts.toIntOrNull() + if (port != null) { + server_port = port + } else { + hop_ports = bean.serverPorts } - if (bean.alpn.isNotBlank()) { - alpn = bean.alpn.listByLineOrComma() + hop_interval = bean.hopInterval + up_mbps = bean.uploadMbps + down_mbps = bean.downloadMbps + obfs = bean.obfuscation + disable_mtu_discovery = bean.disableMtuDiscovery + when (bean.authPayloadType) { + HysteriaBean.TYPE_BASE64 -> auth = bean.authPayload + HysteriaBean.TYPE_STRING -> auth_str = bean.authPayload } - if (bean.caText.isNotBlank()) { - certificate = bean.caText + if (bean.streamReceiveWindow > 0) { + recv_window_conn = bean.streamReceiveWindow.toLong() } - insecure = bean.allowInsecure - enabled = true - } + if (bean.connectionReceiveWindow > 0) { + recv_window_conn = bean.connectionReceiveWindow.toLong() + } + tls = SingBoxOptions.OutboundTLSOptions().apply { + if (bean.sni.isNotBlank()) { + server_name = bean.sni + } + if (bean.alpn.isNotBlank()) { + alpn = bean.alpn.listByLineOrComma() + } + if (bean.caText.isNotBlank()) { + certificate = bean.caText + } + insecure = bean.allowInsecure + enabled = true + } + }.asMap() + + 2 -> SingBoxOptions.Outbound_Hysteria2Options().apply { + type = "hysteria2" + server = bean.serverAddress + val port = bean.serverPorts.toIntOrNull() + if (port != null) { + server_port = port + } else { +// hop_ports = bean.serverPorts + } +// hop_interval = bean.hopInterval + up_mbps = bean.uploadMbps + down_mbps = bean.downloadMbps + if (bean.obfuscation.isNotBlank()) { + obfs = SingBoxOptions.Hysteria2Obfs().apply { + type = "salamander" + password = bean.obfuscation + } + } +// disable_mtu_discovery = bean.disableMtuDiscovery + password = bean.authPayload +// if (bean.streamReceiveWindow > 0) { +// recv_window_conn = bean.streamReceiveWindow.toLong() +// } +// if (bean.connectionReceiveWindow > 0) { +// recv_window_conn = bean.connectionReceiveWindow.toLong() +// } + tls = SingBoxOptions.OutboundTLSOptions().apply { + if (bean.sni.isNotBlank()) { + server_name = bean.sni + } + alpn = listOf("h3") + if (bean.caText.isNotBlank()) { + certificate = bean.caText + } + insecure = bean.allowInsecure + enabled = true + } + }.asMap() + + else -> mutableMapOf("error_version" to bean.protocolVersion) } } diff --git a/app/src/main/java/io/nekohasekai/sagernet/ktx/Formats.kt b/app/src/main/java/io/nekohasekai/sagernet/ktx/Formats.kt index ce1c179a..1764c5b0 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ktx/Formats.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ktx/Formats.kt @@ -181,7 +181,7 @@ suspend fun parseProxies(text: String): List { }.onFailure { Logs.w(it) } - } else if (startsWith("hysteria://")) { + } else if (startsWith("hysteria://") || startsWith("hysteria2://") || startsWith("hy2://")) { Logs.d("Try parse hysteria link: $this") runCatching { entities.add(parseHysteria(this)) diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/HysteriaSettingsActivity.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/HysteriaSettingsActivity.kt index 78d22575..c00c6a3c 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/HysteriaSettingsActivity.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/HysteriaSettingsActivity.kt @@ -3,6 +3,7 @@ package io.nekohasekai.sagernet.ui.profile import android.os.Bundle import androidx.preference.EditTextPreference import androidx.preference.PreferenceFragmentCompat +import androidx.preference.SwitchPreference import io.nekohasekai.sagernet.Key import io.nekohasekai.sagernet.R import io.nekohasekai.sagernet.database.DataStore @@ -17,11 +18,12 @@ class HysteriaSettingsActivity : ProfileSettingsActivity() { override fun HysteriaBean.init() { DataStore.profileName = name + DataStore.protocolVersion = protocolVersion DataStore.serverAddress = serverAddress DataStore.serverPorts = serverPorts DataStore.serverObfs = obfuscation DataStore.serverAuthType = authPayloadType - DataStore.serverProtocolVersion = protocol + DataStore.serverProtocolInt = protocol DataStore.serverPassword = authPayload DataStore.serverSNI = sni DataStore.serverALPN = alpn @@ -37,12 +39,13 @@ class HysteriaSettingsActivity : ProfileSettingsActivity() { override fun HysteriaBean.serialize() { name = DataStore.profileName + protocolVersion = DataStore.protocolVersion serverAddress = DataStore.serverAddress serverPorts = DataStore.serverPorts obfuscation = DataStore.serverObfs authPayloadType = DataStore.serverAuthType authPayload = DataStore.serverPassword - protocol = DataStore.serverProtocolVersion + protocol = DataStore.serverProtocolInt sni = DataStore.serverSNI alpn = DataStore.serverALPN caText = DataStore.serverCertificates @@ -69,6 +72,35 @@ class HysteriaSettingsActivity : ProfileSettingsActivity() { true } + val protocol = findPreference(Key.SERVER_PROTOCOL)!! + val alpn = findPreference(Key.SERVER_ALPN)!! + + fun updateVersion(v: Int) { + if (v == 2) { + authPayload.isVisible = true + authType.isVisible = false + protocol.isVisible = false + alpn.isVisible = false + // + findPreference(Key.SERVER_HOP_INTERVAL)!!.isVisible = false + findPreference(Key.SERVER_STREAM_RECEIVE_WINDOW)!!.isVisible = + false + findPreference(Key.SERVER_CONNECTION_RECEIVE_WINDOW)!!.isVisible = + false + findPreference(Key.SERVER_DISABLE_MTU_DISCOVERY)!!.isVisible = + false + } else { + authType.isVisible = true + protocol.isVisible = true + alpn.isVisible = true + } + } + findPreference(Key.PROTOCOL_VERSION)!!.setOnPreferenceChangeListener { _, newValue -> + updateVersion(newValue.toString().toIntOrNull() ?: 1) + true + } + updateVersion(DataStore.protocolVersion) + findPreference(Key.SERVER_UPLOAD_SPEED)!!.apply { setOnBindEditTextListener(EditTextPreferenceModifiers.Number) } @@ -85,6 +117,9 @@ class HysteriaSettingsActivity : ProfileSettingsActivity() { findPreference(Key.SERVER_PASSWORD)!!.apply { summaryProvider = PasswordSummaryProvider } + findPreference(Key.SERVER_OBFS)!!.apply { + summaryProvider = PasswordSummaryProvider + } findPreference(Key.SERVER_HOP_INTERVAL)!!.apply { setOnBindEditTextListener(EditTextPreferenceModifiers.Number) diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/SocksSettingsActivity.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/SocksSettingsActivity.kt index 14eb355e..11005ed1 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/SocksSettingsActivity.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/SocksSettingsActivity.kt @@ -18,7 +18,7 @@ class SocksSettingsActivity : ProfileSettingsActivity() { DataStore.serverAddress = serverAddress DataStore.serverPort = serverPort - DataStore.serverProtocolVersion = protocol + DataStore.serverProtocolInt = protocol DataStore.serverUsername = username DataStore.serverPassword = password @@ -30,7 +30,7 @@ class SocksSettingsActivity : ProfileSettingsActivity() { serverAddress = DataStore.serverAddress serverPort = DataStore.serverPort - protocol = DataStore.serverProtocolVersion + protocol = DataStore.serverProtocolInt username = DataStore.serverUsername password = DataStore.serverPassword @@ -54,7 +54,7 @@ class SocksSettingsActivity : ProfileSettingsActivity() { password.isVisible = version == SOCKSBean.PROTOCOL_SOCKS5 } - updateProtocol(DataStore.serverProtocolVersion) + updateProtocol(DataStore.protocolVersion) protocol.setOnPreferenceChangeListener { _, newValue -> updateProtocol((newValue as String).toInt()) true diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/TuicSettingsActivity.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/TuicSettingsActivity.kt index 461a043f..a07e76d0 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/TuicSettingsActivity.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/TuicSettingsActivity.kt @@ -9,7 +9,6 @@ import io.nekohasekai.sagernet.R import io.nekohasekai.sagernet.database.DataStore import io.nekohasekai.sagernet.fmt.tuic.TuicBean import io.nekohasekai.sagernet.ktx.applyDefaultValues -import moe.matsuri.nb4a.ui.EditConfigPreference import moe.matsuri.nb4a.ui.SimpleMenuPreference class TuicSettingsActivity : ProfileSettingsActivity() { @@ -34,7 +33,7 @@ class TuicSettingsActivity : ProfileSettingsActivity() { DataStore.serverAllowInsecure = allowInsecure // DataStore.serverConfig = customJSON - DataStore.serverProtocolVersion = protocolVersion + DataStore.protocolVersion = protocolVersion DataStore.serverUsername = uuid } @@ -56,7 +55,7 @@ class TuicSettingsActivity : ProfileSettingsActivity() { allowInsecure = DataStore.serverAllowInsecure // customJSON = DataStore.serverConfig - protocolVersion = DataStore.serverProtocolVersion + protocolVersion = DataStore.protocolVersion uuid = DataStore.serverUsername } @@ -80,11 +79,11 @@ class TuicSettingsActivity : ProfileSettingsActivity() { fastConnect.isVisible = true } } - findPreference(Key.SERVER_PROTOCOL)!!.setOnPreferenceChangeListener { _, newValue -> + findPreference(Key.PROTOCOL_VERSION)!!.setOnPreferenceChangeListener { _, newValue -> updateVersion(newValue.toString().toIntOrNull() ?: 4) true } - updateVersion(DataStore.serverProtocolVersion) + updateVersion(DataStore.protocolVersion) val disableSNI = findPreference(Key.SERVER_DISABLE_SNI)!! val sni = findPreference(Key.SERVER_SNI)!! diff --git a/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java b/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java index f626d8d2..e77de2ae 100644 --- a/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java +++ b/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java @@ -56,6 +56,8 @@ public static class ClashAPIOptions extends SingBoxOption { public String default_mode; + public Boolean store_mode; + public Boolean store_selected; public Boolean store_fakeip; @@ -64,6 +66,8 @@ public static class ClashAPIOptions extends SingBoxOption { public String cache_id; + // Generate note: option type: public List ModeList; + } public static class SelectorOutboundOptions extends SingBoxOption { @@ -152,6 +156,8 @@ public static class DirectInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -206,6 +212,8 @@ public static class DirectOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -309,6 +317,8 @@ public static class HysteriaInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -390,6 +400,8 @@ public static class HysteriaOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -438,6 +450,128 @@ public static class HysteriaOutboundOptions extends SingBoxOption { } + public static class Hysteria2InboundOptions extends SingBoxOption { + + // Generate note: nested type ListenOptions + public String listen; + + public Integer listen_port; + + public Boolean tcp_fast_open; + + public Boolean tcp_multi_path; + + public Boolean udp_fragment; + + // Generate note: option type: public Boolean UDPFragmentDefault; + + public Long udp_timeout; + + public Boolean proxy_protocol; + + public Boolean proxy_protocol_accept_no_header; + + public String detour; + + // Generate note: nested type InboundOptions + public Boolean sniff; + + public Boolean sniff_override_destination; + + public Long sniff_timeout; + + public String domain_strategy; + + // End of public InboundOptions ; + + // End of public ListenOptions ; + + public Integer up_mbps; + + public Integer down_mbps; + + public Hysteria2Obfs obfs; + + public List users; + + public Boolean ignore_client_bandwidth; + + public InboundTLSOptions tls; + + public String masquerade; + + } + + public static class Hysteria2Obfs extends SingBoxOption { + + public String type; + + public String password; + + } + + public static class Hysteria2User extends SingBoxOption { + + public String name; + + public String password; + + } + + public static class Hysteria2OutboundOptions extends SingBoxOption { + + // Generate note: nested type DialerOptions + public String detour; + + public String bind_interface; + + public String inet4_bind_address; + + public String inet6_bind_address; + + public String protect_path; + + public Integer routing_mark; + + public Boolean reuse_addr; + + public Long connect_timeout; + + public Boolean tcp_fast_open; + + public Boolean tcp_multi_path; + + public Boolean udp_fragment; + + // Generate note: option type: public Boolean UDPFragmentDefault; + + public String domain_strategy; + + public Long fallback_delay; + + // End of public DialerOptions ; + + // Generate note: nested type ServerOptions + public String server; + + public Integer server_port; + + // End of public ServerOptions ; + + public Integer up_mbps; + + public Integer down_mbps; + + public Hysteria2Obfs obfs; + + public String password; + + public String network; + + public OutboundTLSOptions tls; + + } + public static class Inbound extends SingBoxOption { @@ -475,6 +609,8 @@ public static class Inbound extends SingBoxOption { // Generate note: option type: public TUICInboundOptions TUICOptions; + // Generate note: option type: public Hysteria2InboundOptions Hysteria2Options; + } public static class InboundOptions extends SingBoxOption { @@ -497,6 +633,8 @@ public static class ListenOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -531,6 +669,8 @@ public static class NaiveInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -598,6 +738,8 @@ public static class NTPOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -645,6 +787,8 @@ public static class Outbound extends SingBoxOption { // Generate note: option type: public TUICOutboundOptions TUICOptions; + // Generate note: option type: public Hysteria2OutboundOptions Hysteria2Options; + // Generate note: option type: public SelectorOutboundOptions SelectorOptions; // Generate note: option type: public URLTestOutboundOptions URLTestOptions; @@ -671,6 +815,8 @@ public static class DialerOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -742,6 +888,8 @@ public static class RedirectInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -778,6 +926,8 @@ public static class TProxyInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1069,6 +1219,8 @@ public static class ShadowsocksInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1150,6 +1302,8 @@ public static class ShadowsocksOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1204,6 +1358,8 @@ public static class ShadowsocksROutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1246,6 +1402,8 @@ public static class ShadowTLSInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1321,6 +1479,8 @@ public static class ShadowTLSHandshakeOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1354,6 +1514,8 @@ public static class ShadowTLSOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1388,6 +1550,8 @@ public static class SocksInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1426,6 +1590,8 @@ public static class HTTPMixedInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1480,6 +1646,8 @@ public static class SocksOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1530,6 +1698,8 @@ public static class HTTPOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1580,6 +1750,8 @@ public static class SSHOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1635,16 +1807,20 @@ public static class InboundTLSOptions extends SingBoxOption { // Generate note: Listable public List cipher_suites; - public String certificate; + // Generate note: Listable + public List certificate; public String certificate_path; - public String key; + // Generate note: Listable + public List key; public String key_path; public InboundACMEOptions acme; + public InboundECHOptions ech; + public InboundRealityOptions reality; } @@ -1724,6 +1900,8 @@ public static class InboundRealityHandshakeOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1736,6 +1914,21 @@ public static class InboundRealityHandshakeOptions extends SingBoxOption { } + public static class InboundECHOptions extends SingBoxOption { + + public Boolean enabled; + + public Boolean pq_signature_schemes_enabled; + + public Boolean dynamic_record_sizing_disabled; + + // Generate note: Listable + public List key; + + public String key_path; + + } + public static class OutboundECHOptions extends SingBoxOption { public Boolean enabled; @@ -1744,7 +1937,10 @@ public static class OutboundECHOptions extends SingBoxOption { public Boolean dynamic_record_sizing_disabled; - public String config; + // Generate note: Listable + public List config; + + public String config_path; } @@ -1820,6 +2016,8 @@ public static class TorOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1849,6 +2047,8 @@ public static class TrojanInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1915,6 +2115,8 @@ public static class TrojanOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -1953,6 +2155,8 @@ public static class TUICInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2023,6 +2227,8 @@ public static class TUICOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2048,6 +2254,8 @@ public static class TUICOutboundOptions extends SingBoxOption { public String udp_relay_mode; + public Boolean udp_over_stream; + public Boolean zero_rtt_handshake; public Long heartbeat; @@ -2080,6 +2288,12 @@ public static class TunInboundOptions extends SingBoxOption { // Generate note: Listable public List inet6_route_address; + // Generate note: Listable + public List include_interface; + + // Generate note: Listable + public List exclude_interface; + // Generate note: Listable public List include_uid; @@ -2238,6 +2452,8 @@ public static class VLESSInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2302,6 +2518,8 @@ public static class VLESSOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2344,6 +2562,8 @@ public static class VMessInboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2408,6 +2628,8 @@ public static class VMessOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2468,6 +2690,8 @@ public static class WireGuardOutboundOptions extends SingBoxOption { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; // Generate note: option type: public Boolean UDPFragmentDefault; @@ -2554,6 +2778,12 @@ public static class Inbound_TunOptions extends Inbound { // Generate note: Listable public List inet6_route_address; + // Generate note: Listable + public List include_interface; + + // Generate note: Listable + public List exclude_interface; + // Generate note: Listable public List include_uid; @@ -2605,6 +2835,8 @@ public static class Inbound_RedirectOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2640,6 +2872,8 @@ public static class Inbound_TProxyOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2677,6 +2911,8 @@ public static class Inbound_DirectOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2718,6 +2954,8 @@ public static class Inbound_SocksOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2755,6 +2993,8 @@ public static class Inbound_HTTPOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2796,6 +3036,8 @@ public static class Inbound_MixedOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2837,6 +3079,8 @@ public static class Inbound_ShadowsocksOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2882,6 +3126,8 @@ public static class Inbound_VMessOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2923,6 +3169,8 @@ public static class Inbound_TrojanOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -2968,6 +3216,8 @@ public static class Inbound_NaiveOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3009,6 +3259,8 @@ public static class Inbound_HysteriaOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3066,6 +3318,8 @@ public static class Inbound_ShadowTLSOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3113,6 +3367,8 @@ public static class Inbound_VLESSOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3154,6 +3410,8 @@ public static class Inbound_TUICOptions extends Inbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3192,6 +3450,57 @@ public static class Inbound_TUICOptions extends Inbound { } + public static class Inbound_Hysteria2Options extends Inbound { + + // Generate note: nested type ListenOptions + public String listen; + + public Integer listen_port; + + public Boolean tcp_fast_open; + + public Boolean tcp_multi_path; + + public Boolean udp_fragment; + + + public Long udp_timeout; + + public Boolean proxy_protocol; + + public Boolean proxy_protocol_accept_no_header; + + public String detour; + + // Generate note: nested type InboundOptions + public Boolean sniff; + + public Boolean sniff_override_destination; + + public Long sniff_timeout; + + public String domain_strategy; + + // End of public InboundOptions ; + + // End of public ListenOptions ; + + public Integer up_mbps; + + public Integer down_mbps; + + public Hysteria2Obfs obfs; + + public List users; + + public Boolean ignore_client_bandwidth; + + public InboundTLSOptions tls; + + public String masquerade; + + } + public static class Outbound_DirectOptions extends Outbound { // Generate note: nested type DialerOptions @@ -3213,6 +3522,8 @@ public static class Outbound_DirectOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3251,6 +3562,8 @@ public static class Outbound_SocksOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3300,6 +3613,8 @@ public static class Outbound_HTTPOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3349,6 +3664,8 @@ public static class Outbound_ShadowsocksOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3402,6 +3719,8 @@ public static class Outbound_VMessOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3461,6 +3780,8 @@ public static class Outbound_TrojanOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3510,6 +3831,8 @@ public static class Outbound_WireGuardOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3573,6 +3896,8 @@ public static class Outbound_HysteriaOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3641,6 +3966,8 @@ public static class Outbound_TorOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3681,6 +4008,8 @@ public static class Outbound_SSHOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3738,6 +4067,8 @@ public static class Outbound_ShadowTLSOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3783,6 +4114,8 @@ public static class Outbound_ShadowsocksROptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3836,6 +4169,8 @@ public static class Outbound_VLESSOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3889,6 +4224,8 @@ public static class Outbound_TUICOptions extends Outbound { public Boolean tcp_fast_open; + public Boolean tcp_multi_path; + public Boolean udp_fragment; @@ -3913,6 +4250,8 @@ public static class Outbound_TUICOptions extends Outbound { public String udp_relay_mode; + public Boolean udp_over_stream; + public Boolean zero_rtt_handshake; public Long heartbeat; @@ -3923,6 +4262,59 @@ public static class Outbound_TUICOptions extends Outbound { } + public static class Outbound_Hysteria2Options extends Outbound { + + // Generate note: nested type DialerOptions + public String detour; + + public String bind_interface; + + public String inet4_bind_address; + + public String inet6_bind_address; + + public String protect_path; + + public Integer routing_mark; + + public Boolean reuse_addr; + + public Long connect_timeout; + + public Boolean tcp_fast_open; + + public Boolean tcp_multi_path; + + public Boolean udp_fragment; + + + public String domain_strategy; + + public Long fallback_delay; + + // End of public DialerOptions ; + + // Generate note: nested type ServerOptions + public String server; + + public Integer server_port; + + // End of public ServerOptions ; + + public Integer up_mbps; + + public Integer down_mbps; + + public Hysteria2Obfs obfs; + + public String password; + + public String network; + + public OutboundTLSOptions tls; + + } + public static class Outbound_SelectorOptions extends Outbound { public List outbounds; diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 1f026c93..4eff93cb 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -386,6 +386,11 @@ BASE64 + + 1 + 2 + + 5 4 diff --git a/app/src/main/res/xml/hysteria_preferences.xml b/app/src/main/res/xml/hysteria_preferences.xml index 9b5e3380..1ff4042c 100644 --- a/app/src/main/res/xml/hysteria_preferences.xml +++ b/app/src/main/res/xml/hysteria_preferences.xml @@ -6,6 +6,15 @@ app:title="@string/profile_name" app:useSimpleSummaryProvider="true" /> + + diff --git a/buildScript/lib/core/get_source_env.sh b/buildScript/lib/core/get_source_env.sh index 6809fa71..5c4fa6f3 100644 --- a/buildScript/lib/core/get_source_env.sh +++ b/buildScript/lib/core/get_source_env.sh @@ -1,5 +1,5 @@ if [ ! -z $ENV_NB4A ]; then - export COMMIT_SING_BOX_EXTRA="70387142a28f10663b847988306ff6899fce0176" + export COMMIT_SING_BOX_EXTRA="2d7e05f22f2c3285ca929aaa0cad79ba4fd3e1fb" fi if [ ! -z $ENV_SING_BOX_EXTRA ]; then diff --git a/libcore/go.mod b/libcore/go.mod index ffd4e4ff..b2212cf3 100644 --- a/libcore/go.mod +++ b/libcore/go.mod @@ -7,7 +7,7 @@ require ( github.com/matsuridayo/libneko v1.0.0 // replaced github.com/matsuridayo/sing-box-extra v1.0.0 // replaced github.com/miekg/dns v1.1.55 - github.com/sagernet/sing v0.2.10-0.20230824115837-8d731e68853a + github.com/sagernet/sing v0.2.10-0.20230830132630-30bf19f2833c github.com/sagernet/sing-box v1.0.0 // replaced github.com/sagernet/sing-dns v0.1.9-0.20230824120133-4d5cbceb40c1 github.com/sagernet/sing-tun v0.1.12-0.20230821065522-7545dc2d5641 @@ -22,7 +22,7 @@ require ( github.com/ajg/form v1.5.1 // indirect github.com/andybalholm/brotli v1.0.5 // indirect github.com/caddyserver/certmagic v0.19.2 // indirect - github.com/cloudflare/circl v1.2.1-0.20221019164342-6ab4dfed8f3c // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/cretz/bine v0.2.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect @@ -32,7 +32,6 @@ require ( github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/gofrs/uuid/v5 v5.0.0 // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect @@ -54,13 +53,13 @@ require ( github.com/pires/go-proxyproto v0.7.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.3.3 // indirect - github.com/sagernet/cloudflare-tls v0.0.0-20221031050923-d70792f4c3a0 // indirect + github.com/sagernet/cloudflare-tls v0.0.0-20230829051644-4a68352d0c4a // indirect github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61 // indirect github.com/sagernet/gvisor v0.0.0-20230627031050-1ab0276e0dd2 // indirect github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect - github.com/sagernet/quic-go v0.0.0-20230825040534-0cd917b2ddda // indirect + github.com/sagernet/quic-go v0.0.0-20230831052420-45809eee2e86 // indirect github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect - github.com/sagernet/sing-mux v0.1.3-0.20230811111955-dc1639b5204c // indirect + github.com/sagernet/sing-mux v0.1.3-0.20230830095209-2a10ebd53ba8 // indirect github.com/sagernet/sing-shadowsocks v0.2.4 // indirect github.com/sagernet/sing-shadowsocks2 v0.1.3 // indirect github.com/sagernet/sing-shadowtls v0.1.4 // indirect diff --git a/libcore/go.sum b/libcore/go.sum index cbebc31c..0dbdf2e1 100644 --- a/libcore/go.sum +++ b/libcore/go.sum @@ -15,8 +15,8 @@ github.com/caddyserver/certmagic v0.19.2/go.mod h1:fsL01NomQ6N+kE2j37ZCnig2MFosG github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cloudflare/circl v1.2.1-0.20221019164342-6ab4dfed8f3c h1:K1VdSnBZiGapczwcUKnE1qcsMBclA84DUOD2NG/78VY= -github.com/cloudflare/circl v1.2.1-0.20221019164342-6ab4dfed8f3c/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/codeclysm/extract v2.2.0+incompatible h1:q3wyckoA30bhUSiwdQezMqVhwd8+WGE64/GL//LtUhI= github.com/codeclysm/extract v2.2.0+incompatible/go.mod h1:2nhFMPHiU9At61hz+12bfrlpXSUrOnK+wR+KlGO4Uks= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -43,8 +43,6 @@ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEe github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -101,26 +99,26 @@ github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1 github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM= github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagernet/cloudflare-tls v0.0.0-20221031050923-d70792f4c3a0 h1:KyhtFFt1Jtp5vW2ohNvstvQffTOQ/s5vENuGXzdA+TM= -github.com/sagernet/cloudflare-tls v0.0.0-20221031050923-d70792f4c3a0/go.mod h1:D4SFEOkJK+4W1v86ZhX0jPM0rAL498fyQAChqMtes/I= +github.com/sagernet/cloudflare-tls v0.0.0-20230829051644-4a68352d0c4a h1:wZHruBxZCsQLXHAozWpnJBL3wJ/XufDpz0qKtgpSnA4= +github.com/sagernet/cloudflare-tls v0.0.0-20230829051644-4a68352d0c4a/go.mod h1:dNV1ZP9y3qx5ltULeKaQZTZWTLHflgW5DES+Ses7cMI= github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61 h1:5+m7c6AkmAylhauulqN/c5dnh8/KssrE9c93TQrXldA= github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61/go.mod h1:QUQ4RRHD6hGGHdFMEtR8T2P6GS6R3D/CXKdaYHKKXms= github.com/sagernet/gvisor v0.0.0-20230627031050-1ab0276e0dd2 h1:dnkKrzapqtAwjTSWt6hdPrARORfoYvuUczynvRLrueo= github.com/sagernet/gvisor v0.0.0-20230627031050-1ab0276e0dd2/go.mod h1:1JUiV7nGuf++YFm9eWZ8q2lrwHmhcUGzptMl/vL1+LA= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 h1:iL5gZI3uFp0X6EslacyapiRz7LLSJyr4RajF/BhMVyE= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM= -github.com/sagernet/quic-go v0.0.0-20230825040534-0cd917b2ddda h1:7J/hnOFqCThiCrVpvr0wKO+Dic/XPSulPr5yI8FVJMs= -github.com/sagernet/quic-go v0.0.0-20230825040534-0cd917b2ddda/go.mod h1:Iw8Tt3dMqC/61cMHa0nN5i/958oYuuMnQCMOSPx+xcg= +github.com/sagernet/quic-go v0.0.0-20230831052420-45809eee2e86 h1:g4TEg9inAtA1FDTXpNrvmx72nN5mTOLQrJce6fVxF9g= +github.com/sagernet/quic-go v0.0.0-20230831052420-45809eee2e86/go.mod h1:O4Cj7TmMOvqD6S0XMqJRZfcYzA3m0H0ARbbaJFB0p7A= github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 h1:5Th31OC6yj8byLGkEnIYp6grlXfo1QYUfiYFGjewIdc= github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU= github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY= github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= -github.com/sagernet/sing v0.2.10-0.20230824115837-8d731e68853a h1:eV4HEz9NP7eAlQ/IHD6OF2VVM6ke4Vw6htuSAsvgtDk= -github.com/sagernet/sing v0.2.10-0.20230824115837-8d731e68853a/go.mod h1:9uOZwWkhT2Z2WldolLxX34s+1svAX4i4vvz5hy8u1MA= +github.com/sagernet/sing v0.2.10-0.20230830132630-30bf19f2833c h1:J2ptRncTNy+ZHfcFYSBfTmpvmgNlSEUZz6sDjh1np/Y= +github.com/sagernet/sing v0.2.10-0.20230830132630-30bf19f2833c/go.mod h1:9uOZwWkhT2Z2WldolLxX34s+1svAX4i4vvz5hy8u1MA= github.com/sagernet/sing-dns v0.1.9-0.20230824120133-4d5cbceb40c1 h1:5w+jXz8y/8UQAxO74TjftN5okYkpg5mGvVxXunlKdqI= github.com/sagernet/sing-dns v0.1.9-0.20230824120133-4d5cbceb40c1/go.mod h1:Kg98PBJEg/08jsNFtmZWmPomhskn9Ausn50ecNm4M+8= -github.com/sagernet/sing-mux v0.1.3-0.20230811111955-dc1639b5204c h1:35/FowAvt3Z62mck0TXzVc4jS5R5CWq62qcV2P1cp0I= -github.com/sagernet/sing-mux v0.1.3-0.20230811111955-dc1639b5204c/go.mod h1:TKxqIvfQQgd36jp2tzsPavGjYTVZilV+atip1cssjIY= +github.com/sagernet/sing-mux v0.1.3-0.20230830095209-2a10ebd53ba8 h1:UyUkEUEGqfIGqzOJ7OuJry4slgcT/qb0etDJ+89LTAs= +github.com/sagernet/sing-mux v0.1.3-0.20230830095209-2a10ebd53ba8/go.mod h1:TKxqIvfQQgd36jp2tzsPavGjYTVZilV+atip1cssjIY= github.com/sagernet/sing-shadowsocks v0.2.4 h1:s/CqXlvFAZhlIoHWUwPw5CoNnQ9Ibki9pckjuugtVfY= github.com/sagernet/sing-shadowsocks v0.2.4/go.mod h1:80fNKP0wnqlu85GZXV1H1vDPC/2t+dQbFggOw4XuFUM= github.com/sagernet/sing-shadowsocks2 v0.1.3 h1:WXoLvCFi5JTFBRYorf1YePGYIQyJ/zbsBM6Fwbl5kGA= @@ -158,7 +156,6 @@ github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg= github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zeebo/assert v1.1.0 h1:hU1L1vLTHsnO8x8c9KAR5GmM5QscxHg5RNU5z5qbUWY= github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= @@ -198,7 +195,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= @@ -212,9 +208,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -235,7 +229,6 @@ golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=