Update On Mon Jun 24 20:32:20 CEST 2024

This commit is contained in:
github-action[bot]
2024-06-24 20:32:21 +02:00
parent 7fc59c4f98
commit 7675fc7fa1
120 changed files with 8922 additions and 5174 deletions
+1
View File
@@ -682,3 +682,4 @@ Update On Thu Jun 20 20:32:09 CEST 2024
Update On Fri Jun 21 20:31:57 CEST 2024
Update On Sat Jun 22 20:28:32 CEST 2024
Update On Sun Jun 23 20:28:19 CEST 2024
Update On Mon Jun 24 20:32:10 CEST 2024
+2 -2
View File
@@ -6516,9 +6516,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "uuid"
version = "1.8.0"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
checksum = "3ea73390fe27785838dcbf75b91b1d84799e28f1ce71e6f372a5dc2200c80de5"
dependencies = [
"getrandom 0.2.15",
]
+2 -2
View File
@@ -2,7 +2,7 @@
"manifest_version": 1,
"latest": {
"mihomo": "v1.18.5",
"mihomo_alpha": "alpha-a9ecc62",
"mihomo_alpha": "alpha-9f4cd64",
"clash_rs": "v0.1.18",
"clash_premium": "2023-09-05-gdcc8d87"
},
@@ -36,5 +36,5 @@
"darwin-x64": "clash-darwin-amd64-n{}.gz"
}
},
"updated_at": "2024-06-22T22:19:42.822Z"
"updated_at": "2024-06-23T22:19:33.648Z"
}
+2 -2
View File
@@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .219
LINUX_KERNEL_HASH-5.10.219 = 93b73f15cc376463e6422cce09ccd9d0a20fb113921ffebddf3352c44d84cd30
LINUX_VERSION-5.10 = .220
LINUX_KERNEL_HASH-5.10.220 = 7cc3aff924e9707a5dbf1200c79a7f01617e097b9b175d02bda8ca762aeee19b
@@ -1,140 +0,0 @@
From 02591f9febd5f69bb4c266a4abf899c4cf21964f Mon Sep 17 00:00:00 2001
From: Dai Ngo <dai.ngo@oracle.com>
Date: Thu, 28 Jan 2021 01:42:26 -0500
Subject: [PATCH] NFSv4_2: SSC helper should use its own config.
Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD
as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which
depends on NFS_V4_2 and is automatically selected when NFSD_V4 is
enabled. Also removed the file name from a comment in nfs_ssc.c.
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/Kconfig | 4 ++++
fs/nfs/nfs4file.c | 4 ++++
fs/nfs/super.c | 12 ++++++++++++
fs/nfs_common/Makefile | 2 +-
fs/nfs_common/nfs_ssc.c | 2 --
fs/nfsd/Kconfig | 1 +
6 files changed, 22 insertions(+), 3 deletions(-)
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -333,6 +333,10 @@ config NFS_COMMON
depends on NFSD || NFS_FS || LOCKD
default y
+config NFS_V4_2_SSC_HELPER
+ tristate
+ default y if NFS_V4=y || NFS_FS=y
+
source "net/sunrpc/Kconfig"
source "fs/ceph/Kconfig"
source "fs/cifs/Kconfig"
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -430,7 +430,9 @@ static const struct nfs4_ssc_client_ops
*/
void nfs42_ssc_register_ops(void)
{
+#ifdef CONFIG_NFSD_V4
nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
+#endif
}
/**
@@ -441,7 +443,9 @@ void nfs42_ssc_register_ops(void)
*/
void nfs42_ssc_unregister_ops(void)
{
+#ifdef CONFIG_NFSD_V4
nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
+#endif
}
#endif /* CONFIG_NFS_V4_2 */
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -86,9 +86,11 @@ const struct super_operations nfs_sops =
};
EXPORT_SYMBOL_GPL(nfs_sops);
+#ifdef CONFIG_NFS_V4_2
static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = {
.sco_sb_deactive = nfs_sb_deactive,
};
+#endif
#if IS_ENABLED(CONFIG_NFS_V4)
static int __init register_nfs4_fs(void)
@@ -111,15 +113,21 @@ static void unregister_nfs4_fs(void)
}
#endif
+#ifdef CONFIG_NFS_V4_2
static void nfs_ssc_register_ops(void)
{
+#ifdef CONFIG_NFSD_V4
nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
+#endif
}
static void nfs_ssc_unregister_ops(void)
{
+#ifdef CONFIG_NFSD_V4
nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
+#endif
}
+#endif /* CONFIG_NFS_V4_2 */
static struct shrinker acl_shrinker = {
.count_objects = nfs_access_cache_count,
@@ -148,7 +156,9 @@ int __init register_nfs_fs(void)
ret = register_shrinker(&acl_shrinker);
if (ret < 0)
goto error_3;
+#ifdef CONFIG_NFS_V4_2
nfs_ssc_register_ops();
+#endif
return 0;
error_3:
nfs_unregister_sysctl();
@@ -168,7 +178,9 @@ void __exit unregister_nfs_fs(void)
unregister_shrinker(&acl_shrinker);
nfs_unregister_sysctl();
unregister_nfs4_fs();
+#ifdef CONFIG_NFS_V4_2
nfs_ssc_unregister_ops();
+#endif
unregister_filesystem(&nfs_fs_type);
}
--- a/fs/nfs_common/Makefile
+++ b/fs/nfs_common/Makefile
@@ -7,4 +7,4 @@ obj-$(CONFIG_NFS_ACL_SUPPORT) += nfs_acl
nfs_acl-objs := nfsacl.o
obj-$(CONFIG_GRACE_PERIOD) += grace.o
-obj-$(CONFIG_GRACE_PERIOD) += nfs_ssc.o
+obj-$(CONFIG_NFS_V4_2_SSC_HELPER) += nfs_ssc.o
--- a/fs/nfs_common/nfs_ssc.c
+++ b/fs/nfs_common/nfs_ssc.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * fs/nfs_common/nfs_ssc_comm.c
- *
* Helper for knfsd's SSC to access ops in NFS client modules
*
* Author: Dai Ngo <dai.ngo@oracle.com>
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -77,6 +77,7 @@ config NFSD_V4
select CRYPTO_MD5
select CRYPTO_SHA256
select GRACE_PERIOD
+ select NFS_V4_2_SSC_HELPER if NFS_V4_2
help
This option enables support in your system's NFS server for
version 4 of the NFS protocol (RFC 3530).
@@ -1,84 +0,0 @@
From d9092b4bb2109502eb8972021a3f74febc931a63 Mon Sep 17 00:00:00 2001
From: Dai Ngo <dai.ngo@oracle.com>
Date: Thu, 22 Apr 2021 03:37:49 -0400
Subject: [PATCH] NFSv4.2: Remove ifdef CONFIG_NFSD from NFSv4.2 client SSC
code.
The client SSC code should not depend on any of the CONFIG_NFSD config.
This patch removes all CONFIG_NFSD from NFSv4.2 client SSC code and
simplifies the config of CONFIG_NFS_V4_2_SSC_HELPER, NFSD_V4_2_INTER_SSC.
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
fs/Kconfig | 4 ++--
fs/nfs/nfs4file.c | 4 ----
fs/nfs/super.c | 4 ----
fs/nfsd/Kconfig | 2 +-
4 files changed, 3 insertions(+), 11 deletions(-)
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -334,8 +334,8 @@ config NFS_COMMON
default y
config NFS_V4_2_SSC_HELPER
- tristate
- default y if NFS_V4=y || NFS_FS=y
+ bool
+ default y if NFS_V4_2
source "net/sunrpc/Kconfig"
source "fs/ceph/Kconfig"
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -430,9 +430,7 @@ static const struct nfs4_ssc_client_ops
*/
void nfs42_ssc_register_ops(void)
{
-#ifdef CONFIG_NFSD_V4
nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
-#endif
}
/**
@@ -443,9 +441,7 @@ void nfs42_ssc_register_ops(void)
*/
void nfs42_ssc_unregister_ops(void)
{
-#ifdef CONFIG_NFSD_V4
nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
-#endif
}
#endif /* CONFIG_NFS_V4_2 */
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -116,16 +116,12 @@ static void unregister_nfs4_fs(void)
#ifdef CONFIG_NFS_V4_2
static void nfs_ssc_register_ops(void)
{
-#ifdef CONFIG_NFSD_V4
nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
-#endif
}
static void nfs_ssc_unregister_ops(void)
{
-#ifdef CONFIG_NFSD_V4
nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
-#endif
}
#endif /* CONFIG_NFS_V4_2 */
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -138,7 +138,7 @@ config NFSD_FLEXFILELAYOUT
config NFSD_V4_2_INTER_SSC
bool "NFSv4.2 inter server to server COPY"
- depends on NFSD_V4 && NFS_V4_1 && NFS_V4_2
+ depends on NFSD_V4 && NFS_V4_2
help
This option enables support for NFSv4.2 inter server to
server copy where the destination server calls the NFSv4.2
@@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
config MODULES_TREE_LOOKUP
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3262,9 +3262,11 @@ static int setup_load_info(struct load_i
@@ -3254,9 +3254,11 @@ static int setup_load_info(struct load_i
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
{
@@ -117,7 +117,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
modmagic = NULL;
@@ -3285,6 +3287,7 @@ static int check_modinfo(struct module *
@@ -3277,6 +3279,7 @@ static int check_modinfo(struct module *
mod->name);
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
}
@@ -29,7 +29,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -3016,6 +3016,8 @@ static const struct seq_operations locks
@@ -3076,6 +3076,8 @@ static const struct seq_operations locks
static int __init proc_locks_init(void)
{
@@ -156,8 +156,8 @@ return view.extend({
o.rmempty = false;
o = s.taboption('routing', form.Value, 'dns_server', _('DNS server'),
_('You can only have one server set. It MUST support TCP query.'));
o.value('wan', _('Use DNS server from WAN'));
_('It MUST support TCP query.'));
o.value('wan', _('WAN DNS (read from interface)'));
o.value('1.1.1.1', _('CloudFlare Public DNS (1.1.1.1)'));
o.value('208.67.222.222', _('Cisco Public DNS (208.67.222.222)'));
o.value('8.8.8.8', _('Google Public DNS (8.8.8.8)'));
@@ -182,27 +182,37 @@ return view.extend({
}
if (features.hp_has_chinadns_ng) {
o = s.taboption('routing', form.Value, 'china_dns_server', _('China DNS server'),
_('You can only have two servers set at maximum.'));
o.value('', _('Disable'));
o.value('wan', _('Use DNS server from WAN'));
o.value('wan_114', _('Use DNS server from WAN + 114DNS'));
o = s.taboption('routing', form.DynamicList, 'china_dns_server', _('China DNS server'));
o.value('wan', _('WAN DNS (read from interface)'));
o.value('223.5.5.5', _('Aliyun Public DNS (223.5.5.5)'));
o.value('210.2.4.8', _('CNNIC Public DNS (210.2.4.8)'));
o.value('119.29.29.29', _('Tencent Public DNS (119.29.29.29)'));
o.value('114.114.114.114', _('Xinfeng Public DNS (114.114.114.114)'));
o.depends('routing_mode', 'bypass_mainland_china');
o.validate = function(section_id, value) {
if (section_id && value && !['wan', 'wan_114'].includes(value)) {
var dns_servers = value.split(',');
var ipv6_support = this.map.lookupOption('ipv6_support', section_id)[0].formvalue(section_id);
o.validate = function(section_id) {
if (section_id) {
var value = this.map.lookupOption('china_dns_server', section_id)[0].formvalue(section_id);
if (value.length < 1)
return true;
if (dns_servers.length > 2)
if (!features.hp_has_chinadns_ng_v2 && value.length > 2)
return _('You can only have two servers set at maximum.');
for (var i of dns_servers)
if (!stubValidator.apply((ipv6_support === '1') ? 'ipaddr' : 'ip4addr', i))
return _('Expecting: %s').format(_('valid IP address'));
for (var dns of value) {
var ipv6_support = this.map.lookupOption('ipv6_support', section_id)[0].formvalue(section_id);
if (dns === 'wan') {
continue;
} else {
var err = _('Expecting: %s').format(_('valid address#port'));
dns = dns.split('#');
if (dns.length > 2)
return err;
if (!stubValidator.apply((ipv6_support === '1') ? 'ipaddr' : 'ip4addr', dns[0]))
return err;
if (dns[1] && !stubValidator.apply('port', dns[1]))
return err;
}
}
}
return true;
@@ -299,6 +309,7 @@ return view.extend({
so = ss.option(form.Flag, 'endpoint_independent_nat', _('Enable endpoint-independent NAT'),
_('Performance may degrade slightly, so it is not recommended to enable on when it is not needed.'));
so.default = so.enabled;
so.depends('tcpip_stack', 'mixed');
so.depends('tcpip_stack', 'gvisor');
so.rmempty = false;
@@ -437,7 +448,8 @@ return view.extend({
'<code>(port || port_range)</code> &&<br/>' +
'<code>(source_ip_cidr || source_ip_is_private)</code> &&<br/>' +
'<code>(source_port || source_port_range)</code> &&<br/>' +
'<code>other fields</code>.'));
'<code>other fields</code>.<br/>' +
'Additionally, included rule sets can be considered merged rather than as a single rule sub-item.'));
so.value('default', _('Default'));
so.default = 'default';
so.rmempty = false;
@@ -619,6 +631,22 @@ return view.extend({
_('Make each DNS server\'s cache independent for special purposes. If enabled, will slightly degrade performance.'));
so.default = so.disabled;
so.depends('disable_cache', '0');
so = ss.option(form.Value, 'client_subnet', _('EDNS Client subnet'),
_('Append a <code>edns0-subnet</code> OPT extra record with the specified IP prefix to every query by default.<br/>' +
'If value is an IP address instead of prefix, <code>/32</code> or <code>/128</code> will be appended automatically.'));
so.datatype = 'or(cidr, ipaddr)';
so = ss.option(form.Flag, 'cache_file_store_rdrc', _('Store RDRC'),
_('Store rejected DNS response cache.<br/>' +
'The check results of <code>Address filter DNS rule items</code> will be cached until expiration.'));
so.ucisection = 'experimental';
so.default = so.disabled;
so = ss.option(form.Value, 'cache_file_rdrc_timeout', _('RDRC timeout'),
_('Timeout of rejected DNS response cache. <code>7d</code> is used by default.'));
so.ucisection = 'experimental';
so.depends('cache_file_store_rdrc', '1');
/* DNS settings end */
/* DNS servers start */
@@ -709,6 +737,12 @@ return view.extend({
so.default = 'direct-out';
so.rmempty = false;
so.editable = true;
so = ss.option(form.Value, 'client_subnet', _('EDNS Client subnet'),
_('Append a <code>edns0-subnet</code> OPT extra record with the specified IP prefix to every query by default.<br/>' +
'If value is an IP address instead of prefix, <code>/32</code> or <code>/128</code> will be appended automatically.<br/>' +
'Can be overrides by <code>rules.[].client_subnet</code>. Will overrides <code>dns.client_subnet</code>.'));
so.datatype = 'or(cidr, ipaddr)';
/* DNS servers end */
/* DNS rules start */
@@ -741,7 +775,8 @@ return view.extend({
'<code>(port || port_range)</code> &&<br/>' +
'<code>(source_ip_cidr || source_ip_is_private)</code> &&<br/>' +
'<code>(source_port || source_port_range)</code> &&<br/>' +
'<code>other fields</code>.'));
'<code>other fields</code>.<br/>' +
'Additionally, included rule sets can be considered merged rather than as a single rule sub-item.'));
so.value('default', _('Default'));
so.default = 'default';
so.rmempty = false;
@@ -805,7 +840,16 @@ return view.extend({
so = ss.option(form.Flag, 'source_ip_is_private', _('Private source IP'),
_('Match private source IP.'));
so.default = so.disabled;
so.rmempty = false;
so.modalonly = true;
so = ss.option(form.DynamicList, 'ip_cidr', _('IP CIDR'),
_('Match IP CIDR with query response.'));
so.datatype = 'or(cidr, ipaddr)';
so.modalonly = true;
so = ss.option(form.Flag, 'ip_is_private', _('Private IP'),
_('Match private IP with query response.'));
so.default = so.disabled;
so.modalonly = true;
so = ss.option(form.DynamicList, 'source_port', _('Source port'),
@@ -846,6 +890,11 @@ return view.extend({
}
so.modalonly = true;
so = ss.option(form.Flag, 'rule_set_ipcidr_match_source', _('Rule set IP CIDR as source IP'),
_('Make <code>ipcidr</code> in rule sets match the source IP.'));
so.default = so.disabled;
so.modalonly = true;
so = ss.option(form.Flag, 'invert', _('Invert'),
_('Invert match result.'));
so.default = so.disabled;
@@ -897,6 +946,12 @@ return view.extend({
_('Rewrite TTL in DNS responses.'));
so.datatype = 'uinteger';
so.modalonly = true;
so = ss.option(form.Value, 'client_subnet', _('EDNS Client subnet'),
_('Append a <code>edns0-subnet</code> OPT extra record with the specified IP prefix to every query by default.<br/>' +
'If value is an IP address instead of prefix, <code>/32</code> or <code>/128</code> will be appended automatically.<br/>' +
'Will overrides <code>dns.client_subnet</code> and <code>servers.[].client_subnet</code>.'));
so.datatype = 'or(cidr, ipaddr)';
/* DNS rules end */
/* Custom routing settings end */
@@ -1323,7 +1323,7 @@ return view.extend({
}
}
o.onclick = function() {
return fs.exec('/etc/homeproxy/scripts/update_subscriptions.uc').then((res) => {
return fs.exec_direct('/etc/homeproxy/scripts/update_subscriptions.uc').then((res) => {
return location.reload();
}).catch((err) => {
ui.addNotification(null, E('p', _('An error occurred during updating subscriptions: %s').format(err)));
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1 +1 @@
20240220150003
20240602150004
@@ -2,12 +2,15 @@
2001:254::/31
2001:256:100::/48
2001:550:1601::/48
2001:67c:aec::/48
2001:67c:c28::/48
2001:7fa:5::/48
2001:c68::/32
2001:cc0::/32
2001:da8::/32
2001:daa:1::/48
2001:daa:2::/47
2001:daa:4::/47
2001:daa:6::/48
2001:dc7::/32
2001:dd8:1::/48
2001:dd8:5::/48
@@ -22,22 +25,20 @@
2001:df3:3a80::/48
2001:df3:8b80::/48
2001:df3:b380::/48
2001:df3:d0c0::/48
2001:df5:7800::/48
2001:df7:1480::/48
2400:1160::/32
2400:3200::/32
2400:3f60:3::/48
2400:5280:f803::/48
2400:5400:10::/48
2400:58a0:1400::/48
2400:58a0:1402::/48
2400:5a60:2::/48
2400:5a60:100::/48
2400:6000::/32
2400:6460::/40
2400:6600::/32
2400:6e60:1301::/48
2400:70e0:bed::/48
2400:72e0:9f00::/40
2400:73e0:201::/48
2400:73e0::/32
2400:75aa::/32
2400:7bc0:20::/43
2400:7fc0::/40
@@ -106,9 +107,12 @@
2400:b200::/32
2400:b600::/32
2400:be00::/48
2400:cb80:e30::/44
2400:cb80:e40::/44
2400:da00::/32
2400:dd00::/28
2400:ebc0::/32
2400:ee00::/32
2400:f6e0::/32
2400:f720::/32
2400:f7c0::/32
@@ -116,19 +120,25 @@
2400:fe00::/32
2401:20::/40
2401:800::/32
2401:e60:10::/44
2401:1160::/32
2401:11a0:10::/44
2401:11a0:150::/44
2401:11a0:1500::/40
2401:11a0:d150::/48
2401:11a0:d152::/48
2401:11a0:d158::/48
2401:1200::/48
2401:1320::/32
2401:13a0:1::/48
2401:1740:2000::/48
2401:1d40::/32
2401:2780::/32
2401:2e00::/32
2401:33c0::/32
2401:3480::/36
2401:3480:2000::/48
2401:3480:3000::/36
2401:34a1::/32
2401:34a0::/31
2401:3800::/32
2401:3880::/32
2401:3980::/32
@@ -147,6 +157,7 @@
2401:4780::/32
2401:4880::/32
2401:4a80::/32
2401:5960:5960::/48
2401:70e0::/32
2401:7700::/32
2401:7d40::/32
@@ -160,14 +171,12 @@
2401:8d00:10::/48
2401:8d00:12::/48
2401:8d00:14::/48
2401:95c0:f001::/48
2401:a140:1::/48
2401:b180::/32
2401:b400::/45
2401:b400:8::/47
2401:b400:11::/48
2401:b400:14::/48
2401:b400:16::/47
2401:b400:14::/46
2401:b400:20::/47
2401:b680::/32
2401:be00::/32
@@ -197,7 +206,9 @@
2402:6e80::/32
2402:6f40::/48
2402:6f40:2::/47
2402:6fc0::/48
2402:7040::/32
2402:7240::/36
2402:7d80::/32
2402:8bc0::/32
2402:8cc0::/40
@@ -207,6 +218,7 @@
2402:93c0:20::/48
2402:93c0:100::/48
2402:9a80::/32
2402:9e80:60::/48
2402:a200::/32
2402:b8c0::/32
2402:b940::/40
@@ -227,11 +239,9 @@
2402:ef40::/32
2402:f000::/32
2402:f8c0::/32
2403:600:a000::/38
2403:600:a600::/47
2403:600:a602::/48
2403:600:b001::/48
2403:600::/32
2403:c80::/32
2403:1a40::/32
2403:1b80::/48
2403:1ec0:1200::/48
2403:1ec0:1400::/48
@@ -246,6 +256,7 @@
2403:4b40::/32
2403:4c80::/48
2403:5c80::/48
2403:6380:14::/47
2403:6380:20::/44
2403:6380:40::/48
2403:6380:42::/47
@@ -259,6 +270,7 @@
2403:a140:100::/40
2403:a200::/32
2403:ac00::/32
2403:ad80:8008::/48
2403:b400::/32
2403:c980::/32
2403:d400::/32
@@ -275,9 +287,13 @@
2404:bc0:4f00::/43
2404:1c80::/32
2404:2280:106::/47
2404:2280:10c::/47
2404:2280:10d::/48
2404:2280:10f::/48
2404:2280:112::/47
2404:2280:115::/48
2404:2280:11b::/48
2404:2280:11c::/47
2404:2280:11e::/48
2404:2280:123::/48
2404:2280:126::/47
2404:2280:12e::/48
@@ -285,12 +301,23 @@
2404:2280:136::/47
2404:2280:13b::/48
2404:2280:13c::/47
2404:2280:142::/48
2404:2280:147::/48
2404:2280:152::/48
2404:2280:193::/48
2404:2280:196::/48
2404:2280:199::/48
2404:2280:19a::/47
2404:2280:19c::/47
2404:2280:19e::/48
2404:2280:1a4::/47
2404:2280:1a8::/48
2404:2280:1b0::/48
2404:2280:1b2::/48
2404:2280:1b4::/48
2404:2280:1b8::/48
2404:2280:1b4::/46
2404:2280:1b8::/47
2404:2280:1ba::/48
2404:2280:1bf::/48
2404:2280:1c1::/48
2404:2280:1c2::/47
2404:2280:1c4::/47
@@ -299,12 +326,19 @@
2404:2280:1cb::/48
2404:2280:1cc::/48
2404:2280:1cf::/48
2404:2280:1d0::/48
2404:2280:1d3::/48
2404:2280:1d6::/48
2404:2280:1d8::/45
2404:2280:1e0::/48
2404:2280:1e2::/47
2404:2280:1e4::/47
2404:2280:1e4::/46
2404:2280:1e8::/48
2404:2280:1ea::/48
2404:2280:1ec::/47
2404:2280:1ee::/48
2404:2280:1f0::/45
2404:2280:1f8::/46
2404:4dc0::/32
2404:6380::/48
2404:6380:1000::/48
@@ -313,7 +347,6 @@
2404:7180:a000::/48
2404:7180:a010::/48
2404:7180:a021::/48
2404:7180:a022::/48
2404:7180:aa00::/48
2404:7180:aa10::/48
2404:7180:b001::/48
@@ -358,6 +391,7 @@
2405:1480:1000::/48
2405:1480:2000::/48
2405:1480:3000::/47
2405:1640:6::/48
2405:3140:11::/48
2405:3140:31::/48
2405:3140:3a::/48
@@ -367,6 +401,9 @@
2405:66c0::/32
2405:68c0:21::/48
2405:6940::/48
2405:6f00:c101::/48
2405:6f00:c102::/48
2405:6f00:c170::/47
2405:6f00:c602::/48
2405:7040:6000::/47
2405:78c0:6e00::/43
@@ -376,6 +413,7 @@
2405:a900:fffe::/48
2405:ad00::/32
2405:b7c0::/32
2405:be80::/32
2405:d900::/32
2405:e000::/32
2405:f580::/32
@@ -387,22 +425,30 @@
2406:840:10::/45
2406:840:20::/48
2406:840:44::/47
2406:840:78::/48
2406:840:78::/47
2406:840:80::/47
2406:840:90::/48
2406:840:100::/48
2406:840:110::/48
2406:840:180::/48
2406:840:1c0::/48
2406:840:301::/48
2406:840:302::/48
2406:840:3c1::/48
2406:840:410::/48
2406:840:800::/42
2406:840:420::/48
2406:840:680::/48
2406:840:801::/48
2406:840:802::/47
2406:840:840::/47
2406:840:860::/48
2406:840:880::/48
2406:840:9b1::/48
2406:840:a08::/48
2406:840:c00::/48
2406:840:a90::/48
2406:840:c00::/47
2406:840:c60::/48
2406:840:1800::/48
2406:840:1860::/48
2406:840:2800::/48
2406:840:3800::/48
2406:840:4100::/47
@@ -423,16 +469,15 @@
2406:840:9801::/48
2406:840:9810::/48
2406:840:981c::/46
2406:840:9960::/44
2406:840:9960::/47
2406:840:9962::/48
2406:840:9969::/48
2406:840:996f::/48
2406:840:9980::/48
2406:840:9984::/48
2406:840:9ef0::/44
2406:840:a000::/35
2406:840:c0a8::/48
2406:840:e010::/47
2406:840:e014::/46
2406:840:e018::/45
2406:840:e030::/47
2406:840:e033::/48
2406:840:e03f::/48
2406:840:e080::/44
2406:840:e0c1::/48
@@ -443,20 +488,23 @@
2406:840:e180::/44
2406:840:e20f::/48
2406:840:e230::/48
2406:840:e280::/48
2406:840:e270::/44
2406:840:e300::/47
2406:840:e302::/48
2406:840:e340::/44
2406:840:e351::/48
2406:840:e354::/48
2406:840:e36f::/48
2406:840:e500::/47
2406:840:e57b::/48
2406:840:e57f::/48
2406:840:e666::/47
2406:840:e720::/48
2406:840:e770::/48
2406:840:e777::/48
2406:840:e80f::/48
2406:840:e841::/48
2406:840:e842::/48
2406:840:e846::/48
2406:840:e84a::/48
2406:840:e84c::/47
2406:840:e84f::/48
@@ -471,10 +519,11 @@
2406:840:eb0b::/48
2406:840:eb0f::/48
2406:840:eb80::/42
2406:840:ed02::/48
2406:840:eed0::/44
2406:840:efa0::/44
2406:840:f0a1::/48
2406:840:f0aa::/48
2406:840:f100::/47
2406:840:f200::/44
2406:840:f230::/44
2406:840:f380::/44
2406:840:f401::/48
@@ -482,24 +531,23 @@
2406:840:f440::/47
2406:840:f44f::/48
2406:840:f48f::/48
2406:840:f62f::/48
2406:840:f660::/44
2406:840:f681::/48
2406:840:f990::/44
2406:840:fa01::/48
2406:840:fa02::/47
2406:840:fa04::/48
2406:840:fd00::/47
2406:840:fd03::/48
2406:840:fd05::/48
2406:840:fd06::/48
2406:840:fd1f::/48
2406:840:fdd0::/47
2406:840:fde0::/48
2406:840:fe27::/48
2406:840:fe50::/48
2406:840:fe60::/48
2406:840:fe72::/47
2406:840:fec0::/47
2406:840:fec4::/47
2406:840:fec8::/47
2406:840:feca::/48
2406:840:fec8::/45
2406:840:fed1::/48
2406:840:fed2::/47
2406:840:fed4::/46
@@ -510,8 +558,10 @@
2406:840:feed::/48
2406:840:fef0::/46
2406:840:fef5::/48
2406:840:fef6::/47
2406:840:fef8::/45
2406:840:fef7::/48
2406:840:fef8::/47
2406:840:fefb::/48
2406:840:fefc::/46
2406:1e40:f012::/47
2406:2000:a0::/48
2406:2700::/32
@@ -524,6 +574,7 @@
2406:5340:6666::/48
2406:5340:8888::/48
2406:5ac0::/32
2406:8880::/48
2406:94c0::/48
2406:b640:100::/48
2406:b640:4100::/48
@@ -532,8 +583,6 @@
2406:d440:100::/44
2406:d440:200::/44
2406:d440:300::/44
2406:d440:500::/48
2406:d440:600::/48
2406:e3c0::/32
2406:e500::/33
2407:2840::/48
@@ -544,8 +593,8 @@
2407:5380::/32
2407:6c40:1210::/48
2407:6c40:1500::/48
2407:6c40:1600::/40
2407:6c40:1810::/48
2407:7d00:1::/48
2407:8f40:2::/48
2407:9f00::/32
2407:ad80::/32
@@ -888,6 +937,7 @@
2408:844b::/32
2408:844c::/30
2408:8452::/31
2408:8454::/32
2408:8456::/31
2408:8458::/30
2408:845c::/31
@@ -949,7 +999,7 @@
2408:8708::/29
2408:8710::/30
2408:8719::/32
2408:871a::/32
2408:871a::/31
2408:8720::/30
2408:8726::/32
2408:872b::/32
@@ -984,7 +1034,9 @@
2408:8806::/42
2408:8806:40::/43
2408:880c::/30
2408:8810::/29
2408:8810::/30
2408:8814::/31
2408:8816::/32
2408:8818::/31
2408:882c::/32
2408:883a::/32
@@ -1046,19 +1098,22 @@
2408:8a24:4000::/34
2408:8a26:c000::/34
2408:8a27:4000::/35
2409:2000::/32
2409:2000::/31
2409:27fa::/48
2409:27fa:f000::/48
2409:27fb::/48
2409:27fc::/48
2409:27fe::/33
2409:6100::/44
2409:8000::/20
240a:2000::/29
240a:400b::/33
240a:4010:8000::/33
240a:4020:83a::/48
240a:4020:883a::/48
240a:4021:83a::/48
240a:4021:883a::/48
240a:4082:c000::/35
240a:408a:c000::/35
240a:4084:2000::/35
240a:408c:2000::/35
240a:4090:50::/48
240a:4090:120::/48
240a:4090:250::/48
@@ -1073,18 +1128,22 @@
240a:4090:5200::/40
240a:4090:7000::/39
240a:4090:7200::/40
240a:4092:c000::/35
240a:409a:c000::/35
240a:40a2:c000::/35
240a:40aa:c000::/35
240a:4094:2000::/35
240a:409c:2000::/35
240a:40a4:2000::/35
240a:40ac:2000::/35
240a:40b0:83a::/48
240a:40b0:283a::/48
240a:40b0:483a::/48
240a:40b0:683a::/48
240a:40c0:8200::/48
240a:40c0:8240::/48
240a:414c::/31
240a:41cc::/31
240a:40c3:c200::/48
240a:40c3:c240::/48
240a:4172::/31
240a:41b0::/31
240a:41f2::/31
240a:4242::/31
240a:4280::/26
240a:42c0::/27
240a:42e0::/28
@@ -1107,8 +1166,8 @@
240d:c000:6000::/36
240d:c000:7000::/44
240d:c000:f000::/44
240d:c000:f020::/44
240d:c010::/47
240d:c010:11::/48
240d:c010:14::/48
240d:c010:16::/48
240d:c010:20::/44
@@ -1116,56 +1175,39 @@
240d:c010:58::/48
240d:c010:5b::/48
240d:c010:5c::/48
240d:c010:5e::/48
240d:c010:68::/48
240d:c010:6c::/48
240d:c040::/44
240e::/20
2602:2a3::/40
2602:2a3::/48
2602:2a4:ff::/48
2602:2c3:810::/44
2602:f9a9:101::/48
2602:f9ba:a9::/48
2602:f9df:400::/48
2602:f9df:410::/48
2602:f9df:420::/48
2602:f9df:400::/47
2602:f9df:500::/48
2602:f9df:505::/48
2602:f9df:510::/47
2602:f9f6:400::/44
2602:fa1c:121::/48
2602:f9df:515::/48
2602:f9df:516::/48
2602:f9f6:400::/47
2602:fa4f:600::/40
2602:fab0:11::/48
2602:fbda:600::/48
2602:fbda:660::/48
2602:fbda:666::/48
2602:fc52:311::/48
2602:fc52:312::/48
2602:fc52:315::/48
2602:fd92:800::/40
2602:fd92:801::/48
2602:fe69:f26::/47
2602:fed2:7020::/46
2602:fed2:7101::/48
2602:fed2:731d::/48
2602:feda:182::/47
2602:feda:1bf::/48
2602:feda:1d1::/48
2602:feda:1d2::/48
2602:feda:2a0::/46
2602:feda:2a4::/47
2602:feda:2a6::/48
2602:feda:2aa::/48
2602:feda:2af::/48
2602:feda:2d0::/47
2602:feda:2f0::/48
2602:feda:3c5::/48
2602:feda:b8f::/48
2602:feda:c34::/48
2602:feda:ca1::/48
2602:feda:d80::/48
2602:feda:d83::/48
2602:ffe4:c5f::/48
2602:ffe4:c60::/47
2605:640f:bcd7::/48
2605:9d80:8001::/48
2605:9d80:8011::/48
2605:9d80:8021::/48
@@ -1180,10 +1222,8 @@
2605:9d80:9052::/48
2605:9d80:9071::/48
2605:9d80:9092::/48
2605:f440:cafe::/48
2607:7640::/48
2620:57:4004::/47
2804:1e48::/32
2a03:5840:f3::/48
2a03:5840:290::/48
2a04:3e00:1002::/48
2a04:f580:8010::/47
@@ -1215,15 +1255,11 @@
2a04:f580:9280::/48
2a04:f580:9290::/48
2a05:1085::/32
2a05:1086:f000::/47
2a05:1087::/32
2a05:dfc1:5900::/41
2a05:dfc1:5a00::/40
2a05:dfc1:6607::/48
2a05:dfc1:7100::/47
2a05:dfc1:7103::/48
2a05:dfc1:1600::/40
2a05:dfc1:7106::/47
2a05:dfc1:7108::/47
2a05:dfc1:8c00::/48
2a05:dfc1:7110::/48
2a05:dfc1:8c02::/48
2a05:dfc1:8c05::/48
2a05:dfc1:8c09::/48
@@ -1234,102 +1270,60 @@
2a05:dfc1:8c1d::/48
2a05:dfc1:8c22::/48
2a05:dfc1:8c24::/48
2a05:dfc1:8c30::/48
2a05:dfc1:8c3a::/48
2a05:dfc1:8c40::/48
2a05:dfc1:8c90::/47
2a05:dfc1:8c42::/48
2a05:dfc1:8c90::/46
2a05:dfc1:8c94::/47
2a05:dfc1:8c98::/47
2a05:dfc1:8d00::/48
2a05:dfc1:8d02::/48
2a05:dfc1:8d05::/48
2a06:3600::/29
2a06:a001:a0c4::/48
2a06:a005:260::/43
2a06:a005:280::/42
2a06:a005:486::/48
2a06:a005:8d0::/47
2a06:a005:8da::/48
2a06:a005:910::/44
2a06:a005:280::/43
2a06:a005:2a0::/44
2a06:a005:9c0::/48
2a06:a005:a13::/48
2a06:a005:b69::/48
2a06:a005:d22::/48
2a06:a005:e80::/43
2a06:a005:f80::/44
2a06:a005:1340::/43
2a06:a005:13b0::/44
2a06:a005:13c0::/43
2a06:a005:13e0::/47
2a06:a005:13eb::/48
2a06:a005:1520::/44
2a06:a005:1700::/44
2a06:a005:1800::/48
2a06:a005:1c40::/44
2a06:a005:13e2::/48
2a06:a005:13ea::/47
2a06:a005:13ed::/48
2a06:a005:13ef::/48
2a06:a005:1ee1::/48
2a06:a005:1ee8::/47
2a06:a005:1ee9::/48
2a06:a005:1eee::/48
2a06:a005:2040::/44
2a06:a005:2100::/44
2a06:a005:2200::/44
2a06:a005:2510::/48
2a06:a005:28f3::/48
2a06:a005:28f4::/48
2a06:a005:2910::/44
2a06:a005:2922::/48
2a06:a005:2925::/48
2a06:a005:2926::/48
2a06:a005:2940::/43
2a06:a005:2980::/44
2a06:a005:29d1::/48
2a06:de00:de04::/48
2a06:de00:de0e::/47
2a06:de01:80b::/48
2a06:de01:821::/48
2a06:de01:82e::/48
2a06:de01:84c::/48
2a06:de01:863::/48
2a06:de01:871::/48
2a06:de01:87a::/48
2a06:de01:8a0::/48
2a06:de01:8bb::/48
2a06:de01:8be::/47
2a06:de01:8d8::/48
2a06:de01:904::/48
2a06:de01:907::/48
2a06:de01:908::/48
2a06:de01:912::/48
2a06:de01:95f::/48
2a06:de01:962::/48
2a06:de01:967::/48
2a06:de01:97c::/48
2a06:de01:980::/48
2a06:de01:99c::/48
2a06:de01:9ad::/48
2a06:de01:adb::/48
2a06:de01:ae6::/48
2a06:de01:af6::/48
2a06:de01:afc::/48
2a06:de01:b36::/48
2a06:e881:2509::/48
2a06:e881:5501::/48
2a06:e881:5502::/48
2a06:e881:5506::/48
2a06:de00:de0e::/48
2a06:e881:6600::/48
2a06:e881:6602::/47
2a06:e881:6606::/48
2a09:b280:ff80::/47
2a07:54c1:2200::/47
2a07:54c1:2202::/48
2a09:b280:ff80::/48
2a09:b280:ff83::/48
2a09:b280:ff84::/47
2a0a:280:2d00::/46
2a0a:280:2d04::/47
2a0a:2840:20::/43
2a0a:2845:aab8::/46
2a0a:6040:c00::/40
2a0a:6040:e01::/48
2a0a:6040:e02::/47
2a0a:6040:e02::/48
2a0a:6040:ea0::/48
2a0a:6040:f00::/48
2a0a:6040:f10::/47
2a0a:6040:f00::/47
2a0a:6040:f02::/48
2a0a:6040:f11::/48
2a0a:6040:f15::/48
2a0a:6040:1b00::/40
2a0a:6040:2222::/48
2a0a:6040:2228::/48
@@ -1337,52 +1331,33 @@
2a0a:6040:2255::/48
2a0a:6040:2277::/48
2a0a:6040:2d00::/44
2a0a:6040:3300::/48
2a0a:6040:3410::/48
2a0a:6040:3420::/48
2a0a:6040:3430::/48
2a0a:6040:3441::/48
2a0a:6040:34ff::/48
2a0a:6040:5555::/48
2a0a:6040:6607::/48
2a0a:6040:6c40::/44
2a0a:6040:a450::/47
2a0a:6040:a730::/48
2a0a:6040:a740::/48
2a0a:6040:a901::/48
2a0a:6040:a900::/47
2a0a:6040:b770::/44
2a0a:6040:c601::/48
2a0a:6040:c700::/42
2a0a:6040:c740::/47
2a0a:6040:c742::/48
2a0a:6040:c750::/47
2a0a:6040:c770::/44
2a0a:6040:c7a0::/48
2a0a:6040:ce00::/48
2a0a:6040:ce10::/48
2a0a:6040:d0fe::/48
2a0a:6040:d401::/48
2a0a:6040:d310::/48
2a0a:6040:d600::/44
2a0a:6040:d610::/47
2a0a:6040:d610::/48
2a0a:6040:d612::/48
2a0a:6040:d614::/46
2a0a:6040:d710::/44
2a0a:6040:d614::/47
2a0a:6040:d617::/48
2a0a:6040:e410::/48
2a0a:6040:e541::/48
2a0a:6040:e543::/48
2a0a:6040:e544::/47
2a0a:6040:e546::/48
2a0a:6040:e54b::/48
2a0a:6040:e54c::/48
2a0a:6040:e900::/40
2a0a:6040:ec00::/40
2a0b:b86:ffe0::/48
2a0b:b87:ffb5::/48
2a0b:2542::/48
2a0b:2542:300::/40
2a0b:4340:6::/48
2a0b:4340:22::/48
2a0b:4340:30::/44
2a0b:4340:60::/44
2a0b:4340:70::/48
2a0b:4340:90::/48
2a0b:4340:93::/48
@@ -1393,44 +1368,27 @@
2a0b:4340:a0::/44
2a0b:4340:c0::/44
2a0b:4340:d8::/48
2a0b:4340:400::/46
2a0b:4340:404::/47
2a0b:4340:406::/48
2a0b:4340:434::/48
2a0b:4340:560::/44
2a0b:4340:1304::/48
2a0b:4340:1340::/48
2a0c:9a40:8cf0::/48
2a0c:9a40:9e04::/47
2a0c:9a40:9e08::/45
2a0c:9a40:9e00::/43
2a0c:b641:210::/47
2a0c:b641:24f::/48
2a0c:b641:312::/48
2a0c:b641:510::/48
2a0c:b641:570::/47
2a0c:b641:730::/44
2a0c:b641:a11::/48
2a0c:b641:a60::/44
2a0c:b641:b21::/48
2a0c:b641:b25::/48
2a0c:b641:b26::/48
2a0c:b642:4101::/48
2a0c:b642:4102::/47
2a0c:b642:4104::/47
2a0d:2146:8040::/48
2a0d:2406:510::/46
2a0c:b642:4104::/46
2a0d:2580:ff00::/45
2a0d:2580:ff08::/46
2a0d:2581:fffc::/48
2a0d:2581:fffe::/47
2a0d:2683:2::/48
2a0d:2687::/32
2a0d:2904::/44
2a0d:2906:f000::/44
2a0d:c7c7::/32
2a0e:800:ff00::/48
2a0e:800:ff04::/48
2a0e:800:ff20::/47
2a0e:800:ff40::/42
2a0e:15c0:6::/48
2a0e:8f02:2182::/47
2a0e:8f02:f006::/48
2a0e:8f02:f058::/48
@@ -1440,6 +1398,7 @@
2a0e:97c0:550::/44
2a0e:97c0:5ef::/48
2a0e:97c0:83f::/48
2a0e:9b00::/29
2a0e:aa01:1fff::/48
2a0e:aa06::/40
2a0e:aa06:400::/44
@@ -1447,42 +1406,40 @@
2a0e:aa06:470::/44
2a0e:aa06:490::/44
2a0e:aa07:e01b::/48
2a0e:aa07:e024::/46
2a0e:aa07:e024::/47
2a0e:aa07:e027::/48
2a0e:aa07:e030::/48
2a0e:aa07:e035::/48
2a0e:aa07:e039::/48
2a0e:aa07:e043::/48
2a0e:aa07:e050::/44
2a0e:aa07:e060::/48
2a0e:aa07:e071::/48
2a0e:aa07:e073::/48
2a0e:aa07:e0f1::/48
2a0e:aa07:e0f7::/48
2a0e:aa07:e120::/44
2a0e:aa07:e130::/47
2a0e:aa07:e141::/48
2a0e:aa07:e142::/47
2a0e:aa07:e140::/47
2a0e:aa07:e143::/48
2a0e:aa07:e145::/48
2a0e:aa07:e146::/47
2a0e:aa07:e16a::/48
2a0e:aa07:e1a0::/46
2a0e:aa07:e1b0::/47
2a0e:aa07:e1b2::/48
2a0e:aa07:e1b4::/47
2a0e:aa07:e200::/44
2a0e:aa07:f000::/48
2a0e:aa07:f004::/48
2a0e:aa07:f008::/48
2a0e:aa07:f041::/48
2a0e:aa07:f042::/48
2a0e:aa07:f0d0::/47
2a0e:aa07:f0d0::/48
2a0e:aa07:f0d2::/48
2a0e:aa07:f0d4::/47
2a0e:aa07:f0d6::/48
2a0e:aa07:f0e0::/44
2a0e:b107:30::/48
2a0e:b107:32::/47
2a0e:b107:a0::/44
2a0e:b107:12b::/48
2a0e:b107:1c0::/48
2a0e:b107:1c1::/48
2a0e:b107:272::/48
2a0e:b107:790::/44
2a0e:b107:bd0::/48
2a0e:b107:740::/44
2a0e:b107:c10::/48
2a0e:b107:da0::/44
2a0e:b107:dce::/48
@@ -1491,32 +1448,31 @@
2a0e:b107:16c0::/44
2a0e:b107:1a40::/46
2a0e:b107:1b60::/48
2a0e:b107:1d25::/48
2a0e:b107:1b6e::/47
2a0e:b107:1e85::/48
2a0e:b107:2440::/44
2a0f:1440::/29
2a0f:2100::/29
2a0f:5707:ac01::/48
2a0f:5707:fe01::/48
2a0f:5707:fff5::/48
2a0f:7803:fc00::/44
2a0f:7803:fc30::/44
2a0f:5707:fff4::/47
2a0f:7803:fc00::/43
2a0f:7803:fc20::/44
2a0f:7803:fc80::/44
2a0f:7803:fcc0::/44
2a0f:7803:fd00::/40
2a0f:7803:fe21::/48
2a0f:7803:fe23::/48
2a0f:7803:fe22::/48
2a0f:7803:fe24::/48
2a0f:7803:fe80::/47
2a0f:7803:fe82::/48
2a0f:7803:ff10::/48
2a0f:7980::/44
2a0f:85c1:100::/47
2a0f:85c1:3b5::/48
2a0f:9400:6110::/48
2a0f:9400:7700::/48
2a10:2f00:13a::/48
2a0f:9400:8016::/48
2a0f:e401:133::/48
2a10:2f00:147::/48
2a10:2f00:15a::/48
2a10:2f00:18e::/48
2a10:2f01:100::/48
2a10:cc40:180::/47
2a10:cc40:188::/48
2a10:cc40:190::/48
2a10:cc42:120::/43
2a10:ccc0:cc1::/48
@@ -1524,58 +1480,54 @@
2a10:ccc0:ccc::/48
2a10:ccc0:ccc6::/48
2a10:ccc0:cccc::/46
2a10:ccc1:105::/48
2a11:f2c0:ffc4::/48
2a12:3fc2:6600::/48
2a12:3fc2:6666::/48
2a12:3fc2:aa10::/44
2a12:3fc2:aa40::/44
2a12:3fc2:ab50::/48
2a12:3fc2:e72e::/48
2a12:3fc2:e810::/44
2a12:3fc7::/48
2a12:3fc7:8000::/48
2a12:dd47:5c00::/40
2a12:f8c0::/48
2a12:f8c0:1000::/39
2a12:f8c1::/48
2a12:f8c0:1000::/40
2a12:f8c3::/36
2a13:1800::/48
2a13:1800:10::/48
2a13:1800:80::/44
2a13:1800:300::/44
2a13:1801:180::/43
2a13:1802::/44
2a13:1802::/43
2a13:a5c3:f000::/40
2a13:a5c4:1000::/38
2a13:a5c7:1200::/40
2a13:a5c7:1500::/40
2a13:a5c7:1600::/46
2a13:a5c7:1604::/48
2a13:a5c7:1606::/47
2a13:a5c7:1608::/48
2a13:a5c7:1610::/47
2a13:a5c7:1612::/48
2a13:a5c7:1600::/45
2a13:a5c7:1608::/47
2a13:a5c7:1610::/46
2a13:a5c7:1614::/47
2a13:a5c7:1801::/48
2a13:a5c7:1802::/47
2a13:a5c7:1804::/47
2a13:a5c7:2102::/47
2a13:a5c7:2104::/48
2a13:a5c7:2106::/48
2a13:aac4:f000::/44
2a13:b487:11da::/48
2a13:b487:1200::/43
2a13:b487:1b86::/48
2a13:b487:1bb2::/48
2a13:b487:1bb6::/48
2a13:b487:1bbb::/48
2a13:b487:1f00::/45
2a13:b487:4200::/47
2a13:b487:4210::/44
2a13:b487:4220::/43
2a13:b487:4240::/43
2a13:b487:42d0::/44
2a13:df80:3b10::/48
2a13:df80:6808::/48
2a13:df85:be00::/48
2a13:b487:1ba2::/48
2a13:b487:1ba6::/47
2a13:b487:1bb2::/47
2a13:b487:1bba::/47
2a13:b487:1bc0::/47
2a13:b487:1bff::/48
2a13:b487:1f02::/47
2a13:b487:1f04::/46
2a13:df80:3b00::/44
2a13:df80:3b11::/48
2a13:df85:be10::/48
2a13:df85:be80::/48
2a13:df85:be88::/48
2a13:df85:be90::/48
2a13:df85:beaa::/48
2a13:df85:bed0::/48
2a13:df85:bedc::/48
2a13:df85:befe::/48
2c0f:f7a8:8011::/48
2c0f:f7a8:8050::/48
@@ -1 +1 @@
20240220150003
20240602150004
File diff suppressed because it is too large Load Diff
@@ -1 +1 @@
202402192209
202406062209
@@ -326,6 +326,7 @@ apkmirror.com
apkmonk.com
apkplz.com
apkpure.com
apkpure.net
aplusvpn.com
app.box.com
app.cloudcone.com
@@ -338,6 +339,7 @@ appdownloader.net
appledaily.com
appledaily.com.hk
appledaily.com.tw
apps.evozi.com
appshopper.com
appsocks.net
appspot.com
@@ -347,6 +349,7 @@ ar.hao123.com
archive.fo
archive.is
archive.li
archive.md
archive.org
archive.ph
archive.today
@@ -625,7 +628,6 @@ blog.tiney.com
blog.workflow.is
blog.xuite.net
blog.youthwant.com.tw
blog.youxu.info
blogblog.com
blogcatalog.com
blogcity.me
@@ -634,7 +636,6 @@ blogger.com
blogimg.jp
bloglines.com
bloglovin.com
blogs.icerocket.com
blogs.libraryinformationtechnology.com
blogs.tampabay.com
blogs.yahoo.co.jp
@@ -817,6 +818,7 @@ c-span.org
c-spanvideo.org
c100tibet.org
c2cx.com
cableav.tv
cablegatesearch.net
cachinese.com
cacnw.com
@@ -896,6 +898,7 @@ cdn-images.mailchimp.com
cdn-telegram.org
cdn.assets.lfpcontent.com
cdn.helixstudios.net
cdn.jwplayer.com
cdn.printfriendly.com
cdn.seatguru.com
cdn.softlayer.net
@@ -936,6 +939,8 @@ changsa.net
channelnewsasia.com
chaoex.com
chapm25.com
chat.lmsys.org
chatgpt.com
chatnook.com
chaturbate.com
checkgfw.com
@@ -1045,6 +1050,7 @@ chubold.com
chubun.com
churchinhongkong.org
chushigangdrug.ch
ciciai.com
cienen.com
cineastentreff.de
cipfg.org
@@ -1174,6 +1180,7 @@ costco.com
cotweet.com
counter.social
coursehero.com
coze.com
cpj.org
cq99.us
crackle.com
@@ -1334,6 +1341,7 @@ deviantart.com
deviantart.net
devio.us
devpn.com
devv.ai
dfas.mil
dfn.org
dharamsalanet.com
@@ -1607,6 +1615,7 @@ etaa.org.au
etadult.com
etaiwannews.com
etherdelta.com
ethermine.org
etherscan.io
etizer.org
etokki.com
@@ -1643,6 +1652,7 @@ eyny.com
ezpc.tk
ezpeer.com
ezua.com
f2pool.com
f8.com
fa.gov.tw
facebook.br
@@ -2649,6 +2659,7 @@ hrcchina.org
hrcir.com
hrea.org
hrichina.org
hrntt.org
hrtsea.com
hrw.org
hrweb.org
@@ -2734,6 +2745,7 @@ ibros.org
ibvpn.com
icams.com
ice.audionow.com
icedrive.net
icij.org
icl-fi.org
icoco.com
@@ -3207,7 +3219,6 @@ livecoin.net
livedoor.jp
liveleak.com
livemint.com
livestation.com
livestream.com
livevideo.com
livingonline.us
@@ -3215,7 +3226,6 @@ livingstream.com
liwangyang.com
lizhizhuangbi.com
lkcn.net
llss.me
lncn.org
load.to
lobsangwangyal.com
@@ -3655,6 +3665,7 @@ newlandmagazine.com.au
newmitbbs.com
newnews.ca
news.cnyes.com
news.ebc.net.tw
news.hk.msn.com
news.msn.com.tw
news.nationalgeographic.com
@@ -3753,6 +3764,7 @@ noxinfluencer.com
noypf.com
npa.go.jp
npa.gov.tw
npm.gov.tw
npnt.me
nps.gov
npsboost.com
@@ -4060,6 +4072,7 @@ pipii.tv
piposay.com
piraattilahti.org
piring.com
pixeldrain.com
pixelqi.com
pixiv.net
pixnet.net
@@ -4131,6 +4144,7 @@ postimg.org
posts.careerengine.us
potato.im
potvpn.com
pourquoi.tw
power.com
powerapple.com
powercx.com
@@ -4212,6 +4226,7 @@ python.com.tw
pythonhackers.com
pytorch.org
qanote.com
qbittorrent.org
qgirl.com.tw
qhigh.com
qi-gong.me
@@ -4246,9 +4261,9 @@ qxbbs.org
qz.com
r0.ru
r18.com
ra.gg
radicalparty.org
radiko.jp
radio-canada.ca
radio.garden
radioaustralia.net.au
radiohilight.net
@@ -4369,6 +4384,7 @@ ronjoneswriter.com
roodo.com
rosechina.net
rotten.com
rou.video
rsdlmonitor.com
rsf-chinese.org
rsf.org
@@ -4857,6 +4873,7 @@ tahr.org.tw
taipei.gov.tw
taipeisociety.org
taipeitimes.com
taisounds.com
taiwan-sex.com
taiwanbible.com
taiwancon.com
@@ -5894,6 +5911,7 @@ x-art.com
x-berry.com
x-wall.org
x.co
x.com
x.company
x1949x.com
x24hr.com
@@ -6021,7 +6039,6 @@ yilubbs.com
yingsuoss.com
yinlei.org
yipub.com
yiyechat.com
yizhihongxing.com
yobit.net
yobt.com
@@ -6069,17 +6086,18 @@ yuanming.net
yuanzhengtang.org
yulghun.com
yunchao.net
yuntipub.com
yuvutu.com
yvesgeleyn.com
ywpw.com
yx51.net
yyii.org
yyjlymb.xyz
yysub.net
yzzk.com
z-lib.org
zacebook.com
zalmos.com
zamimg.com
zannel.com
zaobao.com
zaobao.com.sg
@@ -1 +1 @@
202402192209
202406062209
@@ -51,7 +51,7 @@ const dns_port = uci.get(uciconfig, uciinfra, 'dns_port') || '5333';
let main_node, main_udp_node, dedicated_udp_node, default_outbound, sniff_override = '1',
dns_server, dns_default_strategy, dns_default_server, dns_disable_cache, dns_disable_cache_expire,
dns_independent_cache, direct_domain_list;
dns_independent_cache, dns_client_subnet, direct_domain_list;
if (routing_mode !== 'custom') {
main_node = uci.get(uciconfig, ucimain, 'main_node') || 'nil';
@@ -72,6 +72,7 @@ if (routing_mode !== 'custom') {
dns_disable_cache = uci.get(uciconfig, ucidnssetting, 'disable_cache');
dns_disable_cache_expire = uci.get(uciconfig, ucidnssetting, 'disable_cache_expire');
dns_independent_cache = uci.get(uciconfig, ucidnssetting, 'independent_cache');
dns_client_subnet = uci.get(uciconfig, ucidnssetting, 'client_subnet');
/* Routing settings */
default_outbound = uci.get(uciconfig, uciroutingsetting, 'default_outbound') || 'nil';
@@ -82,6 +83,9 @@ const proxy_mode = uci.get(uciconfig, ucimain, 'proxy_mode') || 'redirect_tproxy
ipv6_support = uci.get(uciconfig, ucimain, 'ipv6_support') || '0',
default_interface = uci.get(uciconfig, ucicontrol, 'bind_interface');
const cache_file_store_rdrc = uci.get(uciconfig, uciexp, 'cache_file_store_rdrc'),
cache_file_rdrc_timeout = uci.get(uciconfig, uciexp, 'cache_file_rdrc_timeout');
const mixed_port = uci.get(uciconfig, uciinfra, 'mixed_port') || '5330';
let self_mark, redirect_port, tproxy_port,
tun_name, tun_addr4, tun_addr6, tun_mtu, tun_gso,
@@ -98,9 +102,10 @@ if (match(proxy_mode), /tun/) {
tun_addr4 = uci.get(uciconfig, uciinfra, 'tun_addr4') || '172.19.0.1/30';
tun_addr6 = uci.get(uciconfig, uciinfra, 'tun_addr6') || 'fdfe:dcba:9876::1/126';
tun_mtu = uci.get(uciconfig, uciinfra, 'tun_mtu') || '9000';
tun_gso = uci.get(uciconfig, uciinfra, 'tun_gso') || '0';
tun_gso = '0';
tcpip_stack = 'system';
if (routing_mode === 'custom') {
tun_gso = uci.get(uciconfig, uciroutingsetting, 'tun_gso') || '0';
tcpip_stack = uci.get(uciconfig, uciroutingsetting, 'tcpip_stack') || 'system';
endpoint_independent_nat = uci.get(uciconfig, uciroutingsetting, 'endpoint_independent_nat');
}
@@ -344,7 +349,8 @@ config.dns = {
strategy: dns_default_strategy,
disable_cache: (dns_disable_cache === '1'),
disable_expire: (dns_disable_cache_expire === '1'),
independent_cache: (dns_independent_cache === '1')
independent_cache: (dns_independent_cache === '1'),
client_subnet: dns_client_subnet
};
if (!isEmpty(main_node)) {
@@ -401,7 +407,8 @@ if (!isEmpty(main_node)) {
address_resolver: get_resolver(cfg.address_resolver),
address_strategy: cfg.address_strategy,
strategy: cfg.resolve_strategy,
detour: get_outbound(cfg.outbound)
detour: get_outbound(cfg.outbound),
client_subnet: cfg.client_subnet
});
});
@@ -423,17 +430,21 @@ if (!isEmpty(main_node)) {
port_range: cfg.port_range,
source_ip_cidr: cfg.source_ip_cidr,
source_ip_is_private: (cfg.source_ip_is_private === '1') || null,
ip_cidr: cfg.ip_cidr,
ip_is_private: (cfg.ip_is_private === '1') || null,
source_port: parse_port(cfg.source_port),
source_port_range: cfg.source_port_range,
process_name: cfg.process_name,
process_path: cfg.process_path,
user: cfg.user,
rule_set: get_ruleset(cfg.rule_set),
rule_set_ipcidr_match_source: (cfg.rule_set_ipcidr_match_source === '1') || null,
invert: (cfg.invert === '1') || null,
outbound: get_outbound(cfg.outbound),
server: get_resolver(cfg.server),
disable_cache: (cfg.dns_disable_cache === '1') || null,
rewrite_ttl: strToInt(cfg.rewrite_ttl)
rewrite_ttl: strToInt(cfg.rewrite_ttl),
client_subnet: cfg.client_subnet
});
});
@@ -638,7 +649,9 @@ if (routing_mode === 'custom') {
config.experimental = {
cache_file: {
enabled: true,
path: HP_DIR + '/cache.db'
path: HP_DIR + '/cache.db',
store_rdrc: (cache_file_store_rdrc === '1') || null,
rdrc_timeout: cache_file_rdrc_timeout
}
};
}
@@ -95,8 +95,8 @@ case "$1" in
check_list_update "$1" "Loyalsoldier/v2ray-rules-dat" "release" "gfw.txt"
;;
"china_list")
check_list_update "$1" "Loyalsoldier/v2ray-rules-dat" "release" "direct-list.txt"
sed -i -e "s/full://g" -e "/:/d" "$RESOURCES_DIR/china_list.txt"
check_list_update "$1" "Loyalsoldier/v2ray-rules-dat" "release" "direct-list.txt" && \
sed -i -e "s/full://g" -e "/:/d" "$RESOURCES_DIR/china_list.txt"
;;
*)
echo -e "Usage: $0 <china_ip4 / china_ip6 / gfw_list / china_list>"
@@ -180,39 +180,46 @@ start_service() {
# chinadns-ng
if [ -n "$china_dns_server" ]; then
local wandns="$(ifstatus wan | jsonfilter -e '@["dns-server"][0]' || echo "119.29.29.29")"
case "$china_dns_server" in
"wan") china_dns_server="$wandns" ;;
"wan_114") china_dns_server="$wandns,114.114.114.114" ;;
esac
china_dns_server="${china_dns_server/wan/$wandns}"
china_dns_server="${china_dns_server// /,}"
procd_open_instance "chinadns-ng"
for i in $(seq 1 "$(grep -c "processor" "/proc/cpuinfo")"); do
procd_open_instance "chinadns-ng-$i"
procd_set_param command "/usr/bin/chinadns-ng"
procd_append_param command --bind-port "$china_dns_port"
procd_append_param command --china-dns "$china_dns_server"
procd_append_param command --trust-dns "127.0.0.1#$dns_port"
procd_append_param command --ipset-name4 "inet@fw4@homeproxy_mainland_addr_v4"
procd_append_param command --ipset-name6 "inet@fw4@homeproxy_mainland_addr_v6"
procd_append_param command --chnlist-file "$HP_DIR/resources/china_list.txt"
procd_append_param command --gfwlist-file "$HP_DIR/resources/gfw_list.txt"
[ "$ipv6_support" -eq "1" ] || procd_append_param command --no-ipv6=tC
procd_set_param command "/usr/bin/chinadns-ng"
procd_append_param command --bind-port "$china_dns_port"
procd_append_param command --china-dns "$china_dns_server"
procd_append_param command --trust-dns "127.0.0.1#$dns_port"
procd_append_param command --ipset-name4 "inet@fw4@homeproxy_mainland_addr_v4"
procd_append_param command --ipset-name6 "inet@fw4@homeproxy_mainland_addr_v6"
procd_append_param command --chnlist-file "$HP_DIR/resources/china_list.txt"
procd_append_param command --gfwlist-file "$HP_DIR/resources/gfw_list.txt"
[ "$ipv6_support" -eq "1" ] || procd_append_param command --no-ipv6=tC
procd_append_param command --reuse-port
if [ -x "/sbin/ujail" ]; then
procd_add_jail "chinadns-ng" log
procd_add_jail_mount "$HP_DIR/resources/china_list.txt"
procd_add_jail_mount "$HP_DIR/resources/gfw_list.txt"
procd_set_param capabilities "/etc/capabilities/homeproxy.json"
procd_set_param no_new_privs 1
procd_set_param user sing-box
procd_set_param group sing-box
fi
if chinadns-ng --version | grep -q "target:"; then
procd_append_param command --cache 10000
procd_append_param command --cache-stale 3600
procd_append_param command --verdict-cache 10000
fi
procd_set_param limits core="unlimited"
procd_set_param limits nofile="1000000 1000000"
procd_set_param stderr 1
procd_set_param respawn
if [ -x "/sbin/ujail" ]; then
procd_add_jail "chinadns-ng" log
procd_add_jail_mount "$HP_DIR/resources/china_list.txt"
procd_add_jail_mount "$HP_DIR/resources/gfw_list.txt"
procd_set_param capabilities "/etc/capabilities/homeproxy.json"
procd_set_param no_new_privs 1
procd_set_param user sing-box
procd_set_param group sing-box
fi
procd_close_instance
procd_set_param limits core="unlimited"
procd_set_param limits nofile="1000000 1000000"
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
done
fi
fi
@@ -0,0 +1,16 @@
#!/bin/sh
china_dns_server="$(uci -q get "homeproxy.config.china_dns_server")"
if [ "$china_dns_server" = "wan_114" ]; then
uci -q delete "homeproxy.config.china_dns_server"
uci -q add_list "homeproxy.config.china_dns_server"="wan"
uci -q add_list "homeproxy.config.china_dns_server"="114.114.114.114"
elif echo "$china_dns_server" | grep -q ","; then
uci -q delete "homeproxy.config.china_dns_server"
for dns in ${china_dns_server//,/ }; do
uci -q add_list "homeproxy.config.china_dns_server"="$dns"
done
fi
[ -z "$(uci -q changes "homeproxy")" ] || uci -q commit "homeproxy"
exit 0
@@ -173,6 +173,8 @@ const methods = {
}
features.hp_has_chinadns_ng = access('/usr/bin/chinadns-ng');
if (features.hp_has_chinadns_ng)
features.hp_has_chinadns_ng_v2 = (system('/usr/bin/chinadns-ng --version | grep -q "target:"') === 0);
features.hp_has_ip_full = access('/usr/libexec/ip-full');
features.hp_has_tcp_brutal = hasKernelModule('brutal.ko');
features.hp_has_tproxy = hasKernelModule('nft_tproxy.ko') || access('/etc/modules.d/nft-tproxy');
+1 -1
View File
@@ -11,7 +11,7 @@ LUCI_DEPENDS:=+curl +opkg +luci-base +tar +coreutils +coreutils-stat +libuci-lua
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.19)
LUCI_PKGARCH:=all
PKG_VERSION:=0.1.19-0
PKG_VERSION:=0.1.20-0
# PKG_RELEASE MUST be empty for luci.mk
PKG_RELEASE:=
@@ -216,7 +216,7 @@ local function _action(exe, cmd, ...)
end
function validate_pkgname(val)
return (val ~= nil and val:match("^[a-zA-Z0-9_]+$") ~= nil)
return (val ~= nil and val:match("^[a-zA-Z0-9_-]+$") ~= nil)
end
function store_action(param)
@@ -0,0 +1,327 @@
swagger: "2.0"
info:
description: Store API V1
title: Store API V1
version: 3.0.0
paths:
/cgi-bin/luci/admin/store/token:
get:
tags:
- token
summary: 获取csrfToken(用于POST请求)
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStoreToken"
/cgi-bin/luci/admin/store/installed:
get:
tags:
- installed
summary: 获取已安装的插件
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStoreInstalled"
/cgi-bin/luci/admin/store/install:
post:
tags:
- install
summary: 安装插件
parameters:
- in: "query"
name: "token"
type: string
required: true
- in: "query"
name: "package"
type: string
required: true
- in: "query"
name: "autoconf"
type: string
description: "可选参数,表示安装完以后是否自动配置插件"
- in: "query"
name: "path"
type: string
description: "可选参数,表示安装完以后是否自动配置插件"
- in: "query"
name: "enable"
type: string
description: "可选参数,表示安装完以后是否自动配置插件"
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/remove:
post:
tags:
- remove
summary: 卸载插件
parameters:
- in: "query"
name: "token"
type: string
required: true
- in: "query"
name: "package"
type: string
required: true
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/upgrade:
post:
tags:
- upgrade
summary: 更新插件
parameters:
- in: "query"
name: "token"
type: string
required: true
- in: "query"
name: "package"
type: string
required: true
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/upload:
post:
tags:
- upload
summary: 上传插件
description: "(文件上传表单,支持文件扩展名 .ipk,.run )"
consumes:
- multipart/form-data
parameters:
- in: formData
name: file
type: file
description: The file to upload.
- in: "query"
name: "token"
type: string
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/update:
post:
tags:
- update
summary: 刷新可用软件列表
parameters:
- in: "query"
name: "token"
type: string
required: true
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/status:
get:
tags:
- status
summary: 查询特定软件状态
parameters:
- in: "query"
name: "package"
type: string
required: true
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStoreStatus"
/cgi-bin/luci/admin/store/log:
get:
tags:
- log
summary: 任务日志
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/check_self_upgrade:
get:
tags:
- check_self_upgrade
summary: 检查iStore自身更新
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStoreCheckSelfUpgrade"
/cgi-bin/luci/admin/store/do_self_upgrade:
post:
tags:
- do_self_upgrade
summary: 更新iStore自身
parameters:
- in: "query"
name: "token"
type: string
required: true
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStore"
/cgi-bin/luci/admin/store/get_block_devices:
get:
tags:
- get_block_devices
summary: 枚举块设备
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStoreCheckSelfUpgrade"
/cgi-bin/luci/admin/store/configured:
get:
tags:
- configured
summary: 检查插件是否已经配置过
responses:
"200":
description: OK
schema:
$ref: "#/definitions/ResponseStoreConfigured"
definitions:
ResponseStoreToken:
type: object
properties:
token:
type: string
StoreInstalledApp:
type: object
properties:
tutorial:
type: string
description: "教程"
arch:
type: array
description: "适用的架构平台"
items:
type: string
entry:
type: string
description: "对于的页面地址"
author:
type: string
description: "作者"
depends:
type: array
description: "关联的依赖"
items:
type: string
time:
type: integer
description: "更新日期"
tags:
type: array
description: "标签"
items:
type: string
description_en:
type: string
description: "简介,英文"
description:
type: string
description: "简介,英文"
title:
type: string
description: "标题"
release:
type: integer
description: "发布"
website:
type: string
description: "官网"
version:
type: string
description: "版本号"
name:
type: string
description: "名称"
ResponseStoreInstalled:
type: array
items:
$ref: "#/definitions/StoreInstalledApp"
ResponseStore:
type: object
properties:
code:
type: integer
stdout:
type: string
stderr:
type: string
ResponseStoreStatus:
type: object
allOf:
- $ref: "#/definitions/StoreInstalledApp"
properties:
installed:
type: boolean
ResponseStoreCheckSelfUpgrade:
type: object
properties:
code:
type: integer
description: "为200时,msg会显示版本号"
msg:
type: string
description: "内容"
GetBlockDevice:
type: object
properties:
dev:
type: string
uuid:
type: string
version:
type: string
label:
type: string
mount:
type: string
type:
type: string
size:
type: string
ResponseStoreGetBlockDevices:
type: object
properties:
code:
type: integer
description: "为200时"
msg:
type: string
description: "内容"
data:
type: object
additionalProperties:
$ref: "#/definitions/GetBlockDevice"
ResponseStoreConfigured:
type: object
properties:
code:
type: integer
description: "为200时"
configured:
type: boolean
+20 -10
View File
@@ -1655,9 +1655,19 @@ dependencies = [
[[package]]
name = "idna"
version = "1.0.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "idna"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44a986806a1cc899952ba462bc1f28afbfd5850ab6cb030ccb20dd02cc527a24"
dependencies = [
"icu_normalizer",
"icu_properties",
@@ -1845,9 +1855,9 @@ dependencies = [
[[package]]
name = "libmimalloc-sys"
version = "0.1.38"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7bb23d733dfcc8af652a78b7bf232f0e967710d044732185e561e47c0336b6"
checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44"
dependencies = [
"cc",
"libc",
@@ -1988,9 +1998,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "mimalloc"
version = "0.1.42"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9186d86b79b52f4a77af65604b51225e8db1d6ee7e3f41aec1e40829c71a176"
checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633"
dependencies = [
"libmimalloc-sys",
]
@@ -3275,7 +3285,7 @@ dependencies = [
"http-body-util",
"httparse",
"hyper",
"idna 1.0.0",
"idna 1.0.1",
"ipnet",
"iprange",
"json5",
@@ -3961,12 +3971,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.1"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [
"form_urlencoded",
"idna 1.0.0",
"idna 0.5.0",
"percent-encoding",
"serde",
]
+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
with:
images: ghcr.io/sagernet/sing-box
- name: Build and release Docker images
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
platforms: linux/386,linux/amd64,linux/arm64,linux/s390x
context: .
+5 -12
View File
@@ -4,14 +4,13 @@ import (
"bytes"
"context"
"encoding/binary"
"io"
"net"
"time"
"github.com/sagernet/sing-box/common/urltest"
"github.com/sagernet/sing-dns"
N "github.com/sagernet/sing/common/network"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
type ClashServer interface {
@@ -56,16 +55,15 @@ func (s *SavedRuleSet) MarshalBinary() ([]byte, error) {
if err != nil {
return nil, err
}
err = rw.WriteUVariant(&buffer, uint64(len(s.Content)))
err = varbin.Write(&buffer, binary.BigEndian, s.Content)
if err != nil {
return nil, err
}
buffer.Write(s.Content)
err = binary.Write(&buffer, binary.BigEndian, s.LastUpdated.Unix())
if err != nil {
return nil, err
}
err = rw.WriteVString(&buffer, s.LastEtag)
err = varbin.Write(&buffer, binary.BigEndian, s.LastEtag)
if err != nil {
return nil, err
}
@@ -79,12 +77,7 @@ func (s *SavedRuleSet) UnmarshalBinary(data []byte) error {
if err != nil {
return err
}
contentLen, err := rw.ReadUVariant(reader)
if err != nil {
return err
}
s.Content = make([]byte, contentLen)
_, err = io.ReadFull(reader, s.Content)
err = varbin.Read(reader, binary.BigEndian, &s.Content)
if err != nil {
return err
}
@@ -94,7 +87,7 @@ func (s *SavedRuleSet) UnmarshalBinary(data []byte) error {
return err
}
s.LastUpdated = time.Unix(lastUpdated, 0)
s.LastEtag, err = rw.ReadVString(reader)
err = varbin.Read(reader, binary.BigEndian, &s.LastEtag)
if err != nil {
return err
}
+4 -1
View File
@@ -51,7 +51,9 @@ type InboundContext struct {
// rule cache
IPCIDRMatchSource bool
IPCIDRMatchSource bool
IPCIDRAcceptEmpty bool
SourceAddressMatch bool
SourcePortMatch bool
DestinationAddressMatch bool
@@ -62,6 +64,7 @@ type InboundContext struct {
func (c *InboundContext) ResetRuleCache() {
c.IPCIDRMatchSource = false
c.IPCIDRAcceptEmpty = false
c.SourceAddressMatch = false
c.SourcePortMatch = false
c.DestinationAddressMatch = false
+3 -1
View File
@@ -45,7 +45,9 @@ func (s *Box) startOutbounds() error {
}
started[outboundTag] = true
canContinue = true
if starter, isStarter := outboundToStart.(common.Starter); isStarter {
if starter, isStarter := outboundToStart.(interface {
Start() error
}); isStarter {
monitor.Start("initialize outbound/", outboundToStart.Type(), "[", outboundTag, "]")
err := starter.Start()
monitor.Finish()
+2 -2
View File
@@ -93,7 +93,7 @@ func buildAndroid() {
const name = "libbox.aar"
copyPath := filepath.Join("..", "sing-box-for-android", "app", "libs")
if rw.FileExists(copyPath) {
if rw.IsDir(copyPath) {
copyPath, _ = filepath.Abs(copyPath)
err = rw.CopyFile(name, filepath.Join(copyPath, name))
if err != nil {
@@ -134,7 +134,7 @@ func buildiOS() {
}
copyPath := filepath.Join("..", "sing-box-for-apple")
if rw.FileExists(copyPath) {
if rw.IsDir(copyPath) {
targetDir := filepath.Join(copyPath, "Libbox.xcframework")
targetDir, _ = filepath.Abs(targetDir)
os.RemoveAll(targetDir)
+5 -5
View File
@@ -30,7 +30,7 @@ func FindSDK() {
}
for _, path := range searchPath {
path = os.ExpandEnv(path)
if rw.FileExists(filepath.Join(path, "licenses", "android-sdk-license")) {
if rw.IsFile(filepath.Join(path, "licenses", "android-sdk-license")) {
androidSDKPath = path
break
}
@@ -60,7 +60,7 @@ func FindSDK() {
func findNDK() bool {
const fixedVersion = "26.2.11394342"
const versionFile = "source.properties"
if fixedPath := filepath.Join(androidSDKPath, "ndk", fixedVersion); rw.FileExists(filepath.Join(fixedPath, versionFile)) {
if fixedPath := filepath.Join(androidSDKPath, "ndk", fixedVersion); rw.IsFile(filepath.Join(fixedPath, versionFile)) {
androidNDKPath = fixedPath
return true
}
@@ -86,7 +86,7 @@ func findNDK() bool {
})
for _, versionName := range versionNames {
currentNDKPath := filepath.Join(androidSDKPath, "ndk", versionName)
if rw.FileExists(filepath.Join(androidSDKPath, versionFile)) {
if rw.IsFile(filepath.Join(androidSDKPath, versionFile)) {
androidNDKPath = currentNDKPath
log.Warn("reproducibility warning: using NDK version " + versionName + " instead of " + fixedVersion)
return true
@@ -100,11 +100,11 @@ var GoBinPath string
func FindMobile() {
goBin := filepath.Join(build.Default.GOPATH, "bin")
if runtime.GOOS == "windows" {
if !rw.FileExists(filepath.Join(goBin, "gobind.exe")) {
if !rw.IsFile(filepath.Join(goBin, "gobind.exe")) {
log.Fatal("missing gomobile installation")
}
} else {
if !rw.FileExists(filepath.Join(goBin, "gobind")) {
if !rw.IsFile(filepath.Join(goBin, "gobind")) {
log.Fatal("missing gomobile installation")
}
}
+5 -1
View File
@@ -54,7 +54,11 @@ func merge(outputPath string) error {
return nil
}
}
err = rw.WriteFile(outputPath, buffer.Bytes())
err = rw.MkdirParent(outputPath)
if err != nil {
return err
}
err = os.WriteFile(outputPath, buffer.Bytes(), 0o644)
if err != nil {
return err
}
+1 -1
View File
@@ -109,7 +109,7 @@ func readConfigAndMerge() (option.Options, error) {
}
var mergedMessage json.RawMessage
for _, options := range optionsList {
mergedMessage, err = badjson.MergeJSON(options.options.RawMessage, mergedMessage)
mergedMessage, err = badjson.MergeJSON(options.options.RawMessage, mergedMessage, false)
if err != nil {
return option.Options{}, E.Cause(err, "merge config at ", options.path)
}
+38 -42
View File
@@ -1,11 +1,15 @@
package geosite
import (
"bufio"
"encoding/binary"
"io"
"os"
"sync/atomic"
"github.com/sagernet/sing/common"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
type Reader struct {
@@ -34,45 +38,36 @@ func Open(path string) (*Reader, []string, error) {
return reader, codes, nil
}
type geositeMetadata struct {
Code string
Index uint64
Length uint64
}
func (r *Reader) readMetadata() error {
version, err := rw.ReadByte(r.reader)
reader := bufio.NewReader(r.reader)
version, err := reader.ReadByte()
if err != nil {
return err
}
if version != 0 {
return E.New("unknown version")
}
entryLength, err := rw.ReadUVariant(r.reader)
metadataEntries, err := varbin.ReadValue[[]geositeMetadata](reader, binary.BigEndian)
if err != nil {
return err
}
keys := make([]string, entryLength)
domainIndex := make(map[string]int)
domainLength := make(map[string]int)
for i := 0; i < int(entryLength); i++ {
var (
code string
codeIndex uint64
codeLength uint64
)
code, err = rw.ReadVString(r.reader)
if err != nil {
return err
}
keys[i] = code
codeIndex, err = rw.ReadUVariant(r.reader)
if err != nil {
return err
}
codeLength, err = rw.ReadUVariant(r.reader)
if err != nil {
return err
}
domainIndex[code] = int(codeIndex)
domainLength[code] = int(codeLength)
for _, entry := range metadataEntries {
domainIndex[entry.Code] = int(entry.Index)
domainLength[entry.Code] = int(entry.Length)
}
r.domainIndex = domainIndex
r.domainLength = domainLength
if reader.Buffered() > 0 {
return common.Error(r.reader.Seek(int64(-reader.Buffered()), io.SeekCurrent))
}
return nil
}
@@ -85,27 +80,28 @@ func (r *Reader) Read(code string) ([]Item, error) {
if err != nil {
return nil, err
}
counter := &rw.ReadCounter{Reader: r.reader}
domain := make([]Item, r.domainLength[code])
for i := range domain {
var (
item Item
err error
)
item.Type, err = rw.ReadByte(counter)
if err != nil {
return nil, err
}
item.Value, err = rw.ReadVString(counter)
if err != nil {
return nil, err
}
domain[i] = item
counter := &readCounter{Reader: r.reader}
domain, err := varbin.ReadValue[[]Item](bufio.NewReader(counter), binary.BigEndian)
if err != nil {
return nil, err
}
_, err = r.reader.Seek(int64(-index)-counter.Count(), io.SeekCurrent)
_, err = r.reader.Seek(int64(-index)-counter.count, io.SeekCurrent)
return domain, err
}
func (r *Reader) Upstream() any {
return r.reader
}
type readCounter struct {
io.Reader
count int64
}
func (r *readCounter) Read(p []byte) (n int, err error) {
n, err = r.Reader.Read(p)
if n > 0 {
atomic.AddInt64(&r.count, int64(n))
}
return
}
+15 -26
View File
@@ -2,13 +2,14 @@ package geosite
import (
"bytes"
"io"
"encoding/binary"
"sort"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/varbin"
)
func Write(writer io.Writer, domains map[string][]Item) error {
func Write(writer varbin.Writer, domains map[string][]Item) error {
keys := make([]string, 0, len(domains))
for code := range domains {
keys = append(keys, code)
@@ -19,40 +20,28 @@ func Write(writer io.Writer, domains map[string][]Item) error {
index := make(map[string]int)
for _, code := range keys {
index[code] = content.Len()
for _, domain := range domains[code] {
content.WriteByte(domain.Type)
err := rw.WriteVString(content, domain.Value)
if err != nil {
return err
}
err := varbin.Write(content, binary.BigEndian, domains[code])
if err != nil {
return err
}
}
err := rw.WriteByte(writer, 0)
err := writer.WriteByte(0)
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(keys)))
err = varbin.Write(writer, binary.BigEndian, common.Map(keys, func(it string) *geositeMetadata {
return &geositeMetadata{
Code: it,
Index: uint64(index[it]),
Length: uint64(len(domains[it])),
}
}))
if err != nil {
return err
}
for _, code := range keys {
err = rw.WriteVString(writer, code)
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(index[code]))
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(domains[code])))
if err != nil {
return err
}
}
_, err = writer.Write(content.Bytes())
if err != nil {
return err
+32 -72
View File
@@ -1,6 +1,7 @@
package srs
import (
"bufio"
"compress/zlib"
"encoding/binary"
"io"
@@ -11,7 +12,7 @@ import (
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/domain"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
"go4.org/netipx"
)
@@ -60,13 +61,14 @@ func Read(reader io.Reader, recovery bool) (ruleSet option.PlainRuleSet, err err
if err != nil {
return
}
length, err := rw.ReadUVariant(zReader)
bReader := bufio.NewReader(zReader)
length, err := binary.ReadUvarint(bReader)
if err != nil {
return
}
ruleSet.Rules = make([]option.HeadlessRule, length)
for i := uint64(0); i < length; i++ {
ruleSet.Rules[i], err = readRule(zReader, recovery)
ruleSet.Rules[i], err = readRule(bReader, recovery)
if err != nil {
err = E.Cause(err, "read rule[", i, "]")
return
@@ -88,12 +90,13 @@ func Write(writer io.Writer, ruleSet option.PlainRuleSet) error {
if err != nil {
return err
}
err = rw.WriteUVariant(zWriter, uint64(len(ruleSet.Rules)))
bWriter := bufio.NewWriter(zWriter)
_, err = varbin.WriteUvarint(bWriter, uint64(len(ruleSet.Rules)))
if err != nil {
return err
}
for _, rule := range ruleSet.Rules {
err = writeRule(zWriter, rule)
err = writeRule(bWriter, rule)
if err != nil {
return err
}
@@ -101,7 +104,7 @@ func Write(writer io.Writer, ruleSet option.PlainRuleSet) error {
return zWriter.Close()
}
func readRule(reader io.Reader, recovery bool) (rule option.HeadlessRule, err error) {
func readRule(reader varbin.Reader, recovery bool) (rule option.HeadlessRule, err error) {
var ruleType uint8
err = binary.Read(reader, binary.BigEndian, &ruleType)
if err != nil {
@@ -120,7 +123,7 @@ func readRule(reader io.Reader, recovery bool) (rule option.HeadlessRule, err er
return
}
func writeRule(writer io.Writer, rule option.HeadlessRule) error {
func writeRule(writer varbin.Writer, rule option.HeadlessRule) error {
switch rule.Type {
case C.RuleTypeDefault:
return writeDefaultRule(writer, rule.DefaultOptions)
@@ -131,7 +134,7 @@ func writeRule(writer io.Writer, rule option.HeadlessRule) error {
}
}
func readDefaultRule(reader io.Reader, recovery bool) (rule option.DefaultHeadlessRule, err error) {
func readDefaultRule(reader varbin.Reader, recovery bool) (rule option.DefaultHeadlessRule, err error) {
var lastItemType uint8
for {
var itemType uint8
@@ -209,7 +212,7 @@ func readDefaultRule(reader io.Reader, recovery bool) (rule option.DefaultHeadle
}
}
func writeDefaultRule(writer io.Writer, rule option.DefaultHeadlessRule) error {
func writeDefaultRule(writer varbin.Writer, rule option.DefaultHeadlessRule) error {
err := binary.Write(writer, binary.BigEndian, uint8(0))
if err != nil {
return err
@@ -327,73 +330,31 @@ func writeDefaultRule(writer io.Writer, rule option.DefaultHeadlessRule) error {
return nil
}
func readRuleItemString(reader io.Reader) ([]string, error) {
length, err := rw.ReadUVariant(reader)
if err != nil {
return nil, err
}
value := make([]string, length)
for i := uint64(0); i < length; i++ {
value[i], err = rw.ReadVString(reader)
if err != nil {
return nil, err
}
}
return value, nil
func readRuleItemString(reader varbin.Reader) ([]string, error) {
return varbin.ReadValue[[]string](reader, binary.BigEndian)
}
func writeRuleItemString(writer io.Writer, itemType uint8, value []string) error {
err := binary.Write(writer, binary.BigEndian, itemType)
func writeRuleItemString(writer varbin.Writer, itemType uint8, value []string) error {
err := writer.WriteByte(itemType)
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(value)))
return varbin.Write(writer, binary.BigEndian, value)
}
func readRuleItemUint16(reader varbin.Reader) ([]uint16, error) {
return varbin.ReadValue[[]uint16](reader, binary.BigEndian)
}
func writeRuleItemUint16(writer varbin.Writer, itemType uint8, value []uint16) error {
err := writer.WriteByte(itemType)
if err != nil {
return err
}
for _, item := range value {
err = rw.WriteVString(writer, item)
if err != nil {
return err
}
}
return nil
return varbin.Write(writer, binary.BigEndian, value)
}
func readRuleItemUint16(reader io.Reader) ([]uint16, error) {
length, err := rw.ReadUVariant(reader)
if err != nil {
return nil, err
}
value := make([]uint16, length)
for i := uint64(0); i < length; i++ {
err = binary.Read(reader, binary.BigEndian, &value[i])
if err != nil {
return nil, err
}
}
return value, nil
}
func writeRuleItemUint16(writer io.Writer, itemType uint8, value []uint16) error {
err := binary.Write(writer, binary.BigEndian, itemType)
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(value)))
if err != nil {
return err
}
for _, item := range value {
err = binary.Write(writer, binary.BigEndian, item)
if err != nil {
return err
}
}
return nil
}
func writeRuleItemCIDR(writer io.Writer, itemType uint8, value []string) error {
func writeRuleItemCIDR(writer varbin.Writer, itemType uint8, value []string) error {
var builder netipx.IPSetBuilder
for i, prefixString := range value {
prefix, err := netip.ParsePrefix(prefixString)
@@ -419,9 +380,8 @@ func writeRuleItemCIDR(writer io.Writer, itemType uint8, value []string) error {
return writeIPSet(writer, ipSet)
}
func readLogicalRule(reader io.Reader, recovery bool) (logicalRule option.LogicalHeadlessRule, err error) {
var mode uint8
err = binary.Read(reader, binary.BigEndian, &mode)
func readLogicalRule(reader varbin.Reader, recovery bool) (logicalRule option.LogicalHeadlessRule, err error) {
mode, err := reader.ReadByte()
if err != nil {
return
}
@@ -434,7 +394,7 @@ func readLogicalRule(reader io.Reader, recovery bool) (logicalRule option.Logica
err = E.New("unknown logical mode: ", mode)
return
}
length, err := rw.ReadUVariant(reader)
length, err := binary.ReadUvarint(reader)
if err != nil {
return
}
@@ -453,7 +413,7 @@ func readLogicalRule(reader io.Reader, recovery bool) (logicalRule option.Logica
return
}
func writeLogicalRule(writer io.Writer, logicalRule option.LogicalHeadlessRule) error {
func writeLogicalRule(writer varbin.Writer, logicalRule option.LogicalHeadlessRule) error {
err := binary.Write(writer, binary.BigEndian, uint8(1))
if err != nil {
return err
@@ -469,7 +429,7 @@ func writeLogicalRule(writer io.Writer, logicalRule option.LogicalHeadlessRule)
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(logicalRule.Rules)))
_, err = varbin.WriteUvarint(writer, uint64(len(logicalRule.Rules)))
if err != nil {
return err
}
+36 -71
View File
@@ -2,11 +2,13 @@ package srs
import (
"encoding/binary"
"io"
"net/netip"
"os"
"unsafe"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/varbin"
"go4.org/netipx"
)
@@ -20,94 +22,57 @@ type myIPRange struct {
to netip.Addr
}
func readIPSet(reader io.Reader) (*netipx.IPSet, error) {
var version uint8
err := binary.Read(reader, binary.BigEndian, &version)
type myIPRangeData struct {
From []byte
To []byte
}
func readIPSet(reader varbin.Reader) (*netipx.IPSet, error) {
version, err := reader.ReadByte()
if err != nil {
return nil, err
}
if version != 1 {
return nil, os.ErrInvalid
}
// WTF why using uint64 here
var length uint64
err = binary.Read(reader, binary.BigEndian, &length)
if err != nil {
return nil, err
}
mySet := &myIPSet{
rr: make([]myIPRange, length),
ranges := make([]myIPRangeData, length)
err = varbin.Read(reader, binary.BigEndian, &ranges)
if err != nil {
return nil, err
}
for i := uint64(0); i < length; i++ {
var (
fromLen uint64
toLen uint64
fromAddr netip.Addr
toAddr netip.Addr
)
fromLen, err = rw.ReadUVariant(reader)
if err != nil {
return nil, err
}
fromBytes := make([]byte, fromLen)
_, err = io.ReadFull(reader, fromBytes)
if err != nil {
return nil, err
}
err = fromAddr.UnmarshalBinary(fromBytes)
if err != nil {
return nil, err
}
toLen, err = rw.ReadUVariant(reader)
if err != nil {
return nil, err
}
toBytes := make([]byte, toLen)
_, err = io.ReadFull(reader, toBytes)
if err != nil {
return nil, err
}
err = toAddr.UnmarshalBinary(toBytes)
if err != nil {
return nil, err
}
mySet.rr[i] = myIPRange{fromAddr, toAddr}
mySet := &myIPSet{
rr: make([]myIPRange, len(ranges)),
}
for i, rangeData := range ranges {
mySet.rr[i].from = M.AddrFromIP(rangeData.From)
mySet.rr[i].to = M.AddrFromIP(rangeData.To)
}
return (*netipx.IPSet)(unsafe.Pointer(mySet)), nil
}
func writeIPSet(writer io.Writer, set *netipx.IPSet) error {
err := binary.Write(writer, binary.BigEndian, uint8(1))
func writeIPSet(writer varbin.Writer, set *netipx.IPSet) error {
err := writer.WriteByte(1)
if err != nil {
return err
}
mySet := (*myIPSet)(unsafe.Pointer(set))
err = binary.Write(writer, binary.BigEndian, uint64(len(mySet.rr)))
dataList := common.Map((*myIPSet)(unsafe.Pointer(set)).rr, func(rr myIPRange) myIPRangeData {
return myIPRangeData{
From: rr.from.AsSlice(),
To: rr.to.AsSlice(),
}
})
err = binary.Write(writer, binary.BigEndian, uint64(len(dataList)))
if err != nil {
return err
}
for _, rr := range mySet.rr {
var (
fromBinary []byte
toBinary []byte
)
fromBinary, err = rr.from.MarshalBinary()
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(fromBinary)))
if err != nil {
return err
}
_, err = writer.Write(fromBinary)
if err != nil {
return err
}
toBinary, err = rr.to.MarshalBinary()
if err != nil {
return err
}
err = rw.WriteUVariant(writer, uint64(len(toBinary)))
if err != nil {
return err
}
_, err = writer.Write(toBinary)
for _, data := range dataList {
err = varbin.Write(writer, binary.BigEndian, data)
if err != nil {
return err
}
+3 -3
View File
@@ -13,14 +13,14 @@ var resourcePaths []string
func FindPath(name string) (string, bool) {
name = os.ExpandEnv(name)
if rw.FileExists(name) {
if rw.IsFile(name) {
return name, true
}
for _, dir := range resourcePaths {
if path := filepath.Join(dir, dirName, name); rw.FileExists(path) {
if path := filepath.Join(dir, dirName, name); rw.IsFile(path) {
return path, true
}
if path := filepath.Join(dir, name); rw.FileExists(path) {
if path := filepath.Join(dir, name); rw.IsFile(path) {
return path, true
}
}
+21
View File
@@ -2,6 +2,27 @@
icon: material/alert-decagram
---
#### 1.10.0-alpha.17
* Some chaotic changes **1**
* `rule_set_ipcidr_match_source` rule items are renamed **2**
* Add `rule_set_ip_cidr_accept_empty` DNS address filter rule item **3**
* Update quic-go to v0.45.1
* Fixes and improvements
**1**:
Something may be broken, please actively report problems with this version.
**2**:
`rule_set_ipcidr_match_source` route and DNS rule items are renamed to
`rule_set_ip_cidr_match_source` and will be remove in sing-box 1.11.0.
**3**:
See [DNS Rule](/configuration/dns/rule/#rule_set_ip_cidr_accept_empty).
#### 1.10.0-alpha.16
* Add custom options for `auto-route` and `auto-redirect` **1**
+27 -2
View File
@@ -2,6 +2,12 @@
icon: material/new-box
---
!!! quote "Changes in sing-box 1.10.0"
:material-delete-clock: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
:material-plus: [rule_set_ip_cidr_match_source](#rule_set_ip_cidr_match_source)
:material-plus: [rule_set_ip_cidr_accept_empty](#rule_set_ip_cidr_accept_empty)
!!! quote "Changes in sing-box 1.9.0"
:material-plus: [geoip](#geoip)
@@ -117,7 +123,10 @@ icon: material/new-box
"geoip-cn",
"geosite-cn"
],
// deprecated
"rule_set_ipcidr_match_source": false,
"rule_set_ip_cidr_match_source": false,
"rule_set_ip_cidr_accept_empty": false,
"invert": false,
"outbound": [
"direct"
@@ -309,7 +318,17 @@ Match [Rule Set](/configuration/route/#rule_set).
!!! question "Since sing-box 1.9.0"
Make `ipcidr` in rule sets match the source IP.
!!! failure "Deprecated in sing-box 1.10.0"
`rule_set_ipcidr_match_source` is renamed to `rule_set_ip_cidr_match_source` and will be remove in sing-box 1.11.0.
Make `ip_cidr` rule items in rule sets match the source IP.
#### rule_set_ip_cidr_match_source
!!! question "Since sing-box 1.10.0"
Make `ip_cidr` rule items in rule sets match the source IP.
#### invert
@@ -347,7 +366,7 @@ Will overrides `dns.client_subnet` and `servers.[].client_subnet`.
### Address Filter Fields
Only takes effect for IP address requests. When the query results do not match the address filtering rule items, the current rule will be skipped.
Only takes effect for address requests (A/AAAA/HTTPS). When the query results do not match the address filtering rule items, the current rule will be skipped.
!!! info ""
@@ -375,6 +394,12 @@ Match IP CIDR with query response.
Match private IP with query response.
#### rule_set_ip_cidr_accept_empty
!!! question "Since sing-box 1.10.0"
Make `ip_cidr` rules in rule sets accept empty query response.
### Logical Fields
#### type
+28 -3
View File
@@ -2,6 +2,12 @@
icon: material/new-box
---
!!! quote "sing-box 1.10.0 中的更改"
:material-delete-clock: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
:material-plus: [rule_set_ip_cidr_match_source](#rule_set_ip_cidr_match_source)
:material-plus: [rule_set_ip_cidr_accept_empty](#rule_set_ip_cidr_accept_empty)
!!! quote "sing-box 1.9.0 中的更改"
:material-plus: [geoip](#geoip)
@@ -117,7 +123,10 @@ icon: material/new-box
"geoip-cn",
"geosite-cn"
],
// 已弃用
"rule_set_ipcidr_match_source": false,
"rule_set_ip_cidr_match_source": false,
"rule_set_ip_cidr_accept_empty": false,
"invert": false,
"outbound": [
"direct"
@@ -307,7 +316,17 @@ DNS 查询类型。值可以为整数或者类型名称字符串。
!!! question "自 sing-box 1.9.0 起"
使规则集中的 `ipcidr` 规则匹配源 IP。
!!! failure "已在 sing-box 1.10.0 废弃"
`rule_set_ipcidr_match_source` 已重命名为 `rule_set_ip_cidr_match_source` 且将在 sing-box 1.11.0 移除。
使规则集中的 `ip_cidr` 规则匹配源 IP。
#### rule_set_ip_cidr_match_source
!!! question "自 sing-box 1.10.0 起"
使规则集中的 `ip_cidr` 规则匹配源 IP。
#### invert
@@ -345,7 +364,7 @@ DNS 查询类型。值可以为整数或者类型名称字符串。
### 地址筛选字段
仅对IP地址请求生效。 当查询结果与地址筛选规则项不匹配时,将跳过当前规则。
仅对地址请求 (A/AAAA/HTTPS) 生效。 当查询结果与地址筛选规则项不匹配时,将跳过当前规则。
!!! info ""
@@ -365,7 +384,7 @@ DNS 查询类型。值可以为整数或者类型名称字符串。
!!! question "自 sing-box 1.9.0 起"
与查询应匹配 IP CIDR。
与查询应匹配 IP CIDR。
#### ip_is_private
@@ -373,6 +392,12 @@ DNS 查询类型。值可以为整数或者类型名称字符串。
与查询响应匹配非公开 IP。
#### rule_set_ip_cidr_accept_empty
!!! question "自 sing-box 1.10.0 起"
使规则集中的 `ip_cidr` 规则接受空查询响应。
### 逻辑字段
#### type
@@ -168,7 +168,7 @@ tun 接口的 IPv4 和 IPv6 前缀。
!!! failure "已在 sing-box 1.10.0 废弃"
`inet4_address` 已合并到 `address` 且将在 sing-box 1.11.0 移除.
`inet4_address` 已合并到 `address` 且将在 sing-box 1.11.0 移除
==必填==
@@ -178,7 +178,7 @@ tun 接口的 IPv4 前缀。
!!! failure "已在 sing-box 1.10.0 废弃"
`inet6_address` 已合并到 `address` 且将在 sing-box 1.11.0 移除.
`inet6_address` 已合并到 `address` 且将在 sing-box 1.11.0 移除
tun 接口的 IPv6 前缀。
@@ -288,7 +288,7 @@ tun 接口的 IPv6 前缀。
!!! failure "已在 sing-box 1.10.0 废弃"
`inet4_route_address` 已合并到 `route_address` 且将在 sing-box 1.11.0 移除.
`inet4_route_address` 已合并到 `route_address` 且将在 sing-box 1.11.0 移除
启用 `auto_route` 时使用自定义路由而不是默认路由。
@@ -296,7 +296,7 @@ tun 接口的 IPv6 前缀。
!!! failure "已在 sing-box 1.10.0 废弃"
`inet6_route_address` 已合并到 `route_address` 且将在 sing-box 1.11.0 移除.
`inet6_route_address` 已合并到 `route_address` 且将在 sing-box 1.11.0 移除
启用 `auto_route` 时使用自定义路由而不是默认路由。
@@ -310,7 +310,7 @@ tun 接口的 IPv6 前缀。
!!! failure "已在 sing-box 1.10.0 废弃"
`inet4_route_exclude_address` 已合并到 `route_exclude_address` 且将在 sing-box 1.11.0 移除.
`inet4_route_exclude_address` 已合并到 `route_exclude_address` 且将在 sing-box 1.11.0 移除
启用 `auto_route` 时排除自定义路由。
@@ -318,7 +318,7 @@ tun 接口的 IPv6 前缀。
!!! failure "已在 sing-box 1.10.0 废弃"
`inet6_route_exclude_address` 已合并到 `route_exclude_address` 且将在 sing-box 1.11.0 移除.
`inet6_route_exclude_address` 已合并到 `route_exclude_address` 且将在 sing-box 1.11.0 移除
启用 `auto_route` 时排除自定义路由。
+22 -1
View File
@@ -1,3 +1,12 @@
---
icon: material/alert-decagram
---
!!! quote "Changes in sing-box 1.10.0"
:material-delete-clock: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
:material-plus: [rule_set_ip_cidr_match_source](#rule_set_ip_cidr_match_source)
!!! quote "Changes in sing-box 1.8.0"
:material-plus: [rule_set](#rule_set)
@@ -105,7 +114,9 @@
"geoip-cn",
"geosite-cn"
],
// deprecated
"rule_set_ipcidr_match_source": false,
"rule_set_ip_cidr_match_source": false,
"invert": false,
"outbound": "direct"
},
@@ -303,7 +314,17 @@ Match [Rule Set](/configuration/route/#rule_set).
!!! question "Since sing-box 1.8.0"
Make `ipcidr` in rule sets match the source IP.
!!! failure "Deprecated in sing-box 1.10.0"
`rule_set_ipcidr_match_source` is renamed to `rule_set_ip_cidr_match_source` and will be remove in sing-box 1.11.0.
Make `ip_cidr` in rule sets match the source IP.
#### rule_set_ip_cidr_match_source
!!! question "Since sing-box 1.10.0"
Make `ip_cidr` in rule sets match the source IP.
#### invert
+22 -1
View File
@@ -1,3 +1,12 @@
---
icon: material/alert-decagram
---
!!! quote "sing-box 1.10.0 中的更改"
:material-delete-clock: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
:material-plus: [rule_set_ip_cidr_match_source](#rule_set_ip_cidr_match_source)
!!! quote "sing-box 1.8.0 中的更改"
:material-plus: [rule_set](#rule_set)
@@ -103,7 +112,9 @@
"geoip-cn",
"geosite-cn"
],
// 已弃用
"rule_set_ipcidr_match_source": false,
"rule_set_ip_cidr_match_source": false,
"invert": false,
"outbound": "direct"
},
@@ -301,7 +312,17 @@
!!! question "自 sing-box 1.8.0 起"
使规则集中的 `ipcidr` 规则匹配源 IP。
!!! failure "已在 sing-box 1.10.0 废弃"
`rule_set_ipcidr_match_source` 已重命名为 `rule_set_ip_cidr_match_source` 且将在 sing-box 1.11.0 移除。
使规则集中的 `ip_cidr` 规则匹配源 IP。
#### rule_set_ip_cidr_match_source
!!! question "自 sing-box 1.10.0 起"
使规则集中的 `ip_cidr` 规则匹配源 IP。
#### invert
@@ -9,7 +9,7 @@ import (
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/experimental/clashapi"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
func (c *CommandClient) SetClashMode(newMode string) error {
@@ -22,7 +22,7 @@ func (c *CommandClient) SetClashMode(newMode string) error {
if err != nil {
return err
}
err = rw.WriteVString(conn, newMode)
err = varbin.Write(conn, binary.BigEndian, newMode)
if err != nil {
return err
}
@@ -30,7 +30,7 @@ func (c *CommandClient) SetClashMode(newMode string) error {
}
func (s *CommandServer) handleSetClashMode(conn net.Conn) error {
newMode, err := rw.ReadVString(conn)
newMode, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return err
}
@@ -50,7 +50,7 @@ func (c *CommandClient) handleModeConn(conn net.Conn) {
defer conn.Close()
for {
newMode, err := rw.ReadVString(conn)
newMode, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
c.handler.Disconnected(err.Error())
return
@@ -80,7 +80,7 @@ func (s *CommandServer) handleModeConn(conn net.Conn) error {
for {
select {
case <-s.modeUpdate:
err = rw.WriteVString(conn, clashServer.Mode())
err = varbin.Write(conn, binary.BigEndian, clashServer.Mode())
if err != nil {
return err
}
@@ -101,12 +101,12 @@ func readClashModeList(reader io.Reader) (modeList []string, currentMode string,
}
modeList = make([]string, modeListLength)
for i := 0; i < int(modeListLength); i++ {
modeList[i], err = rw.ReadVString(reader)
modeList[i], err = varbin.ReadValue[string](reader, binary.BigEndian)
if err != nil {
return
}
}
currentMode, err = rw.ReadVString(reader)
currentMode, err = varbin.ReadValue[string](reader, binary.BigEndian)
return
}
@@ -118,12 +118,12 @@ func writeClashModeList(writer io.Writer, clashServer adapter.ClashServer) error
}
if len(modeList) > 0 {
for _, mode := range modeList {
err = rw.WriteVString(writer, mode)
err = varbin.Write(writer, binary.BigEndian, mode)
if err != nil {
return err
}
}
err = rw.WriteVString(writer, clashServer.Mode())
err = varbin.Write(writer, binary.BigEndian, clashServer.Mode())
if err != nil {
return err
}
@@ -7,6 +7,7 @@ import (
"github.com/sagernet/sing-box/experimental/clashapi"
"github.com/sagernet/sing/common/binary"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/varbin"
"github.com/gofrs/uuid/v5"
)
@@ -18,7 +19,7 @@ func (c *CommandClient) CloseConnection(connId string) error {
}
defer conn.Close()
writer := bufio.NewWriter(conn)
err = binary.WriteData(writer, binary.BigEndian, connId)
err = varbin.Write(writer, binary.BigEndian, connId)
if err != nil {
return err
}
@@ -32,7 +33,7 @@ func (c *CommandClient) CloseConnection(connId string) error {
func (s *CommandServer) handleCloseConnection(conn net.Conn) error {
reader := bufio.NewReader(conn)
var connId string
err := binary.ReadData(reader, binary.BigEndian, &connId)
err := varbin.Read(reader, binary.BigEndian, &connId)
if err != nil {
return E.Cause(err, "read connection id")
}
@@ -12,6 +12,7 @@ import (
"github.com/sagernet/sing/common/binary"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/varbin"
"github.com/gofrs/uuid/v5"
)
@@ -21,7 +22,7 @@ func (c *CommandClient) handleConnectionsConn(conn net.Conn) {
reader := bufio.NewReader(conn)
var connections Connections
for {
err := binary.ReadData(reader, binary.BigEndian, &connections.connections)
err := varbin.Read(reader, binary.BigEndian, &connections.connections)
if err != nil {
c.handler.Disconnected(err.Error())
return
@@ -69,7 +70,7 @@ func (s *CommandServer) handleConnectionsConn(conn net.Conn) error {
for _, connection := range trafficManager.ClosedConnections() {
outConnections = append(outConnections, newConnection(connections, connection, true))
}
err = binary.WriteData(writer, binary.BigEndian, outConnections)
err = varbin.Write(writer, binary.BigEndian, outConnections)
if err != nil {
return err
}
+17 -123
View File
@@ -1,6 +1,7 @@
package libbox
import (
"bufio"
"encoding/binary"
"io"
"net"
@@ -10,7 +11,7 @@ import (
"github.com/sagernet/sing-box/common/urltest"
"github.com/sagernet/sing-box/outbound"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
"github.com/sagernet/sing/service"
)
@@ -36,19 +37,24 @@ func (s *CommandServer) handleGroupConn(conn net.Conn) error {
ticker := time.NewTicker(time.Duration(interval))
defer ticker.Stop()
ctx := connKeepAlive(conn)
writer := bufio.NewWriter(conn)
for {
service := s.service
if service != nil {
err := writeGroups(conn, service)
err = writeGroups(writer, service)
if err != nil {
return err
}
} else {
err := binary.Write(conn, binary.BigEndian, uint16(0))
err = binary.Write(writer, binary.BigEndian, uint16(0))
if err != nil {
return err
}
}
err = writer.Flush()
if err != nil {
return err
}
select {
case <-ctx.Done():
return ctx.Err()
@@ -68,11 +74,11 @@ type OutboundGroup struct {
Selectable bool
Selected string
IsExpand bool
items []*OutboundGroupItem
ItemList []*OutboundGroupItem
}
func (g *OutboundGroup) GetItems() OutboundGroupItemIterator {
return newIterator(g.items)
return newIterator(g.ItemList)
}
type OutboundGroupIterator interface {
@@ -93,73 +99,10 @@ type OutboundGroupItemIterator interface {
}
func readGroups(reader io.Reader) (OutboundGroupIterator, error) {
var groupLength uint16
err := binary.Read(reader, binary.BigEndian, &groupLength)
groups, err := varbin.ReadValue[[]*OutboundGroup](reader, binary.BigEndian)
if err != nil {
return nil, err
}
groups := make([]*OutboundGroup, 0, groupLength)
for i := 0; i < int(groupLength); i++ {
var group OutboundGroup
group.Tag, err = rw.ReadVString(reader)
if err != nil {
return nil, err
}
group.Type, err = rw.ReadVString(reader)
if err != nil {
return nil, err
}
err = binary.Read(reader, binary.BigEndian, &group.Selectable)
if err != nil {
return nil, err
}
group.Selected, err = rw.ReadVString(reader)
if err != nil {
return nil, err
}
err = binary.Read(reader, binary.BigEndian, &group.IsExpand)
if err != nil {
return nil, err
}
var itemLength uint16
err = binary.Read(reader, binary.BigEndian, &itemLength)
if err != nil {
return nil, err
}
group.items = make([]*OutboundGroupItem, itemLength)
for j := 0; j < int(itemLength); j++ {
var item OutboundGroupItem
item.Tag, err = rw.ReadVString(reader)
if err != nil {
return nil, err
}
item.Type, err = rw.ReadVString(reader)
if err != nil {
return nil, err
}
err = binary.Read(reader, binary.BigEndian, &item.URLTestTime)
if err != nil {
return nil, err
}
err = binary.Read(reader, binary.BigEndian, &item.URLTestDelay)
if err != nil {
return nil, err
}
group.items[j] = &item
}
groups = append(groups, &group)
}
return newIterator(groups), nil
}
@@ -199,63 +142,14 @@ func writeGroups(writer io.Writer, boxService *BoxService) error {
item.URLTestTime = history.Time.Unix()
item.URLTestDelay = int32(history.Delay)
}
group.items = append(group.items, &item)
group.ItemList = append(group.ItemList, &item)
}
if len(group.items) < 2 {
if len(group.ItemList) < 2 {
continue
}
groups = append(groups, group)
}
err := binary.Write(writer, binary.BigEndian, uint16(len(groups)))
if err != nil {
return err
}
for _, group := range groups {
err = rw.WriteVString(writer, group.Tag)
if err != nil {
return err
}
err = rw.WriteVString(writer, group.Type)
if err != nil {
return err
}
err = binary.Write(writer, binary.BigEndian, group.Selectable)
if err != nil {
return err
}
err = rw.WriteVString(writer, group.Selected)
if err != nil {
return err
}
err = binary.Write(writer, binary.BigEndian, group.IsExpand)
if err != nil {
return err
}
err = binary.Write(writer, binary.BigEndian, uint16(len(group.items)))
if err != nil {
return err
}
for _, item := range group.items {
err = rw.WriteVString(writer, item.Tag)
if err != nil {
return err
}
err = rw.WriteVString(writer, item.Type)
if err != nil {
return err
}
err = binary.Write(writer, binary.BigEndian, item.URLTestTime)
if err != nil {
return err
}
err = binary.Write(writer, binary.BigEndian, item.URLTestDelay)
if err != nil {
return err
}
}
}
return nil
return varbin.Write(writer, binary.BigEndian, groups)
}
func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error {
@@ -268,7 +162,7 @@ func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error {
if err != nil {
return err
}
err = rw.WriteVString(conn, groupTag)
err = varbin.Write(conn, binary.BigEndian, groupTag)
if err != nil {
return err
}
@@ -280,7 +174,7 @@ func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error {
}
func (s *CommandServer) handleSetGroupExpand(conn net.Conn) error {
groupTag, err := rw.ReadVString(conn)
groupTag, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return err
}
+3 -2
View File
@@ -9,6 +9,7 @@ import (
"github.com/sagernet/sing/common/binary"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/varbin"
)
func (s *CommandServer) WriteMessage(message string) {
@@ -26,7 +27,7 @@ func writeLog(writer *bufio.Writer, messages []string) error {
if err != nil {
return err
}
err = binary.WriteData(writer, binary.BigEndian, messages)
err = varbin.Write(writer, binary.BigEndian, messages)
if err != nil {
return err
}
@@ -119,7 +120,7 @@ func (c *CommandClient) handleLogConn(conn net.Conn) {
var messages []string
switch messageType {
case 0:
err = binary.ReadData(reader, binary.BigEndian, &messages)
err = varbin.Read(reader, binary.BigEndian, &messages)
if err != nil {
c.handler.Disconnected(err.Error())
return
@@ -5,7 +5,7 @@ import (
"net"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
func (c *CommandClient) ServiceReload() error {
@@ -24,7 +24,7 @@ func (c *CommandClient) ServiceReload() error {
return err
}
if hasError {
errorMessage, err := rw.ReadVString(conn)
errorMessage, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return err
}
@@ -40,7 +40,7 @@ func (s *CommandServer) handleServiceReload(conn net.Conn) error {
return err
}
if rErr != nil {
return rw.WriteVString(conn, rErr.Error())
return varbin.Write(conn, binary.BigEndian, rErr.Error())
}
return nil
}
@@ -61,7 +61,7 @@ func (c *CommandClient) ServiceClose() error {
return nil
}
if hasError {
errorMessage, err := rw.ReadVString(conn)
errorMessage, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return nil
}
@@ -78,7 +78,7 @@ func (s *CommandServer) handleServiceClose(conn net.Conn) error {
return err
}
if rErr != nil {
return rw.WriteVString(conn, rErr.Error())
return varbin.Write(conn, binary.BigEndian, rErr.Error())
}
return nil
}
@@ -6,7 +6,7 @@ import (
"github.com/sagernet/sing-box/outbound"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) error {
@@ -19,11 +19,11 @@ func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) erro
if err != nil {
return err
}
err = rw.WriteVString(conn, groupTag)
err = varbin.Write(conn, binary.BigEndian, groupTag)
if err != nil {
return err
}
err = rw.WriteVString(conn, outboundTag)
err = varbin.Write(conn, binary.BigEndian, outboundTag)
if err != nil {
return err
}
@@ -31,11 +31,11 @@ func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) erro
}
func (s *CommandServer) handleSelectOutbound(conn net.Conn) error {
groupTag, err := rw.ReadVString(conn)
groupTag, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return err
}
outboundTag, err := rw.ReadVString(conn)
outboundTag, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return err
}
@@ -5,7 +5,7 @@ import (
"io"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
func readError(reader io.Reader) error {
@@ -15,7 +15,7 @@ func readError(reader io.Reader) error {
return err
}
if hasError {
errorMessage, err := rw.ReadVString(reader)
errorMessage, err := varbin.ReadValue[string](reader, binary.BigEndian)
if err != nil {
return err
}
@@ -30,7 +30,7 @@ func writeError(writer io.Writer, wErr error) error {
return err
}
if wErr != nil {
err = rw.WriteVString(writer, wErr.Error())
err = varbin.Write(writer, binary.BigEndian, wErr.Error())
if err != nil {
return err
}
@@ -11,7 +11,7 @@ import (
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/batch"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
"github.com/sagernet/sing/service"
)
@@ -25,7 +25,7 @@ func (c *CommandClient) URLTest(groupTag string) error {
if err != nil {
return err
}
err = rw.WriteVString(conn, groupTag)
err = varbin.Write(conn, binary.BigEndian, groupTag)
if err != nil {
return err
}
@@ -33,7 +33,7 @@ func (c *CommandClient) URLTest(groupTag string) error {
}
func (s *CommandServer) handleURLTest(conn net.Conn) error {
groupTag, err := rw.ReadVString(conn)
groupTag, err := varbin.ReadValue[string](conn, binary.BigEndian)
if err != nil {
return err
}
+23 -20
View File
@@ -1,13 +1,13 @@
package libbox
import (
"bufio"
"bytes"
"compress/gzip"
"encoding/binary"
"io"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
func EncodeChunkedMessage(data []byte) []byte {
@@ -35,13 +35,13 @@ type ErrorMessage struct {
func (e *ErrorMessage) Encode() []byte {
var buffer bytes.Buffer
buffer.WriteByte(MessageTypeError)
rw.WriteVString(&buffer, e.Message)
varbin.Write(&buffer, binary.BigEndian, e.Message)
return buffer.Bytes()
}
func DecodeErrorMessage(data []byte) (*ErrorMessage, error) {
reader := bytes.NewReader(data)
messageType, err := rw.ReadByte(reader)
messageType, err := reader.ReadByte()
if err != nil {
return nil, err
}
@@ -49,7 +49,7 @@ func DecodeErrorMessage(data []byte) (*ErrorMessage, error) {
return nil, E.New("invalid message")
}
var message ErrorMessage
message.Message, err = rw.ReadVString(reader)
message.Message, err = varbin.ReadValue[string](reader, binary.BigEndian)
if err != nil {
return nil, err
}
@@ -87,7 +87,7 @@ func (e *ProfileEncoder) Encode() []byte {
binary.Write(&buffer, binary.BigEndian, uint16(len(e.profiles)))
for _, preview := range e.profiles {
binary.Write(&buffer, binary.BigEndian, preview.ProfileID)
rw.WriteVString(&buffer, preview.Name)
varbin.Write(&buffer, binary.BigEndian, preview.Name)
binary.Write(&buffer, binary.BigEndian, preview.Type)
}
return buffer.Bytes()
@@ -117,7 +117,7 @@ func (d *ProfileDecoder) Decode(data []byte) error {
if err != nil {
return err
}
profile.Name, err = rw.ReadVString(reader)
profile.Name, err = varbin.ReadValue[string](reader, binary.BigEndian)
if err != nil {
return err
}
@@ -147,7 +147,7 @@ func (r *ProfileContentRequest) Encode() []byte {
func DecodeProfileContentRequest(data []byte) (*ProfileContentRequest, error) {
reader := bytes.NewReader(data)
messageType, err := rw.ReadByte(reader)
messageType, err := reader.ReadByte()
if err != nil {
return nil, err
}
@@ -176,12 +176,13 @@ func (c *ProfileContent) Encode() []byte {
buffer := new(bytes.Buffer)
buffer.WriteByte(MessageTypeProfileContent)
buffer.WriteByte(1)
writer := gzip.NewWriter(buffer)
rw.WriteVString(writer, c.Name)
gWriter := gzip.NewWriter(buffer)
writer := bufio.NewWriter(gWriter)
varbin.Write(writer, binary.BigEndian, c.Name)
binary.Write(writer, binary.BigEndian, c.Type)
rw.WriteVString(writer, c.Config)
varbin.Write(writer, binary.BigEndian, c.Config)
if c.Type != ProfileTypeLocal {
rw.WriteVString(writer, c.RemotePath)
varbin.Write(writer, binary.BigEndian, c.RemotePath)
}
if c.Type == ProfileTypeRemote {
binary.Write(writer, binary.BigEndian, c.AutoUpdate)
@@ -189,29 +190,31 @@ func (c *ProfileContent) Encode() []byte {
binary.Write(writer, binary.BigEndian, c.LastUpdated)
}
writer.Flush()
writer.Close()
gWriter.Flush()
gWriter.Close()
return buffer.Bytes()
}
func DecodeProfileContent(data []byte) (*ProfileContent, error) {
var reader io.Reader = bytes.NewReader(data)
messageType, err := rw.ReadByte(reader)
reader := bytes.NewReader(data)
messageType, err := reader.ReadByte()
if err != nil {
return nil, err
}
if messageType != MessageTypeProfileContent {
return nil, E.New("invalid message")
}
version, err := rw.ReadByte(reader)
version, err := reader.ReadByte()
if err != nil {
return nil, err
}
reader, err = gzip.NewReader(reader)
gReader, err := gzip.NewReader(reader)
if err != nil {
return nil, E.Cause(err, "unsupported profile")
}
bReader := varbin.StubReader(gReader)
var content ProfileContent
content.Name, err = rw.ReadVString(reader)
content.Name, err = varbin.ReadValue[string](bReader, binary.BigEndian)
if err != nil {
return nil, err
}
@@ -219,12 +222,12 @@ func DecodeProfileContent(data []byte) (*ProfileContent, error) {
if err != nil {
return nil, err
}
content.Config, err = rw.ReadVString(reader)
content.Config, err = varbin.ReadValue[string](bReader, binary.BigEndian)
if err != nil {
return nil, err
}
if content.Type != ProfileTypeLocal {
content.RemotePath, err = rw.ReadVString(reader)
content.RemotePath, err = varbin.ReadValue[string](bReader, binary.BigEndian)
if err != nil {
return nil, err
}
+6 -6
View File
@@ -17,23 +17,23 @@ require (
github.com/libdns/cloudflare v0.1.1
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/mholt/acmez v1.2.0
github.com/miekg/dns v1.1.59
github.com/miekg/dns v1.1.61
github.com/ooni/go-libtor v1.1.8
github.com/oschwald/maxminddb-golang v1.12.0
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a
github.com/sagernet/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1
github.com/sagernet/gomobile v0.1.3
github.com/sagernet/gvisor v0.0.0-20240428053021-e691de28565f
github.com/sagernet/quic-go v0.45.0-beta.2
github.com/sagernet/quic-go v0.45.1-beta.2
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
github.com/sagernet/sing v0.5.0-alpha.11
github.com/sagernet/sing-dns v0.3.0-beta.5
github.com/sagernet/sing v0.5.0-alpha.11.0.20240624115117-0b4c0a1283a3
github.com/sagernet/sing-dns v0.3.0-beta.10
github.com/sagernet/sing-mux v0.2.0
github.com/sagernet/sing-quic v0.2.0-beta.9
github.com/sagernet/sing-quic v0.2.0-beta.12
github.com/sagernet/sing-shadowsocks v0.2.6
github.com/sagernet/sing-shadowsocks2 v0.2.0
github.com/sagernet/sing-shadowtls v0.1.4
github.com/sagernet/sing-tun v0.4.0-beta.12
github.com/sagernet/sing-tun v0.4.0-beta.13
github.com/sagernet/sing-vmess v0.1.8
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7
github.com/sagernet/tfo-go v0.0.0-20231209031829-7b5343ac1dc6
+12 -12
View File
@@ -76,8 +76,8 @@ github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
github.com/mholt/acmez v1.2.0 h1:1hhLxSgY5FvH5HCnGUuwbKY2VQVo8IU7rxXKSnZ7F30=
github.com/mholt/acmez v1.2.0/go.mod h1:VT9YwH1xgNX1kmYY89gY8xPJC84BFAisjo8Egigt4kE=
github.com/miekg/dns v1.1.59 h1:C9EXc/UToRwKLhK5wKU/I4QVsBUc8kE6MkHBkeypWZs=
github.com/miekg/dns v1.1.59/go.mod h1:nZpewl5p6IvctfgrckopVx2OlSEHPRO/U4SYkRklrEk=
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss=
@@ -108,27 +108,27 @@ github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZN
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM=
github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I=
github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8=
github.com/sagernet/quic-go v0.45.0-beta.2 h1:nWq9KJTR+cGU8UU4E20XNjdM6QgbLkBgpq+NCExg5RY=
github.com/sagernet/quic-go v0.45.0-beta.2/go.mod h1:rs3XCo3SQ2sB96NtaKnEyq+ZkyaKWL51BvIW3veaiWw=
github.com/sagernet/quic-go v0.45.1-beta.2 h1:zkEeCbhdFFkrxKcuIRBtXNKci/1t2J/39QSG/sPvlmc=
github.com/sagernet/quic-go v0.45.1-beta.2/go.mod h1:+N3FqM9DAzOWfe64uxXuBejVJwX7DeW7BslzLO6N/xI=
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.2.18/go.mod h1:OL6k2F0vHmEzXz2KW19qQzu172FDgSbUSODylighuVo=
github.com/sagernet/sing v0.5.0-alpha.11 h1:4nR9hv3Thxb16tdMY8eQ3xNqyvqGV2gLCwiTht6TkD8=
github.com/sagernet/sing v0.5.0-alpha.11/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/sagernet/sing-dns v0.3.0-beta.5 h1:lX+wfnBVaOlSd7+GBgb431Tt/gmYwJXSHvS1HutfnD4=
github.com/sagernet/sing-dns v0.3.0-beta.5/go.mod h1:qeO/lOUK/c3Zczp5a1VO13fbmolaM8xGKCUXtaX0/NQ=
github.com/sagernet/sing v0.5.0-alpha.11.0.20240624115117-0b4c0a1283a3 h1:dmkN0SqTjyV5PfLYBlWsLhEXXYHvrIIr+o0Gz6ChZ78=
github.com/sagernet/sing v0.5.0-alpha.11.0.20240624115117-0b4c0a1283a3/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/sagernet/sing-dns v0.3.0-beta.10 h1:Js61EjQXVpcu2VDegWEQTH1isCcVwJju8WEHYgG4tQ0=
github.com/sagernet/sing-dns v0.3.0-beta.10/go.mod h1:nXE6EYMXahB5DV3AcXYbFfuorqF7tbQ86kxweSxRKM4=
github.com/sagernet/sing-mux v0.2.0 h1:4C+vd8HztJCWNYfufvgL49xaOoOHXty2+EAjnzN3IYo=
github.com/sagernet/sing-mux v0.2.0/go.mod h1:khzr9AOPocLa+g53dBplwNDz4gdsyx/YM3swtAhlkHQ=
github.com/sagernet/sing-quic v0.2.0-beta.9 h1:gfqUwVgKA6APwFOPhwge9VrPZ0XQtmuXF8hbbIVZML8=
github.com/sagernet/sing-quic v0.2.0-beta.9/go.mod h1:hb6RwYy9Js0gZi80zlTBWABMOIvJDv46K5yak/pbZ4w=
github.com/sagernet/sing-quic v0.2.0-beta.12 h1:BhvA5mmrDFEyDUQB5eeu+9UhF+ieyuNJ5Rsb0dAG3QY=
github.com/sagernet/sing-quic v0.2.0-beta.12/go.mod h1:YVpLfVi8BvYM7NMrjmnvcRm3E8iMETf1gFQmTQDN9jI=
github.com/sagernet/sing-shadowsocks v0.2.6 h1:xr7ylAS/q1cQYS8oxKKajhuQcchd5VJJ4K4UZrrpp0s=
github.com/sagernet/sing-shadowsocks v0.2.6/go.mod h1:j2YZBIpWIuElPFL/5sJAj470bcn/3QQ5lxZUNKLDNAM=
github.com/sagernet/sing-shadowsocks2 v0.2.0 h1:wpZNs6wKnR7mh1wV9OHwOyUr21VkS3wKFHi+8XwgADg=
github.com/sagernet/sing-shadowsocks2 v0.2.0/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k=
github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4=
github.com/sagernet/sing-tun v0.4.0-beta.12 h1:TQWTpRaGte3N7yMOHF99i83BiAfM0p+QYnvz85iHGjE=
github.com/sagernet/sing-tun v0.4.0-beta.12/go.mod h1:YgaSM4cm+YIn6erBZN/eF+sW7I27BfBt91EWGo53MME=
github.com/sagernet/sing-tun v0.4.0-beta.13 h1:UgojXZLwRKAGQPlNR/+2nkAOBdSe1YutDEt6sr8INvI=
github.com/sagernet/sing-tun v0.4.0-beta.13/go.mod h1:YgaSM4cm+YIn6erBZN/eF+sW7I27BfBt91EWGo53MME=
github.com/sagernet/sing-vmess v0.1.8 h1:XVWad1RpTy9b5tPxdm5MCU8cGfrTGdR8qCq6HV2aCNc=
github.com/sagernet/sing-vmess v0.1.8/go.mod h1:vhx32UNzTDUkNwOyIjcZQohre1CaytquC5mPplId8uA=
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ=
+6 -8
View File
@@ -12,10 +12,7 @@ import (
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
"github.com/sagernet/sing/common/auth"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
N "github.com/sagernet/sing/common/network"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/protocol/http"
"github.com/sagernet/sing/protocol/socks"
"github.com/sagernet/sing/protocol/socks/socks4"
@@ -51,16 +48,17 @@ func NewMixed(ctx context.Context, router adapter.Router, logger log.ContextLogg
}
func (h *Mixed) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
headerType, err := rw.ReadByte(conn)
reader := std_bufio.NewReader(conn)
headerBytes, err := reader.Peek(1)
if err != nil {
return err
}
switch headerType {
switch headerBytes[0] {
case socks4.Version, socks5.Version:
return socks.HandleConnection0(ctx, conn, headerType, h.authenticator, h.upstreamUserHandler(metadata), adapter.UpstreamMetadata(metadata))
return socks.HandleConnection0(ctx, conn, reader, h.authenticator, h.upstreamUserHandler(metadata), adapter.UpstreamMetadata(metadata))
default:
return http.HandleConnection(ctx, conn, reader, h.authenticator, h.upstreamUserHandler(metadata), adapter.UpstreamMetadata(metadata))
}
reader := std_bufio.NewReader(bufio.NewCachedReader(conn, buf.As([]byte{headerType})))
return http.HandleConnection(ctx, conn, reader, h.authenticator, h.upstreamUserHandler(metadata), adapter.UpstreamMetadata(metadata))
}
func (h *Mixed) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
+5 -6
View File
@@ -83,12 +83,11 @@ func NewVLESS(ctx context.Context, router adapter.Router, logger log.ContextLogg
}
func (h *VLESS) Start() error {
err := common.Start(
h.service,
h.tlsConfig,
)
if err != nil {
return err
if h.tlsConfig != nil {
err := h.tlsConfig.Start()
if err != nil {
return err
}
}
if h.transport == nil {
return h.myInboundAdapter.Start()
+7 -4
View File
@@ -93,13 +93,16 @@ func NewVMess(ctx context.Context, router adapter.Router, logger log.ContextLogg
}
func (h *VMess) Start() error {
err := common.Start(
h.service,
h.tlsConfig,
)
err := h.service.Start()
if err != nil {
return err
}
if h.tlsConfig != nil {
err = h.tlsConfig.Start()
if err != nil {
return err
}
}
if h.transport == nil {
return h.myInboundAdapter.Start()
}
+22 -3
View File
@@ -64,7 +64,7 @@ func (r Rule) IsValid() bool {
}
}
type DefaultRule struct {
type _DefaultRule struct {
Inbound Listable[string] `json:"inbound,omitempty"`
IPVersion int `json:"ip_version,omitempty"`
Network Listable[string] `json:"network,omitempty"`
@@ -94,12 +94,31 @@ type DefaultRule struct {
WIFISSID Listable[string] `json:"wifi_ssid,omitempty"`
WIFIBSSID Listable[string] `json:"wifi_bssid,omitempty"`
RuleSet Listable[string] `json:"rule_set,omitempty"`
RuleSetIPCIDRMatchSource bool `json:"rule_set_ipcidr_match_source,omitempty"`
RuleSetIPCIDRMatchSource bool `json:"rule_set_ip_cidr_match_source,omitempty"`
Invert bool `json:"invert,omitempty"`
Outbound string `json:"outbound,omitempty"`
// Deprecated: renamed to rule_set_ip_cidr_match_source
Deprecated_RulesetIPCIDRMatchSource bool `json:"rule_set_ipcidr_match_source,omitempty"`
}
func (r DefaultRule) IsValid() bool {
type DefaultRule _DefaultRule
func (r *DefaultRule) UnmarshalJSON(bytes []byte) error {
err := json.Unmarshal(bytes, (*_DefaultRule)(r))
if err != nil {
return err
}
//nolint:staticcheck
//goland:noinspection GoDeprecation
if r.Deprecated_RulesetIPCIDRMatchSource {
r.Deprecated_RulesetIPCIDRMatchSource = false
r.RuleSetIPCIDRMatchSource = true
}
return nil
}
func (r *DefaultRule) IsValid() bool {
var defaultValue DefaultRule
defaultValue.Invert = r.Invert
defaultValue.Outbound = r.Outbound
+23 -3
View File
@@ -64,7 +64,7 @@ func (r DNSRule) IsValid() bool {
}
}
type DefaultDNSRule struct {
type _DefaultDNSRule struct {
Inbound Listable[string] `json:"inbound,omitempty"`
IPVersion int `json:"ip_version,omitempty"`
QueryType Listable[DNSQueryType] `json:"query_type,omitempty"`
@@ -96,15 +96,35 @@ type DefaultDNSRule struct {
WIFISSID Listable[string] `json:"wifi_ssid,omitempty"`
WIFIBSSID Listable[string] `json:"wifi_bssid,omitempty"`
RuleSet Listable[string] `json:"rule_set,omitempty"`
RuleSetIPCIDRMatchSource bool `json:"rule_set_ipcidr_match_source,omitempty"`
RuleSetIPCIDRMatchSource bool `json:"rule_set_ip_cidr_match_source,omitempty"`
RuleSetIPCIDRAcceptEmpty bool `json:"rule_set_ip_cidr_accept_empty,omitempty"`
Invert bool `json:"invert,omitempty"`
Server string `json:"server,omitempty"`
DisableCache bool `json:"disable_cache,omitempty"`
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
ClientSubnet *AddrPrefix `json:"client_subnet,omitempty"`
// Deprecated: renamed to rule_set_ip_cidr_match_source
Deprecated_RulesetIPCIDRMatchSource bool `json:"rule_set_ipcidr_match_source,omitempty"`
}
func (r DefaultDNSRule) IsValid() bool {
type DefaultDNSRule _DefaultDNSRule
func (r *DefaultDNSRule) UnmarshalJSON(bytes []byte) error {
err := json.Unmarshal(bytes, (*_DefaultDNSRule)(r))
if err != nil {
return err
}
//nolint:staticcheck
//goland:noinspection GoDeprecation
if r.Deprecated_RulesetIPCIDRMatchSource {
r.Deprecated_RulesetIPCIDRMatchSource = false
r.RuleSetIPCIDRMatchSource = true
}
return nil
}
func (r *DefaultDNSRule) IsValid() bool {
var defaultValue DefaultDNSRule
defaultValue.Invert = r.Invert
defaultValue.Server = r.Server
+1 -17
View File
@@ -1,7 +1,6 @@
package outbound
import (
std_bufio "bufio"
"context"
"crypto/rand"
"encoding/hex"
@@ -11,16 +10,10 @@ import (
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/auth"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/protocol/http"
"github.com/sagernet/sing/protocol/socks"
"github.com/sagernet/sing/protocol/socks/socks4"
"github.com/sagernet/sing/protocol/socks/socks5"
)
type ProxyListener struct {
@@ -102,16 +95,7 @@ func (l *ProxyListener) acceptLoop() {
}
func (l *ProxyListener) accept(ctx context.Context, conn *net.TCPConn) error {
headerType, err := rw.ReadByte(conn)
if err != nil {
return err
}
switch headerType {
case socks4.Version, socks5.Version:
return socks.HandleConnection0(ctx, conn, headerType, l.authenticator, l, M.Metadata{})
}
reader := std_bufio.NewReader(bufio.NewCachedReader(conn, buf.As([]byte{headerType})))
return http.HandleConnection(ctx, conn, reader, l.authenticator, l, M.Metadata{})
return socks.HandleConnection(ctx, conn, l.authenticator, l, M.Metadata{})
}
func (l *ProxyListener) NewConnection(ctx context.Context, conn net.Conn, upstreamMetadata M.Metadata) error {
+8 -4
View File
@@ -44,10 +44,10 @@ func NewTor(ctx context.Context, router adapter.Router, logger log.ContextLogger
startConf.ExtraArgs = options.ExtraArgs
if options.DataDirectory != "" {
dataDirAbs, _ := filepath.Abs(startConf.DataDir)
if geoIPPath := filepath.Join(dataDirAbs, "geoip"); rw.FileExists(geoIPPath) && !common.Contains(options.ExtraArgs, "--GeoIPFile") {
if geoIPPath := filepath.Join(dataDirAbs, "geoip"); rw.IsFile(geoIPPath) && !common.Contains(options.ExtraArgs, "--GeoIPFile") {
options.ExtraArgs = append(options.ExtraArgs, "--GeoIPFile", geoIPPath)
}
if geoIP6Path := filepath.Join(dataDirAbs, "geoip6"); rw.FileExists(geoIP6Path) && !common.Contains(options.ExtraArgs, "--GeoIPv6File") {
if geoIP6Path := filepath.Join(dataDirAbs, "geoip6"); rw.IsFile(geoIP6Path) && !common.Contains(options.ExtraArgs, "--GeoIPv6File") {
options.ExtraArgs = append(options.ExtraArgs, "--GeoIPv6File", geoIP6Path)
}
}
@@ -58,8 +58,12 @@ func NewTor(ctx context.Context, router adapter.Router, logger log.ContextLogger
}
if startConf.DataDir != "" {
torrcFile := filepath.Join(startConf.DataDir, "torrc")
if !rw.FileExists(torrcFile) {
err := rw.WriteFile(torrcFile, []byte(""))
err := rw.MkdirParent(torrcFile)
if err != nil {
return nil, err
}
if !rw.IsFile(torrcFile) {
err := os.WriteFile(torrcFile, []byte(""), 0o600)
if err != nil {
return nil, err
}
+19 -11
View File
@@ -36,7 +36,7 @@ func (m *DNSReverseMapping) Query(address netip.Addr) (string, bool) {
return domain, loaded
}
func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int) (context.Context, dns.Transport, dns.DomainStrategy, adapter.DNSRule, int) {
func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int, isAddressQuery bool) (context.Context, dns.Transport, dns.DomainStrategy, adapter.DNSRule, int) {
metadata := adapter.ContextFrom(ctx)
if metadata == nil {
panic("no context")
@@ -47,6 +47,9 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, index int) (con
dnsRules = dnsRules[index+1:]
}
for currentRuleIndex, rule := range dnsRules {
if rule.WithAddressLimit() && !isAddressQuery {
continue
}
metadata.ResetRuleCache()
if rule.Match(metadata) {
detour := rule.Outbound()
@@ -101,7 +104,8 @@ func (r *Router) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, er
response, cached = r.dnsClient.ExchangeCache(ctx, message)
if !cached {
var metadata *adapter.InboundContext
ctx, metadata = adapter.AppendContext(ctx)
ctx, metadata = adapter.ExtendContext(ctx)
metadata.Destination = M.Socksaddr{}
if len(message.Question) > 0 {
metadata.QueryType = message.Question[0].Qtype
switch metadata.QueryType {
@@ -123,12 +127,16 @@ func (r *Router) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, er
dnsCtx context.Context
addressLimit bool
)
dnsCtx, transport, strategy, rule, ruleIndex = r.matchDNS(ctx, true, ruleIndex)
if rule != nil && rule.WithAddressLimit() && isAddressQuery(message) {
dnsCtx, transport, strategy, rule, ruleIndex = r.matchDNS(ctx, true, ruleIndex, isAddressQuery(message))
dnsCtx = adapter.OverrideContext(dnsCtx)
if rule != nil && rule.WithAddressLimit() {
addressLimit = true
response, err = r.dnsClient.ExchangeWithResponseCheck(dnsCtx, transport, message, strategy, func(response *mDNS.Msg) bool {
metadata.DestinationAddresses, _ = dns.MessageToAddresses(response)
addresses, addrErr := dns.MessageToAddresses(response)
if addrErr != nil {
return false
}
metadata.DestinationAddresses = addresses
return rule.MatchAddressLimit(metadata)
})
} else {
@@ -184,7 +192,8 @@ func (r *Router) Lookup(ctx context.Context, domain string, strategy dns.DomainS
return responseAddrs, nil
}
r.dnsLogger.DebugContext(ctx, "lookup domain ", domain)
ctx, metadata := adapter.AppendContext(ctx)
ctx, metadata := adapter.ExtendContext(ctx)
metadata.Destination = M.Socksaddr{}
metadata.Domain = domain
var (
transport dns.Transport
@@ -198,9 +207,8 @@ func (r *Router) Lookup(ctx context.Context, domain string, strategy dns.DomainS
dnsCtx context.Context
addressLimit bool
)
metadata.ResetRuleCache()
metadata.DestinationAddresses = nil
dnsCtx, transport, transportStrategy, rule, ruleIndex = r.matchDNS(ctx, false, ruleIndex)
dnsCtx, transport, transportStrategy, rule, ruleIndex = r.matchDNS(ctx, false, ruleIndex, true)
dnsCtx = adapter.OverrideContext(dnsCtx)
if strategy == dns.DomainStrategyAsIS {
strategy = transportStrategy
}
@@ -249,7 +257,7 @@ func (r *Router) ClearDNSCache() {
func isAddressQuery(message *mDNS.Msg) bool {
for _, question := range message.Question {
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA || question.Qtype == mDNS.TypeHTTPS {
return true
}
}
+4 -4
View File
@@ -50,7 +50,7 @@ func (r *Router) prepareGeoIPDatabase() error {
geoPath = foundPath
}
}
if !rw.FileExists(geoPath) {
if !rw.IsFile(geoPath) {
geoPath = filemanager.BasePath(r.ctx, geoPath)
}
if stat, err := os.Stat(geoPath); err == nil {
@@ -61,7 +61,7 @@ func (r *Router) prepareGeoIPDatabase() error {
os.Remove(geoPath)
}
}
if !rw.FileExists(geoPath) {
if !rw.IsFile(geoPath) {
r.logger.Warn("geoip database not exists: ", geoPath)
var err error
for attempts := 0; attempts < 3; attempts++ {
@@ -96,7 +96,7 @@ func (r *Router) prepareGeositeDatabase() error {
geoPath = foundPath
}
}
if !rw.FileExists(geoPath) {
if !rw.IsFile(geoPath) {
geoPath = filemanager.BasePath(r.ctx, geoPath)
}
if stat, err := os.Stat(geoPath); err == nil {
@@ -107,7 +107,7 @@ func (r *Router) prepareGeositeDatabase() error {
os.Remove(geoPath)
}
}
if !rw.FileExists(geoPath) {
if !rw.IsFile(geoPath) {
r.logger.Warn("geosite database not exists: ", geoPath)
var err error
for attempts := 0; attempts < 3; attempts++ {
+14 -5
View File
@@ -29,9 +29,13 @@ func (r *abstractDefaultRule) Type() string {
func (r *abstractDefaultRule) Start() error {
for _, item := range r.allItems {
err := common.Start(item)
if err != nil {
return err
if starter, isStarter := item.(interface {
Start() error
}); isStarter {
err := starter.Start()
if err != nil {
return err
}
}
}
return nil
@@ -183,8 +187,13 @@ func (r *abstractLogicalRule) UpdateGeosite() error {
}
func (r *abstractLogicalRule) Start() error {
for _, rule := range common.FilterIsInstance(r.rules, func(it adapter.HeadlessRule) (common.Starter, bool) {
rule, loaded := it.(common.Starter)
for _, rule := range common.FilterIsInstance(r.rules, func(it adapter.HeadlessRule) (interface {
Start() error
}, bool,
) {
rule, loaded := it.(interface {
Start() error
})
return rule, loaded
}) {
err := rule.Start()
+1 -1
View File
@@ -205,7 +205,7 @@ func NewDefaultRule(router adapter.Router, logger log.ContextLogger, options opt
rule.allItems = append(rule.allItems, item)
}
if len(options.RuleSet) > 0 {
item := NewRuleSetItem(router, options.RuleSet, options.RuleSetIPCIDRMatchSource)
item := NewRuleSetItem(router, options.RuleSet, options.RuleSetIPCIDRMatchSource, false)
rule.items = append(rule.items, item)
rule.allItems = append(rule.allItems, item)
}
+1 -1
View File
@@ -219,7 +219,7 @@ func NewDefaultDNSRule(router adapter.Router, logger log.ContextLogger, options
rule.allItems = append(rule.allItems, item)
}
if len(options.RuleSet) > 0 {
item := NewRuleSetItem(router, options.RuleSet, options.RuleSetIPCIDRMatchSource)
item := NewRuleSetItem(router, options.RuleSet, options.RuleSetIPCIDRMatchSource, options.RuleSetIPCIDRAcceptEmpty)
rule.items = append(rule.items, item)
rule.allItems = append(rule.allItems, item)
}
+10 -9
View File
@@ -75,18 +75,19 @@ func NewRawIPCIDRItem(isSource bool, ipSet *netipx.IPSet) *IPCIDRItem {
func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool {
if r.isSource || metadata.IPCIDRMatchSource {
return r.ipSet.Contains(metadata.Source.Addr)
} else {
if metadata.Destination.IsIP() {
return r.ipSet.Contains(metadata.Destination.Addr)
} else {
for _, address := range metadata.DestinationAddresses {
if r.ipSet.Contains(address) {
return true
}
}
if metadata.Destination.IsIP() {
return r.ipSet.Contains(metadata.Destination.Addr)
}
if len(metadata.DestinationAddresses) > 0 {
for _, address := range metadata.DestinationAddresses {
if r.ipSet.Contains(address) {
return true
}
}
return false
}
return false
return metadata.IPCIDRAcceptEmpty
}
func (r *IPCIDRItem) String() string {
+8 -5
View File
@@ -15,14 +15,16 @@ type RuleSetItem struct {
router adapter.Router
tagList []string
setList []adapter.RuleSet
ipcidrMatchSource bool
ipCidrMatchSource bool
ipCidrAcceptEmpty bool
}
func NewRuleSetItem(router adapter.Router, tagList []string, ipCIDRMatchSource bool) *RuleSetItem {
func NewRuleSetItem(router adapter.Router, tagList []string, ipCIDRMatchSource bool, ipCidrAcceptEmpty bool) *RuleSetItem {
return &RuleSetItem{
router: router,
tagList: tagList,
ipcidrMatchSource: ipCIDRMatchSource,
ipCidrMatchSource: ipCIDRMatchSource,
ipCidrAcceptEmpty: ipCidrAcceptEmpty,
}
}
@@ -39,7 +41,8 @@ func (r *RuleSetItem) Start() error {
}
func (r *RuleSetItem) Match(metadata *adapter.InboundContext) bool {
metadata.IPCIDRMatchSource = r.ipcidrMatchSource
metadata.IPCIDRMatchSource = r.ipCidrMatchSource
metadata.IPCIDRAcceptEmpty = r.ipCidrAcceptEmpty
for _, ruleSet := range r.setList {
if ruleSet.Match(metadata) {
return true
@@ -49,7 +52,7 @@ func (r *RuleSetItem) Match(metadata *adapter.InboundContext) bool {
}
func (r *RuleSetItem) ContainsDestinationIPCIDRRule() bool {
if r.ipcidrMatchSource {
if r.ipCidrMatchSource {
return false
}
return common.Any(r.setList, func(ruleSet adapter.RuleSet) bool {
+19 -8
View File
@@ -1,12 +1,14 @@
package trojan
import (
std_bufio "bufio"
"context"
"net"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/task"
"github.com/sagernet/smux"
)
@@ -33,27 +35,36 @@ func HandleMuxConnection(ctx context.Context, conn net.Conn, metadata M.Metadata
return group.Run(ctx)
}
func newMuxConnection(ctx context.Context, stream net.Conn, metadata M.Metadata, handler Handler) {
err := newMuxConnection0(ctx, stream, metadata, handler)
func newMuxConnection(ctx context.Context, conn net.Conn, metadata M.Metadata, handler Handler) {
err := newMuxConnection0(ctx, conn, metadata, handler)
if err != nil {
handler.NewError(ctx, E.Cause(err, "process trojan-go multiplex connection"))
}
}
func newMuxConnection0(ctx context.Context, stream net.Conn, metadata M.Metadata, handler Handler) error {
command, err := rw.ReadByte(stream)
func newMuxConnection0(ctx context.Context, conn net.Conn, metadata M.Metadata, handler Handler) error {
reader := std_bufio.NewReader(conn)
command, err := reader.ReadByte()
if err != nil {
return E.Cause(err, "read command")
}
metadata.Destination, err = M.SocksaddrSerializer.ReadAddrPort(stream)
metadata.Destination, err = M.SocksaddrSerializer.ReadAddrPort(reader)
if err != nil {
return E.Cause(err, "read destination")
}
if reader.Buffered() > 0 {
buffer := buf.NewSize(reader.Buffered())
_, err = buffer.ReadFullFrom(reader, buffer.Len())
if err != nil {
return err
}
conn = bufio.NewCachedConn(conn, buffer)
}
switch command {
case CommandTCP:
return handler.NewConnection(ctx, stream, metadata)
return handler.NewConnection(ctx, conn, metadata)
case CommandUDP:
return handler.NewPacketConnection(ctx, &PacketConn{Conn: stream}, metadata)
return handler.NewPacketConnection(ctx, &PacketConn{Conn: conn}, metadata)
default:
return E.New("unknown command ", command)
}
+3 -1
View File
@@ -2,6 +2,7 @@ package trojan
import (
"context"
"encoding/binary"
"net"
"github.com/sagernet/sing/common/auth"
@@ -76,7 +77,8 @@ func (s *Service[K]) NewConnection(ctx context.Context, conn net.Conn, metadata
return E.Cause(err, "skip crlf")
}
command, err := rw.ReadByte(conn)
var command byte
err = binary.Read(conn, binary.BigEndian, &command)
if err != nil {
return E.Cause(err, "read command")
}
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/baderror"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/rw"
N "github.com/sagernet/sing/common/network"
)
var _ net.Conn = (*GRPCConn)(nil)
@@ -90,7 +90,7 @@ func (c *GRPCConn) Upstream() any {
return c.GunService
}
var _ rw.WriteCloser = (*clientConnWrapper)(nil)
var _ N.WriteCloser = (*clientConnWrapper)(nil)
type clientConnWrapper struct {
GunService_TunClient
+4 -4
View File
@@ -13,7 +13,7 @@ import (
"github.com/sagernet/sing/common/baderror"
"github.com/sagernet/sing/common/buf"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
// kanged from: https://github.com/Qv2ray/gun-lite
@@ -96,7 +96,7 @@ func (c *GunConn) read(b []byte) (n int, err error) {
}
func (c *GunConn) Write(b []byte) (n int, err error) {
varLen := rw.UVariantLen(uint64(len(b)))
varLen := varbin.UvarintLen(uint64(len(b)))
buffer := buf.NewSize(6 + varLen + len(b))
header := buffer.Extend(6 + varLen)
header[0] = 0x00
@@ -117,13 +117,13 @@ func (c *GunConn) Write(b []byte) (n int, err error) {
func (c *GunConn) WriteBuffer(buffer *buf.Buffer) error {
defer buffer.Release()
dataLen := buffer.Len()
varLen := rw.UVariantLen(uint64(dataLen))
varLen := varbin.UvarintLen(uint64(dataLen))
header := buffer.ExtendHeader(6 + varLen)
header[0] = 0x00
binary.BigEndian.PutUint32(header[1:5], uint32(1+varLen+dataLen))
header[5] = 0x0A
binary.PutUvarint(header[6:], uint64(dataLen))
err := rw.WriteBytes(c.writer, buffer.Bytes())
err := common.Error(c.writer.Write(buffer.Bytes()))
if err != nil {
return baderror.WrapH2(err)
}
+22 -16
View File
@@ -11,6 +11,7 @@ import (
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
const (
@@ -49,7 +50,8 @@ func ReadRequest(reader io.Reader) (*Request, error) {
}
if addonsLen > 0 {
addonsBytes, err := rw.ReadBytes(reader, int(addonsLen))
addonsBytes := make([]byte, addonsLen)
_, err = io.ReadFull(reader, addonsBytes)
if err != nil {
return nil, err
}
@@ -81,8 +83,8 @@ type Addons struct {
Seed string
}
func readAddons(reader io.Reader) (*Addons, error) {
protoHeader, err := rw.ReadByte(reader)
func readAddons(reader varbin.Reader) (*Addons, error) {
protoHeader, err := reader.ReadByte()
if err != nil {
return nil, err
}
@@ -92,27 +94,29 @@ func readAddons(reader io.Reader) (*Addons, error) {
var addons Addons
flowLen, err := rw.ReadUVariant(reader)
flowLen, err := binary.ReadUvarint(reader)
if err != nil {
if err == io.EOF {
return &addons, nil
}
return nil, err
}
flowBytes, err := rw.ReadBytes(reader, int(flowLen))
flowBytes := make([]byte, flowLen)
_, err = io.ReadFull(reader, flowBytes)
if err != nil {
return nil, err
}
addons.Flow = string(flowBytes)
seedLen, err := rw.ReadUVariant(reader)
seedLen, err := binary.ReadUvarint(reader)
if err != nil {
if err == io.EOF {
return &addons, nil
}
return nil, err
}
seedBytes, err := rw.ReadBytes(reader, int(seedLen))
seedBytes := make([]byte, seedLen)
_, err = io.ReadFull(reader, seedBytes)
if err != nil {
return nil, err
}
@@ -130,7 +134,7 @@ func WriteRequest(writer io.Writer, request Request, payload []byte) error {
var addonsLen int
if request.Flow != "" {
addonsLen += 1 // protobuf header
addonsLen += rw.UVariantLen(uint64(len(request.Flow)))
addonsLen += varbin.UvarintLen(uint64(len(request.Flow)))
addonsLen += len(request.Flow)
requestLen += addonsLen
}
@@ -148,7 +152,7 @@ func WriteRequest(writer io.Writer, request Request, payload []byte) error {
)
if addonsLen > 0 {
common.Must(buffer.WriteByte(10))
binary.PutUvarint(buffer.Extend(rw.UVariantLen(uint64(len(request.Flow)))), uint64(len(request.Flow)))
binary.PutUvarint(buffer.Extend(varbin.UvarintLen(uint64(len(request.Flow)))), uint64(len(request.Flow)))
common.Must(common.Error(buffer.WriteString(request.Flow)))
}
common.Must(
@@ -175,7 +179,7 @@ func EncodeRequest(request Request, buffer *buf.Buffer) error {
var addonsLen int
if request.Flow != "" {
addonsLen += 1 // protobuf header
addonsLen += rw.UVariantLen(uint64(len(request.Flow)))
addonsLen += varbin.UvarintLen(uint64(len(request.Flow)))
addonsLen += len(request.Flow)
requestLen += addonsLen
}
@@ -190,7 +194,7 @@ func EncodeRequest(request Request, buffer *buf.Buffer) error {
)
if addonsLen > 0 {
common.Must(buffer.WriteByte(10))
binary.PutUvarint(buffer.Extend(rw.UVariantLen(uint64(len(request.Flow)))), uint64(len(request.Flow)))
binary.PutUvarint(buffer.Extend(varbin.UvarintLen(uint64(len(request.Flow)))), uint64(len(request.Flow)))
common.Must(common.Error(buffer.WriteString(request.Flow)))
}
common.Must(
@@ -215,7 +219,7 @@ func RequestLen(request Request) int {
var addonsLen int
if request.Flow != "" {
addonsLen += 1 // protobuf header
addonsLen += rw.UVariantLen(uint64(len(request.Flow)))
addonsLen += varbin.UvarintLen(uint64(len(request.Flow)))
addonsLen += len(request.Flow)
requestLen += addonsLen
}
@@ -234,7 +238,7 @@ func WritePacketRequest(writer io.Writer, request Request, payload []byte) error
var addonsLen int
/*if request.Flow != "" {
addonsLen += 1 // protobuf header
addonsLen += rw.UVariantLen(uint64(len(request.Flow)))
addonsLen += varbin.UvarintLen(uint64(len(request.Flow)))
addonsLen += len(request.Flow)
requestLen += addonsLen
}*/
@@ -254,7 +258,7 @@ func WritePacketRequest(writer io.Writer, request Request, payload []byte) error
if addonsLen > 0 {
common.Must(buffer.WriteByte(10))
binary.PutUvarint(buffer.Extend(rw.UVariantLen(uint64(len(request.Flow)))), uint64(len(request.Flow)))
binary.PutUvarint(buffer.Extend(varbin.UvarintLen(uint64(len(request.Flow)))), uint64(len(request.Flow)))
common.Must(common.Error(buffer.WriteString(request.Flow)))
}
@@ -276,14 +280,16 @@ func WritePacketRequest(writer io.Writer, request Request, payload []byte) error
}
func ReadResponse(reader io.Reader) error {
version, err := rw.ReadByte(reader)
var version byte
err := binary.Read(reader, binary.BigEndian, &version)
if err != nil {
return err
}
if version != Version {
return E.New("unknown version: ", version)
}
protobufLength, err := rw.ReadByte(reader)
var protobufLength byte
err = binary.Read(reader, binary.BigEndian, &protobufLength)
if err != nil {
return err
}
+2 -2
View File
@@ -30,13 +30,13 @@ define Download/geosite
HASH:=408f035f7d2cefcfe357d85b288dd73d9a0e0a118375b1633bf8f28d64a0b0f3
endef
GEOSITE_IRAN_VER:=202406170029
GEOSITE_IRAN_VER:=202406240029
GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER)
define Download/geosite-ir
URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/
URL_FILE:=iran.dat
FILE:=$(GEOSITE_IRAN_FILE)
HASH:=a8b934ae5312b7201217e268627c67d7dba30ad4c731cd248ddd25dcfe722b3c
HASH:=86503687cbca94889b9c94504d4310983060cdb2d813929b6da6f077776d5096
endef
define Package/v2ray-geodata/template
+1 -1
View File
@@ -9,7 +9,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.0" />
<PackageReference Include="Google.Protobuf" Version="3.27.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.63.0" />
<PackageReference Include="Grpc.Tools" Version="2.64.0">
<PrivateAssets>all</PrivateAssets>
@@ -8,6 +8,7 @@
http2,
pac,
api,
api2,
speedtest = 21
}
}
+2 -1
View File
@@ -23,7 +23,8 @@ namespace v2rayN
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/SagerNet/sing-{0}/rule-set/{1}.srs";
public const string SingboxRulesetUrlGeosite = @"https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/{0}.srs";
public const string SingboxRulesetUrlGeoip = @"https://raw.githubusercontent.com/Loyalsoldier/geoip/release/srs/{0}.srs";
public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw=";
public const string ConfigFileName = "guiNConfig.json";
+14 -4
View File
@@ -1,6 +1,7 @@
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
using v2rayN.Enums;
using v2rayN.Handler.Fmt;
using v2rayN.Models;
@@ -1355,18 +1356,27 @@ namespace v2rayN.Handler
public static int AddSubItem(Config config, string url)
{
//already exists
if (SQLiteHelper.Instance.Table<SubItem>().Where(e => e.url == url).Count() > 0)
if (SQLiteHelper.Instance.Table<SubItem>().Any(e => e.url == url))
{
return 0;
}
SubItem subItem = new()
{
id = string.Empty,
remarks = "import_sub",
url = url
};
try
{
var uri = new Uri(url);
var queryVars = HttpUtility.ParseQueryString(uri.Query);
subItem.remarks = queryVars["remarks"] ?? "import_sub";
}
catch (UriFormatException)
{
return 0;
}
return AddSubItem(config, subItem);
}
@@ -1615,7 +1625,7 @@ namespace v2rayN.Handler
public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false)
{
var ver = "V2-";
var ver = "V3-";
var items = LazyConfig.Instance.RoutingItems();
if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(ver)).ToList().Count <= 0)
{
@@ -27,7 +27,7 @@ namespace v2rayN.Handler.CoreConfig
{
return GenerateClientCustomConfig(node, fileName, out msg);
}
else if (config.tunModeItem.enableTun || LazyConfig.Instance.GetCoreType(node, node.configType) == ECoreType.sing_box)
else if (LazyConfig.Instance.GetCoreType(node, node.configType) == ECoreType.sing_box)
{
var configGenSingbox = new CoreConfigSingbox(config);
if (configGenSingbox.GenerateClientConfigContent(node, out SingboxConfig? singboxConfig, out msg) != 0)
@@ -1,4 +1,5 @@
using System.Net;
using System.Data;
using System.Net;
using System.Net.NetworkInformation;
using v2rayN.Enums;
using v2rayN.Models;
@@ -120,7 +121,8 @@ namespace v2rayN.Handler.CoreConfig
var listen = "::";
singboxConfig.inbounds = [];
if (!_config.tunModeItem.enableTun || _config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound)
if (!_config.tunModeItem.enableTun
|| (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound && _config.runningCoreType == ECoreType.sing_box))
{
var inbound = new Inbound4Sbox()
{
@@ -191,7 +193,7 @@ namespace v2rayN.Handler.CoreConfig
tunInbound.strict_route = _config.tunModeItem.strictRoute;
tunInbound.stack = _config.tunModeItem.stack;
tunInbound.sniff = _config.inbound[0].sniffingEnabled;
tunInbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
//tunInbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
if (_config.tunModeItem.enableIPv6Address == false)
{
tunInbound.inet6_address = null;
@@ -844,12 +846,14 @@ namespace v2rayN.Handler.CoreConfig
.ToList();
if (lstDomain != null && lstDomain.Count > 0)
{
//var strategy = dns4Sbox.servers.Where(t => !Utils.IsNullOrEmpty(t.strategy)).Select(t => t.strategy).FirstOrDefault();
var tag = "local_local";
dns4Sbox.servers.Add(new()
{
tag = tag,
address = "223.5.5.5",
detour = Global.DirectTag,
//strategy = strategy
});
dns4Sbox.rules.Add(new()
{
@@ -868,7 +872,7 @@ namespace v2rayN.Handler.CoreConfig
singboxConfig.experimental ??= new Experimental4Sbox();
singboxConfig.experimental.clash_api = new Clash_Api4Sbox()
{
external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort}",
external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort2}",
};
}
@@ -886,6 +890,10 @@ namespace v2rayN.Handler.CoreConfig
private int ConvertGeo2Ruleset(SingboxConfig singboxConfig)
{
static void AddRuleSets(List<string> ruleSets, List<string>? rule_set)
{
if (rule_set != null) ruleSets.AddRange(rule_set);
}
var geosite = "geosite";
var geoip = "geoip";
var ruleSets = new List<string>();
@@ -895,13 +903,13 @@ namespace v2rayN.Handler.CoreConfig
{
rule.rule_set = rule?.geosite?.Select(t => $"{geosite}-{t}").ToList();
rule.geosite = null;
ruleSets.AddRange(rule.rule_set);
AddRuleSets(ruleSets, rule.rule_set);
}
foreach (var rule in singboxConfig.route.rules.Where(t => t.geoip?.Count > 0).ToList() ?? [])
{
rule.rule_set = rule?.geoip?.Select(t => $"{geoip}-{t}").ToList();
rule.geoip = null;
ruleSets.AddRange(rule.rule_set);
AddRuleSets(ruleSets, rule.rule_set);
}
//convert dns geosite & geoip to ruleset
@@ -917,7 +925,15 @@ namespace v2rayN.Handler.CoreConfig
}
foreach (var dnsRule in singboxConfig.dns?.rules.Where(t => t.rule_set?.Count > 0).ToList() ?? [])
{
ruleSets.AddRange(dnsRule.rule_set);
AddRuleSets(ruleSets, dnsRule.rule_set);
}
//rules in rules
foreach (var item in singboxConfig.dns?.rules.Where(t => t.rules?.Count > 0).Select(t => t.rules).ToList() ?? [])
{
foreach (var item2 in item ?? [])
{
AddRuleSets(ruleSets, item2.rule_set);
}
}
//load custom ruleset file
@@ -943,6 +959,7 @@ namespace v2rayN.Handler.CoreConfig
singboxConfig.route.rule_set = [];
foreach (var item in new HashSet<string>(ruleSets))
{
if (Utils.IsNullOrEmpty(item)) { continue; }
var customRuleset = customRulesets.FirstOrDefault(t => t.tag != null && t.tag.Equals(item));
if (customRuleset != null)
{
@@ -955,7 +972,9 @@ namespace v2rayN.Handler.CoreConfig
type = "remote",
format = "binary",
tag = item,
url = string.Format(Global.SingboxRulesetUrl, item.StartsWith(geosite) ? geosite : geoip, item),
url = item.StartsWith(geosite) ?
string.Format(Global.SingboxRulesetUrlGeosite, item) :
string.Format(Global.SingboxRulesetUrlGeoip, item.Replace($"{geoip}-", "")),
download_detour = Global.ProxyTag
});
}
+45 -30
View File
@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.IO;
using System.Reactive.Linq;
using System.Text;
using v2rayN.Enums;
using v2rayN.Handler.CoreConfig;
@@ -57,22 +56,22 @@ namespace v2rayN.Handler
CoreStart(node);
//In tun mode, do a delay check and restart the core
if (_config.tunModeItem.enableTun)
{
Observable.Range(1, 1)
.Delay(TimeSpan.FromSeconds(15))
.Subscribe(x =>
{
{
if (_process == null || _process.HasExited)
{
CoreStart(node);
ShowMsg(false, "Tun mode restart the core once");
Logging.SaveLog("Tun mode restart the core once");
}
}
});
}
//if (_config.tunModeItem.enableTun)
//{
// Observable.Range(1, 1)
// .Delay(TimeSpan.FromSeconds(15))
// .Subscribe(x =>
// {
// {
// if (_process == null || _process.HasExited)
// {
// CoreStart(node);
// ShowMsg(false, "Tun mode restart the core once");
// Logging.SaveLog("Tun mode restart the core once");
// }
// }
// });
//}
}
}
@@ -186,15 +185,16 @@ namespace v2rayN.Handler
ShowMsg(false, $"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}");
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
ECoreType coreType;
if (node.configType != EConfigType.Custom && _config.tunModeItem.enableTun)
{
coreType = ECoreType.sing_box;
}
else
{
coreType = LazyConfig.Instance.GetCoreType(node, node.configType);
}
//ECoreType coreType;
//if (node.configType != EConfigType.Custom && _config.tunModeItem.enableTun)
//{
// coreType = ECoreType.sing_box;
//}
//else
//{
// coreType = LazyConfig.Instance.GetCoreType(node, node.configType);
//}
var coreType = LazyConfig.Instance.GetCoreType(node, node.configType);
_config.runningCoreType = coreType;
var coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
@@ -206,13 +206,25 @@ namespace v2rayN.Handler
}
_process = proc;
//start a socks service
//start a pre service
if (_process != null && !_process.HasExited)
{
if ((node.configType == EConfigType.Custom && node.preSocksPort > 0))
ProfileItem? itemSocks = null;
var preCoreType = ECoreType.sing_box;
if (node.configType != EConfigType.Custom && coreType != ECoreType.sing_box && _config.tunModeItem.enableTun)
{
var preCoreType = _config.tunModeItem.enableTun ? ECoreType.sing_box : ECoreType.Xray;
var itemSocks = new ProfileItem()
itemSocks = new ProfileItem()
{
coreType = preCoreType,
configType = EConfigType.Socks,
address = Global.Loopback,
port = LazyConfig.Instance.GetLocalPort(EInboundProtocol.socks)
};
}
else if ((node.configType == EConfigType.Custom && node.preSocksPort > 0))
{
preCoreType = _config.tunModeItem.enableTun ? ECoreType.sing_box : ECoreType.Xray;
itemSocks = new ProfileItem()
{
coreType = preCoreType,
configType = EConfigType.Socks,
@@ -220,6 +232,9 @@ namespace v2rayN.Handler
port = node.preSocksPort
};
_config.runningCoreType = preCoreType;
}
if (itemSocks != null)
{
string fileName2 = Utils.GetConfigPath(Global.CorePreConfigFileName);
if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0)
{
+15 -5
View File
@@ -13,20 +13,26 @@ namespace v2rayN.Handler
public static LazyConfig Instance => _instance.Value;
private int? _statePort;
private int? _statePort2;
public int StatePort
{
get
{
if (_statePort is null)
{
_statePort = Utils.GetFreePort(GetLocalPort(EInboundProtocol.api));
}
_statePort ??= Utils.GetFreePort(GetLocalPort(EInboundProtocol.api));
return _statePort.Value;
}
}
public int StatePort2
{
get
{
_statePort2 ??= Utils.GetFreePort(GetLocalPort(EInboundProtocol.api2));
return _statePort2.Value;
}
}
private Job _processJob = new();
public LazyConfig()
@@ -330,7 +336,11 @@ namespace v2rayN.Handler
arguments = "-f config.json",
coreUrl = Global.MihomoCoreUrl,
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
coreDownloadUrl32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
coreDownloadUrl64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
coreDownloadUrlArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
match = "Mihomo",
versionArg = "-v",
redirectInfo = true,
});
@@ -28,7 +28,7 @@ namespace v2rayN.Handler
try
{
url = $"ws://{Global.Loopback}:{LazyConfig.Instance.StatePort}/traffic";
url = $"ws://{Global.Loopback}:{LazyConfig.Instance.StatePort2}/traffic";
if (webSocket == null)
{
+13 -7
View File
@@ -28,6 +28,7 @@
public bool? disable_expire { get; set; }
public bool? independent_cache { get; set; }
public bool? reverse_mapping { get; set; }
public string? client_subnet { get; set; }
public Fakeip4Sbox? fakeip { get; set; }
}
@@ -44,12 +45,14 @@
public string? outbound { get; set; }
public string? server { get; set; }
public bool? disable_cache { get; set; }
public List<string>? inbound { get; set; }
public List<string>? protocol { get; set; }
public string? type { get; set; }
public string? mode { get; set; }
public List<string>? network { get; set; }
public bool? ip_is_private { get; set; }
public string? client_subnet { get; set; }
public bool? invert { get; set; }
public List<string>? inbound { get; set; }
public List<string>? protocol { get; set; }
public List<string>? network { get; set; }
public List<int>? port { get; set; }
public List<string>? port_range { get; set; }
public List<string>? geosite { get; set; }
@@ -62,6 +65,7 @@
public List<string>? source_ip_cidr { get; set; }
public List<string>? process_name { get; set; }
public List<string>? rule_set { get; set; }
public List<Rule4Sbox>? rules { get; set; }
}
[Serializable]
@@ -184,11 +188,13 @@
public class Server4Sbox
{
public string tag { get; set; }
public string address { get; set; }
public string address_resolver { get; set; }
public string strategy { get; set; }
public string? tag { get; set; }
public string? address { get; set; }
public string? address_resolver { get; set; }
public string? address_strategy { get; set; }
public string? strategy { get; set; }
public string? detour { get; set; }
public string? client_subnet { get; set; }
}
public class Experimental4Sbox
@@ -16,7 +16,22 @@
"domain": [
"geosite:geolocation-!cn",
"geosite:greatfire"
"geosite:greatfire"
]
},
{
"outboundTag": "proxy",
"ip": [
"1.0.0.1",
"1.1.1.1",
"8.8.8.8",
"8.8.4.4",
"geoip:facebook",
"geoip:fastly",
"geoip:google",
"geoip:netflix",
"geoip:telegram",
"geoip:twitter"
]
},
{
@@ -22,6 +22,10 @@
{
"outboundTag": "direct",
"ip": [
"223.5.5.5/32",
"119.29.29.29/32",
"180.76.76.76/32",
"114.114.114.114/32",
"geoip:private",
"geoip:cn"
]
@@ -150,18 +150,10 @@ namespace v2rayN.ViewModels
//CheckUpdate
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
//public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
//public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
//public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
//public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
[Reactive]
@@ -520,29 +512,17 @@ namespace v2rayN.ViewModels
{
CheckUpdateN();
});
//CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() =>
//{
// CheckUpdateCore(ECoreType.v2fly_v5);
//});
//CheckUpdateSagerNetCoreCmd = ReactiveCommand.Create(() =>
//{
// CheckUpdateCore(ECoreType.SagerNet);
//});
CheckUpdateXrayCoreCmd = ReactiveCommand.Create(() =>
{
CheckUpdateCore(ECoreType.Xray);
CheckUpdateCore(ECoreType.Xray, null);
});
CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
{
CheckUpdateCore(ECoreType.mihomo, false);
});
//CheckUpdateClashCoreCmd = ReactiveCommand.Create(() =>
//{
// CheckUpdateCore(ECoreType.clash);
//});
//CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
//{
// CheckUpdateCore(ECoreType.clash_meta);
//});
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
{
CheckUpdateCore(ECoreType.sing_box);
CheckUpdateCore(ECoreType.sing_box, null);
});
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
{
@@ -1473,7 +1453,7 @@ namespace v2rayN.ViewModels
(new UpdateHandle()).CheckUpdateGuiN(_config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
}
private void CheckUpdateCore(ECoreType type)
private void CheckUpdateCore(ECoreType type, bool? preRelease)
{
void _updateUI(bool success, string msg)
{
@@ -1499,7 +1479,7 @@ namespace v2rayN.ViewModels
}
}
}
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, preRelease ?? _config.guiItem.checkPreReleaseUpdate);
}
private void CheckUpdateGeo()
+3 -17
View File
@@ -37,8 +37,8 @@
</Window.Resources>
<materialDesign:DialogHost
Identifier="RootDialog"
materialDesign:TransitionAssist.DisableTransitions="True"
Identifier="RootDialog"
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
<Grid>
@@ -231,28 +231,14 @@
x:Name="menuCheckUpdateN"
Height="{StaticResource MenuItemHeight}"
Header="V2rayN" />
<!--<MenuItem
x:Name="menuCheckUpdateV2flyCore"
Height="{StaticResource MenuItemHeight}"
Header="V2fly v5 Core" />
<MenuItem
x:Name="menuCheckUpdateSagerNetCore"
Height="{StaticResource MenuItemHeight}"
Header="SagerNet Core" />-->
<MenuItem
x:Name="menuCheckUpdateXrayCore"
Height="{StaticResource MenuItemHeight}"
Header="Xray Core" />
<!--<Separator Margin="-40,5" />
<MenuItem
x:Name="menuCheckUpdateClashCore"
x:Name="menuCheckUpdateMihomoCore"
Height="{StaticResource MenuItemHeight}"
Header="Clash Core" />
<MenuItem
x:Name="menuCheckUpdateClashMetaCore"
Height="{StaticResource MenuItemHeight}"
Header="Clash.Meta Core" />
<Separator Margin="-40,5" />-->
Header="Mihomo Core" />
<MenuItem
x:Name="menuCheckUpdateSingBoxCore"
Height="{StaticResource MenuItemHeight}"
@@ -144,11 +144,8 @@ namespace v2rayN.Views
//check update
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
//this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables);
//this.BindCommand(ViewModel, vm => vm.CheckUpdateSagerNetCoreCmd, v => v.menuCheckUpdateSagerNetCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateMihomoCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateSingBoxCoreCmd, v => v.menuCheckUpdateSingBoxCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables);
+2 -2
View File
@@ -10,13 +10,13 @@
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
<FileVersion>6.46</FileVersion>
<FileVersion>6.48</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.0.6" />
<PackageReference Include="MaterialDesignThemes" Version="5.0.0" />
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.131" />
<PackageReference Include="QRCoder.Xaml" Version="1.5.1" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
@@ -46,22 +46,22 @@
<string name="server_lab_more_function">Другие параметры</string>
<string name="server_lab_head_type">Тип заголовка</string>
<string name="server_lab_mode_type">Режим gRPC</string>
<string name="server_lab_request_host">host</string>
<string name="server_lab_request_host_http">http host</string>
<string name="server_lab_request_host_ws">ws host</string>
<string name="server_lab_request_host_httpupgrade">httpupgrade host</string>
<string name="server_lab_request_host_splithttp">splithttp host</string>
<string name="server_lab_request_host_h2">h2 host</string>
<string name="server_lab_request_host_quic">QUIC security</string>
<string name="server_lab_request_host_grpc">gRPC Authority</string>
<string name="server_lab_path">path</string>
<string name="server_lab_path_ws">ws path</string>
<string name="server_lab_path_httpupgrade">httpupgrade path</string>
<string name="server_lab_path_splithttp">splithttp path</string>
<string name="server_lab_path_h2">h2 path</string>
<string name="server_lab_path_quic">QUIC key</string>
<string name="server_lab_path_kcp">kcp seed</string>
<string name="server_lab_path_grpc">gRPC serviceName</string>
<string name="server_lab_request_host">Узел</string>
<string name="server_lab_request_host_http">Узел HTTP</string>
<string name="server_lab_request_host_ws">Узел WS</string>
<string name="server_lab_request_host_httpupgrade">Узел HTTPUpgrade</string>
<string name="server_lab_request_host_splithttp">Узел SplitHTTP</string>
<string name="server_lab_request_host_h2">Узел H2</string>
<string name="server_lab_request_host_quic">Шифрование QUIC</string>
<string name="server_lab_request_host_grpc">Полномочия gRPC</string>
<string name="server_lab_path">Путь</string>
<string name="server_lab_path_ws">Путь WS</string>
<string name="server_lab_path_httpupgrade">Путь HTTPUpgrade</string>
<string name="server_lab_path_splithttp">Путь SplitHTTP</string>
<string name="server_lab_path_h2">Путь H2</string>
<string name="server_lab_path_quic">Ключ QUIC</string>
<string name="server_lab_path_kcp">Сид KCP</string>
<string name="server_lab_path_grpc">Служба gRPC</string>
<string name="server_lab_stream_security">TLS</string>
<string name="server_lab_allow_insecure">Разрешать небезопасные</string>
<string name="server_lab_sni">SNI</string>
@@ -101,6 +101,7 @@
<string name="msg_remark_is_duplicate">Описание уже существует</string>
<string name="toast_action_not_allowed">Это действие запрещено</string>
<!-- PerAppProxyActivity -->
<string name="msg_dialog_progress">Загрузка…</string>
<string name="menu_item_search">Поиск</string>
@@ -140,7 +141,6 @@
<string name="title_pref_route_only_enabled">Домен только для маршрутизации</string>
<string name="summary_pref_route_only_enabled">Использовать определённое доменное имя только для маршрутизации и сохранять целевой адрес в виде IP.</string>
<string name="title_pref_local_dns_enabled">Использовать локальную DNS</string>
<string name="summary_pref_local_dns_enabled">Обслуживание выполняется DNS-модулем ядра (в настройках маршрутизации рекомендуется выбрать режим «Все, кроме LAN и Китая»)</string>
@@ -192,7 +192,7 @@
<string name="summary_pref_feedback">Предложить улучшение или сообщить об ошибке на GitHub</string>
<string name="summary_pref_tg_group">Присоединиться к группе в Telegram</string>
<string name="toast_tg_app_not_found">Приложение Telegram не найдено</string>
<string name="title_privacy_policy">Конфиденциальность</string>
<string name="title_privacy_policy">Политика конфиденциальности</string>
<string name="title_about">О приложении</string>
<string name="title_source_code">Исходный код</string>
<string name="title_tg_channel">Telegram-канал</string>
+25 -25
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22690"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -23,7 +23,7 @@
<rect key="frame" x="0.0" y="0.0" width="700" height="360"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jcb-hK-ckn">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jcb-hK-ckn">
<rect key="frame" x="18" y="323" width="109" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Domain Strategy:" id="22k-l7-G7a">
@@ -32,7 +32,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oz6-O3-feh">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oz6-O3-feh">
<rect key="frame" x="42" y="293" width="85" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Routing Rule:" id="4rB-9k-291">
@@ -121,23 +121,23 @@
</tabViewItem>
<tabViewItem label="Direct" identifier="" id="yc0-Po-cG1">
<view key="view" id="mlE-HX-BcJ">
<rect key="frame" x="10" y="33" width="414" height="190"/>
<rect key="frame" x="10" y="33" width="650" height="190"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kkR-uc-Qja">
<rect key="frame" x="12" y="12" width="389" height="171"/>
<rect key="frame" x="12" y="12" width="627" height="171"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="oot-vM-Y6a">
<rect key="frame" x="0.0" y="0.0" width="389" height="171"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="oot-vM-Y6a">
<rect key="frame" x="0.0" y="0.0" width="627" height="171"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView ambiguous="YES" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="vYm-hy-3PV">
<rect key="frame" x="0.0" y="0.0" width="389" height="171"/>
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="vYm-hy-3PV">
<rect key="frame" x="0.0" y="0.0" width="627" height="171"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="389" height="171"/>
<size key="maxSize" width="394" height="10000000"/>
<size key="minSize" width="627" height="171"/>
<size key="maxSize" width="628" height="10000000"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
@@ -148,7 +148,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="9vp-fC-VPR">
<rect key="frame" x="373" y="0.0" width="16" height="171"/>
<rect key="frame" x="611" y="0.0" width="16" height="171"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
@@ -157,23 +157,23 @@
</tabViewItem>
<tabViewItem label="Block" identifier="" id="nsT-BW-R2Z">
<view key="view" id="OgP-Jb-qTh">
<rect key="frame" x="10" y="33" width="414" height="190"/>
<rect key="frame" x="10" y="33" width="650" height="190"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GOX-0f-UYf">
<rect key="frame" x="12" y="12" width="389" height="171"/>
<rect key="frame" x="12" y="12" width="627" height="171"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="lep-5k-Lk2">
<rect key="frame" x="0.0" y="0.0" width="389" height="171"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="lep-5k-Lk2">
<rect key="frame" x="0.0" y="0.0" width="627" height="171"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView ambiguous="YES" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="UmH-oj-OeF">
<rect key="frame" x="0.0" y="0.0" width="389" height="171"/>
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="UmH-oj-OeF">
<rect key="frame" x="0.0" y="0.0" width="627" height="171"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="389" height="171"/>
<size key="maxSize" width="394" height="10000000"/>
<size key="minSize" width="627" height="171"/>
<size key="maxSize" width="633" height="10000000"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
@@ -184,7 +184,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="c7l-Gi-Vwn">
<rect key="frame" x="373" y="0.0" width="16" height="171"/>
<rect key="frame" x="611" y="0.0" width="16" height="171"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
@@ -193,7 +193,7 @@
</tabViewItem>
</tabViewItems>
</tabView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="abB-zF-WFz" userLabel="Set the rules line by line: domain or ip">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="abB-zF-WFz" userLabel="Set the rules line by line: domain or ip">
<rect key="frame" x="18" y="20" width="241" height="17"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="* Set the rules line by line: domain or ip" id="ccq-gn-C6Z" userLabel="Set the rules line by line: domain or ip">
@@ -30,7 +30,17 @@ final class PreferencePacViewController: NSViewController, PreferencePane {
@IBOutlet var gfwPacListUrl: NSTextField!
@IBOutlet var userRulesView: NSTextView!
@objc private func configWindowWillClose(notification: Notification) {
print("configWindowWillClose-pac",notification)
guard let object = notification.object as? NSWindow else {
return
}
if object.title == "V2rayU" {
showDock(state: false)
}
}
override func viewDidLoad() {
super.viewDidLoad()
// fix: https://github.com/sindresorhus/Preferences/issues/31
@@ -275,6 +285,9 @@ func getPacUserRules() -> String {
if !userRuleTxt.contains("chat.openai.com") {
userRuleTxt.append("\n||chat.openai.com")
}
if !userRuleTxt.contains("chatgpt.com") {
userRuleTxt.append("\n||chatgpt.com")
}
return userRuleTxt
}
+40 -59
View File
@@ -297,8 +297,8 @@ class V2rayConfig: NSObject {
var rules: [V2rayRoutingSettingRule] = []
// rules
var ruleProxyDomain, ruleProxyIp, ruleDirectDomain, ruleDirectIp, ruleBlockDomain, ruleBlockIp: V2rayRoutingSettingRule?
var ruleProxyDomain, ruleProxyIp, ruleDirectDomain, ruleDirectIp, ruleBlockDomain, ruleBlockIp, ruleDirectIpDefault, ruleDirectDomainDefault: V2rayRoutingSettingRule?
print("ruleBlockDomain",self.routingBlockDomains)
// proxy
if self.routingProxyDomains.count > 0 {
ruleProxyDomain = getRoutingRule(outTag: "proxy", domain: self.routingProxyDomains, ip: nil, port: nil)
@@ -317,7 +317,7 @@ class V2rayConfig: NSObject {
// block
if self.routingBlockDomains.count > 0 {
ruleBlockDomain = getRoutingRule(outTag: "block", domain: self.routingDirectDomains, ip: nil, port: nil)
ruleBlockDomain = getRoutingRule(outTag: "block", domain: self.routingBlockDomains, ip: nil, port: nil)
}
if self.routingBlockIps.count > 0 {
ruleBlockIp = getRoutingRule(outTag: "block", domain: nil, ip: self.routingBlockIps, port: nil)
@@ -327,79 +327,60 @@ class V2rayConfig: NSObject {
case .RoutingRuleGlobal:
break
case .RoutingRuleLAN:
if ruleDirectIp == nil {
ruleDirectIp = getRoutingRule(outTag: "direct", domain: nil, ip: ["geoip:private"], port: nil)
} else {
ruleDirectIp?.domain?.append("geoip:private")
}
if ruleDirectDomain == nil {
ruleDirectDomain = getRoutingRule(outTag: "direct", domain: ["localhost"], ip: nil, port: nil)
} else {
ruleDirectDomain?.domain?.append("localhost")
}
ruleDirectIpDefault = getRoutingRule(outTag: "direct", domain: nil, ip: ["geoip:private"], port: nil)
ruleDirectDomainDefault = getRoutingRule(outTag: "direct", domain: ["localhost"], ip: nil, port: nil)
break
case .RoutingRuleCn:
if ruleDirectIp == nil {
ruleDirectIp = getRoutingRule(outTag: "direct", domain: nil, ip: ["geoip:cn"], port: nil)
} else {
ruleDirectIp?.domain?.append("geoip:cn")
}
if ruleDirectDomain == nil {
ruleDirectDomain = getRoutingRule(outTag: "direct", domain: ["geosite:cn"], ip: nil, port: nil)
} else {
ruleDirectDomain?.domain?.append("geosite:cn")
}
ruleDirectIpDefault = getRoutingRule(outTag: "direct", domain: nil, ip: ["geoip:cn"], port: nil)
ruleDirectDomainDefault = getRoutingRule(outTag: "direct", domain: ["geosite:cn"], ip: nil, port: nil)
break
case .RoutingRuleLANAndCn:
if ruleDirectIp == nil {
ruleDirectIp = getRoutingRule(outTag: "direct", domain: nil, ip: ["geoip:cn","geoip:private"], port: nil)
} else {
ruleDirectIp?.ip?.append("geoip:private")
ruleDirectIp?.ip?.append("geoip:cn")
}
if ruleDirectDomain == nil {
ruleDirectDomain = getRoutingRule(outTag: "direct", domain: ["geosite:cn","localhost"], ip: nil, port: nil)
} else {
ruleDirectDomain?.domain?.append("geosite:cn")
ruleDirectDomain?.domain?.append("localhost")
}
ruleDirectIpDefault = getRoutingRule(outTag: "direct", domain: nil, ip: ["geoip:cn","geoip:private"], port: nil)
ruleDirectDomainDefault = getRoutingRule(outTag: "direct", domain: ["geosite:cn","localhost"], ip: nil, port: nil)
break
}
// block
// -> -> -> IP -> IP -> IP
//
if ruleBlockDomain != nil {
ruleBlockDomain?.ip = nil
rules.append(ruleBlockDomain!)
}
if ruleBlockIp != nil {
ruleBlockIp?.domain = nil
rules.append(ruleBlockIp!)
}
//
if ruleDirectDomain != nil {
ruleDirectDomain!.ip = nil
rules.append(ruleDirectDomain!)
}
if ruleDirectIp != nil {
ruleDirectIp!.domain = nil
rules.append(ruleDirectIp!)
}
//
//
if ruleProxyDomain != nil {
ruleProxyDomain?.ip = nil
rules.append(ruleProxyDomain!)
}
//
if ruleDirectDomain != nil {
ruleDirectDomain!.ip = nil
rules.append(ruleDirectDomain!)
}
// IP
if ruleBlockIp != nil {
ruleBlockIp!.domain = nil
rules.append(ruleBlockIp!)
}
// IP
if ruleProxyIp != nil {
ruleProxyIp?.domain = nil
ruleProxyIp!.domain = nil
rules.append(ruleProxyIp!)
}
//
var ruleProxyPort = getRoutingRule(outTag: "proxy", domain: nil, ip: nil, port: "0-65535")
ruleProxyPort.outboundTag = "proxy"
ruleProxyPort.type = "field"
ruleProxyPort.port = "0-65535"
// rules.append(ruleProxyPort)
// IP
if ruleDirectIp != nil {
ruleDirectIp!.domain = nil
rules.append(ruleDirectIp!)
}
//
if ruleDirectIpDefault != nil {
ruleDirectIpDefault!.domain = nil
rules.append(ruleDirectIpDefault!)
}
if ruleDirectDomainDefault != nil {
ruleDirectDomainDefault!.ip = nil
rules.append(ruleDirectDomainDefault!)
}
// ,
//
self.routing.settings.rules = rules
// set v2ray routing

Some files were not shown because too many files have changed in this diff Show More