mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-22 16:07:49 +08:00
Update On Tue Aug 6 20:32:53 CEST 2024
This commit is contained in:
@@ -725,3 +725,4 @@ Update On Fri Aug 2 20:31:28 CEST 2024
|
||||
Update On Sat Aug 3 20:32:05 CEST 2024
|
||||
Update On Sun Aug 4 20:30:12 CEST 2024
|
||||
Update On Mon Aug 5 20:34:45 CEST 2024
|
||||
Update On Tue Aug 6 20:32:42 CEST 2024
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
C "github.com/metacubex/mihomo/constant"
|
||||
"github.com/metacubex/mihomo/rules/common"
|
||||
@@ -13,19 +14,19 @@ import (
|
||||
|
||||
type Logic struct {
|
||||
*common.Base
|
||||
payload string
|
||||
adapter string
|
||||
ruleType C.RuleType
|
||||
rules []C.Rule
|
||||
subRules map[string][]C.Rule
|
||||
needIP bool
|
||||
needProcess bool
|
||||
payload string
|
||||
adapter string
|
||||
ruleType C.RuleType
|
||||
rules []C.Rule
|
||||
subRules map[string][]C.Rule
|
||||
|
||||
payloadOnce sync.Once
|
||||
}
|
||||
|
||||
type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error)
|
||||
|
||||
func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule ParseRuleFunc) (*Logic, error) {
|
||||
logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules}
|
||||
logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules, subRules: subRules}
|
||||
err := logic.parsePayload(fmt.Sprintf("(%s)", payload), parseRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -34,15 +35,6 @@ func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule
|
||||
if len(logic.rules) != 1 {
|
||||
return nil, fmt.Errorf("Sub-Rule rule must contain one rule")
|
||||
}
|
||||
for _, rule := range subRules[adapter] {
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
}
|
||||
logic.subRules = subRules
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
@@ -56,9 +48,6 @@ func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, er
|
||||
if len(logic.rules) != 1 {
|
||||
return nil, fmt.Errorf("not rule must contain one rule")
|
||||
}
|
||||
logic.needIP = logic.rules[0].ShouldResolveIP()
|
||||
logic.needProcess = logic.rules[0].ShouldFindProcess()
|
||||
logic.payload = fmt.Sprintf("(!(%s,%s))", logic.rules[0].RuleType(), logic.rules[0].Payload())
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
@@ -68,40 +57,15 @@ func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " || "))
|
||||
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
func NewAND(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) {
|
||||
logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.AND}
|
||||
err := logic.parsePayload(payload, parseRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " && "))
|
||||
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
@@ -218,13 +182,6 @@ func (logic *Logic) parsePayload(payload string, parseRule ParseRuleFunc) error
|
||||
return err
|
||||
}
|
||||
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
|
||||
rules = append(rules, rule)
|
||||
}
|
||||
|
||||
@@ -279,9 +236,9 @@ func (logic *Logic) Match(metadata *C.Metadata) (bool, string) {
|
||||
}
|
||||
}
|
||||
return true, logic.adapter
|
||||
default:
|
||||
return false, ""
|
||||
}
|
||||
|
||||
return false, ""
|
||||
}
|
||||
|
||||
func (logic *Logic) Adapter() string {
|
||||
@@ -289,15 +246,58 @@ func (logic *Logic) Adapter() string {
|
||||
}
|
||||
|
||||
func (logic *Logic) Payload() string {
|
||||
logic.payloadOnce.Do(func() { // a little bit expensive, so only computed once
|
||||
switch logic.ruleType {
|
||||
case C.NOT:
|
||||
logic.payload = fmt.Sprintf("(!(%s,%s))", logic.rules[0].RuleType(), logic.rules[0].Payload())
|
||||
case C.OR:
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " || "))
|
||||
case C.AND:
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " && "))
|
||||
default:
|
||||
}
|
||||
})
|
||||
return logic.payload
|
||||
}
|
||||
|
||||
func (logic *Logic) ShouldResolveIP() bool {
|
||||
return logic.needIP
|
||||
if logic.ruleType == C.SubRules {
|
||||
for _, rule := range logic.subRules[logic.adapter] {
|
||||
if rule.ShouldResolveIP() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, rule := range logic.rules {
|
||||
if rule.ShouldResolveIP() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (logic *Logic) ShouldFindProcess() bool {
|
||||
return logic.needProcess
|
||||
if logic.ruleType == C.SubRules {
|
||||
for _, rule := range logic.subRules[logic.adapter] {
|
||||
if rule.ShouldFindProcess() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, rule := range logic.rules {
|
||||
if rule.ShouldFindProcess() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (logic *Logic) ProviderNames() (names []string) {
|
||||
|
||||
@@ -40,10 +40,7 @@ func (rs *RuleSet) Adapter() string {
|
||||
}
|
||||
|
||||
func (rs *RuleSet) Payload() string {
|
||||
if provider, ok := rs.getProvider(); ok {
|
||||
return provider.Name()
|
||||
}
|
||||
return ""
|
||||
return rs.ruleProviderName
|
||||
}
|
||||
|
||||
func (rs *RuleSet) ShouldResolveIP() bool {
|
||||
|
||||
Generated
+115
-71
@@ -961,9 +961,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.16.1"
|
||||
version = "1.16.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
|
||||
checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
@@ -1297,7 +1297,7 @@ dependencies = [
|
||||
"sha2 0.10.8",
|
||||
"simd-json",
|
||||
"single-instance",
|
||||
"sysinfo",
|
||||
"sysinfo 0.30.13",
|
||||
"sysproxy",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
@@ -1980,7 +1980,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "dirs-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-utils.git#28f4f6234b67a2d806bd28a90112cb1da67bd0f6"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-utils.git#436d877629bda63fda2e50da8bb5fc8cd8c4b678"
|
||||
dependencies = [
|
||||
"dirs-next",
|
||||
"thiserror",
|
||||
@@ -2093,7 +2093,7 @@ dependencies = [
|
||||
"cc",
|
||||
"memchr",
|
||||
"rustc_version 0.4.0",
|
||||
"toml 0.8.16",
|
||||
"toml 0.8.19",
|
||||
"vswhom",
|
||||
"winreg 0.52.0",
|
||||
]
|
||||
@@ -2330,9 +2330,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.30"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
|
||||
checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
@@ -3553,19 +3553,6 @@ dependencies = [
|
||||
"syn 2.0.72",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "interprocess"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81f2533f3be42fffe3b5e63b71aeca416c1c3bc33e4e27be018521e76b1f38fb"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"rustc_version 0.4.0",
|
||||
"to_method",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "interprocess"
|
||||
version = "2.2.1"
|
||||
@@ -4087,9 +4074,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.12.3"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc"
|
||||
checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904"
|
||||
dependencies = [
|
||||
"hashbrown 0.14.5",
|
||||
]
|
||||
@@ -4510,18 +4497,18 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||
|
||||
[[package]]
|
||||
name = "normpath"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804"
|
||||
checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify-rust"
|
||||
version = "4.11.0"
|
||||
version = "4.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5312f837191c317644f313f7b2b39f9cb1496570c74f7c17152dd3961219551f"
|
||||
checksum = "26a1d03b6305ecefdd9c6c60150179bb8d9f0cd4e64bbcad1e41419e7bf5e414"
|
||||
dependencies = [
|
||||
"log 0.4.22",
|
||||
"mac-notification-sys",
|
||||
@@ -4681,7 +4668,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nyanpasu-ipc"
|
||||
version = "1.0.5"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-service.git#6f80557dbc79147626506191410f30a17bda0973"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-service.git#eb54833d830b9dc5b5cb8af8493de939122b49c6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
@@ -4691,7 +4678,7 @@ dependencies = [
|
||||
"http-body-util",
|
||||
"hyper 1.4.1",
|
||||
"hyper-util",
|
||||
"interprocess 2.2.1",
|
||||
"interprocess",
|
||||
"nyanpasu-utils",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
@@ -4706,7 +4693,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nyanpasu-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-utils.git#28f4f6234b67a2d806bd28a90112cb1da67bd0f6"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-utils.git#436d877629bda63fda2e50da8bb5fc8cd8c4b678"
|
||||
dependencies = [
|
||||
"constcat",
|
||||
"derive_builder",
|
||||
@@ -4719,7 +4706,7 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"serde",
|
||||
"shared_child",
|
||||
"sysinfo",
|
||||
"sysinfo 0.31.2",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@@ -4988,7 +4975,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "os-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-utils.git#28f4f6234b67a2d806bd28a90112cb1da67bd0f6"
|
||||
source = "git+https://github.com/LibNyanpasu/nyanpasu-utils.git#436d877629bda63fda2e50da8bb5fc8cd8c4b678"
|
||||
dependencies = [
|
||||
"nix 0.29.0",
|
||||
"shared_child",
|
||||
@@ -5030,9 +5017,9 @@ checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f"
|
||||
|
||||
[[package]]
|
||||
name = "oxc_allocator"
|
||||
version = "0.23.0"
|
||||
version = "0.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce3c5442368a2b966a045e2499fb1075c2470abc91c7f4cc4bd8fb369c144e78"
|
||||
checksum = "0222635617c93d6b8cf04931d33f865af48f092219bd3a5748a0a10aadba3357"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"bumpalo",
|
||||
@@ -5098,9 +5085,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "oxc_span"
|
||||
version = "0.23.0"
|
||||
version = "0.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4754789169acb508592992125a9f8aae5144064860aee4df7f5df0dd5bad06f8"
|
||||
checksum = "e11728a24c5e0219c0f93b633e8cf472f4963635911de6bece7ec663c762099f"
|
||||
dependencies = [
|
||||
"compact_str",
|
||||
"miette",
|
||||
@@ -5521,9 +5508,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
version = "0.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
@@ -6064,9 +6054,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rgb"
|
||||
version = "0.8.45"
|
||||
version = "0.8.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ade4539f42266ded9e755c605bdddf546242b2c961b03b06a7375260788a0523"
|
||||
checksum = "e12bc8d2f72df26a5d3178022df33720fbede0d31d82c7291662eff89836994d"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
@@ -6616,12 +6606,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "shared_child"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
|
||||
checksum = "09fa9338aed9a1df411814a5b2252f7cd206c55ae9bf2fa763f8de84603aa60c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6999,6 +6989,20 @@ dependencies = [
|
||||
"windows 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.31.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4115055da5f572fff541dd0c4e61b0262977f453cc9fe04be83aba25a89bdab"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"memchr",
|
||||
"ntapi",
|
||||
"rayon",
|
||||
"windows 0.57.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysproxy"
|
||||
version = "0.3.0"
|
||||
@@ -7056,7 +7060,7 @@ dependencies = [
|
||||
"cfg-expr 0.15.8",
|
||||
"heck 0.5.0",
|
||||
"pkg-config",
|
||||
"toml 0.8.16",
|
||||
"toml 0.8.19",
|
||||
"version-compare 0.2.0",
|
||||
]
|
||||
|
||||
@@ -7139,9 +7143,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.12.15"
|
||||
version = "0.12.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2"
|
||||
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
@@ -7272,12 +7276,13 @@ name = "tauri-plugin-deep-link"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"dirs 5.0.1",
|
||||
"interprocess 1.2.1",
|
||||
"interprocess",
|
||||
"log 0.4.22",
|
||||
"objc2",
|
||||
"once_cell",
|
||||
"tauri-utils",
|
||||
"windows-sys 0.52.0",
|
||||
"tokio",
|
||||
"windows-sys 0.59.0",
|
||||
"winreg 0.52.0",
|
||||
]
|
||||
|
||||
@@ -7626,12 +7631,6 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "to_method"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7c4ceeeca15c8384bbc3e011dbd8fccb7f068a440b752b7d9b32ceb0ca0e2e8"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.39.2"
|
||||
@@ -7729,21 +7728,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.16"
|
||||
version = "0.8.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c"
|
||||
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit 0.22.17",
|
||||
"toml_edit 0.22.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.7"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -7774,15 +7773,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.17"
|
||||
version = "0.22.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16"
|
||||
checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
|
||||
dependencies = [
|
||||
"indexmap 2.3.0",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow 0.6.16",
|
||||
"winnow 0.6.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8615,11 +8614,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8709,6 +8708,16 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
||||
dependencies = [
|
||||
"windows-core 0.57.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.58.0"
|
||||
@@ -8750,6 +8759,18 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
|
||||
dependencies = [
|
||||
"windows-implement 0.57.0",
|
||||
"windows-interface 0.57.0",
|
||||
"windows-result 0.1.2",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.58.0"
|
||||
@@ -8784,6 +8805,17 @@ dependencies = [
|
||||
"syn 2.0.72",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.72",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.58.0"
|
||||
@@ -8806,6 +8838,17 @@ dependencies = [
|
||||
"syn 2.0.72",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.72",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.58.0"
|
||||
@@ -9166,9 +9209,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.16"
|
||||
version = "0.6.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c"
|
||||
checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -9467,6 +9510,7 @@ version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
@@ -9618,18 +9662,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zstd-safe"
|
||||
version = "7.2.0"
|
||||
version = "7.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa556e971e7b568dc775c136fc9de8c779b1c2fc3a63defaafadffdbd3181afa"
|
||||
checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059"
|
||||
dependencies = [
|
||||
"zstd-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-sys"
|
||||
version = "2.0.12+zstd.1.5.6"
|
||||
version = "2.0.13+zstd.1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a4e40c320c3cb459d9a9ff6de98cff88f4751ee9275d140e2be94a2b74e4c13"
|
||||
checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
|
||||
@@ -17,13 +17,14 @@ once_cell = "1"
|
||||
tauri-utils = { version = "1" }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
interprocess = { version = "1.2", default-features = false }
|
||||
windows-sys = { version = "0.52.0", features = [
|
||||
interprocess = { version = "2" }
|
||||
windows-sys = { version = "0.59.0", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_UI_Input_KeyboardAndMouse",
|
||||
"Win32_UI_WindowsAndMessaging",
|
||||
] }
|
||||
winreg = "0.52.0"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc2 = "0.5.0"
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
use std::{
|
||||
io::{BufRead, BufReader, Result, Write},
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicU16, AtomicUsize, Ordering},
|
||||
Arc,
|
||||
},
|
||||
sync::atomic::{AtomicU16, Ordering},
|
||||
};
|
||||
|
||||
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
|
||||
use interprocess::{
|
||||
bound_util::RefTokioAsyncRead,
|
||||
local_socket::{
|
||||
tokio::prelude::*,
|
||||
traits::tokio::{Listener, Stream},
|
||||
GenericNamespaced, ListenerNonblockingMode, ListenerOptions, Name, ToNsName,
|
||||
},
|
||||
};
|
||||
use std::io::Result;
|
||||
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
||||
use windows_sys::Win32::UI::{
|
||||
Input::KeyboardAndMouse::{SendInput, INPUT, INPUT_0, INPUT_KEYBOARD, KEYBDINPUT},
|
||||
WindowsAndMessaging::{AllowSetForegroundWindow, ASFW_ANY},
|
||||
// WindowsAndMessaging::{AllowSetForegroundWindow, ASFW_ANY},
|
||||
};
|
||||
use winreg::{enums::HKEY_CURRENT_USER, RegKey};
|
||||
|
||||
@@ -68,65 +74,115 @@ pub fn listen<F: FnMut(String) + Send + 'static>(mut handler: F) -> Result<()> {
|
||||
}
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let listener =
|
||||
LocalSocketListener::bind(ID.get().expect("listen() called before prepare()").as_str())
|
||||
.expect("Can't create listener");
|
||||
let name = ID
|
||||
.get()
|
||||
.expect("listen() called before prepare()")
|
||||
.as_str()
|
||||
.to_ns_name::<GenericNamespaced>()
|
||||
.unwrap();
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.expect("failed to create tokio runtime")
|
||||
.block_on(async move {
|
||||
let listener = ListenerOptions::new()
|
||||
.name(name)
|
||||
.nonblocking(ListenerNonblockingMode::Both)
|
||||
.create_tokio()
|
||||
.expect("Can't create listener");
|
||||
|
||||
for conn in listener.incoming() {
|
||||
match conn {
|
||||
Ok(conn) => {
|
||||
// Listen for the launch arguments
|
||||
let mut conn = BufReader::new(conn);
|
||||
let mut buffer = String::new();
|
||||
if let Err(io_err) = conn.read_line(&mut buffer) {
|
||||
log::error!("Error reading incoming connection: {}", io_err.to_string());
|
||||
};
|
||||
buffer.pop();
|
||||
|
||||
handler(buffer);
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("Incoming connection failed: {}", error);
|
||||
if error.raw_os_error() == Some(232) || error.to_string().contains("232") {
|
||||
break;
|
||||
loop {
|
||||
match listener.accept().await {
|
||||
Ok(conn) => {
|
||||
let (rx, mut tx) = conn.split();
|
||||
let mut reader = BufReader::new(rx);
|
||||
let mut buf = String::new();
|
||||
if let Err(e) = reader.read_line(&mut buf).await {
|
||||
log::error!("Error reading from connection: {}", e);
|
||||
continue;
|
||||
}
|
||||
buf.pop();
|
||||
let current_pid = std::process::id();
|
||||
let response = format!("{current_pid}\n");
|
||||
if let Err(e) = tx.write_all(response.as_bytes()).await {
|
||||
log::error!("Error writing to connection: {}", e);
|
||||
continue;
|
||||
}
|
||||
handler(buf);
|
||||
}
|
||||
Err(e) if e.raw_os_error() == Some(232) => {
|
||||
// 234 is WSAEINTR, which means the listener was closed.
|
||||
break;
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Error accepting connection: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CRASH_COUNT.fetch_add(1, Ordering::Release);
|
||||
let _ = listen(handler);
|
||||
CRASH_COUNT.fetch_add(1, Ordering::Release);
|
||||
let _ = listen(handler);
|
||||
});
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn prepare(identifier: &str) {
|
||||
if let Ok(mut conn) = LocalSocketStream::connect(identifier) {
|
||||
// We are the secondary instance.
|
||||
// Prep to activate primary instance by allowing another process to take focus.
|
||||
let name: Name = identifier
|
||||
.to_ns_name::<GenericNamespaced>()
|
||||
.expect("Invalid identifier");
|
||||
|
||||
// A workaround to allow AllowSetForegroundWindow to succeed - press a key.
|
||||
// This was originally used by Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=837796
|
||||
dummy_keypress();
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.expect("failed to create tokio runtime")
|
||||
.block_on(async move {
|
||||
if let Ok(conn) = LocalSocketStream::connect(name).await {
|
||||
// We are the secondary instance.
|
||||
// Prep to activate primary instance by allowing another process to take focus.
|
||||
|
||||
let primary_instance_pid = conn.peer_pid().unwrap_or(ASFW_ANY);
|
||||
unsafe {
|
||||
let success = AllowSetForegroundWindow(primary_instance_pid) != 0;
|
||||
if !success {
|
||||
log::warn!("AllowSetForegroundWindow failed.");
|
||||
}
|
||||
}
|
||||
// A workaround to allow AllowSetForegroundWindow to succeed - press a key.
|
||||
// This was originally used by Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=837796
|
||||
// dummy_keypress();
|
||||
|
||||
// let primary_instance_pid = conn.peer_pid().unwrap_or(ASFW_ANY);
|
||||
// unsafe {
|
||||
// let success = AllowSetForegroundWindow(primary_instance_pid) != 0;
|
||||
// if !success {
|
||||
// log::warn!("AllowSetForegroundWindow failed.");
|
||||
// }
|
||||
// }
|
||||
let (socket_rx, mut socket_tx) = conn.split();
|
||||
let mut socket_rx = socket_rx.as_tokio_async_read();
|
||||
let url = std::env::args().nth(1).expect("URL not provided");
|
||||
socket_tx
|
||||
.write_all(url.as_bytes())
|
||||
.await
|
||||
.expect("Failed to write to socket");
|
||||
socket_tx
|
||||
.write_all(b"\n")
|
||||
.await
|
||||
.expect("Failed to write to socket");
|
||||
socket_tx.flush().await.expect("Failed to flush socket");
|
||||
|
||||
let mut reader = BufReader::new(&mut socket_rx);
|
||||
let mut buf = String::new();
|
||||
if let Err(e) = reader.read_line(&mut buf).await {
|
||||
eprintln!("Error reading from connection: {}", e);
|
||||
}
|
||||
buf.pop();
|
||||
dummy_keypress();
|
||||
let pid = buf.parse::<u32>().unwrap_or(ASFW_ANY);
|
||||
unsafe {
|
||||
let success = AllowSetForegroundWindow(pid) != 0;
|
||||
if !success {
|
||||
eprintln!("AllowSetForegroundWindow failed.");
|
||||
}
|
||||
}
|
||||
std::process::exit(0);
|
||||
};
|
||||
});
|
||||
|
||||
if let Err(io_err) = conn.write_all(std::env::args().nth(1).unwrap_or_default().as_bytes())
|
||||
{
|
||||
log::error!(
|
||||
"Error sending message to primary instance: {}",
|
||||
io_err.to_string()
|
||||
);
|
||||
};
|
||||
let _ = conn.write_all(b"\n");
|
||||
std::process::exit(0);
|
||||
};
|
||||
ID.set(identifier.to_string())
|
||||
.expect("prepare() called more than once with different identifiers.");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ use crate::utils::{dirs, help};
|
||||
use anyhow::Result;
|
||||
// use log::LevelFilter;
|
||||
use enumflags2::bitflags;
|
||||
use semver::Op;
|
||||
use serde::{Deserialize, Serialize};
|
||||
mod clash_strategy;
|
||||
pub mod logging;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::utils::dirs::tray_icons_path;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
any::Any,
|
||||
borrow::Cow,
|
||||
fmt::{Display, Formatter},
|
||||
path::PathBuf,
|
||||
|
||||
@@ -255,8 +255,6 @@ mod utils {
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::enhance::script;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct FunctionVisitor<'n> {
|
||||
exported_name: Vec<Cow<'n, str>>,
|
||||
|
||||
@@ -27,7 +27,7 @@ use crate::{
|
||||
utils::{init, resolve},
|
||||
};
|
||||
use tauri::{api, Manager, SystemTray};
|
||||
use utils::resolve::reset_window_open_counter;
|
||||
use utils::resolve::{is_window_opened, reset_window_open_counter};
|
||||
|
||||
rust_i18n::i18n!("../../locales");
|
||||
|
||||
@@ -129,19 +129,18 @@ fn main() -> std::io::Result<()> {
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
if let Some(url) = custom_schema {
|
||||
log::info!(target: "app", "started with schema");
|
||||
if Config::verge().data().enable_silent_start.unwrap_or(true) {
|
||||
resolve::create_window(&handle.clone());
|
||||
resolve::create_window(&handle.clone());
|
||||
while !is_window_opened() {
|
||||
log::info!(target: "app", "waiting for window open");
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
}
|
||||
app.listen_global("init-complete", move |_| {
|
||||
log::info!(target: "app", "frontend init-complete event received");
|
||||
Handle::global()
|
||||
.app_handle
|
||||
.lock()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.emit_all("scheme-request-received", url.clone())
|
||||
.unwrap();
|
||||
});
|
||||
Handle::global()
|
||||
.app_handle
|
||||
.lock()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.emit_all("scheme-request-received", url.clone())
|
||||
.unwrap();
|
||||
}
|
||||
// This operation should terminate the app if app is called by custom scheme and this instance is not the primary instance
|
||||
log_err!(tauri_plugin_deep_link::register(
|
||||
@@ -149,6 +148,10 @@ fn main() -> std::io::Result<()> {
|
||||
move |request| {
|
||||
log::info!(target: "app", "scheme request received: {:?}", &request);
|
||||
resolve::create_window(&handle.clone()); // create window if not exists
|
||||
while !is_window_opened() {
|
||||
log::info!(target: "app", "waiting for window open");
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
}
|
||||
handle.emit_all("scheme-request-received", request).unwrap();
|
||||
}
|
||||
));
|
||||
|
||||
@@ -22,6 +22,10 @@ use tauri::{api::process::Command, async_runtime::block_on, App, AppHandle, Mana
|
||||
|
||||
static OPEN_WINDOWS_COUNTER: AtomicU16 = AtomicU16::new(0);
|
||||
|
||||
pub fn is_window_opened() -> bool {
|
||||
OPEN_WINDOWS_COUNTER.load(Ordering::Acquire) == 0 // 0 means no window open or windows is initialized
|
||||
}
|
||||
|
||||
pub fn reset_window_open_counter() {
|
||||
OPEN_WINDOWS_COUNTER.store(0, Ordering::Release);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
"@types/fs-extra": "11.0.4",
|
||||
"@types/lodash-es": "4.17.12",
|
||||
"@types/node": "20.14.14",
|
||||
"@typescript-eslint/eslint-plugin": "8.0.0",
|
||||
"@typescript-eslint/parser": "8.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.0.1",
|
||||
"@typescript-eslint/parser": "8.0.1",
|
||||
"autoprefixer": "10.4.20",
|
||||
"conventional-changelog-conventionalcommits": "8.0.0",
|
||||
"cross-env": "7.0.3",
|
||||
@@ -79,7 +79,7 @@
|
||||
"knip": "5.27.0",
|
||||
"lint-staged": "15.2.8",
|
||||
"npm-run-all2": "6.2.2",
|
||||
"postcss": "8.4.40",
|
||||
"postcss": "8.4.41",
|
||||
"postcss-html": "1.7.0",
|
||||
"postcss-import": "16.1.0",
|
||||
"postcss-scss": "4.0.9",
|
||||
|
||||
Generated
+121
-111
@@ -44,14 +44,14 @@ importers:
|
||||
specifier: 20.14.14
|
||||
version: 20.14.14
|
||||
'@typescript-eslint/eslint-plugin':
|
||||
specifier: 8.0.0
|
||||
version: 8.0.0(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)
|
||||
specifier: 8.0.1
|
||||
version: 8.0.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/parser':
|
||||
specifier: 8.0.0
|
||||
version: 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
specifier: 8.0.1
|
||||
version: 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
autoprefixer:
|
||||
specifier: 10.4.20
|
||||
version: 10.4.20(postcss@8.4.40)
|
||||
version: 10.4.20(postcss@8.4.41)
|
||||
conventional-changelog-conventionalcommits:
|
||||
specifier: 8.0.0
|
||||
version: 8.0.0
|
||||
@@ -69,16 +69,16 @@ importers:
|
||||
version: 9.1.0(eslint@8.57.0)
|
||||
eslint-config-standard:
|
||||
specifier: 17.1.0
|
||||
version: 17.1.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint-plugin-n@16.6.2(eslint@8.57.0))(eslint-plugin-promise@6.6.0(eslint@8.57.0))(eslint@8.57.0)
|
||||
version: 17.1.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint-plugin-n@16.6.2(eslint@8.57.0))(eslint-plugin-promise@6.6.0(eslint@8.57.0))(eslint@8.57.0)
|
||||
eslint-import-resolver-alias:
|
||||
specifier: 1.1.2
|
||||
version: 1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))
|
||||
version: 1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))
|
||||
eslint-plugin-html:
|
||||
specifier: 8.1.1
|
||||
version: 8.1.1
|
||||
eslint-plugin-import:
|
||||
specifier: 2.29.1
|
||||
version: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)
|
||||
version: 2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)
|
||||
eslint-plugin-n:
|
||||
specifier: 16.6.2
|
||||
version: 16.6.2(eslint@8.57.0)
|
||||
@@ -107,17 +107,17 @@ importers:
|
||||
specifier: 6.2.2
|
||||
version: 6.2.2
|
||||
postcss:
|
||||
specifier: 8.4.40
|
||||
version: 8.4.40
|
||||
specifier: 8.4.41
|
||||
version: 8.4.41
|
||||
postcss-html:
|
||||
specifier: 1.7.0
|
||||
version: 1.7.0
|
||||
postcss-import:
|
||||
specifier: 16.1.0
|
||||
version: 16.1.0(postcss@8.4.40)
|
||||
version: 16.1.0(postcss@8.4.41)
|
||||
postcss-scss:
|
||||
specifier: 4.0.9
|
||||
version: 4.0.9(postcss@8.4.40)
|
||||
version: 4.0.9(postcss@8.4.41)
|
||||
prettier:
|
||||
specifier: 3.3.3
|
||||
version: 3.3.3
|
||||
@@ -338,7 +338,7 @@ importers:
|
||||
version: vite-plugin-monaco-editor-new@1.1.3(monaco-editor@0.50.0)
|
||||
vite-plugin-sass-dts:
|
||||
specifier: 1.3.25
|
||||
version: 1.3.25(postcss@8.4.40)(prettier@3.3.3)(sass@1.77.8)(vite@5.3.5(@types/node@20.14.14)(less@4.2.0)(sass@1.77.8)(stylus@0.62.0))
|
||||
version: 1.3.25(postcss@8.4.41)(prettier@3.3.3)(sass@1.77.8)(vite@5.3.5(@types/node@20.14.14)(less@4.2.0)(sass@1.77.8)(stylus@0.62.0))
|
||||
vite-plugin-svgr:
|
||||
specifier: 4.2.0
|
||||
version: 4.2.0(rollup@4.17.2)(typescript@5.5.4)(vite@5.3.5(@types/node@20.14.14)(less@4.2.0)(sass@1.77.8)(stylus@0.62.0))
|
||||
@@ -429,8 +429,8 @@ importers:
|
||||
specifier: 0.5.5
|
||||
version: 0.5.5
|
||||
adm-zip:
|
||||
specifier: 0.5.14
|
||||
version: 0.5.14
|
||||
specifier: 0.5.15
|
||||
version: 0.5.15
|
||||
colorize-template:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0
|
||||
@@ -456,8 +456,8 @@ importers:
|
||||
specifier: 7.4.3
|
||||
version: 7.4.3
|
||||
telegram:
|
||||
specifier: 2.23.6
|
||||
version: 2.23.6
|
||||
specifier: 2.23.10
|
||||
version: 2.23.10
|
||||
undici:
|
||||
specifier: 6.19.5
|
||||
version: 6.19.5
|
||||
@@ -2249,8 +2249,8 @@ packages:
|
||||
'@types/yauzl@2.10.3':
|
||||
resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.0.0':
|
||||
resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==}
|
||||
'@typescript-eslint/eslint-plugin@8.0.1':
|
||||
resolution: {integrity: sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
|
||||
@@ -2260,8 +2260,8 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/parser@8.0.0':
|
||||
resolution: {integrity: sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==}
|
||||
'@typescript-eslint/parser@8.0.1':
|
||||
resolution: {integrity: sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
@@ -2270,12 +2270,12 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/scope-manager@8.0.0':
|
||||
resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==}
|
||||
'@typescript-eslint/scope-manager@8.0.1':
|
||||
resolution: {integrity: sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/type-utils@8.0.0':
|
||||
resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==}
|
||||
'@typescript-eslint/type-utils@8.0.1':
|
||||
resolution: {integrity: sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
@@ -2283,12 +2283,12 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/types@8.0.0':
|
||||
resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==}
|
||||
'@typescript-eslint/types@8.0.1':
|
||||
resolution: {integrity: sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.0.0':
|
||||
resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==}
|
||||
'@typescript-eslint/typescript-estree@8.0.1':
|
||||
resolution: {integrity: sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
@@ -2296,14 +2296,14 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/utils@8.0.0':
|
||||
resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==}
|
||||
'@typescript-eslint/utils@8.0.1':
|
||||
resolution: {integrity: sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.0.0':
|
||||
resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==}
|
||||
'@typescript-eslint/visitor-keys@8.0.1':
|
||||
resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@ungap/structured-clone@1.2.0':
|
||||
@@ -2351,8 +2351,8 @@ packages:
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
adm-zip@0.5.14:
|
||||
resolution: {integrity: sha512-DnyqqifT4Jrcvb8USYjp6FHtBpEIz1mnXu6pTRHZ0RL69LbQYiO+0lDFg5+OKA7U29oWSs3a/i8fhn8ZcceIWg==}
|
||||
adm-zip@0.5.15:
|
||||
resolution: {integrity: sha512-jYPWSeOA8EFoZnucrKCNihqBjoEGQSU4HKgHYQgKNEQ0pQF9a/DYuo/+fAxY76k4qe75LUlLWpAM1QWcBMTOKw==}
|
||||
engines: {node: '>=12.0'}
|
||||
|
||||
agent-base@7.1.1:
|
||||
@@ -5098,6 +5098,10 @@ packages:
|
||||
resolution: {integrity: sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
|
||||
postcss@8.4.41:
|
||||
resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
|
||||
prelude-ls@1.2.1:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@@ -5825,8 +5829,8 @@ packages:
|
||||
resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
telegram@2.23.6:
|
||||
resolution: {integrity: sha512-tMHsjhccrLj0LTsnq7zPHc0MVnjWXMvOInlv2Et351bsrg62O6PH4MThMCnsg6ZaJHcXvJXsHJ63EcRnOo2ayg==}
|
||||
telegram@2.23.10:
|
||||
resolution: {integrity: sha512-ofn6Jhig83GW0wHxpDPoP4EffNKMloZMOhSdN6ltgWUSi3rE6+KWQDi2Gcvem2Xp+sodUw9uBDyq71aLcE3iKA==}
|
||||
|
||||
term-size@1.2.0:
|
||||
resolution: {integrity: sha512-7dPUZQGy/+m3/wjVz3ZW5dobSoD/02NxJpoXUX0WIyjfVS3l0c+b/+9phIDFA7FHzkYtwtMFgeGZ/Y8jVTeqQQ==}
|
||||
@@ -8126,11 +8130,11 @@ snapshots:
|
||||
|
||||
'@types/postcss-modules-local-by-default@4.0.2':
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
'@types/postcss-modules-scope@3.0.4':
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
'@types/prop-types@15.7.12': {}
|
||||
|
||||
@@ -8151,14 +8155,14 @@ snapshots:
|
||||
'@types/node': 20.14.14
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)':
|
||||
'@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.10.0
|
||||
'@typescript-eslint/parser': 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/scope-manager': 8.0.0
|
||||
'@typescript-eslint/type-utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/visitor-keys': 8.0.0
|
||||
'@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/scope-manager': 8.0.1
|
||||
'@typescript-eslint/type-utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/visitor-keys': 8.0.1
|
||||
eslint: 8.57.0
|
||||
graphemer: 1.4.0
|
||||
ignore: 5.3.1
|
||||
@@ -8169,12 +8173,12 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4)':
|
||||
'@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4)':
|
||||
dependencies:
|
||||
'@typescript-eslint/scope-manager': 8.0.0
|
||||
'@typescript-eslint/types': 8.0.0
|
||||
'@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4)
|
||||
'@typescript-eslint/visitor-keys': 8.0.0
|
||||
'@typescript-eslint/scope-manager': 8.0.1
|
||||
'@typescript-eslint/types': 8.0.1
|
||||
'@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4)
|
||||
'@typescript-eslint/visitor-keys': 8.0.1
|
||||
debug: 4.3.6
|
||||
eslint: 8.57.0
|
||||
optionalDependencies:
|
||||
@@ -8182,15 +8186,15 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.0.0':
|
||||
'@typescript-eslint/scope-manager@8.0.1':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.0.0
|
||||
'@typescript-eslint/visitor-keys': 8.0.0
|
||||
'@typescript-eslint/types': 8.0.1
|
||||
'@typescript-eslint/visitor-keys': 8.0.1
|
||||
|
||||
'@typescript-eslint/type-utils@8.0.0(eslint@8.57.0)(typescript@5.5.4)':
|
||||
'@typescript-eslint/type-utils@8.0.1(eslint@8.57.0)(typescript@5.5.4)':
|
||||
dependencies:
|
||||
'@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4)
|
||||
'@typescript-eslint/utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4)
|
||||
'@typescript-eslint/utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
debug: 4.3.6
|
||||
ts-api-utils: 1.3.0(typescript@5.5.4)
|
||||
optionalDependencies:
|
||||
@@ -8199,12 +8203,12 @@ snapshots:
|
||||
- eslint
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/types@8.0.0': {}
|
||||
'@typescript-eslint/types@8.0.1': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.0.0(typescript@5.5.4)':
|
||||
'@typescript-eslint/typescript-estree@8.0.1(typescript@5.5.4)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.0.0
|
||||
'@typescript-eslint/visitor-keys': 8.0.0
|
||||
'@typescript-eslint/types': 8.0.1
|
||||
'@typescript-eslint/visitor-keys': 8.0.1
|
||||
debug: 4.3.6
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
@@ -8216,20 +8220,20 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.0.0(eslint@8.57.0)(typescript@5.5.4)':
|
||||
'@typescript-eslint/utils@8.0.1(eslint@8.57.0)(typescript@5.5.4)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
|
||||
'@typescript-eslint/scope-manager': 8.0.0
|
||||
'@typescript-eslint/types': 8.0.0
|
||||
'@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4)
|
||||
'@typescript-eslint/scope-manager': 8.0.1
|
||||
'@typescript-eslint/types': 8.0.1
|
||||
'@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4)
|
||||
eslint: 8.57.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.0.0':
|
||||
'@typescript-eslint/visitor-keys@8.0.1':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.0.0
|
||||
'@typescript-eslint/types': 8.0.1
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
'@ungap/structured-clone@1.2.0': {}
|
||||
@@ -8275,7 +8279,7 @@ snapshots:
|
||||
|
||||
acorn@8.12.1: {}
|
||||
|
||||
adm-zip@0.5.14: {}
|
||||
adm-zip@0.5.15: {}
|
||||
|
||||
agent-base@7.1.1:
|
||||
dependencies:
|
||||
@@ -8443,14 +8447,14 @@ snapshots:
|
||||
|
||||
asynckit@0.4.0: {}
|
||||
|
||||
autoprefixer@10.4.20(postcss@8.4.40):
|
||||
autoprefixer@10.4.20(postcss@8.4.41):
|
||||
dependencies:
|
||||
browserslist: 4.23.3
|
||||
caniuse-lite: 1.0.30001646
|
||||
fraction.js: 4.3.7
|
||||
normalize-range: 0.1.2
|
||||
picocolors: 1.0.1
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
postcss-value-parser: 4.2.0
|
||||
|
||||
autoprefixer@9.8.8:
|
||||
@@ -9396,16 +9400,16 @@ snapshots:
|
||||
dependencies:
|
||||
eslint: 8.57.0
|
||||
|
||||
eslint-config-standard@17.1.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint-plugin-n@16.6.2(eslint@8.57.0))(eslint-plugin-promise@6.6.0(eslint@8.57.0))(eslint@8.57.0):
|
||||
eslint-config-standard@17.1.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint-plugin-n@16.6.2(eslint@8.57.0))(eslint-plugin-promise@6.6.0(eslint@8.57.0))(eslint@8.57.0):
|
||||
dependencies:
|
||||
eslint: 8.57.0
|
||||
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)
|
||||
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)
|
||||
eslint-plugin-n: 16.6.2(eslint@8.57.0)
|
||||
eslint-plugin-promise: 6.6.0(eslint@8.57.0)
|
||||
|
||||
eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)):
|
||||
eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)):
|
||||
dependencies:
|
||||
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)
|
||||
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)
|
||||
|
||||
eslint-import-resolver-node@0.3.9:
|
||||
dependencies:
|
||||
@@ -9415,11 +9419,11 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0):
|
||||
eslint-module-utils@2.8.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0):
|
||||
dependencies:
|
||||
debug: 3.2.7
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
eslint: 8.57.0
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
transitivePeerDependencies:
|
||||
@@ -9436,7 +9440,7 @@ snapshots:
|
||||
dependencies:
|
||||
htmlparser2: 9.1.0
|
||||
|
||||
eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0):
|
||||
eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0):
|
||||
dependencies:
|
||||
array-includes: 3.1.8
|
||||
array.prototype.findlastindex: 1.2.5
|
||||
@@ -9446,7 +9450,7 @@ snapshots:
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.57.0
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0)
|
||||
eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint@8.57.0)
|
||||
hasown: 2.0.2
|
||||
is-core-module: 2.13.1
|
||||
is-glob: 4.0.3
|
||||
@@ -9457,7 +9461,7 @@ snapshots:
|
||||
semver: 6.3.1
|
||||
tsconfig-paths: 3.15.0
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 8.0.0(eslint@8.57.0)(typescript@5.5.4)
|
||||
'@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4)
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
@@ -11205,19 +11209,19 @@ snapshots:
|
||||
dependencies:
|
||||
htmlparser2: 8.0.2
|
||||
js-tokens: 9.0.0
|
||||
postcss: 8.4.40
|
||||
postcss-safe-parser: 6.0.0(postcss@8.4.40)
|
||||
postcss: 8.4.41
|
||||
postcss-safe-parser: 6.0.0(postcss@8.4.41)
|
||||
|
||||
postcss-import@15.1.0(postcss@8.4.40):
|
||||
postcss-import@15.1.0(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
postcss-value-parser: 4.2.0
|
||||
read-cache: 1.0.0
|
||||
resolve: 1.22.8
|
||||
|
||||
postcss-import@16.1.0(postcss@8.4.40):
|
||||
postcss-import@16.1.0(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
postcss-value-parser: 4.2.0
|
||||
read-cache: 1.0.0
|
||||
resolve: 1.22.8
|
||||
@@ -11227,10 +11231,10 @@ snapshots:
|
||||
camelcase-css: 2.0.1
|
||||
postcss: 7.0.39
|
||||
|
||||
postcss-js@4.0.1(postcss@8.4.40):
|
||||
postcss-js@4.0.1(postcss@8.4.41):
|
||||
dependencies:
|
||||
camelcase-css: 2.0.1
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
postcss-load-config@3.1.4(postcss@8.4.38):
|
||||
dependencies:
|
||||
@@ -11239,12 +11243,12 @@ snapshots:
|
||||
optionalDependencies:
|
||||
postcss: 8.4.38
|
||||
|
||||
postcss-load-config@4.0.2(postcss@8.4.40):
|
||||
postcss-load-config@4.0.2(postcss@8.4.41):
|
||||
dependencies:
|
||||
lilconfig: 3.1.1
|
||||
yaml: 2.4.2
|
||||
optionalDependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
postcss-media-query-parser@0.2.3: {}
|
||||
|
||||
@@ -11269,24 +11273,24 @@ snapshots:
|
||||
postcss: 7.0.39
|
||||
postcss-selector-parser: 6.1.1
|
||||
|
||||
postcss-nested@6.0.1(postcss@8.4.40):
|
||||
postcss-nested@6.0.1(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
postcss-selector-parser: 6.1.1
|
||||
|
||||
postcss-resolve-nested-selector@0.1.4: {}
|
||||
|
||||
postcss-safe-parser@6.0.0(postcss@8.4.40):
|
||||
postcss-safe-parser@6.0.0(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
postcss-safe-parser@7.0.0(postcss@8.4.40):
|
||||
postcss-safe-parser@7.0.0(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
postcss-scss@4.0.9(postcss@8.4.40):
|
||||
postcss-scss@4.0.9(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
postcss-selector-parser@6.0.16:
|
||||
dependencies:
|
||||
@@ -11303,9 +11307,9 @@ snapshots:
|
||||
cssesc: 3.0.0
|
||||
util-deprecate: 1.0.2
|
||||
|
||||
postcss-sorting@8.0.2(postcss@8.4.40):
|
||||
postcss-sorting@8.0.2(postcss@8.4.41):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
|
||||
postcss-value-parser@3.3.1: {}
|
||||
|
||||
@@ -11340,6 +11344,12 @@ snapshots:
|
||||
picocolors: 1.0.1
|
||||
source-map-js: 1.2.0
|
||||
|
||||
postcss@8.4.41:
|
||||
dependencies:
|
||||
nanoid: 3.3.7
|
||||
picocolors: 1.0.1
|
||||
source-map-js: 1.2.0
|
||||
|
||||
prelude-ls@1.2.1: {}
|
||||
|
||||
prepend-http@1.0.4: {}
|
||||
@@ -11957,8 +11967,8 @@ snapshots:
|
||||
|
||||
stylelint-order@6.0.4(stylelint@16.8.1(typescript@5.5.4)):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss-sorting: 8.0.2(postcss@8.4.40)
|
||||
postcss: 8.4.41
|
||||
postcss-sorting: 8.0.2(postcss@8.4.41)
|
||||
stylelint: 16.8.1(typescript@5.5.4)
|
||||
|
||||
stylelint-scss@6.5.0(stylelint@16.8.1(typescript@5.5.4)):
|
||||
@@ -12001,9 +12011,9 @@ snapshots:
|
||||
micromatch: 4.0.7
|
||||
normalize-path: 3.0.0
|
||||
picocolors: 1.0.1
|
||||
postcss: 8.4.40
|
||||
postcss: 8.4.41
|
||||
postcss-resolve-nested-selector: 0.1.4
|
||||
postcss-safe-parser: 7.0.0(postcss@8.4.40)
|
||||
postcss-safe-parser: 7.0.0(postcss@8.4.41)
|
||||
postcss-selector-parser: 6.1.1
|
||||
postcss-value-parser: 4.2.0
|
||||
resolve-from: 5.0.0
|
||||
@@ -12136,11 +12146,11 @@ snapshots:
|
||||
normalize-path: 3.0.0
|
||||
object-hash: 3.0.0
|
||||
picocolors: 1.0.1
|
||||
postcss: 8.4.40
|
||||
postcss-import: 15.1.0(postcss@8.4.40)
|
||||
postcss-js: 4.0.1(postcss@8.4.40)
|
||||
postcss-load-config: 4.0.2(postcss@8.4.40)
|
||||
postcss-nested: 6.0.1(postcss@8.4.40)
|
||||
postcss: 8.4.41
|
||||
postcss-import: 15.1.0(postcss@8.4.41)
|
||||
postcss-js: 4.0.1(postcss@8.4.41)
|
||||
postcss-load-config: 4.0.2(postcss@8.4.41)
|
||||
postcss-nested: 6.0.1(postcss@8.4.41)
|
||||
postcss-selector-parser: 6.1.0
|
||||
resolve: 1.22.8
|
||||
sucrase: 3.35.0
|
||||
@@ -12156,7 +12166,7 @@ snapshots:
|
||||
mkdirp: 3.0.1
|
||||
yallist: 5.0.0
|
||||
|
||||
telegram@2.23.6:
|
||||
telegram@2.23.10:
|
||||
dependencies:
|
||||
'@cryptography/aes': 0.1.1
|
||||
async-mutex: 0.3.2
|
||||
@@ -12521,10 +12531,10 @@ snapshots:
|
||||
esbuild: 0.19.12
|
||||
monaco-editor: 0.50.0
|
||||
|
||||
vite-plugin-sass-dts@1.3.25(postcss@8.4.40)(prettier@3.3.3)(sass@1.77.8)(vite@5.3.5(@types/node@20.14.14)(less@4.2.0)(sass@1.77.8)(stylus@0.62.0)):
|
||||
vite-plugin-sass-dts@1.3.25(postcss@8.4.41)(prettier@3.3.3)(sass@1.77.8)(vite@5.3.5(@types/node@20.14.14)(less@4.2.0)(sass@1.77.8)(stylus@0.62.0)):
|
||||
dependencies:
|
||||
postcss: 8.4.40
|
||||
postcss-js: 4.0.1(postcss@8.4.40)
|
||||
postcss: 8.4.41
|
||||
postcss-js: 4.0.1(postcss@8.4.41)
|
||||
prettier: 3.3.3
|
||||
sass: 1.77.8
|
||||
vite: 5.3.5(@types/node@20.14.14)(less@4.2.0)(sass@1.77.8)(stylus@0.62.0)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"devDependencies": {
|
||||
"@octokit/types": "13.5.0",
|
||||
"@types/adm-zip": "0.5.5",
|
||||
"adm-zip": "0.5.14",
|
||||
"adm-zip": "0.5.15",
|
||||
"colorize-template": "1.0.0",
|
||||
"consola": "3.2.3",
|
||||
"fs-extra": "11.2.0",
|
||||
@@ -19,7 +19,7 @@
|
||||
"octokit": "4.0.2",
|
||||
"picocolors": "1.0.1",
|
||||
"tar": "7.4.3",
|
||||
"telegram": "2.23.6",
|
||||
"telegram": "2.23.10",
|
||||
"undici": "6.19.5"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+12
-18
@@ -61,7 +61,7 @@ jobs:
|
||||
|
||||
- name: Verify mmdb files
|
||||
run: |
|
||||
cd ./output/maxmind || exit 1
|
||||
cd ./output || exit 1
|
||||
go install -v github.com/maxmind/mmdbverify@latest
|
||||
for name in $(ls *.mmdb); do
|
||||
$(go env GOPATH)/bin/mmdbverify -file ${name}
|
||||
@@ -69,14 +69,14 @@ jobs:
|
||||
|
||||
- name: Generate sha256 checksum for dat files
|
||||
run: |
|
||||
cd ./output/dat || exit 1
|
||||
cd ./output || exit 1
|
||||
for name in $(ls *.dat); do
|
||||
sha256sum ${name} > ./${name}.sha256sum
|
||||
done
|
||||
|
||||
- name: Generate sha256 checksum for mmdb files
|
||||
run: |
|
||||
cd ./output/maxmind || exit 1
|
||||
cd ./output || exit 1
|
||||
for name in $(ls *.mmdb); do
|
||||
sha256sum ${name} > ./${name}.sha256sum
|
||||
done
|
||||
@@ -85,21 +85,14 @@ jobs:
|
||||
env:
|
||||
LICENSE_KEY: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
|
||||
run: |
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" -o GeoLite2-ASN.tar.gz
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-ASN-CSV.zip
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz" -o GeoLite2-Country.tar.gz
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-Country-CSV.zip
|
||||
|
||||
- name: Move files to publish directory
|
||||
run: |
|
||||
mkdir -p publish
|
||||
mv ./output/dat/*.dat ./output/dat/*.sha256sum ./output/maxmind/*.mmdb ./output/maxmind/*.sha256sum *.gz *.zip ./publish/
|
||||
cp -fpPR ./output/text ./publish
|
||||
cp -fpPR ./output/srs ./publish
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" -o ./output/GeoLite2-ASN.tar.gz
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o ./output/GeoLite2-ASN-CSV.zip
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz" -o ./output/GeoLite2-Country.tar.gz
|
||||
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o ./output/GeoLite2-Country-CSV.zip
|
||||
|
||||
- name: Git push assets to "release" branch
|
||||
run: |
|
||||
cd publish || exit 1
|
||||
cd output || exit 1
|
||||
git init
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
@@ -111,18 +104,19 @@ jobs:
|
||||
|
||||
- name: Purge jsdelivr CDN
|
||||
run: |
|
||||
cd publish || exit 1
|
||||
cd output || exit 1
|
||||
for file in $(ls); do
|
||||
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/${file}"
|
||||
done
|
||||
|
||||
- name: Remove some files to avoid publishing to GitHub release
|
||||
run: rm -rf ./publish/*.{gz,zip} ./publish/text ./publish/srs
|
||||
run: rm -rf ./output/*.{gz,zip} ./output/{clash,dat,nginx,srs,surge,text}
|
||||
|
||||
- name: Upload files to GitHub release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file_glob: true
|
||||
file: ./publish/*
|
||||
file: ./output/*
|
||||
release_name: ${{ env.RELEASE_NAME }}
|
||||
tag: ${{ env.TAG_NAME }}
|
||||
|
||||
@@ -104,6 +104,19 @@
|
||||
"onlyIPType": "ipv4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "add",
|
||||
"args": {
|
||||
"inputDir": "./data",
|
||||
"onlyIPType": "ipv4",
|
||||
"removePrefixesInLine": [
|
||||
"iptables -A INPUT -s",
|
||||
"iptables -A INPUT -d"
|
||||
],
|
||||
"removeSuffixesInLine": ["-j ACCEPT", "-j DROP"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "add",
|
||||
@@ -113,6 +126,26 @@
|
||||
"onlyIPType": "ipv6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "add",
|
||||
"args": {
|
||||
"name": "mylist",
|
||||
"uri": "./an/example/dir/mycidr.txt",
|
||||
"onlyIPType": "ipv6",
|
||||
"removePrefixesInLine": ["allow from", "deny from"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "add",
|
||||
"args": {
|
||||
"name": "mylist",
|
||||
"uri": "./an/example/dir/mycidr.txt",
|
||||
"onlyIPType": "ipv6",
|
||||
"removeSuffixesInLine": [";", ","]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "add",
|
||||
@@ -243,6 +276,43 @@
|
||||
"onlyIPType": "ipv6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./publish",
|
||||
"onlyIPType": "ipv6",
|
||||
"addPrefixInLine": "iptables -A INPUT -d ",
|
||||
"addSuffixInLine": " -j DROP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"addPrefixInLine": "deny from "
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output/nginx/allow",
|
||||
"outputExtension": ".conf",
|
||||
"addPrefixInLine": "allow ",
|
||||
"addSuffixInLine": ";"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output/nginx/deny",
|
||||
"outputExtension": ".conf",
|
||||
"addPrefixInLine": "deny ",
|
||||
"addSuffixInLine": ";"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stdout",
|
||||
"action": "output"
|
||||
@@ -292,6 +362,13 @@
|
||||
"wantedList": ["cn", "private", "test"],
|
||||
"onlyIPType": "ipv4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "surgeRuleSet",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"addSuffixInLine": ",no-resolve"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
"type": "v2rayGeoIPDat",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"outputName": "geoip.dat"
|
||||
}
|
||||
},
|
||||
@@ -92,6 +93,7 @@
|
||||
"type": "v2rayGeoIPDat",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"outputName": "geoip-only-cn-private.dat",
|
||||
"wantedList": ["cn", "private"]
|
||||
}
|
||||
@@ -100,6 +102,7 @@
|
||||
"type": "v2rayGeoIPDat",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"outputName": "geoip-asn.dat",
|
||||
"wantedList": [
|
||||
"cloudflare",
|
||||
@@ -117,14 +120,23 @@
|
||||
"type": "v2rayGeoIPDat",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"oneFilePerList": true,
|
||||
"wantedList": ["cn", "private"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "v2rayGeoIPDat",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"oneFilePerList": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "maxmindMMDB",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"outputName": "Country.mmdb",
|
||||
"overwriteList": [
|
||||
"cn",
|
||||
@@ -144,6 +156,7 @@
|
||||
"type": "maxmindMMDB",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"outputName": "Country-only-cn-private.mmdb",
|
||||
"wantedList": ["cn", "private"]
|
||||
}
|
||||
@@ -152,6 +165,7 @@
|
||||
"type": "maxmindMMDB",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output",
|
||||
"outputName": "Country-asn.mmdb",
|
||||
"wantedList": [
|
||||
"cloudflare",
|
||||
@@ -172,6 +186,41 @@
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output/nginx/allow",
|
||||
"outputExtension": ".conf",
|
||||
"addPrefixInLine": "allow ",
|
||||
"addSuffixInLine": ";"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"outputDir": "./output/nginx/deny",
|
||||
"outputExtension": ".conf",
|
||||
"addPrefixInLine": "deny ",
|
||||
"addSuffixInLine": ";"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "clashRuleSetClassical",
|
||||
"action": "output"
|
||||
},
|
||||
{
|
||||
"type": "clashRuleSet",
|
||||
"action": "output"
|
||||
},
|
||||
{
|
||||
"type": "surgeRuleSet",
|
||||
"action": "output",
|
||||
"args": {
|
||||
"addSuffixInLine": ",no-resolve"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
@@ -159,7 +160,7 @@ func (m *mmdbOut) getEntryNameListInOrder(container lib.Container) []string {
|
||||
}
|
||||
}
|
||||
|
||||
list := make([]string, 0, 200)
|
||||
list := make([]string, 0, 300)
|
||||
for entry := range container.Loop() {
|
||||
name := entry.GetName()
|
||||
_, found := overwriteMap[name]
|
||||
@@ -169,6 +170,9 @@ func (m *mmdbOut) getEntryNameListInOrder(container lib.Container) []string {
|
||||
list = append(list, name)
|
||||
}
|
||||
|
||||
// Sort the lists
|
||||
slices.Sort(list)
|
||||
|
||||
// Make sure the names in overwriteList are written at last
|
||||
list = append(list, overwriteList...)
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ type textIn struct {
|
||||
URI string
|
||||
InputDir string
|
||||
OnlyIPType lib.IPType
|
||||
|
||||
RemovePrefixesInLine []string
|
||||
RemoveSuffixesInLine []string
|
||||
}
|
||||
|
||||
func (t *textIn) scanFile(reader io.Reader, entry *lib.Entry) error {
|
||||
@@ -40,10 +43,8 @@ func (t *textIn) scanFile(reader io.Reader, entry *lib.Entry) error {
|
||||
func (t *textIn) scanFileForTextIn(reader io.Reader, entry *lib.Entry) error {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
for scanner.Scan() {
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
line := scanner.Text()
|
||||
|
||||
line, _, _ = strings.Cut(line, "#")
|
||||
line, _, _ = strings.Cut(line, "//")
|
||||
line, _, _ = strings.Cut(line, "/*")
|
||||
@@ -51,6 +52,19 @@ func (t *textIn) scanFileForTextIn(reader io.Reader, entry *lib.Entry) error {
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
line = strings.ToLower(line)
|
||||
for _, prefix := range t.RemovePrefixesInLine {
|
||||
line = strings.TrimSpace(strings.TrimPrefix(line, strings.ToLower(strings.TrimSpace(prefix))))
|
||||
}
|
||||
for _, suffix := range t.RemoveSuffixesInLine {
|
||||
line = strings.TrimSpace(strings.TrimSuffix(line, strings.ToLower(strings.TrimSpace(suffix))))
|
||||
}
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err := entry.AddPrefix(line); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -110,9 +124,17 @@ func (t *textIn) scanFileForClashClassicalRuleSetIn(reader io.Reader, entry *lib
|
||||
continue
|
||||
}
|
||||
|
||||
// Examples:
|
||||
// IP-CIDR,162.208.16.0/24
|
||||
// IP-CIDR6,2a0b:e40:1::/48
|
||||
// IP-CIDR,162.208.16.0/24,no-resolve
|
||||
// IP-CIDR6,2a0b:e40:1::/48,no-resolve
|
||||
if strings.HasPrefix(line, "ip-cidr,") || strings.HasPrefix(line, "ip-cidr6,") {
|
||||
_, line, _ = strings.Cut(line, ",")
|
||||
line = strings.TrimSpace(line)
|
||||
parts := strings.Split(line, ",")
|
||||
if len(parts) < 2 {
|
||||
continue
|
||||
}
|
||||
line = strings.TrimSpace(parts[1])
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
@@ -128,17 +150,27 @@ func (t *textIn) scanFileForClashClassicalRuleSetIn(reader io.Reader, entry *lib
|
||||
func (t *textIn) scanFileForSurgeRuleSetIn(reader io.Reader, entry *lib.Entry) error {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
for scanner.Scan() {
|
||||
line := strings.ToLower(strings.TrimSpace(scanner.Text()))
|
||||
line := scanner.Text()
|
||||
|
||||
line, _, _ = strings.Cut(line, "#")
|
||||
line, _, _ = strings.Cut(line, "//")
|
||||
line, _, _ = strings.Cut(line, "/*")
|
||||
line = strings.ToLower(strings.TrimSpace(line))
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Examples:
|
||||
// IP-CIDR,162.208.16.0/24
|
||||
// IP-CIDR6,2a0b:e40:1::/48
|
||||
// IP-CIDR,162.208.16.0/24,no-resolve
|
||||
// IP-CIDR6,2a0b:e40:1::/48,no-resolve
|
||||
if strings.HasPrefix(line, "ip-cidr,") || strings.HasPrefix(line, "ip-cidr6,") {
|
||||
line, _, _ = strings.Cut(line, "#")
|
||||
line, _, _ = strings.Cut(line, "//")
|
||||
line, _, _ = strings.Cut(line, "/*")
|
||||
_, line, _ = strings.Cut(line, ",")
|
||||
line = strings.TrimSpace(line)
|
||||
parts := strings.Split(line, ",")
|
||||
if len(parts) < 2 {
|
||||
continue
|
||||
}
|
||||
line = strings.TrimSpace(parts[1])
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -23,15 +23,23 @@ type textOut struct {
|
||||
Action lib.Action
|
||||
Description string
|
||||
OutputDir string
|
||||
OutputExt string
|
||||
Want []string
|
||||
OnlyIPType lib.IPType
|
||||
|
||||
AddPrefixInLine string
|
||||
AddSuffixInLine string
|
||||
}
|
||||
|
||||
func newTextOut(iType string, action lib.Action, data json.RawMessage) (lib.OutputConverter, error) {
|
||||
var tmp struct {
|
||||
OutputDir string `json:"outputDir"`
|
||||
OutputExt string `json:"outputExtension"`
|
||||
Want []string `json:"wantedList"`
|
||||
OnlyIPType lib.IPType `json:"onlyIPType"`
|
||||
|
||||
AddPrefixInLine string `json:"addPrefixInLine"`
|
||||
AddSuffixInLine string `json:"addSuffixInLine"`
|
||||
}
|
||||
|
||||
if len(data) > 0 {
|
||||
@@ -53,13 +61,21 @@ func newTextOut(iType string, action lib.Action, data json.RawMessage) (lib.Outp
|
||||
}
|
||||
}
|
||||
|
||||
if tmp.OutputExt == "" {
|
||||
tmp.OutputExt = ".txt"
|
||||
}
|
||||
|
||||
return &textOut{
|
||||
Type: iType,
|
||||
Action: action,
|
||||
Description: descTextOut,
|
||||
OutputDir: tmp.OutputDir,
|
||||
OutputExt: tmp.OutputExt,
|
||||
Want: tmp.Want,
|
||||
OnlyIPType: tmp.OnlyIPType,
|
||||
|
||||
AddPrefixInLine: tmp.AddPrefixInLine,
|
||||
AddSuffixInLine: tmp.AddSuffixInLine,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -101,7 +117,13 @@ func (t *textOut) marshalBytes(entry *lib.Entry) ([]byte, error) {
|
||||
|
||||
func (t *textOut) marshalBytesForTextOut(buf *bytes.Buffer, entryCidr []string) error {
|
||||
for _, cidr := range entryCidr {
|
||||
if t.AddPrefixInLine != "" {
|
||||
buf.WriteString(t.AddPrefixInLine)
|
||||
}
|
||||
buf.WriteString(cidr)
|
||||
if t.AddSuffixInLine != "" {
|
||||
buf.WriteString(t.AddSuffixInLine)
|
||||
}
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
return nil
|
||||
@@ -149,6 +171,9 @@ func (t *textOut) marshalBytesForSurgeRuleSetOut(buf *bytes.Buffer, entryCidr []
|
||||
buf.WriteString("IP-CIDR6,")
|
||||
}
|
||||
buf.WriteString(cidr)
|
||||
if t.AddSuffixInLine != "" {
|
||||
buf.WriteString(t.AddSuffixInLine)
|
||||
}
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ func newTextIn(iType string, action lib.Action, data json.RawMessage) (lib.Input
|
||||
URI string `json:"uri"`
|
||||
InputDir string `json:"inputDir"`
|
||||
OnlyIPType lib.IPType `json:"onlyIPType"`
|
||||
|
||||
RemovePrefixesInLine []string `json:"removePrefixesInLine"`
|
||||
RemoveSuffixesInLine []string `json:"removeSuffixesInLine"`
|
||||
}
|
||||
|
||||
if strings.TrimSpace(iType) == "" {
|
||||
@@ -60,6 +63,9 @@ func newTextIn(iType string, action lib.Action, data json.RawMessage) (lib.Input
|
||||
URI: tmp.URI,
|
||||
InputDir: tmp.InputDir,
|
||||
OnlyIPType: tmp.OnlyIPType,
|
||||
|
||||
RemovePrefixesInLine: tmp.RemovePrefixesInLine,
|
||||
RemoveSuffixesInLine: tmp.RemoveSuffixesInLine,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -147,28 +153,31 @@ func (t *textIn) walkDir(dir string, entries map[string]*lib.Entry) error {
|
||||
}
|
||||
|
||||
func (t *textIn) walkLocalFile(path, name string, entries map[string]*lib.Entry) error {
|
||||
entryName := ""
|
||||
name = strings.TrimSpace(name)
|
||||
var filename string
|
||||
if name != "" {
|
||||
filename = name
|
||||
entryName = name
|
||||
} else {
|
||||
filename = filepath.Base(path)
|
||||
entryName = filepath.Base(path)
|
||||
|
||||
// check filename
|
||||
if !regexp.MustCompile(`^[a-zA-Z0-9_.\-]+$`).MatchString(entryName) {
|
||||
return fmt.Errorf("filename %s cannot be entry name, please remove special characters in it", entryName)
|
||||
}
|
||||
|
||||
// remove file extension but not hidden files of which filename starts with "."
|
||||
dotIndex := strings.LastIndex(entryName, ".")
|
||||
if dotIndex > 0 {
|
||||
entryName = entryName[:dotIndex]
|
||||
}
|
||||
}
|
||||
|
||||
// check filename
|
||||
if !regexp.MustCompile(`^[a-zA-Z0-9_.\-]+$`).MatchString(filename) {
|
||||
return fmt.Errorf("filename %s cannot be entry name, please remove special characters in it", filename)
|
||||
}
|
||||
dotIndex := strings.LastIndex(filename, ".")
|
||||
if dotIndex > 0 {
|
||||
filename = filename[:dotIndex]
|
||||
entryName = strings.ToUpper(entryName)
|
||||
if _, found := entries[entryName]; found {
|
||||
return fmt.Errorf("found duplicated list %s", entryName)
|
||||
}
|
||||
|
||||
if _, found := entries[filename]; found {
|
||||
return fmt.Errorf("found duplicated file %s", filename)
|
||||
}
|
||||
|
||||
entry := lib.NewEntry(filename)
|
||||
entry := lib.NewEntry(entryName)
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -178,7 +187,7 @@ func (t *textIn) walkLocalFile(path, name string, entries map[string]*lib.Entry)
|
||||
return err
|
||||
}
|
||||
|
||||
entries[filename] = entry
|
||||
entries[entryName] = entry
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -194,11 +203,13 @@ func (t *textIn) walkRemoteFile(url, name string, entries map[string]*lib.Entry)
|
||||
return fmt.Errorf("failed to get remote file %s, http status code %d", url, resp.StatusCode)
|
||||
}
|
||||
|
||||
name = strings.ToUpper(name)
|
||||
entry := lib.NewEntry(name)
|
||||
if err := t.scanFile(resp.Body, entry); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entries[name] = entry
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package plaintext
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
@@ -36,28 +37,24 @@ func (t *textOut) GetDescription() string {
|
||||
|
||||
func (t *textOut) Output(container lib.Container) error {
|
||||
// Filter want list
|
||||
wantList := make(map[string]bool)
|
||||
wantList := make([]string, 0, 50)
|
||||
for _, want := range t.Want {
|
||||
if want = strings.ToUpper(strings.TrimSpace(want)); want != "" {
|
||||
wantList[want] = true
|
||||
wantList = append(wantList, want)
|
||||
}
|
||||
}
|
||||
|
||||
switch len(wantList) {
|
||||
case 0:
|
||||
list := make([]string, 0, 300)
|
||||
for entry := range container.Loop() {
|
||||
data, err := t.marshalBytes(entry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filename := strings.ToLower(entry.GetName()) + ".txt"
|
||||
if err := t.writeFile(filename, data); err != nil {
|
||||
return err
|
||||
}
|
||||
list = append(list, entry.GetName())
|
||||
}
|
||||
|
||||
default:
|
||||
for name := range wantList {
|
||||
// Sort the list
|
||||
slices.Sort(list)
|
||||
|
||||
for _, name := range list {
|
||||
entry, found := container.GetEntry(name)
|
||||
if !found {
|
||||
log.Printf("❌ entry %s not found", name)
|
||||
@@ -67,7 +64,27 @@ func (t *textOut) Output(container lib.Container) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filename := strings.ToLower(entry.GetName()) + ".txt"
|
||||
filename := strings.ToLower(entry.GetName()) + t.OutputExt
|
||||
if err := t.writeFile(filename, data); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
// Sort the list
|
||||
slices.Sort(wantList)
|
||||
|
||||
for _, name := range wantList {
|
||||
entry, found := container.GetEntry(name)
|
||||
if !found {
|
||||
log.Printf("❌ entry %s not found", name)
|
||||
continue
|
||||
}
|
||||
data, err := t.marshalBytes(entry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filename := strings.ToLower(entry.GetName()) + t.OutputExt
|
||||
if err := t.writeFile(filename, data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/Loyalsoldier/geoip/lib"
|
||||
@@ -82,23 +83,39 @@ func (s *srsOut) GetDescription() string {
|
||||
|
||||
func (s *srsOut) Output(container lib.Container) error {
|
||||
// Filter want list
|
||||
wantList := make(map[string]bool)
|
||||
wantList := make([]string, 0, 50)
|
||||
for _, want := range s.Want {
|
||||
if want = strings.ToUpper(strings.TrimSpace(want)); want != "" {
|
||||
wantList[want] = true
|
||||
wantList = append(wantList, want)
|
||||
}
|
||||
}
|
||||
|
||||
switch len(wantList) {
|
||||
case 0:
|
||||
list := make([]string, 0, 300)
|
||||
for entry := range container.Loop() {
|
||||
list = append(list, entry.GetName())
|
||||
}
|
||||
|
||||
// Sort the list
|
||||
slices.Sort(list)
|
||||
|
||||
for _, name := range list {
|
||||
entry, found := container.GetEntry(name)
|
||||
if !found {
|
||||
log.Printf("❌ entry %s not found", name)
|
||||
continue
|
||||
}
|
||||
if err := s.run(entry); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
for name := range wantList {
|
||||
// Sort the list
|
||||
slices.Sort(wantList)
|
||||
|
||||
for _, name := range wantList {
|
||||
entry, found := container.GetEntry(name)
|
||||
if !found {
|
||||
log.Printf("❌ entry %s not found", name)
|
||||
|
||||
@@ -94,19 +94,33 @@ func (g *geoIPDatOut) GetDescription() string {
|
||||
|
||||
func (g *geoIPDatOut) Output(container lib.Container) error {
|
||||
// Filter want list
|
||||
wantList := make(map[string]bool)
|
||||
wantList := make([]string, 0, 50)
|
||||
for _, want := range g.Want {
|
||||
if want = strings.ToUpper(strings.TrimSpace(want)); want != "" {
|
||||
wantList[want] = true
|
||||
wantList = append(wantList, want)
|
||||
}
|
||||
}
|
||||
|
||||
geoIPList := new(router.GeoIPList)
|
||||
geoIPList.Entry = make([]*router.GeoIP, 0, 300)
|
||||
updated := false
|
||||
|
||||
switch len(wantList) {
|
||||
case 0:
|
||||
list := make([]string, 0, 300)
|
||||
for entry := range container.Loop() {
|
||||
list = append(list, entry.GetName())
|
||||
}
|
||||
|
||||
// Sort the list
|
||||
sort.Strings(list)
|
||||
|
||||
for _, name := range list {
|
||||
entry, found := container.GetEntry(name)
|
||||
if !found {
|
||||
log.Printf("❌ entry %s not found", name)
|
||||
continue
|
||||
}
|
||||
geoIP, err := g.generateGeoIP(entry)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -128,7 +142,10 @@ func (g *geoIPDatOut) Output(container lib.Container) error {
|
||||
}
|
||||
|
||||
default:
|
||||
for name := range wantList {
|
||||
// Sort the list
|
||||
sort.Strings(wantList)
|
||||
|
||||
for _, name := range wantList {
|
||||
entry, found := container.GetEntry(name)
|
||||
if !found {
|
||||
log.Printf("❌ entry %s not found", name)
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
days-before-stale: 90
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ require (
|
||||
github.com/klauspost/reedsolomon v1.12.3 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.21 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/templexxx/cpu v0.1.0 // indirect
|
||||
github.com/templexxx/cpu v0.1.1 // indirect
|
||||
github.com/templexxx/xorsimd v0.4.2 // indirect
|
||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect
|
||||
|
||||
+2
-2
@@ -39,7 +39,6 @@ github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/ra
|
||||
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
|
||||
github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
|
||||
github.com/klauspost/cpuid v1.2.4/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
|
||||
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
|
||||
github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
@@ -66,8 +65,9 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/templexxx/cpu v0.0.1/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk=
|
||||
github.com/templexxx/cpu v0.0.7/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk=
|
||||
github.com/templexxx/cpu v0.1.0 h1:wVM+WIJP2nYaxVxqgHPD4wGA2aJ9rvrQRV8CvFzNb40=
|
||||
github.com/templexxx/cpu v0.1.0/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk=
|
||||
github.com/templexxx/cpu v0.1.1 h1:isxHaxBXpYFWnk2DReuKkigaZyrjs2+9ypIdGP4h+HI=
|
||||
github.com/templexxx/cpu v0.1.1/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk=
|
||||
github.com/templexxx/xorsimd v0.4.1/go.mod h1:W+ffZz8jJMH2SXwuKu9WhygqBMbFnp14G2fqEr8qaNo=
|
||||
github.com/templexxx/xorsimd v0.4.2 h1:ocZZ+Nvu65LGHmCLZ7OoCtg8Fx8jnHKK37SjvngUoVI=
|
||||
github.com/templexxx/xorsimd v0.4.2/go.mod h1:HgwaPoDREdi6OnULpSfxhzaiiSUY4Fi3JPn1wpt28NI=
|
||||
|
||||
+57
-57
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
C "github.com/metacubex/mihomo/constant"
|
||||
"github.com/metacubex/mihomo/rules/common"
|
||||
@@ -13,19 +14,19 @@ import (
|
||||
|
||||
type Logic struct {
|
||||
*common.Base
|
||||
payload string
|
||||
adapter string
|
||||
ruleType C.RuleType
|
||||
rules []C.Rule
|
||||
subRules map[string][]C.Rule
|
||||
needIP bool
|
||||
needProcess bool
|
||||
payload string
|
||||
adapter string
|
||||
ruleType C.RuleType
|
||||
rules []C.Rule
|
||||
subRules map[string][]C.Rule
|
||||
|
||||
payloadOnce sync.Once
|
||||
}
|
||||
|
||||
type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error)
|
||||
|
||||
func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule ParseRuleFunc) (*Logic, error) {
|
||||
logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules}
|
||||
logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules, subRules: subRules}
|
||||
err := logic.parsePayload(fmt.Sprintf("(%s)", payload), parseRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -34,15 +35,6 @@ func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule
|
||||
if len(logic.rules) != 1 {
|
||||
return nil, fmt.Errorf("Sub-Rule rule must contain one rule")
|
||||
}
|
||||
for _, rule := range subRules[adapter] {
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
}
|
||||
logic.subRules = subRules
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
@@ -56,9 +48,6 @@ func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, er
|
||||
if len(logic.rules) != 1 {
|
||||
return nil, fmt.Errorf("not rule must contain one rule")
|
||||
}
|
||||
logic.needIP = logic.rules[0].ShouldResolveIP()
|
||||
logic.needProcess = logic.rules[0].ShouldFindProcess()
|
||||
logic.payload = fmt.Sprintf("(!(%s,%s))", logic.rules[0].RuleType(), logic.rules[0].Payload())
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
@@ -68,40 +57,15 @@ func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " || "))
|
||||
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
func NewAND(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) {
|
||||
logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.AND}
|
||||
err := logic.parsePayload(payload, parseRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " && "))
|
||||
|
||||
return logic, nil
|
||||
}
|
||||
|
||||
@@ -218,13 +182,6 @@ func (logic *Logic) parsePayload(payload string, parseRule ParseRuleFunc) error
|
||||
return err
|
||||
}
|
||||
|
||||
if rule.ShouldResolveIP() {
|
||||
logic.needIP = true
|
||||
}
|
||||
if rule.ShouldFindProcess() {
|
||||
logic.needProcess = true
|
||||
}
|
||||
|
||||
rules = append(rules, rule)
|
||||
}
|
||||
|
||||
@@ -279,9 +236,9 @@ func (logic *Logic) Match(metadata *C.Metadata) (bool, string) {
|
||||
}
|
||||
}
|
||||
return true, logic.adapter
|
||||
default:
|
||||
return false, ""
|
||||
}
|
||||
|
||||
return false, ""
|
||||
}
|
||||
|
||||
func (logic *Logic) Adapter() string {
|
||||
@@ -289,15 +246,58 @@ func (logic *Logic) Adapter() string {
|
||||
}
|
||||
|
||||
func (logic *Logic) Payload() string {
|
||||
logic.payloadOnce.Do(func() { // a little bit expensive, so only computed once
|
||||
switch logic.ruleType {
|
||||
case C.NOT:
|
||||
logic.payload = fmt.Sprintf("(!(%s,%s))", logic.rules[0].RuleType(), logic.rules[0].Payload())
|
||||
case C.OR:
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " || "))
|
||||
case C.AND:
|
||||
payloads := make([]string, 0, len(logic.rules))
|
||||
for _, rule := range logic.rules {
|
||||
payloads = append(payloads, fmt.Sprintf("(%s,%s)", rule.RuleType().String(), rule.Payload()))
|
||||
}
|
||||
logic.payload = fmt.Sprintf("(%s)", strings.Join(payloads, " && "))
|
||||
default:
|
||||
}
|
||||
})
|
||||
return logic.payload
|
||||
}
|
||||
|
||||
func (logic *Logic) ShouldResolveIP() bool {
|
||||
return logic.needIP
|
||||
if logic.ruleType == C.SubRules {
|
||||
for _, rule := range logic.subRules[logic.adapter] {
|
||||
if rule.ShouldResolveIP() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, rule := range logic.rules {
|
||||
if rule.ShouldResolveIP() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (logic *Logic) ShouldFindProcess() bool {
|
||||
return logic.needProcess
|
||||
if logic.ruleType == C.SubRules {
|
||||
for _, rule := range logic.subRules[logic.adapter] {
|
||||
if rule.ShouldFindProcess() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, rule := range logic.rules {
|
||||
if rule.ShouldFindProcess() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (logic *Logic) ProviderNames() (names []string) {
|
||||
|
||||
@@ -40,10 +40,7 @@ func (rs *RuleSet) Adapter() string {
|
||||
}
|
||||
|
||||
func (rs *RuleSet) Payload() string {
|
||||
if provider, ok := rs.getProvider(); ok {
|
||||
return provider.Name()
|
||||
}
|
||||
return ""
|
||||
return rs.ruleProviderName
|
||||
}
|
||||
|
||||
func (rs *RuleSet) ShouldResolveIP() bool {
|
||||
|
||||
@@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_ARCH_quickstart:=$(ARCH)
|
||||
|
||||
PKG_NAME:=quickstart
|
||||
PKG_VERSION:=0.8.16
|
||||
PKG_VERSION:=0.9.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/linkease/istore-packages/releases/download/prebuilt/
|
||||
PKG_HASH:=a156e9e8831072f14b625c3f7c724c405c963aa67e24adb2ce7bf66531b688a1
|
||||
PKG_HASH:=d86d8c9f160fe5076640bada8b79392c03444af659b79e2e9ecc4c48a5f40892
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
||||
|
||||
|
||||
@@ -754,6 +754,8 @@ function gen_config(var)
|
||||
local dns_listen_port = var["-dns_listen_port"]
|
||||
local direct_dns_port = var["-direct_dns_port"]
|
||||
local direct_dns_udp_server = var["-direct_dns_udp_server"]
|
||||
local direct_dns_tcp_server = var["-direct_dns_tcp_server"]
|
||||
local direct_dns_dot_server = var["-direct_dns_dot_server"]
|
||||
local direct_dns_query_strategy = var["-direct_dns_query_strategy"]
|
||||
local remote_dns_port = var["-remote_dns_port"]
|
||||
local remote_dns_udp_server = var["-remote_dns_udp_server"]
|
||||
@@ -1316,7 +1318,7 @@ function gen_config(var)
|
||||
}
|
||||
end
|
||||
|
||||
if direct_dns_udp_server then
|
||||
if direct_dns_udp_server or direct_dns_tcp_server or direct_dns_dot_server then
|
||||
local domain = {}
|
||||
local nodes_domain_text = sys.exec('uci show passwall | grep ".address=" | cut -d "\'" -f 2 | grep "[a-zA-Z]$" | sort -u')
|
||||
string.gsub(nodes_domain_text, '[^' .. "\r\n" .. ']+', function(w)
|
||||
@@ -1335,12 +1337,26 @@ function gen_config(var)
|
||||
elseif direct_dns_query_strategy == "UseIPv6" then
|
||||
direct_strategy = "ipv6_only"
|
||||
end
|
||||
|
||||
local port = tonumber(direct_dns_port) or 53
|
||||
|
||||
local direct_dns_server, port
|
||||
if direct_dns_udp_server then
|
||||
port = tonumber(direct_dns_port) or 53
|
||||
direct_dns_server = "udp://" .. direct_dns_udp_server .. ":" .. port
|
||||
elseif direct_dns_tcp_server then
|
||||
port = tonumber(direct_dns_port) or 53
|
||||
direct_dns_server = "tcp://" .. direct_dns_tcp_server .. ":" .. port
|
||||
elseif direct_dns_dot_server then
|
||||
port = tonumber(direct_dns_port) or 853
|
||||
if direct_dns_dot_server:find(":") == nil then
|
||||
direct_dns_server = "tls://" .. direct_dns_dot_server .. ":" .. port
|
||||
else
|
||||
direct_dns_server = "tls://[" .. direct_dns_dot_server .. "]:" .. port
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(dns.servers, {
|
||||
tag = "direct",
|
||||
address = "udp://" .. direct_dns_udp_server .. ":" .. port,
|
||||
address = direct_dns_server,
|
||||
address_strategy = "prefer_ipv6",
|
||||
strategy = direct_strategy,
|
||||
detour = "direct",
|
||||
|
||||
@@ -24,6 +24,7 @@ DNS_PORT=15353
|
||||
TUN_DNS="127.0.0.1#${DNS_PORT}"
|
||||
LOCAL_DNS=119.29.29.29,223.5.5.5
|
||||
DEFAULT_DNS=
|
||||
FW_APPEND_DNS=
|
||||
ENABLED_DEFAULT_ACL=0
|
||||
PROXY_IPV6=0
|
||||
PROXY_IPV6_UDP=0
|
||||
@@ -354,7 +355,7 @@ run_ipt2socks() {
|
||||
|
||||
run_singbox() {
|
||||
local flag type node tcp_redir_port udp_redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password
|
||||
local dns_listen_port direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local dns_listen_port direct_dns_port direct_dns_udp_server direct_dns_tcp_server direct_dns_dot_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local loglevel log_file config_file server_host server_port
|
||||
local _extra_param=""
|
||||
eval_set_val $@
|
||||
@@ -395,17 +396,21 @@ run_singbox() {
|
||||
[ -n "$dns_listen_port" ] && _extra_param="${_extra_param} -dns_listen_port ${dns_listen_port}"
|
||||
[ -n "$dns_cache" ] && _extra_param="${_extra_param} -dns_cache ${dns_cache}"
|
||||
|
||||
[ -n "$direct_dns_udp_server" ] && direct_dns_port=$(echo ${direct_dns_udp_server} | awk -F '#' '{print $2}')
|
||||
[ -n "$direct_dns_tcp_server" ] && direct_dns_port=$(echo ${direct_dns_tcp_server} | awk -F '#' '{print $2}')
|
||||
[ -z "$direct_dns_udp_server" ] && [ -z "$direct_dns_tcp_server" ] && {
|
||||
if [ -n "$direct_dns_udp_server" ]; then
|
||||
direct_dns_port=$(echo ${direct_dns_udp_server} | awk -F '#' '{print $2}')
|
||||
_extra_param="${_extra_param} -direct_dns_udp_server $(echo ${direct_dns_udp_server} | awk -F '#' '{print $1}')"
|
||||
elif [ -n "$direct_dns_tcp_server" ]; then
|
||||
direct_dns_port=$(echo ${direct_dns_tcp_server} | awk -F '#' '{print $2}')
|
||||
_extra_param="${_extra_param} -direct_dns_tcp_server $(echo ${direct_dns_tcp_server} | awk -F '#' '{print $1}')"
|
||||
elif [ -n "$direct_dns_dot_server" ]; then
|
||||
direct_dns_port=$(echo ${direct_dns_dot_server} | awk -F '#' '{print $2}')
|
||||
_extra_param="${_extra_param} -direct_dns_dot_server $(echo ${direct_dns_dot_server} | awk -F '#' '{print $1}')"
|
||||
else
|
||||
local local_dns=$(echo -n $(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n1) | tr " " ",")
|
||||
direct_dns_udp_server=$(echo ${local_dns} | awk -F '#' '{print $1}')
|
||||
_extra_param="${_extra_param} -direct_dns_udp_server $(echo ${local_dns} | awk -F '#' '{print $1}')"
|
||||
direct_dns_port=$(echo ${local_dns} | awk -F '#' '{print $2}')
|
||||
}
|
||||
[ -z "$direct_dns_port" ] && direct_dns_port=53
|
||||
[ -n "$direct_dns_udp_server" ] && _extra_param="${_extra_param} -direct_dns_udp_server ${direct_dns_udp_server}"
|
||||
[ -n "$direct_dns_tcp_server" ] && _extra_param="${_extra_param} -direct_dns_tcp_server ${direct_dns_tcp_server}"
|
||||
[ -n "$direct_dns_port" ] && _extra_param="${_extra_param} -direct_dns_port ${direct_dns_port}"
|
||||
fi
|
||||
_extra_param="${_extra_param} -direct_dns_port ${direct_dns_port:-53}"
|
||||
_extra_param="${_extra_param} -direct_dns_query_strategy UseIP"
|
||||
|
||||
[ -n "$remote_dns_query_strategy" ] && _extra_param="${_extra_param} -remote_dns_query_strategy ${remote_dns_query_strategy}"
|
||||
@@ -944,8 +949,22 @@ run_redir() {
|
||||
[ "${DNS_CACHE}" == "0" ] && _args="${_args} dns_cache=0"
|
||||
resolve_dns_port=${dns_listen_port}
|
||||
_args="${_args} dns_listen_port=${resolve_dns_port}"
|
||||
local local_dns=$(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n1)
|
||||
_args="${_args} direct_dns_udp_server=${local_dns}"
|
||||
|
||||
case "$(config_t_get global direct_dns_mode "auto")" in
|
||||
udp)
|
||||
_args="${_args} direct_dns_udp_server=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g')
|
||||
;;
|
||||
tcp)
|
||||
_args="${_args} direct_dns_tcp_server=$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')
|
||||
;;
|
||||
dot)
|
||||
local tmp_dot_dns=$(config_t_get global direct_dns_dot "tls://dot.pub@1.12.12.12")
|
||||
local tmp_dot_ip=$(echo "$tmp_dot_dns" | sed -n 's/.*:\/\/\([^@#]*@\)*\([^@#]*\).*/\2/p')
|
||||
local tmp_dot_port=$(echo "$tmp_dot_dns" | sed -n 's/.*#\([0-9]\+\).*/\1/p')
|
||||
_args="${_args} direct_dns_dot_server=$tmp_dot_ip#${tmp_dot_port:-853}"
|
||||
;;
|
||||
esac
|
||||
|
||||
_args="${_args} remote_dns_protocol=${v2ray_dns_mode}"
|
||||
case "$v2ray_dns_mode" in
|
||||
tcp)
|
||||
@@ -1339,17 +1358,22 @@ start_dns() {
|
||||
echolog "DNS域名解析:"
|
||||
|
||||
local china_ng_local_dns=${LOCAL_DNS}
|
||||
local sing_box_local_dns=
|
||||
local direct_dns_mode=$(config_t_get global direct_dns_mode "auto")
|
||||
case "$direct_dns_mode" in
|
||||
udp)
|
||||
LOCAL_DNS=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g')
|
||||
china_ng_local_dns=${LOCAL_DNS}
|
||||
sing_box_local_dns="direct_dns_udp_server=${LOCAL_DNS}"
|
||||
FW_APPEND_DNS=${LOCAL_DNS}
|
||||
;;
|
||||
tcp)
|
||||
LOCAL_DNS="127.0.0.1#${dns_listen_port}"
|
||||
dns_listen_port=$(expr $dns_listen_port + 1)
|
||||
local DIRECT_DNS=$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')
|
||||
china_ng_local_dns="tcp://${DIRECT_DNS}"
|
||||
sing_box_local_dns="direct_dns_tcp_server=${DIRECT_DNS}"
|
||||
FW_APPEND_DNS="${LOCAL_DNS},${DIRECT_DNS}"
|
||||
ln_run "$(first_type dns2tcp)" dns2tcp "/dev/null" -L "${LOCAL_DNS}" -R "$(get_first_dns DIRECT_DNS 53)" -v
|
||||
echolog " - dns2tcp(${LOCAL_DNS}) -> tcp://$(get_first_dns DIRECT_DNS 53 | sed 's/#/:/g')"
|
||||
echolog " * 请确保上游直连 DNS 支持 TCP 查询。"
|
||||
@@ -1364,6 +1388,11 @@ start_dns() {
|
||||
ln_run "$(first_type chinadns-ng)" chinadns-ng "/dev/null" -b 127.0.0.1 -l ${cdns_listen_port} -c ${DIRECT_DNS} -d chn
|
||||
echolog " - ChinaDNS-NG(${LOCAL_DNS}) -> ${DIRECT_DNS}"
|
||||
echolog " * 请确保上游直连 DNS 支持 DoT 查询。"
|
||||
|
||||
local tmp_dot_ip=$(echo "$DIRECT_DNS" | sed -n 's/.*:\/\/\([^@#]*@\)*\([^@#]*\).*/\2/p')
|
||||
local tmp_dot_port=$(echo "$DIRECT_DNS" | sed -n 's/.*#\([0-9]\+\).*/\1/p')
|
||||
sing_box_local_dns="direct_dns_dot_server=$tmp_dot_ip#${tmp_dot_port:-853}"
|
||||
FW_APPEND_DNS="${LOCAL_DNS},$tmp_dot_ip#${tmp_dot_port:-853}"
|
||||
else
|
||||
echolog " - 你的ChinaDNS-NG版本不支持DoT,直连DNS将使用默认地址。"
|
||||
fi
|
||||
@@ -1420,6 +1449,7 @@ start_dns() {
|
||||
;;
|
||||
esac
|
||||
_args="${_args} dns_socks_address=127.0.0.1 dns_socks_port=${tcp_node_socks_port}"
|
||||
[ -n "${sing_box_local_dns}" ] && _args="${_args} ${sing_box_local_dns}"
|
||||
run_singbox ${_args}
|
||||
}
|
||||
;;
|
||||
@@ -1969,6 +1999,7 @@ DEFAULT_DNSMASQ_CFGID=$(uci show dhcp.@dnsmasq[0] | awk -F '.' '{print $2}' | a
|
||||
DEFAULT_DNS=$(uci show dhcp.@dnsmasq[0] | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label')
|
||||
[ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',')
|
||||
LOCAL_DNS="${DEFAULT_DNS:-119.29.29.29,223.5.5.5}"
|
||||
FW_APPEND_DNS=${LOCAL_DNS}
|
||||
|
||||
DNS_QUERY_STRATEGY="UseIP"
|
||||
[ "$FILTER_PROXY_IPV6" = "1" ] && DNS_QUERY_STRATEGY="UseIPv4"
|
||||
|
||||
@@ -841,12 +841,19 @@ add_firewall_rule() {
|
||||
$ipt_m -N PSW_OUTPUT
|
||||
$ipt_m -A PSW_OUTPUT $(dst $IPSET_LANLIST) -j RETURN
|
||||
$ipt_m -A PSW_OUTPUT $(dst $IPSET_VPSLIST) -j RETURN
|
||||
[ -n "$LOCAL_DNS" ] && {
|
||||
for local_dns in $(echo $LOCAL_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo $local_dns | awk -F '#' '{print $1}')
|
||||
local dns_port=$(echo $local_dns | awk -F '#' '{print $2}')
|
||||
$ipt_m -A PSW_OUTPUT -p udp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
echolog " - [$?]追加直连DNS到iptables:${dns_address}:${dns_port:-53}"
|
||||
[ -n "$FW_APPEND_DNS" ] && {
|
||||
for local_dns in $(echo $FW_APPEND_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo "$local_dns" | sed -E 's/(@|\[)?([0-9a-fA-F:.]+)(@|#|$).*/\2/')
|
||||
local dns_port=$(echo "$local_dns" | sed -nE 's/.*#([0-9]+)$/\1/p')
|
||||
if echo "$dns_address" | grep -q ':'; then
|
||||
$ip6t_m -A PSW_OUTPUT -p udp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
$ip6t_m -A PSW_OUTPUT -p tcp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
echolog " - [$?]追加直连DNS到iptables:[${dns_address}]:${dns_port:-53}"
|
||||
else
|
||||
$ipt_m -A PSW_OUTPUT -p udp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
$ipt_m -A PSW_OUTPUT -p tcp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
echolog " - [$?]追加直连DNS到iptables:${dns_address}:${dns_port:-53}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
[ "${USE_DIRECT_LIST}" = "1" ] && $ipt_m -A PSW_OUTPUT $(dst $IPSET_WHITELIST) -j RETURN
|
||||
|
||||
@@ -865,12 +865,19 @@ add_firewall_rule() {
|
||||
nft "flush chain inet fw4 PSW_OUTPUT_MANGLE"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip daddr @$NFTSET_LANLIST counter return"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip daddr @$NFTSET_VPSLIST counter return"
|
||||
[ -n "$LOCAL_DNS" ] && {
|
||||
for local_dns in $(echo $LOCAL_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo $local_dns | awk -F '#' '{print $1}')
|
||||
local dns_port=$(echo $local_dns | awk -F '#' '{print $2}')
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip protocol udp ip daddr ${dns_address} $(factor ${dns_port:-53} "udp dport") counter return"
|
||||
echolog " - [$?]追加直连DNS到nftables:${dns_address}:${dns_port:-53}"
|
||||
[ -n "$FW_APPEND_DNS" ] && {
|
||||
for local_dns in $(echo $FW_APPEND_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo "$local_dns" | sed -E 's/(@|\[)?([0-9a-fA-F:.]+)(@|#|$).*/\2/')
|
||||
local dns_port=$(echo "$local_dns" | sed -nE 's/.*#([0-9]+)$/\1/p')
|
||||
if echo "$dns_address" | grep -q ':'; then
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE_V6 meta l4proto udp ip6 daddr ${dns_address} $(factor ${dns_port:-53} "udp dport") counter return"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE_V6 meta l4proto tcp ip6 daddr ${dns_address} $(factor ${dns_port:-53} "tcp dport") counter return"
|
||||
echolog " - [$?]追加直连DNS到nftables:[${dns_address}]:${dns_port:-53}"
|
||||
else
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip protocol udp ip daddr ${dns_address} $(factor ${dns_port:-53} "udp dport") counter return"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip protocol tcp ip daddr ${dns_address} $(factor ${dns_port:-53} "tcp dport") counter return"
|
||||
echolog " - [$?]追加直连DNS到nftables:${dns_address}:${dns_port:-53}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
[ "${USE_DIRECT_LIST}" = "1" ] && nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip daddr @$NFTSET_WHITELIST counter return"
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Common.Memory
|
||||
{
|
||||
public partial class ByteMemoryPool
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a <see cref="IMemoryOwner{Byte}"/> that wraps an array rented from
|
||||
/// <see cref="ArrayPool{Byte}.Shared"/> and exposes it as <see cref="Memory{Byte}"/>
|
||||
/// with a length of the requested size.
|
||||
/// </summary>
|
||||
private sealed class ByteMemoryPoolBuffer : IMemoryOwner<byte>
|
||||
{
|
||||
private byte[] _array;
|
||||
private readonly int _length;
|
||||
|
||||
public ByteMemoryPoolBuffer(int length)
|
||||
{
|
||||
_array = ArrayPool<byte>.Shared.Rent(length);
|
||||
_length = length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Memory{Byte}"/> belonging to this owner.
|
||||
/// </summary>
|
||||
public Memory<byte> Memory
|
||||
{
|
||||
get
|
||||
{
|
||||
byte[] array = _array;
|
||||
|
||||
ObjectDisposedException.ThrowIf(array is null, this);
|
||||
|
||||
return new Memory<byte>(array, 0, _length);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
var array = Interlocked.Exchange(ref _array, null);
|
||||
|
||||
if (array != null)
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
|
||||
namespace Ryujinx.Common.Memory
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a pool of re-usable byte array instances.
|
||||
/// </summary>
|
||||
public static partial class ByteMemoryPool
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the maximum buffer size supported by this pool.
|
||||
/// </summary>
|
||||
public static int MaxBufferSize => Array.MaxLength;
|
||||
|
||||
/// <summary>
|
||||
/// Rents a byte memory buffer from <see cref="ArrayPool{Byte}.Shared"/>.
|
||||
/// The buffer may contain data from a prior use.
|
||||
/// </summary>
|
||||
/// <param name="length">The buffer's required length in bytes</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static IMemoryOwner<byte> Rent(long length)
|
||||
=> RentImpl(checked((int)length));
|
||||
|
||||
/// <summary>
|
||||
/// Rents a byte memory buffer from <see cref="ArrayPool{Byte}.Shared"/>.
|
||||
/// The buffer may contain data from a prior use.
|
||||
/// </summary>
|
||||
/// <param name="length">The buffer's required length in bytes</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static IMemoryOwner<byte> Rent(ulong length)
|
||||
=> RentImpl(checked((int)length));
|
||||
|
||||
/// <summary>
|
||||
/// Rents a byte memory buffer from <see cref="ArrayPool{Byte}.Shared"/>.
|
||||
/// The buffer may contain data from a prior use.
|
||||
/// </summary>
|
||||
/// <param name="length">The buffer's required length in bytes</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static IMemoryOwner<byte> Rent(int length)
|
||||
=> RentImpl(length);
|
||||
|
||||
/// <summary>
|
||||
/// Rents a byte memory buffer from <see cref="ArrayPool{Byte}.Shared"/>.
|
||||
/// The buffer's contents are cleared (set to all 0s) before returning.
|
||||
/// </summary>
|
||||
/// <param name="length">The buffer's required length in bytes</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static IMemoryOwner<byte> RentCleared(long length)
|
||||
=> RentCleared(checked((int)length));
|
||||
|
||||
/// <summary>
|
||||
/// Rents a byte memory buffer from <see cref="ArrayPool{Byte}.Shared"/>.
|
||||
/// The buffer's contents are cleared (set to all 0s) before returning.
|
||||
/// </summary>
|
||||
/// <param name="length">The buffer's required length in bytes</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static IMemoryOwner<byte> RentCleared(ulong length)
|
||||
=> RentCleared(checked((int)length));
|
||||
|
||||
/// <summary>
|
||||
/// Rents a byte memory buffer from <see cref="ArrayPool{Byte}.Shared"/>.
|
||||
/// The buffer's contents are cleared (set to all 0s) before returning.
|
||||
/// </summary>
|
||||
/// <param name="length">The buffer's required length in bytes</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static IMemoryOwner<byte> RentCleared(int length)
|
||||
{
|
||||
var buffer = RentImpl(length);
|
||||
|
||||
buffer.Memory.Span.Clear();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies <paramref name="buffer"/> into a newly rented byte memory buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The byte buffer to copy</param>
|
||||
/// <returns>A <see cref="IMemoryOwner{Byte}"/> wrapping the rented memory with <paramref name="buffer"/> copied to it</returns>
|
||||
public static IMemoryOwner<byte> RentCopy(ReadOnlySpan<byte> buffer)
|
||||
{
|
||||
var copy = RentImpl(buffer.Length);
|
||||
|
||||
buffer.CopyTo(copy.Memory.Span);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
private static ByteMemoryPoolBuffer RentImpl(int length)
|
||||
{
|
||||
if ((uint)length > Array.MaxLength)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(length), length, null);
|
||||
}
|
||||
|
||||
return new ByteMemoryPoolBuffer(length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -42,14 +42,14 @@ namespace Ryujinx.Common
|
||||
return StreamUtils.StreamToBytes(stream);
|
||||
}
|
||||
|
||||
public static IMemoryOwner<byte> ReadFileToRentedMemory(string filename)
|
||||
public static MemoryOwner<byte> ReadFileToRentedMemory(string filename)
|
||||
{
|
||||
var (assembly, path) = ResolveManifestPath(filename);
|
||||
|
||||
return ReadFileToRentedMemory(assembly, path);
|
||||
}
|
||||
|
||||
public static IMemoryOwner<byte> ReadFileToRentedMemory(Assembly assembly, string filename)
|
||||
public static MemoryOwner<byte> ReadFileToRentedMemory(Assembly assembly, string filename)
|
||||
{
|
||||
using var stream = GetStream(assembly, filename);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.IO;
|
||||
using Ryujinx.Common.Memory;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -16,7 +15,7 @@ namespace Ryujinx.Common.Utilities
|
||||
return output.ToArray();
|
||||
}
|
||||
|
||||
public static IMemoryOwner<byte> StreamToRentedMemory(Stream input)
|
||||
public static MemoryOwner<byte> StreamToRentedMemory(Stream input)
|
||||
{
|
||||
if (input is MemoryStream inputMemoryStream)
|
||||
{
|
||||
@@ -26,9 +25,9 @@ namespace Ryujinx.Common.Utilities
|
||||
{
|
||||
long bytesExpected = input.Length;
|
||||
|
||||
IMemoryOwner<byte> ownedMemory = ByteMemoryPool.Rent(bytesExpected);
|
||||
MemoryOwner<byte> ownedMemory = MemoryOwner<byte>.Rent(checked((int)bytesExpected));
|
||||
|
||||
var destSpan = ownedMemory.Memory.Span;
|
||||
var destSpan = ownedMemory.Span;
|
||||
|
||||
int totalBytesRead = 0;
|
||||
|
||||
@@ -66,14 +65,14 @@ namespace Ryujinx.Common.Utilities
|
||||
return stream.ToArray();
|
||||
}
|
||||
|
||||
private static IMemoryOwner<byte> MemoryStreamToRentedMemory(MemoryStream input)
|
||||
private static MemoryOwner<byte> MemoryStreamToRentedMemory(MemoryStream input)
|
||||
{
|
||||
input.Position = 0;
|
||||
|
||||
IMemoryOwner<byte> ownedMemory = ByteMemoryPool.Rent(input.Length);
|
||||
MemoryOwner<byte> ownedMemory = MemoryOwner<byte>.Rent(checked((int)input.Length));
|
||||
|
||||
// Discard the return value because we assume reading a MemoryStream always succeeds completely.
|
||||
_ = input.Read(ownedMemory.Memory.Span);
|
||||
_ = input.Read(ownedMemory.Span);
|
||||
|
||||
return ownedMemory;
|
||||
}
|
||||
|
||||
@@ -303,9 +303,9 @@ namespace Ryujinx.Cpu.Jit
|
||||
}
|
||||
else
|
||||
{
|
||||
IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(size);
|
||||
MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(size);
|
||||
|
||||
Read(va, memoryOwner.Memory.Span);
|
||||
Read(va, memoryOwner.Span);
|
||||
|
||||
return new WritableRegion(this, va, memoryOwner);
|
||||
}
|
||||
|
||||
@@ -130,9 +130,9 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
else
|
||||
{
|
||||
IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(size);
|
||||
MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(size);
|
||||
|
||||
Read(va, memoryOwner.Memory.Span);
|
||||
Read(va, memoryOwner.Span);
|
||||
|
||||
return new WritableRegion(this, va, memoryOwner);
|
||||
}
|
||||
|
||||
@@ -70,14 +70,7 @@ use serde::{Deserialize, Serialize};
|
||||
use shadowsocks::relay::socks5::Address;
|
||||
use shadowsocks::{
|
||||
config::{
|
||||
ManagerAddr,
|
||||
Mode,
|
||||
ReplayAttackPolicy,
|
||||
ServerAddr,
|
||||
ServerConfig,
|
||||
ServerSource,
|
||||
ServerUser,
|
||||
ServerUserManager,
|
||||
ManagerAddr, Mode, ReplayAttackPolicy, ServerAddr, ServerConfig, ServerSource, ServerUser, ServerUserManager,
|
||||
ServerWeight,
|
||||
},
|
||||
crypto::CipherKind,
|
||||
|
||||
@@ -6,10 +6,7 @@ use hickory_resolver::proto::{
|
||||
op::{header::MessageType, response_code::ResponseCode, Header, Message, OpCode},
|
||||
rr::{
|
||||
rdata::{A, AAAA},
|
||||
DNSClass,
|
||||
RData,
|
||||
Record,
|
||||
RecordType,
|
||||
DNSClass, RData, Record, RecordType,
|
||||
},
|
||||
};
|
||||
use log::{debug, trace};
|
||||
|
||||
@@ -16,8 +16,7 @@ use hyper::{
|
||||
client::conn::{http1, http2},
|
||||
http::uri::Scheme,
|
||||
rt::{Sleep, Timer},
|
||||
Request,
|
||||
Response,
|
||||
Request, Response,
|
||||
};
|
||||
use log::{error, trace};
|
||||
use lru_time_cache::LruCache;
|
||||
|
||||
@@ -8,13 +8,7 @@ use hyper::{
|
||||
body,
|
||||
header::{self, HeaderValue},
|
||||
http::uri::{Authority, Scheme},
|
||||
HeaderMap,
|
||||
Method,
|
||||
Request,
|
||||
Response,
|
||||
StatusCode,
|
||||
Uri,
|
||||
Version,
|
||||
HeaderMap, Method, Request, Response, StatusCode, Uri, Version,
|
||||
};
|
||||
use log::{debug, error, trace};
|
||||
use shadowsocks::relay::Address;
|
||||
|
||||
@@ -13,9 +13,7 @@ use tokio::{
|
||||
};
|
||||
|
||||
use crate::local::{
|
||||
context::ServiceContext,
|
||||
loadbalancing::PingBalancer,
|
||||
net::tcp::listener::create_standard_tcp_listener,
|
||||
context::ServiceContext, loadbalancing::PingBalancer, net::tcp::listener::create_standard_tcp_listener,
|
||||
};
|
||||
|
||||
use super::{http_client::HttpClient, http_service::HttpService, tokio_rt::TokioIo};
|
||||
|
||||
@@ -9,9 +9,7 @@ use std::{
|
||||
use hyper::{
|
||||
header::{self, HeaderValue},
|
||||
http::uri::Authority,
|
||||
HeaderMap,
|
||||
Uri,
|
||||
Version,
|
||||
HeaderMap, Uri, Version,
|
||||
};
|
||||
use log::error;
|
||||
use shadowsocks::relay::socks5::Address;
|
||||
|
||||
@@ -29,9 +29,7 @@ use shadowsocks::{
|
||||
use crate::{
|
||||
local::{context::ServiceContext, loadbalancing::PingBalancer},
|
||||
net::{
|
||||
packet_window::PacketWindowFilter,
|
||||
MonProxySocket,
|
||||
UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
||||
packet_window::PacketWindowFilter, MonProxySocket, UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
||||
UDP_ASSOCIATION_SEND_CHANNEL_SIZE,
|
||||
},
|
||||
};
|
||||
|
||||
+1
-9
@@ -9,15 +9,7 @@ use std::{
|
||||
use log::trace;
|
||||
use pin_project::pin_project;
|
||||
use shadowsocks::relay::socks5::{
|
||||
self,
|
||||
Address,
|
||||
Command,
|
||||
Error,
|
||||
HandshakeRequest,
|
||||
HandshakeResponse,
|
||||
Reply,
|
||||
TcpRequestHeader,
|
||||
TcpResponseHeader,
|
||||
self, Address, Command, Error, HandshakeRequest, HandshakeResponse, Reply, TcpRequestHeader, TcpResponseHeader,
|
||||
};
|
||||
use tokio::{
|
||||
io::{AsyncRead, AsyncWrite, ReadBuf},
|
||||
|
||||
@@ -7,9 +7,7 @@ use tokio::{net::TcpStream, time};
|
||||
#[cfg(feature = "local-http")]
|
||||
use crate::local::http::HttpConnectionHandler;
|
||||
use crate::local::{
|
||||
context::ServiceContext,
|
||||
loadbalancing::PingBalancer,
|
||||
net::tcp::listener::create_standard_tcp_listener,
|
||||
context::ServiceContext, loadbalancing::PingBalancer, net::tcp::listener::create_standard_tcp_listener,
|
||||
socks::config::Socks5AuthConfig,
|
||||
};
|
||||
|
||||
|
||||
+1
-6
@@ -21,12 +21,7 @@ use crate::local::{
|
||||
};
|
||||
|
||||
use crate::local::socks::socks4::{
|
||||
Address,
|
||||
Command,
|
||||
Error as Socks4Error,
|
||||
HandshakeRequest,
|
||||
HandshakeResponse,
|
||||
ResultCode,
|
||||
Address, Command, Error as Socks4Error, HandshakeRequest, HandshakeResponse, ResultCode,
|
||||
};
|
||||
|
||||
pub struct Socks4TcpHandler {
|
||||
|
||||
+2
-11
@@ -11,17 +11,8 @@ use log::{debug, error, trace, warn};
|
||||
use shadowsocks::{
|
||||
config::Mode,
|
||||
relay::socks5::{
|
||||
self,
|
||||
Address,
|
||||
Command,
|
||||
Error as Socks5Error,
|
||||
HandshakeRequest,
|
||||
HandshakeResponse,
|
||||
PasswdAuthRequest,
|
||||
PasswdAuthResponse,
|
||||
Reply,
|
||||
TcpRequestHeader,
|
||||
TcpResponseHeader,
|
||||
self, Address, Command, Error as Socks5Error, HandshakeRequest, HandshakeResponse, PasswdAuthRequest,
|
||||
PasswdAuthResponse, Reply, TcpRequestHeader, TcpResponseHeader,
|
||||
},
|
||||
ServerAddr,
|
||||
};
|
||||
|
||||
@@ -13,23 +13,13 @@ use shadowsocks::{
|
||||
manager::{
|
||||
datagram::ManagerSocketAddr,
|
||||
protocol::{
|
||||
self,
|
||||
AddRequest,
|
||||
AddResponse,
|
||||
ErrorResponse,
|
||||
ListResponse,
|
||||
ManagerRequest,
|
||||
PingResponse,
|
||||
RemoveRequest,
|
||||
RemoveResponse,
|
||||
ServerUserConfig,
|
||||
StatRequest,
|
||||
self, AddRequest, AddResponse, ErrorResponse, ListResponse, ManagerRequest, PingResponse, RemoveRequest,
|
||||
RemoveResponse, ServerUserConfig, StatRequest,
|
||||
},
|
||||
},
|
||||
net::{AcceptOpts, ConnectOpts},
|
||||
plugin::PluginConfig,
|
||||
ManagerListener,
|
||||
ServerAddr,
|
||||
ManagerListener, ServerAddr,
|
||||
};
|
||||
use tokio::{sync::Mutex, task::JoinHandle};
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ use shadowsocks::{
|
||||
crypto::CipherKind,
|
||||
net::{AcceptOpts, TcpStream as OutboundTcpStream},
|
||||
relay::tcprelay::{utils::copy_encrypted_bidirectional, ProxyServerStream},
|
||||
ProxyListener,
|
||||
ServerConfig,
|
||||
ProxyListener, ServerConfig,
|
||||
};
|
||||
use tokio::{
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
|
||||
@@ -29,10 +29,7 @@ use tokio::{runtime::Handle, sync::mpsc, task::JoinHandle, time};
|
||||
use windows_sys::Win32::Networking::WinSock::WSAEAFNOSUPPORT;
|
||||
|
||||
use crate::net::{
|
||||
packet_window::PacketWindowFilter,
|
||||
utils::to_ipv4_mapped,
|
||||
MonProxySocket,
|
||||
UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
||||
packet_window::PacketWindowFilter, utils::to_ipv4_mapped, MonProxySocket, UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
||||
UDP_ASSOCIATION_SEND_CHANNEL_SIZE,
|
||||
};
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ use hickory_resolver::{
|
||||
udp::{DnsUdpSocket, QuicLocalAddr},
|
||||
TokioTime,
|
||||
},
|
||||
AsyncResolver,
|
||||
TokioHandle,
|
||||
AsyncResolver, TokioHandle,
|
||||
};
|
||||
use log::trace;
|
||||
use tokio::{io::ReadBuf, net::UdpSocket};
|
||||
|
||||
@@ -8,16 +8,8 @@ use super::{
|
||||
datagram::ManagerDatagram,
|
||||
error::Error,
|
||||
protocol::{
|
||||
AddRequest,
|
||||
AddResponse,
|
||||
ListRequest,
|
||||
ListResponse,
|
||||
ManagerProtocol,
|
||||
PingRequest,
|
||||
PingResponse,
|
||||
RemoveRequest,
|
||||
RemoveResponse,
|
||||
StatRequest,
|
||||
AddRequest, AddResponse, ListRequest, ListResponse, ManagerProtocol, PingRequest, PingResponse, RemoveRequest,
|
||||
RemoveResponse, StatRequest,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::{
|
||||
io,
|
||||
mem,
|
||||
io, mem,
|
||||
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
||||
os::unix::io::{AsRawFd, RawFd},
|
||||
pin::Pin,
|
||||
@@ -21,9 +20,7 @@ use tokio_tfo::TfoStream;
|
||||
use crate::net::{
|
||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||
udp::{BatchRecvMessage, BatchSendMessage},
|
||||
AcceptOpts,
|
||||
AddrFamily,
|
||||
ConnectOpts,
|
||||
AcceptOpts, AddrFamily, ConnectOpts,
|
||||
};
|
||||
|
||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||
|
||||
@@ -24,9 +24,7 @@ use tokio_tfo::TfoStream;
|
||||
use crate::net::{
|
||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||
udp::{BatchRecvMessage, BatchSendMessage},
|
||||
AcceptOpts,
|
||||
AddrFamily,
|
||||
ConnectOpts,
|
||||
AcceptOpts, AddrFamily, ConnectOpts,
|
||||
};
|
||||
|
||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::{
|
||||
io,
|
||||
mem,
|
||||
io, mem,
|
||||
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
||||
os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd},
|
||||
pin::Pin,
|
||||
@@ -22,9 +21,7 @@ use tokio_tfo::TfoStream;
|
||||
use crate::net::{
|
||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||
udp::{BatchRecvMessage, BatchSendMessage},
|
||||
AcceptOpts,
|
||||
AddrFamily,
|
||||
ConnectOpts,
|
||||
AcceptOpts, AddrFamily, ConnectOpts,
|
||||
};
|
||||
|
||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||
|
||||
@@ -15,9 +15,7 @@ use tokio::{
|
||||
|
||||
use crate::net::{
|
||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, ErrorKind},
|
||||
AcceptOpts,
|
||||
AddrFamily,
|
||||
ConnectOpts,
|
||||
AcceptOpts, AddrFamily, ConnectOpts,
|
||||
};
|
||||
|
||||
/// A wrapper of `TcpStream`
|
||||
|
||||
@@ -10,8 +10,7 @@ use std::{
|
||||
io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket},
|
||||
},
|
||||
pin::Pin,
|
||||
ptr,
|
||||
slice,
|
||||
ptr, slice,
|
||||
task::{self, Poll},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
@@ -30,32 +29,13 @@ use windows_sys::{
|
||||
Win32::{
|
||||
Foundation::{BOOL, ERROR_BUFFER_OVERFLOW, ERROR_NO_DATA, ERROR_SUCCESS},
|
||||
NetworkManagement::IpHelper::{
|
||||
if_nametoindex,
|
||||
GetAdaptersAddresses,
|
||||
GAA_FLAG_SKIP_ANYCAST,
|
||||
GAA_FLAG_SKIP_DNS_SERVER,
|
||||
GAA_FLAG_SKIP_MULTICAST,
|
||||
GAA_FLAG_SKIP_UNICAST,
|
||||
IP_ADAPTER_ADDRESSES_LH,
|
||||
if_nametoindex, GetAdaptersAddresses, GAA_FLAG_SKIP_ANYCAST, GAA_FLAG_SKIP_DNS_SERVER,
|
||||
GAA_FLAG_SKIP_MULTICAST, GAA_FLAG_SKIP_UNICAST, IP_ADAPTER_ADDRESSES_LH,
|
||||
},
|
||||
Networking::WinSock::{
|
||||
htonl,
|
||||
setsockopt,
|
||||
WSAGetLastError,
|
||||
WSAIoctl,
|
||||
AF_UNSPEC,
|
||||
IPPROTO_IP,
|
||||
IPPROTO_IPV6,
|
||||
IPPROTO_TCP,
|
||||
IPV6_MTU_DISCOVER,
|
||||
IPV6_UNICAST_IF,
|
||||
IP_MTU_DISCOVER,
|
||||
IP_PMTUDISC_DO,
|
||||
IP_UNICAST_IF,
|
||||
SIO_UDP_CONNRESET,
|
||||
SOCKET,
|
||||
SOCKET_ERROR,
|
||||
TCP_FASTOPEN,
|
||||
htonl, setsockopt, WSAGetLastError, WSAIoctl, AF_UNSPEC, IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP,
|
||||
IPV6_MTU_DISCOVER, IPV6_UNICAST_IF, IP_MTU_DISCOVER, IP_PMTUDISC_DO, IP_UNICAST_IF, SIO_UDP_CONNRESET,
|
||||
SOCKET, SOCKET_ERROR, TCP_FASTOPEN,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -66,9 +46,7 @@ const FALSE: BOOL = 0;
|
||||
use crate::net::{
|
||||
is_dual_stack_addr,
|
||||
sys::{set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||
AcceptOpts,
|
||||
AddrFamily,
|
||||
ConnectOpts,
|
||||
AcceptOpts, AddrFamily, ConnectOpts,
|
||||
};
|
||||
|
||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||
|
||||
@@ -24,14 +24,10 @@ use crate::{context::Context, relay::socks5::Address, ServerAddr};
|
||||
use super::{
|
||||
is_dual_stack_addr,
|
||||
sys::{
|
||||
create_inbound_tcp_socket,
|
||||
set_common_sockopt_after_accept,
|
||||
set_tcp_fastopen,
|
||||
socket_bind_dual_stack,
|
||||
create_inbound_tcp_socket, set_common_sockopt_after_accept, set_tcp_fastopen, socket_bind_dual_stack,
|
||||
TcpStream as SysTcpStream,
|
||||
},
|
||||
AcceptOpts,
|
||||
ConnectOpts,
|
||||
AcceptOpts, ConnectOpts,
|
||||
};
|
||||
|
||||
/// TcpStream for outbound connections
|
||||
|
||||
@@ -39,9 +39,7 @@ use crate::{context::Context, relay::socks5::Address, ServerAddr};
|
||||
|
||||
use super::{
|
||||
sys::{bind_outbound_udp_socket, create_inbound_udp_socket, create_outbound_udp_socket},
|
||||
AcceptOpts,
|
||||
AddrFamily,
|
||||
ConnectOpts,
|
||||
AcceptOpts, AddrFamily, ConnectOpts,
|
||||
};
|
||||
|
||||
/// Message struct for `batch_send`
|
||||
|
||||
@@ -16,10 +16,7 @@ use bytes::{Buf, BufMut, BytesMut};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
|
||||
pub use self::consts::{
|
||||
SOCKS5_AUTH_METHOD_GSSAPI,
|
||||
SOCKS5_AUTH_METHOD_NONE,
|
||||
SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE,
|
||||
SOCKS5_AUTH_METHOD_PASSWORD,
|
||||
SOCKS5_AUTH_METHOD_GSSAPI, SOCKS5_AUTH_METHOD_NONE, SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE, SOCKS5_AUTH_METHOD_PASSWORD,
|
||||
};
|
||||
|
||||
#[rustfmt::skip]
|
||||
|
||||
@@ -55,9 +55,7 @@ use std::{
|
||||
|
||||
use aes::{
|
||||
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
|
||||
Aes128,
|
||||
Aes256,
|
||||
Block,
|
||||
Aes128, Aes256, Block,
|
||||
};
|
||||
use byte_string::ByteStr;
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
|
||||
@@ -58,9 +58,7 @@ use std::{
|
||||
|
||||
use aes::{
|
||||
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
|
||||
Aes128,
|
||||
Aes256,
|
||||
Block,
|
||||
Aes128, Aes256, Block,
|
||||
};
|
||||
use byte_string::ByteStr;
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
|
||||
@@ -32,9 +32,7 @@ use crate::{
|
||||
|
||||
#[cfg(feature = "aead-cipher-2022")]
|
||||
use super::aead_2022::{
|
||||
decrypt_client_payload_aead_2022,
|
||||
decrypt_server_payload_aead_2022,
|
||||
encrypt_client_payload_aead_2022,
|
||||
decrypt_client_payload_aead_2022, decrypt_server_payload_aead_2022, encrypt_client_payload_aead_2022,
|
||||
encrypt_server_payload_aead_2022,
|
||||
};
|
||||
#[cfg(feature = "stream-cipher")]
|
||||
|
||||
@@ -23,11 +23,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::crypto_io::{
|
||||
decrypt_client_payload,
|
||||
decrypt_server_payload,
|
||||
encrypt_client_payload,
|
||||
encrypt_server_payload,
|
||||
ProtocolError,
|
||||
decrypt_client_payload, decrypt_server_payload, encrypt_client_payload, encrypt_server_payload, ProtocolError,
|
||||
ProtocolResult,
|
||||
};
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ use shadowsocks::{
|
||||
utils::{copy_from_encrypted, copy_to_encrypted},
|
||||
},
|
||||
},
|
||||
ProxyClientStream,
|
||||
ProxyListener,
|
||||
ProxyClientStream, ProxyListener,
|
||||
};
|
||||
|
||||
async fn handle_tcp_tunnel_server_client(
|
||||
|
||||
@@ -21,9 +21,7 @@ use shadowsocks::{
|
||||
socks5::Address,
|
||||
tcprelay::utils::{copy_from_encrypted, copy_to_encrypted},
|
||||
},
|
||||
ProxyClientStream,
|
||||
ProxyListener,
|
||||
ServerConfig,
|
||||
ProxyClientStream, ProxyListener, ServerConfig,
|
||||
};
|
||||
use tokio::{
|
||||
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
|
||||
|
||||
@@ -15,4 +15,4 @@ use_try_shorthand = true
|
||||
reorder_impl_items = true
|
||||
#use_small_heuristics = "Max"
|
||||
imports_layout = "HorizontalVertical"
|
||||
imports_granularity = "Crate"
|
||||
#imports_granularity = "Crate"
|
||||
|
||||
@@ -24,12 +24,7 @@ use shadowsocks_service::shadowsocks::relay::socks5::Address;
|
||||
use shadowsocks_service::{
|
||||
acl::AccessControl,
|
||||
config::{
|
||||
read_variable_field_value,
|
||||
Config,
|
||||
ConfigType,
|
||||
LocalConfig,
|
||||
LocalInstanceConfig,
|
||||
ProtocolType,
|
||||
read_variable_field_value, Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType,
|
||||
ServerInstanceConfig,
|
||||
},
|
||||
local::{loadbalancing::PingBalancer, Server},
|
||||
@@ -44,8 +39,7 @@ use shadowsocks_service::{
|
||||
use crate::logging;
|
||||
use crate::{
|
||||
config::{Config as ServiceConfig, RuntimeMode},
|
||||
monitor,
|
||||
vparser,
|
||||
monitor, vparser,
|
||||
};
|
||||
|
||||
#[cfg(feature = "local-dns")]
|
||||
|
||||
@@ -27,8 +27,7 @@ use shadowsocks_service::{
|
||||
use crate::logging;
|
||||
use crate::{
|
||||
config::{Config as ServiceConfig, RuntimeMode},
|
||||
monitor,
|
||||
vparser,
|
||||
monitor, vparser,
|
||||
};
|
||||
|
||||
/// Defines command line options
|
||||
|
||||
@@ -25,8 +25,7 @@ use shadowsocks_service::{
|
||||
use crate::logging;
|
||||
use crate::{
|
||||
config::{Config as ServiceConfig, RuntimeMode},
|
||||
monitor,
|
||||
vparser,
|
||||
monitor, vparser,
|
||||
};
|
||||
|
||||
/// Defines command line options
|
||||
|
||||
@@ -11,8 +11,7 @@ use tokio::{
|
||||
|
||||
use shadowsocks_service::{
|
||||
config::{Config, ConfigType},
|
||||
run_local,
|
||||
run_server,
|
||||
run_local, run_server,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -10,8 +10,7 @@ use tokio::{
|
||||
|
||||
use shadowsocks_service::{
|
||||
config::{Config, ConfigType},
|
||||
run_local,
|
||||
run_server,
|
||||
run_local, run_server,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -13,8 +13,7 @@ use tokio::{
|
||||
use shadowsocks_service::{
|
||||
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
||||
local::socks::client::Socks4TcpClient,
|
||||
run_local,
|
||||
run_server,
|
||||
run_local, run_server,
|
||||
shadowsocks::{
|
||||
config::{ServerAddr, ServerConfig},
|
||||
crypto::CipherKind,
|
||||
|
||||
@@ -13,8 +13,7 @@ use tokio::{
|
||||
use shadowsocks_service::{
|
||||
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
||||
local::socks::client::socks5::Socks5TcpClient,
|
||||
run_local,
|
||||
run_server,
|
||||
run_local, run_server,
|
||||
shadowsocks::{
|
||||
config::{Mode, ServerAddr, ServerConfig},
|
||||
crypto::CipherKind,
|
||||
|
||||
@@ -11,8 +11,7 @@ use tokio::{
|
||||
|
||||
use shadowsocks_service::{
|
||||
config::{Config, ConfigType},
|
||||
run_local,
|
||||
run_server,
|
||||
run_local, run_server,
|
||||
};
|
||||
|
||||
fn random_local_tcp_port() -> u16 {
|
||||
|
||||
@@ -9,8 +9,7 @@ use tokio::time::{self, Duration};
|
||||
use shadowsocks_service::{
|
||||
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
||||
local::socks::client::socks5::Socks5UdpClient,
|
||||
run_local,
|
||||
run_server,
|
||||
run_local, run_server,
|
||||
shadowsocks::{config::Mode, crypto::CipherKind, relay::socks5::Address, ServerConfig},
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ require (
|
||||
github.com/sagernet/gvisor v0.0.0-20240428053021-e691de28565f
|
||||
github.com/sagernet/quic-go v0.45.2-beta.1
|
||||
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
|
||||
github.com/sagernet/sing v0.5.0-alpha.14
|
||||
github.com/sagernet/sing v0.5.0-alpha.14.0.20240806051909-7beca62e4f0d
|
||||
github.com/sagernet/sing-dns v0.3.0-beta.14
|
||||
github.com/sagernet/sing-mux v0.2.0
|
||||
github.com/sagernet/sing-quic v0.2.0-beta.12
|
||||
|
||||
+2
-2
@@ -115,8 +115,8 @@ github.com/sagernet/quic-go v0.45.2-beta.1/go.mod h1:+N3FqM9DAzOWfe64uxXuBejVJwX
|
||||
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.14 h1:Qh1eQHkasQeGNF5H43Avmce+L8uM75v9XWBrrH0OV70=
|
||||
github.com/sagernet/sing v0.5.0-alpha.14/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||
github.com/sagernet/sing v0.5.0-alpha.14.0.20240806051909-7beca62e4f0d h1:OvHB9r8Ao1UBMO9vdmmfnxSdi92Y/wRmSg7CVGMP/M4=
|
||||
github.com/sagernet/sing v0.5.0-alpha.14.0.20240806051909-7beca62e4f0d/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||
github.com/sagernet/sing-dns v0.3.0-beta.14 h1:/s+fJzYKsvLaNDt/2rjpsrDcN8wmCO2JbX6OFrl8Nww=
|
||||
github.com/sagernet/sing-dns v0.3.0-beta.14/go.mod h1:rscgSr5ixOPk8XM9ZMLuMXCyldEQ1nLvdl0nfv+lp00=
|
||||
github.com/sagernet/sing-mux v0.2.0 h1:4C+vd8HztJCWNYfufvgL49xaOoOHXty2+EAjnzN3IYo=
|
||||
|
||||
+28
-16
@@ -132,7 +132,7 @@ func NewRouter(
|
||||
pauseManager: service.FromContext[pause.Manager](ctx),
|
||||
platformInterface: platformInterface,
|
||||
needWIFIState: hasRule(options.Rules, isWIFIRule) || hasDNSRule(dnsOptions.Rules, isWIFIDNSRule),
|
||||
needPackageManager: C.IsAndroid && platformInterface == nil && common.Any(inbounds, func(inbound option.Inbound) bool {
|
||||
needPackageManager: common.Any(inbounds, func(inbound option.Inbound) bool {
|
||||
return len(inbound.TunOptions.IncludePackage) > 0 || len(inbound.TunOptions.ExcludePackage) > 0
|
||||
}),
|
||||
}
|
||||
@@ -532,7 +532,7 @@ func (r *Router) Start() error {
|
||||
r.dnsClient.Start()
|
||||
monitor.Finish()
|
||||
|
||||
if r.needPackageManager && r.platformInterface == nil {
|
||||
if C.IsAndroid && r.platformInterface == nil {
|
||||
monitor.Start("initialize package manager")
|
||||
packageManager, err := tun.NewPackageManager(tun.PackageManagerOptions{
|
||||
Callback: r,
|
||||
@@ -542,13 +542,15 @@ func (r *Router) Start() error {
|
||||
if err != nil {
|
||||
return E.Cause(err, "create package manager")
|
||||
}
|
||||
monitor.Start("start package manager")
|
||||
err = packageManager.Start()
|
||||
monitor.Finish()
|
||||
if err != nil {
|
||||
return E.Cause(err, "start package manager")
|
||||
if r.needPackageManager {
|
||||
monitor.Start("start package manager")
|
||||
err = packageManager.Start()
|
||||
monitor.Finish()
|
||||
if err != nil {
|
||||
return E.Cause(err, "start package manager")
|
||||
}
|
||||
r.packageManager = packageManager
|
||||
}
|
||||
r.packageManager = packageManager
|
||||
}
|
||||
|
||||
for i, rule := range r.dnsRules {
|
||||
@@ -679,20 +681,30 @@ func (r *Router) PostStart() error {
|
||||
}
|
||||
ruleSetStartContext.Close()
|
||||
}
|
||||
var (
|
||||
needProcessFromRuleSet bool
|
||||
needWIFIStateFromRuleSet bool
|
||||
)
|
||||
needFindProcess := r.needFindProcess
|
||||
needWIFIState := r.needWIFIState
|
||||
for _, ruleSet := range r.ruleSets {
|
||||
metadata := ruleSet.Metadata()
|
||||
if metadata.ContainsProcessRule {
|
||||
needProcessFromRuleSet = true
|
||||
needFindProcess = true
|
||||
}
|
||||
if metadata.ContainsWIFIRule {
|
||||
needWIFIStateFromRuleSet = true
|
||||
needWIFIState = true
|
||||
}
|
||||
}
|
||||
if needProcessFromRuleSet || r.needFindProcess {
|
||||
if C.IsAndroid && r.platformInterface == nil && !r.needPackageManager {
|
||||
if needFindProcess {
|
||||
monitor.Start("start package manager")
|
||||
err := r.packageManager.Start()
|
||||
monitor.Finish()
|
||||
if err != nil {
|
||||
return E.Cause(err, "start package manager")
|
||||
}
|
||||
} else {
|
||||
r.packageManager = nil
|
||||
}
|
||||
}
|
||||
if needFindProcess {
|
||||
if r.platformInterface != nil {
|
||||
r.processSearcher = r.platformInterface
|
||||
} else {
|
||||
@@ -711,7 +723,7 @@ func (r *Router) PostStart() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needWIFIStateFromRuleSet || r.needWIFIState) && r.platformInterface != nil {
|
||||
if needWIFIState && r.platformInterface != nil {
|
||||
monitor.Start("initialize WIFI state")
|
||||
r.needWIFIState = true
|
||||
r.interfaceMonitor.RegisterCallback(func(_ int) {
|
||||
|
||||
@@ -754,6 +754,8 @@ function gen_config(var)
|
||||
local dns_listen_port = var["-dns_listen_port"]
|
||||
local direct_dns_port = var["-direct_dns_port"]
|
||||
local direct_dns_udp_server = var["-direct_dns_udp_server"]
|
||||
local direct_dns_tcp_server = var["-direct_dns_tcp_server"]
|
||||
local direct_dns_dot_server = var["-direct_dns_dot_server"]
|
||||
local direct_dns_query_strategy = var["-direct_dns_query_strategy"]
|
||||
local remote_dns_port = var["-remote_dns_port"]
|
||||
local remote_dns_udp_server = var["-remote_dns_udp_server"]
|
||||
@@ -1316,7 +1318,7 @@ function gen_config(var)
|
||||
}
|
||||
end
|
||||
|
||||
if direct_dns_udp_server then
|
||||
if direct_dns_udp_server or direct_dns_tcp_server or direct_dns_dot_server then
|
||||
local domain = {}
|
||||
local nodes_domain_text = sys.exec('uci show passwall | grep ".address=" | cut -d "\'" -f 2 | grep "[a-zA-Z]$" | sort -u')
|
||||
string.gsub(nodes_domain_text, '[^' .. "\r\n" .. ']+', function(w)
|
||||
@@ -1335,12 +1337,26 @@ function gen_config(var)
|
||||
elseif direct_dns_query_strategy == "UseIPv6" then
|
||||
direct_strategy = "ipv6_only"
|
||||
end
|
||||
|
||||
local port = tonumber(direct_dns_port) or 53
|
||||
|
||||
local direct_dns_server, port
|
||||
if direct_dns_udp_server then
|
||||
port = tonumber(direct_dns_port) or 53
|
||||
direct_dns_server = "udp://" .. direct_dns_udp_server .. ":" .. port
|
||||
elseif direct_dns_tcp_server then
|
||||
port = tonumber(direct_dns_port) or 53
|
||||
direct_dns_server = "tcp://" .. direct_dns_tcp_server .. ":" .. port
|
||||
elseif direct_dns_dot_server then
|
||||
port = tonumber(direct_dns_port) or 853
|
||||
if direct_dns_dot_server:find(":") == nil then
|
||||
direct_dns_server = "tls://" .. direct_dns_dot_server .. ":" .. port
|
||||
else
|
||||
direct_dns_server = "tls://[" .. direct_dns_dot_server .. "]:" .. port
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(dns.servers, {
|
||||
tag = "direct",
|
||||
address = "udp://" .. direct_dns_udp_server .. ":" .. port,
|
||||
address = direct_dns_server,
|
||||
address_strategy = "prefer_ipv6",
|
||||
strategy = direct_strategy,
|
||||
detour = "direct",
|
||||
|
||||
@@ -24,6 +24,7 @@ DNS_PORT=15353
|
||||
TUN_DNS="127.0.0.1#${DNS_PORT}"
|
||||
LOCAL_DNS=119.29.29.29,223.5.5.5
|
||||
DEFAULT_DNS=
|
||||
FW_APPEND_DNS=
|
||||
ENABLED_DEFAULT_ACL=0
|
||||
PROXY_IPV6=0
|
||||
PROXY_IPV6_UDP=0
|
||||
@@ -354,7 +355,7 @@ run_ipt2socks() {
|
||||
|
||||
run_singbox() {
|
||||
local flag type node tcp_redir_port udp_redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password
|
||||
local dns_listen_port direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local dns_listen_port direct_dns_port direct_dns_udp_server direct_dns_tcp_server direct_dns_dot_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local loglevel log_file config_file server_host server_port
|
||||
local _extra_param=""
|
||||
eval_set_val $@
|
||||
@@ -395,17 +396,21 @@ run_singbox() {
|
||||
[ -n "$dns_listen_port" ] && _extra_param="${_extra_param} -dns_listen_port ${dns_listen_port}"
|
||||
[ -n "$dns_cache" ] && _extra_param="${_extra_param} -dns_cache ${dns_cache}"
|
||||
|
||||
[ -n "$direct_dns_udp_server" ] && direct_dns_port=$(echo ${direct_dns_udp_server} | awk -F '#' '{print $2}')
|
||||
[ -n "$direct_dns_tcp_server" ] && direct_dns_port=$(echo ${direct_dns_tcp_server} | awk -F '#' '{print $2}')
|
||||
[ -z "$direct_dns_udp_server" ] && [ -z "$direct_dns_tcp_server" ] && {
|
||||
if [ -n "$direct_dns_udp_server" ]; then
|
||||
direct_dns_port=$(echo ${direct_dns_udp_server} | awk -F '#' '{print $2}')
|
||||
_extra_param="${_extra_param} -direct_dns_udp_server $(echo ${direct_dns_udp_server} | awk -F '#' '{print $1}')"
|
||||
elif [ -n "$direct_dns_tcp_server" ]; then
|
||||
direct_dns_port=$(echo ${direct_dns_tcp_server} | awk -F '#' '{print $2}')
|
||||
_extra_param="${_extra_param} -direct_dns_tcp_server $(echo ${direct_dns_tcp_server} | awk -F '#' '{print $1}')"
|
||||
elif [ -n "$direct_dns_dot_server" ]; then
|
||||
direct_dns_port=$(echo ${direct_dns_dot_server} | awk -F '#' '{print $2}')
|
||||
_extra_param="${_extra_param} -direct_dns_dot_server $(echo ${direct_dns_dot_server} | awk -F '#' '{print $1}')"
|
||||
else
|
||||
local local_dns=$(echo -n $(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n1) | tr " " ",")
|
||||
direct_dns_udp_server=$(echo ${local_dns} | awk -F '#' '{print $1}')
|
||||
_extra_param="${_extra_param} -direct_dns_udp_server $(echo ${local_dns} | awk -F '#' '{print $1}')"
|
||||
direct_dns_port=$(echo ${local_dns} | awk -F '#' '{print $2}')
|
||||
}
|
||||
[ -z "$direct_dns_port" ] && direct_dns_port=53
|
||||
[ -n "$direct_dns_udp_server" ] && _extra_param="${_extra_param} -direct_dns_udp_server ${direct_dns_udp_server}"
|
||||
[ -n "$direct_dns_tcp_server" ] && _extra_param="${_extra_param} -direct_dns_tcp_server ${direct_dns_tcp_server}"
|
||||
[ -n "$direct_dns_port" ] && _extra_param="${_extra_param} -direct_dns_port ${direct_dns_port}"
|
||||
fi
|
||||
_extra_param="${_extra_param} -direct_dns_port ${direct_dns_port:-53}"
|
||||
_extra_param="${_extra_param} -direct_dns_query_strategy UseIP"
|
||||
|
||||
[ -n "$remote_dns_query_strategy" ] && _extra_param="${_extra_param} -remote_dns_query_strategy ${remote_dns_query_strategy}"
|
||||
@@ -944,8 +949,22 @@ run_redir() {
|
||||
[ "${DNS_CACHE}" == "0" ] && _args="${_args} dns_cache=0"
|
||||
resolve_dns_port=${dns_listen_port}
|
||||
_args="${_args} dns_listen_port=${resolve_dns_port}"
|
||||
local local_dns=$(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n1)
|
||||
_args="${_args} direct_dns_udp_server=${local_dns}"
|
||||
|
||||
case "$(config_t_get global direct_dns_mode "auto")" in
|
||||
udp)
|
||||
_args="${_args} direct_dns_udp_server=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g')
|
||||
;;
|
||||
tcp)
|
||||
_args="${_args} direct_dns_tcp_server=$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')
|
||||
;;
|
||||
dot)
|
||||
local tmp_dot_dns=$(config_t_get global direct_dns_dot "tls://dot.pub@1.12.12.12")
|
||||
local tmp_dot_ip=$(echo "$tmp_dot_dns" | sed -n 's/.*:\/\/\([^@#]*@\)*\([^@#]*\).*/\2/p')
|
||||
local tmp_dot_port=$(echo "$tmp_dot_dns" | sed -n 's/.*#\([0-9]\+\).*/\1/p')
|
||||
_args="${_args} direct_dns_dot_server=$tmp_dot_ip#${tmp_dot_port:-853}"
|
||||
;;
|
||||
esac
|
||||
|
||||
_args="${_args} remote_dns_protocol=${v2ray_dns_mode}"
|
||||
case "$v2ray_dns_mode" in
|
||||
tcp)
|
||||
@@ -1339,17 +1358,22 @@ start_dns() {
|
||||
echolog "DNS域名解析:"
|
||||
|
||||
local china_ng_local_dns=${LOCAL_DNS}
|
||||
local sing_box_local_dns=
|
||||
local direct_dns_mode=$(config_t_get global direct_dns_mode "auto")
|
||||
case "$direct_dns_mode" in
|
||||
udp)
|
||||
LOCAL_DNS=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g')
|
||||
china_ng_local_dns=${LOCAL_DNS}
|
||||
sing_box_local_dns="direct_dns_udp_server=${LOCAL_DNS}"
|
||||
FW_APPEND_DNS=${LOCAL_DNS}
|
||||
;;
|
||||
tcp)
|
||||
LOCAL_DNS="127.0.0.1#${dns_listen_port}"
|
||||
dns_listen_port=$(expr $dns_listen_port + 1)
|
||||
local DIRECT_DNS=$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')
|
||||
china_ng_local_dns="tcp://${DIRECT_DNS}"
|
||||
sing_box_local_dns="direct_dns_tcp_server=${DIRECT_DNS}"
|
||||
FW_APPEND_DNS="${LOCAL_DNS},${DIRECT_DNS}"
|
||||
ln_run "$(first_type dns2tcp)" dns2tcp "/dev/null" -L "${LOCAL_DNS}" -R "$(get_first_dns DIRECT_DNS 53)" -v
|
||||
echolog " - dns2tcp(${LOCAL_DNS}) -> tcp://$(get_first_dns DIRECT_DNS 53 | sed 's/#/:/g')"
|
||||
echolog " * 请确保上游直连 DNS 支持 TCP 查询。"
|
||||
@@ -1364,6 +1388,11 @@ start_dns() {
|
||||
ln_run "$(first_type chinadns-ng)" chinadns-ng "/dev/null" -b 127.0.0.1 -l ${cdns_listen_port} -c ${DIRECT_DNS} -d chn
|
||||
echolog " - ChinaDNS-NG(${LOCAL_DNS}) -> ${DIRECT_DNS}"
|
||||
echolog " * 请确保上游直连 DNS 支持 DoT 查询。"
|
||||
|
||||
local tmp_dot_ip=$(echo "$DIRECT_DNS" | sed -n 's/.*:\/\/\([^@#]*@\)*\([^@#]*\).*/\2/p')
|
||||
local tmp_dot_port=$(echo "$DIRECT_DNS" | sed -n 's/.*#\([0-9]\+\).*/\1/p')
|
||||
sing_box_local_dns="direct_dns_dot_server=$tmp_dot_ip#${tmp_dot_port:-853}"
|
||||
FW_APPEND_DNS="${LOCAL_DNS},$tmp_dot_ip#${tmp_dot_port:-853}"
|
||||
else
|
||||
echolog " - 你的ChinaDNS-NG版本不支持DoT,直连DNS将使用默认地址。"
|
||||
fi
|
||||
@@ -1420,6 +1449,7 @@ start_dns() {
|
||||
;;
|
||||
esac
|
||||
_args="${_args} dns_socks_address=127.0.0.1 dns_socks_port=${tcp_node_socks_port}"
|
||||
[ -n "${sing_box_local_dns}" ] && _args="${_args} ${sing_box_local_dns}"
|
||||
run_singbox ${_args}
|
||||
}
|
||||
;;
|
||||
@@ -1969,6 +1999,7 @@ DEFAULT_DNSMASQ_CFGID=$(uci show dhcp.@dnsmasq[0] | awk -F '.' '{print $2}' | a
|
||||
DEFAULT_DNS=$(uci show dhcp.@dnsmasq[0] | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label')
|
||||
[ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',')
|
||||
LOCAL_DNS="${DEFAULT_DNS:-119.29.29.29,223.5.5.5}"
|
||||
FW_APPEND_DNS=${LOCAL_DNS}
|
||||
|
||||
DNS_QUERY_STRATEGY="UseIP"
|
||||
[ "$FILTER_PROXY_IPV6" = "1" ] && DNS_QUERY_STRATEGY="UseIPv4"
|
||||
|
||||
@@ -841,12 +841,19 @@ add_firewall_rule() {
|
||||
$ipt_m -N PSW_OUTPUT
|
||||
$ipt_m -A PSW_OUTPUT $(dst $IPSET_LANLIST) -j RETURN
|
||||
$ipt_m -A PSW_OUTPUT $(dst $IPSET_VPSLIST) -j RETURN
|
||||
[ -n "$LOCAL_DNS" ] && {
|
||||
for local_dns in $(echo $LOCAL_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo $local_dns | awk -F '#' '{print $1}')
|
||||
local dns_port=$(echo $local_dns | awk -F '#' '{print $2}')
|
||||
$ipt_m -A PSW_OUTPUT -p udp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
echolog " - [$?]追加直连DNS到iptables:${dns_address}:${dns_port:-53}"
|
||||
[ -n "$FW_APPEND_DNS" ] && {
|
||||
for local_dns in $(echo $FW_APPEND_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo "$local_dns" | sed -E 's/(@|\[)?([0-9a-fA-F:.]+)(@|#|$).*/\2/')
|
||||
local dns_port=$(echo "$local_dns" | sed -nE 's/.*#([0-9]+)$/\1/p')
|
||||
if echo "$dns_address" | grep -q ':'; then
|
||||
$ip6t_m -A PSW_OUTPUT -p udp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
$ip6t_m -A PSW_OUTPUT -p tcp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
echolog " - [$?]追加直连DNS到iptables:[${dns_address}]:${dns_port:-53}"
|
||||
else
|
||||
$ipt_m -A PSW_OUTPUT -p udp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
$ipt_m -A PSW_OUTPUT -p tcp -d ${dns_address} --dport ${dns_port:-53} -j RETURN
|
||||
echolog " - [$?]追加直连DNS到iptables:${dns_address}:${dns_port:-53}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
[ "${USE_DIRECT_LIST}" = "1" ] && $ipt_m -A PSW_OUTPUT $(dst $IPSET_WHITELIST) -j RETURN
|
||||
|
||||
@@ -865,12 +865,19 @@ add_firewall_rule() {
|
||||
nft "flush chain inet fw4 PSW_OUTPUT_MANGLE"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip daddr @$NFTSET_LANLIST counter return"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip daddr @$NFTSET_VPSLIST counter return"
|
||||
[ -n "$LOCAL_DNS" ] && {
|
||||
for local_dns in $(echo $LOCAL_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo $local_dns | awk -F '#' '{print $1}')
|
||||
local dns_port=$(echo $local_dns | awk -F '#' '{print $2}')
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip protocol udp ip daddr ${dns_address} $(factor ${dns_port:-53} "udp dport") counter return"
|
||||
echolog " - [$?]追加直连DNS到nftables:${dns_address}:${dns_port:-53}"
|
||||
[ -n "$FW_APPEND_DNS" ] && {
|
||||
for local_dns in $(echo $FW_APPEND_DNS | tr ',' ' '); do
|
||||
local dns_address=$(echo "$local_dns" | sed -E 's/(@|\[)?([0-9a-fA-F:.]+)(@|#|$).*/\2/')
|
||||
local dns_port=$(echo "$local_dns" | sed -nE 's/.*#([0-9]+)$/\1/p')
|
||||
if echo "$dns_address" | grep -q ':'; then
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE_V6 meta l4proto udp ip6 daddr ${dns_address} $(factor ${dns_port:-53} "udp dport") counter return"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE_V6 meta l4proto tcp ip6 daddr ${dns_address} $(factor ${dns_port:-53} "tcp dport") counter return"
|
||||
echolog " - [$?]追加直连DNS到nftables:[${dns_address}]:${dns_port:-53}"
|
||||
else
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip protocol udp ip daddr ${dns_address} $(factor ${dns_port:-53} "udp dport") counter return"
|
||||
nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip protocol tcp ip daddr ${dns_address} $(factor ${dns_port:-53} "tcp dport") counter return"
|
||||
echolog " - [$?]追加直连DNS到nftables:${dns_address}:${dns_port:-53}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
[ "${USE_DIRECT_LIST}" = "1" ] && nft "add rule inet fw4 PSW_OUTPUT_MANGLE ip daddr @$NFTSET_WHITELIST counter return"
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ require (
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
|
||||
golang.org/x/crypto v0.25.0
|
||||
golang.org/x/net v0.27.0
|
||||
golang.org/x/sync v0.7.0
|
||||
golang.org/x/sys v0.22.0
|
||||
golang.org/x/sync v0.8.0
|
||||
golang.org/x/sys v0.23.0
|
||||
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
|
||||
google.golang.org/grpc v1.65.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
|
||||
+4
-4
@@ -214,8 +214,8 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -228,8 +228,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
|
||||
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
name: Build Artifacts (Flatpak)
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
logLevel:
|
||||
description: 'Log level'
|
||||
required: true
|
||||
default: 'warning'
|
||||
type: choice
|
||||
options:
|
||||
- info
|
||||
- warning
|
||||
- debug
|
||||
tags:
|
||||
description: 'Test scenario tags'
|
||||
required: false
|
||||
type: boolean
|
||||
pull_request:
|
||||
branches: [master, develop]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- '.circleci/**'
|
||||
- '.cirrus.yml'
|
||||
push:
|
||||
branches: [master, develop]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- '.circleci/**'
|
||||
- '.cirrus.yml'
|
||||
release:
|
||||
types: [published]
|
||||
schedule:
|
||||
- cron: '0 16 * * *'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
|
||||
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
|
||||
env:
|
||||
GOPROXY: direct
|
||||
jobs:
|
||||
flatpak-release:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout with shallow submodules
|
||||
run: |
|
||||
# unshallow must come first otherwise submodule may be get unshallowed
|
||||
git fetch --tags --unshallow
|
||||
git submodule update --init --depth 1
|
||||
- name: Change ubuntu mirror
|
||||
run: |
|
||||
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list
|
||||
sudo apt-get update -qq
|
||||
- name: Populate depedencies
|
||||
run: |
|
||||
sudo apt-get install -y libarchive-tools zstd
|
||||
sudo apt-get install -y flatpak flatpak-builder
|
||||
- name: Build Flatpak package
|
||||
run: |
|
||||
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
cd flatpak
|
||||
make
|
||||
flatpak-builder --user --install-deps-from=flathub --disable-updates --force-clean --repo=repo builddir it.gui.yass.yml
|
||||
flatpak build-bundle repo yass.flatpak it.gui.yass --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
cd ..
|
||||
mv -fv flatpak/yass.flatpak yass-${{ github.event.release.tag_name }}.flatpak
|
||||
- name: Upload dist tarball (including debuginfo)
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release upload ${{ github.event.release.tag_name }} yass*.flatpak
|
||||
@@ -85,3 +85,4 @@ local.properties
|
||||
/third_party/rust-ohos
|
||||
/i386-alpine320-sysroot
|
||||
/amd64-alpine320-sysroot
|
||||
*.flatpak
|
||||
|
||||
+2
-2
@@ -4473,7 +4473,7 @@ if (GUI)
|
||||
elseif(GUI_FLAVOUR STREQUAL "qt6" OR GUI_FLAVOUR STREQUAL "qt5")
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/yass.qrc
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/freedesktop/yass.png
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/freedesktop/it.gui.yass.png
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/images)
|
||||
list(APPEND SRC_FILES
|
||||
src/qt6/yass_window.hpp
|
||||
@@ -4941,7 +4941,7 @@ if (GUI)
|
||||
DESTINATION share/applications)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/freedesktop/yass.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/freedesktop/it.gui.yass.png
|
||||
DESTINATION share/pixmaps)
|
||||
|
||||
install(DIRECTORY
|
||||
|
||||
@@ -29,6 +29,9 @@ we are following [chromium's release schedule](https://chromiumdash.appspot.com/
|
||||
- GTK4 [download rpm](https://github.com/Chilledheart/yass/releases/download/1.12.1/yass-gtk4.lp155.x86_64.1.12.1.rpm) or [download deb](https://github.com/Chilledheart/yass/releases/download/1.12.1/yass-gtk4-ubuntu-22.04-jammy_amd64.1.12.1.deb) (minimum requirement: opensuse leap 15.5, centos 9 or ubuntu 22.04)
|
||||
- Qt6 [download rpm](https://github.com/Chilledheart/yass/releases/download/1.12.1/yass-qt6.lp155.x86_64.1.12.1.rpm) or [download deb](https://github.com/Chilledheart/yass/releases/download/1.12.1/yass-qt6-ubuntu-22.04-jammy_amd64.1.12.1.deb) (minimum requirement: opensuse leap 15.5, centos 9 with epel or ubuntu 22.04)
|
||||
|
||||
- Qt5 (Flatpak) [download flatpak](https://github.com/Chilledheart/yass/releases/download/1.12.1/yass-1.12.1.flatpak)
|
||||
- GTK4 (Archlinux) [download binary pkg file](https://repo.archlinuxcn.org/x86_64/yass-proxy-1.12.1-1-x86_64.pkg.tar.zst) (PGP Keys: `sudo pacman -S archlinuxcn-keyring`)
|
||||
|
||||
[](https://aur.archlinux.org/packages/yass-proxy-gtk3)
|
||||
[](https://aur.archlinux.org/packages/yass-proxy-qt5)
|
||||
[](https://aur.archlinux.org/packages/yass-proxy)
|
||||
@@ -125,6 +128,7 @@ Please visit [the pages site](https://letshack.info).
|
||||
[](https://github.com/Chilledheart/yass/actions/workflows/releases-freebsd-binary.yml)
|
||||
[](https://github.com/Chilledheart/yass/actions/workflows/releases-rpm.yml)
|
||||
[](https://github.com/Chilledheart/yass/actions/workflows/releases-deb.yml)
|
||||
[](https://github.com/Chilledheart/yass/actions/workflows/releases-flatpak.yml)
|
||||
|
||||
[](https://github.com/Chilledheart/yass/actions/workflows/releases-windows.yml)
|
||||
[](https://github.com/Chilledheart/yass/actions/workflows/releases-mingw.yml)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
usr/bin/yass
|
||||
usr/share/pixmaps/yass.png
|
||||
usr/share/pixmaps/it.gui.yass.png
|
||||
usr/share/applications/it.gui.yass.desktop
|
||||
usr/share/icons/hicolor/*/apps/yass.png
|
||||
usr/share/icons/hicolor/*/apps/it.gui.yass.png
|
||||
usr/share/locale/*/LC_MESSAGES/yass.mo
|
||||
usr/share/doc/yass/LICENSE
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/builddir
|
||||
/repo
|
||||
/.flatpak
|
||||
/.flatpak-builder
|
||||
/it.gui.yass.yml
|
||||
/it.gui.yass.checksum
|
||||
@@ -0,0 +1,20 @@
|
||||
TAG:=$(shell git describe --abbrev=0 --tags HEAD)
|
||||
|
||||
all: it.gui.yass.yml
|
||||
|
||||
it.gui.yass.checksum:
|
||||
../scripts/build-src.sh
|
||||
cp -fv ../yass-$(TAG).tar.bz2 .
|
||||
sha256sum yass-$(TAG).tar.bz2 > it.gui.yass.checksum
|
||||
|
||||
it.gui.yass.yml: it.gui.yass.checksum it.gui.yass.yml.tmpl
|
||||
cp -fv it.gui.yass.yml.tmpl it.gui.yass.yml
|
||||
sed -i s#PWD#$(PWD)#g it.gui.yass.yml
|
||||
sed -i s/TAG_NAME/$(TAG)/g it.gui.yass.yml
|
||||
$(eval SHA256 := $(shell cat it.gui.yass.checksum | cut -d ' ' -f1))
|
||||
sed -i s/SHA256/$(SHA256)/g it.gui.yass.yml
|
||||
|
||||
clean:
|
||||
rm -f yass-$(TAG).tar.bz2
|
||||
rm -f it.gui.yass.checksum
|
||||
rm -f it.gui.yass.yml
|
||||
@@ -0,0 +1,27 @@
|
||||
id: it.gui.yass
|
||||
runtime: org.kde.Platform
|
||||
runtime-version: '5.15-23.08'
|
||||
sdk: org.kde.Sdk
|
||||
command: yass
|
||||
finish-args:
|
||||
- --share=ipc
|
||||
- --share=network
|
||||
- --socket=fallback-x11
|
||||
- --socket=wayland
|
||||
- --device=dri
|
||||
- --filesystem=~/.yass
|
||||
- --talk-name=org.kde.StatusNotifierWatcher
|
||||
modules:
|
||||
- name: yass
|
||||
buildsystem: cmake-ninja
|
||||
builddir: true
|
||||
config-opts:
|
||||
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
- -DUSE_QT5=on
|
||||
- -DGUI=on
|
||||
- -DCLI=off
|
||||
- -DSERVER=off
|
||||
sources:
|
||||
- type: archive
|
||||
url: file://PWD/yass-TAG_NAME.tar.bz2
|
||||
sha256: SHA256
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user