From ffff1418f2be86103444a73478a5e1a044cdec13 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 16:36:34 +0800 Subject: [PATCH 01/15] =?UTF-8?q?[Fixed]=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DPASS=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98=20[C?= =?UTF-8?q?hore]=E8=B0=83=E6=95=B4workflows=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Alpha.yml | 14 ++++++-- adapter/outbound/direct.go | 10 ++++++ adapter/outbound/pass.go | 33 ------------------ config/config.go | 69 +------------------------------------ tunnel/tunnel.go | 1 + 5 files changed, 24 insertions(+), 103 deletions(-) delete mode 100644 adapter/outbound/pass.go diff --git a/.github/workflows/Alpha.yml b/.github/workflows/Alpha.yml index e6d88fa4..7f1e54ff 100644 --- a/.github/workflows/Alpha.yml +++ b/.github/workflows/Alpha.yml @@ -34,10 +34,20 @@ jobs: BINDIR: bin run: make -j releases + - uses: dev-drprasad/delete-tag-and-release@v0.2.0 + with: + delete_release: true # default: false + tag_name: alpha # tag name to delete + repo: / # target repo (optional). defaults to repo running this action + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Alpha - uses: softprops/action-gh-release@v1 + uses: svenstaro/upload-release-action@v2 if: ${{ env.GIT_BRANCH != 'Meta' && success() }} with: - tag_name: alpha + tag: ${{ github.ref }} + asset_name: alpha + overwrite: true files: bin/* prerelease: true \ No newline at end of file diff --git a/adapter/outbound/direct.go b/adapter/outbound/direct.go index f7c88124..7e01f64e 100644 --- a/adapter/outbound/direct.go +++ b/adapter/outbound/direct.go @@ -56,3 +56,13 @@ func NewCompatible() *Direct { }, } } + +func NewPass() *Direct { + return &Direct{ + Base: &Base{ + name: "Pass", + tp: C.Pass, + udp: true, + }, + } +} diff --git a/adapter/outbound/pass.go b/adapter/outbound/pass.go deleted file mode 100644 index 215934de..00000000 --- a/adapter/outbound/pass.go +++ /dev/null @@ -1,33 +0,0 @@ -package outbound - -import ( - "context" - "errors" - "github.com/Dreamacro/clash/component/dialer" - - C "github.com/Dreamacro/clash/constant" -) - -type Pass struct { - *Base -} - -// DialContext implements C.ProxyAdapter -func (r *Pass) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error) { - return nil, errors.New("match Pass rule") -} - -// ListenPacketContext implements C.ProxyAdapter -func (r *Pass) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error) { - return nil, errors.New("match Pass rule") -} - -func NewPass() *Pass { - return &Pass{ - Base: &Base{ - name: "PASS", - tp: C.Pass, - udp: true, - }, - } -} diff --git a/config/config.go b/config/config.go index 1b46c0f0..0134cc3f 100644 --- a/config/config.go +++ b/config/config.go @@ -10,7 +10,6 @@ import ( "net/netip" "net/url" "os" - "regexp" "runtime" "strings" "time" @@ -210,7 +209,6 @@ type RawConfig struct { Proxy []map[string]any `yaml:"proxies"` ProxyGroup []map[string]any `yaml:"proxy-groups"` Rule []string `yaml:"rules"` - Script Script `yaml:"script"` } // Parse config @@ -280,10 +278,6 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) { Profile: Profile{ StoreSelected: true, }, - Script: Script{ - MainCode: "", - ShortcutsCode: map[string]string{}, - }, } if err := yaml.Unmarshal(buf, rawCfg); err != nil { @@ -322,11 +316,6 @@ func ParseRawConfig(rawCfg *RawConfig) (*Config, error) { config.Proxies = proxies config.Providers = providers - err = parseScript(rawCfg) - if err != nil { - return nil, err - } - rules, ruleProviders, err := parseRules(rawCfg, proxies) if err != nil { return nil, err @@ -494,49 +483,6 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ return proxies, providersMap, nil } -func parseScript(cfg *RawConfig) error { - mode := cfg.Mode - script := cfg.Script - mainCode := cleanPyKeywords(script.MainCode) - shortcutsCode := script.ShortcutsCode - - if mode != T.Script && len(shortcutsCode) == 0 { - return nil - } else if mode == T.Script && len(mainCode) == 0 { - return fmt.Errorf("initialized script module failure, can't find script code in the config file") - } - - content := - `# -*- coding: UTF-8 -*- - -from datetime import datetime as whatever - -class ClashTime: - def now(self): - return whatever.now() - - def unix(self): - return int(whatever.now().timestamp()) - - def unix_nano(self): - return int(round(whatever.now().timestamp() * 1000)) - -time = ClashTime() - -` - for k, v := range shortcutsCode { - v = cleanPyKeywords(v) - v = strings.TrimSpace(v) - if len(v) == 0 { - return fmt.Errorf("initialized rule SCRIPT failure, shortcut [%s] code invalid syntax", k) - } - - content += "def " + strings.ToLower(k) + "(ctx, network, process_name, host, src_ip, src_port, dst_ip, dst_port):\n return " + v + "\n\n" - } - - return nil -} - func parseRules(cfg *RawConfig, proxies map[string]C.Proxy) ([]C.Rule, map[string]*providerTypes.RuleProvider, error) { ruleProviders := map[string]*providerTypes.RuleProvider{} log.Infoln("Geodata Loader mode: %s", geodata.LoaderName()) @@ -887,7 +833,7 @@ func parseDNS(rawCfg *RawConfig, hosts *trie.DomainTrie, rules []C.Rule) (*DNS, } func parseAuthentication(rawRecords []string) []auth.AuthUser { - users := []auth.AuthUser{} + var users []auth.AuthUser for _, line := range rawRecords { if user, pass, found := strings.Cut(line, ":"); found { users = append(users, auth.AuthUser{User: user, Pass: pass}) @@ -896,19 +842,6 @@ func parseAuthentication(rawRecords []string) []auth.AuthUser { return users } -func cleanPyKeywords(code string) string { - if len(code) == 0 { - return code - } - keywords := []string{"import", "print"} - - for _, kw := range keywords { - reg := regexp.MustCompile("(?m)[\r\n]+^.*" + kw + ".*$") - code = reg.ReplaceAllString(code, "") - } - return code -} - func parseTun(rawTun RawTun, general *General) (*Tun, error) { if (rawTun.Enable || general.TProxyPort != 0) && general.Interface == "" { autoDetectInterfaceName, err := commons.GetAutoDetectInterface() diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 7486362b..0a0a7ce5 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -369,6 +369,7 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) { } if adapter.Type() == C.Pass || (adapter.Unwrap(metadata) != nil && adapter.Unwrap(metadata).Type() == C.Pass) { + log.Debugln("%s match Pass rule", adapter.Name()) continue } From dbd27ef9104d20341cccc579e75eeab3f1c59475 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 17:07:11 +0800 Subject: [PATCH 02/15] =?UTF-8?q?[Chore]=E8=B0=83=E6=95=B4workflows?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Alpha.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Alpha.yml b/.github/workflows/Alpha.yml index 7f1e54ff..b7296cbe 100644 --- a/.github/workflows/Alpha.yml +++ b/.github/workflows/Alpha.yml @@ -33,10 +33,10 @@ jobs: NAME: Clash.Meta BINDIR: bin run: make -j releases - - - uses: dev-drprasad/delete-tag-and-release@v0.2.0 + - name: Delete old tag and release + uses: dev-drprasad/delete-tag-and-release@v0.2.0 with: - delete_release: true # default: false + delete_release: false # default: false tag_name: alpha # tag name to delete repo: / # target repo (optional). defaults to repo running this action env: From 4e0b22f42de504b4db2c69fc4e2fd6aad183c694 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 18:41:30 +0800 Subject: [PATCH 03/15] =?UTF-8?q?[Chore]=E8=B0=83=E6=95=B4workflows?= =?UTF-8?q?=E6=B5=81=E7=A8=8B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Alpha.yml b/.github/workflows/Alpha.yml index b7296cbe..813f209c 100644 --- a/.github/workflows/Alpha.yml +++ b/.github/workflows/Alpha.yml @@ -37,7 +37,7 @@ jobs: uses: dev-drprasad/delete-tag-and-release@v0.2.0 with: delete_release: false # default: false - tag_name: alpha # tag name to delete +# tag_name: alpha # tag name to delete repo: / # target repo (optional). defaults to repo running this action env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 028ecb70c505dfc6e4174734165a843ea984d067 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 18:44:27 +0800 Subject: [PATCH 04/15] =?UTF-8?q?[Chore]=E8=B0=83=E6=95=B4workflows?= =?UTF-8?q?=E6=B5=81=E7=A8=8B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Alpha.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Alpha.yml b/.github/workflows/Alpha.yml index 813f209c..e2cbc88d 100644 --- a/.github/workflows/Alpha.yml +++ b/.github/workflows/Alpha.yml @@ -34,13 +34,11 @@ jobs: BINDIR: bin run: make -j releases - name: Delete old tag and release - uses: dev-drprasad/delete-tag-and-release@v0.2.0 + uses: cb80/delrel@latest with: - delete_release: false # default: false -# tag_name: alpha # tag name to delete - repo: / # target repo (optional). defaults to repo running this action - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag_name: alpha # tag name to delete +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Alpha uses: svenstaro/upload-release-action@v2 From 5a7b9bdf4592ebd8a337a9b7b7b1252c02c2d536 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 18:49:24 +0800 Subject: [PATCH 05/15] =?UTF-8?q?[Chore]=E8=B0=83=E8=AF=95workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/delete.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/delete.yaml diff --git a/.github/workflows/delete.yaml b/.github/workflows/delete.yaml new file mode 100644 index 00000000..c1374b03 --- /dev/null +++ b/.github/workflows/delete.yaml @@ -0,0 +1,18 @@ +name: Delete Release Assets + +on: push + +jobs: + deleteReleaseAssets: + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v1 + + - name: Delete current release assets + uses: andreaswilli/delete-release-assets-action@ + with: + github_token: ${{ secrets.GITHUB_TOKEN }} +# tagPrefix: v + tag: alpha \ No newline at end of file From ece3bb360a0ffead59c5df32a8bc01c968eae38d Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 18:52:19 +0800 Subject: [PATCH 06/15] =?UTF-8?q?[Chore]=E8=B0=83=E8=AF=95workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/delete.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delete.yaml b/.github/workflows/delete.yaml index c1374b03..0f451b0a 100644 --- a/.github/workflows/delete.yaml +++ b/.github/workflows/delete.yaml @@ -11,7 +11,7 @@ jobs: uses: actions/checkout@v1 - name: Delete current release assets - uses: andreaswilli/delete-release-assets-action@ + uses: andreaswilli/delete-release-assets-action@v2.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} # tagPrefix: v From 4c10d6e212a33a5088ff6009cd64341b440bcff0 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 18:54:00 +0800 Subject: [PATCH 07/15] =?UTF-8?q?[Chore]=E8=B0=83=E8=AF=95workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/delete.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/delete.yaml b/.github/workflows/delete.yaml index 0f451b0a..78f03c02 100644 --- a/.github/workflows/delete.yaml +++ b/.github/workflows/delete.yaml @@ -15,4 +15,5 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} # tagPrefix: v - tag: alpha \ No newline at end of file + tag: alpha + deleteOnlyFromDrafts: false \ No newline at end of file From b323315583f12c34782ece09b021b3cc7cb787c5 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 18:58:23 +0800 Subject: [PATCH 08/15] =?UTF-8?q?[Chore]=E8=B0=83=E8=AF=95workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/delete.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/delete.yaml b/.github/workflows/delete.yaml index 78f03c02..b749291e 100644 --- a/.github/workflows/delete.yaml +++ b/.github/workflows/delete.yaml @@ -16,4 +16,9 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} # tagPrefix: v tag: alpha - deleteOnlyFromDrafts: false \ No newline at end of file + deleteOnlyFromDrafts: false + + - name: Delete a Release + uses: liudonghua123/delete-release-action@v1 + with: + release_name: 'alpha' From 012e044c54b35094511b6a3316c9a58fb34512e8 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 19:02:51 +0800 Subject: [PATCH 09/15] =?UTF-8?q?[Chore]=E5=AE=8C=E6=88=90=E8=B0=83?= =?UTF-8?q?=E8=AF=95workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Alpha.yml | 11 ++++++----- .github/workflows/delete.yaml | 24 ------------------------ 2 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/delete.yaml diff --git a/.github/workflows/Alpha.yml b/.github/workflows/Alpha.yml index e2cbc88d..4db213d3 100644 --- a/.github/workflows/Alpha.yml +++ b/.github/workflows/Alpha.yml @@ -33,12 +33,13 @@ jobs: NAME: Clash.Meta BINDIR: bin run: make -j releases - - name: Delete old tag and release - uses: cb80/delrel@latest + + - name: Delete current release assets + uses: andreaswilli/delete-release-assets-action@v2.0.0 with: - tag_name: alpha # tag name to delete -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + tag: alpha + deleteOnlyFromDrafts: false - name: Upload Alpha uses: svenstaro/upload-release-action@v2 diff --git a/.github/workflows/delete.yaml b/.github/workflows/delete.yaml deleted file mode 100644 index b749291e..00000000 --- a/.github/workflows/delete.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Delete Release Assets - -on: push - -jobs: - deleteReleaseAssets: - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v1 - - - name: Delete current release assets - uses: andreaswilli/delete-release-assets-action@v2.0.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} -# tagPrefix: v - tag: alpha - deleteOnlyFromDrafts: false - - - name: Delete a Release - uses: liudonghua123/delete-release-action@v1 - with: - release_name: 'alpha' From 07fda9311104c773b30490475cdb3907dc7ef856 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 19:48:32 +0800 Subject: [PATCH 10/15] =?UTF-8?q?[Chore]=E5=8D=87=E7=BA=A7=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BE=9D=E8=B5=96=20[Chore]=E9=9A=90=E8=97=8FTUN?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=9C=A8system=E5=A0=86=E6=A0=88=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{Alpha.yml => alpha.yml} | 0 common/cmd/cmd.go | 3 ++- common/cmd/cmd_other.go | 11 +++++++++++ common/cmd/cmd_windows.go | 12 ++++++++++++ go.mod | 18 +++++++++--------- go.sum | 19 +++++++++++++++++++ listener/tun/tun_adapter.go | 1 + 7 files changed, 54 insertions(+), 10 deletions(-) rename .github/workflows/{Alpha.yml => alpha.yml} (100%) create mode 100644 common/cmd/cmd_other.go create mode 100644 common/cmd/cmd_windows.go diff --git a/.github/workflows/Alpha.yml b/.github/workflows/alpha.yml similarity index 100% rename from .github/workflows/Alpha.yml rename to .github/workflows/alpha.yml diff --git a/common/cmd/cmd.go b/common/cmd/cmd.go index b002a2cc..e015dd2e 100644 --- a/common/cmd/cmd.go +++ b/common/cmd/cmd.go @@ -14,8 +14,9 @@ func ExecCmd(cmdStr string) (string, error) { cmd = exec.Command(args[0]) } else { cmd = exec.Command(args[0], args[1:]...) - } + } + prepareBackgroundCommand(cmd) out, err := cmd.CombinedOutput() if err != nil { return "", fmt.Errorf("%v, %s", err, string(out)) diff --git a/common/cmd/cmd_other.go b/common/cmd/cmd_other.go new file mode 100644 index 00000000..c6bc4ac4 --- /dev/null +++ b/common/cmd/cmd_other.go @@ -0,0 +1,11 @@ +//go:build !windows + +package cmd + +import ( + "os/exec" +) + +func prepareBackgroundCommand(cmd *exec.Cmd) { + +} diff --git a/common/cmd/cmd_windows.go b/common/cmd/cmd_windows.go new file mode 100644 index 00000000..5d7fd9d3 --- /dev/null +++ b/common/cmd/cmd_windows.go @@ -0,0 +1,12 @@ +//go:build windows + +package cmd + +import ( + "os/exec" + "syscall" +) + +func prepareBackgroundCommand(cmd *exec.Cmd) { + cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} +} diff --git a/go.mod b/go.mod index ddbddf4f..492c2986 100644 --- a/go.mod +++ b/go.mod @@ -11,19 +11,19 @@ require ( github.com/gofrs/uuid v4.2.0+incompatible github.com/gorilla/websocket v1.5.0 github.com/insomniacslk/dhcp v0.0.0-20220119180841-3c283ff8b7dd - github.com/lucas-clemente/quic-go v0.25.0 + github.com/lucas-clemente/quic-go v0.26.0 github.com/miekg/dns v1.1.47 - github.com/oschwald/geoip2-golang v1.6.1 + github.com/oschwald/geoip2-golang v1.7.0 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.1 github.com/xtls/go v0.0.0-20210920065950-d4af136d3672 go.etcd.io/bbolt v1.3.6 go.uber.org/atomic v1.9.0 go.uber.org/automaxprocs v1.4.0 - golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd - golang.org/x/net v0.0.0-20220225172249-27dd8689420f + golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 + golang.org/x/net v0.0.0-20220325170049-de3da57026de golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 + golang.org/x/sys v0.0.0-20220327210214-530d0810a4d0 golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 golang.zx2c4.com/wireguard v0.0.0-20220318042302-193cf8d6a5d6 golang.zx2c4.com/wireguard/windows v0.5.4-0.20220317000008-6432784c2469 @@ -39,12 +39,12 @@ require ( github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/google/btree v1.0.1 // indirect github.com/kr/pretty v0.2.1 // indirect - github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect - github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect - github.com/marten-seemann/qtls-go1-18 v0.1.0 // indirect + github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect + github.com/marten-seemann/qtls-go1-17 v0.1.1 // indirect + github.com/marten-seemann/qtls-go1-18 v0.1.1 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo v1.16.5 // indirect - github.com/oschwald/maxminddb-golang v1.8.0 // indirect + github.com/oschwald/maxminddb-golang v1.9.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/u-root/uio v0.0.0-20220204230159-dac05f7d2cb4 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect diff --git a/go.sum b/go.sum index d395965f..2235f208 100644 --- a/go.sum +++ b/go.sum @@ -108,17 +108,25 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lucas-clemente/quic-go v0.25.0 h1:K+X9Gvd7JXsOHtU0N2icZ2Nw3rx82uBej3mP4CLgibc= github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= +github.com/lucas-clemente/quic-go v0.26.0 h1:ALBQXr9UJ8A1LyzvceX4jd9QFsHvlI0RR6BkV16o00A= +github.com/lucas-clemente/quic-go v0.26.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= github.com/marten-seemann/qtls-go1-16 v0.1.4 h1:xbHbOGGhrenVtII6Co8akhLEdrawwB2iHl5yhJRpnco= github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-16 v0.1.5 h1:o9JrYPPco/Nukd/HpOHMHZoBDXQqoNtUCmny98/1uqQ= +github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= github.com/marten-seemann/qtls-go1-17 v0.1.0 h1:P9ggrs5xtwiqXv/FHNwntmuLMNq3KaSIG93AtAZ48xk= github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= +github.com/marten-seemann/qtls-go1-17 v0.1.1 h1:DQjHPq+aOzUeh9/lixAGunn6rIOQyWChPSI4+hgW7jc= +github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= github.com/marten-seemann/qtls-go1-18 v0.1.0 h1:gCiNAyl7K4yBBjKkI4LeJjMwIEyCweFoEQFOnRn2MuA= github.com/marten-seemann/qtls-go1-18 v0.1.0/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= +github.com/marten-seemann/qtls-go1-18 v0.1.1 h1:qp7p7XXUFL7fpBvSS1sWD+uSqPvzNQK43DH+/qEkj0Y= +github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7/go.mod h1:U6ZQobyTjI/tJyq2HG+i/dfSoFUt8/aZCM+GKtmFk/Y= github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA= @@ -151,8 +159,12 @@ github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/oschwald/geoip2-golang v1.6.1 h1:GKxT3yaWWNXSb7vj6D7eoJBns+lGYgx08QO0UcNm0YY= github.com/oschwald/geoip2-golang v1.6.1/go.mod h1:xdvYt5xQzB8ORWFqPnqMwZpCpgNagttWdoZLlJQzg7s= +github.com/oschwald/geoip2-golang v1.7.0 h1:JW1r5AKi+vv2ujSxjKthySK3jo8w8oKWPyXsw+Qs/S8= +github.com/oschwald/geoip2-golang v1.7.0/go.mod h1:mdI/C7iK7NVMcIDDtf4bCKMJ7r0o7UwGeCo9eiitCMQ= github.com/oschwald/maxminddb-golang v1.8.0 h1:Uh/DSnGoxsyp/KYbY1AuP0tYEwfs0sCph9p/UMXK/Hk= github.com/oschwald/maxminddb-golang v1.8.0/go.mod h1:RXZtst0N6+FY/3qCNmZMBApR19cdQj43/NM9VkrNAis= +github.com/oschwald/maxminddb-golang v1.9.0 h1:tIk4nv6VT9OiPyrnDAfJS1s1xKDQMZOsGojab6EjC1Y= +github.com/oschwald/maxminddb-golang v1.9.0/go.mod h1:TK+s/Z2oZq0rSl4PSeAEoP0bgm82Cp5HyvYbt8K3zLY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -227,6 +239,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38= golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 h1:S25/rfnfsMVgORT4/J61MJ7rdyseOZOyvLIrZEZ7s6s= +golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -262,6 +276,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -306,9 +322,12 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 h1:saXMvIOKvRFwbOMicHXr0B1uwoxq9dGmLe5ExMES6c4= golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220327210214-530d0810a4d0 h1:G6WAvvcMaaFYQhMbC0L5ZWNExEcJ3j3yFTxx4mwOHtM= +golang.org/x/sys v0.0.0-20220327210214-530d0810a4d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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= diff --git a/listener/tun/tun_adapter.go b/listener/tun/tun_adapter.go index 17058be7..ef538af3 100644 --- a/listener/tun/tun_adapter.go +++ b/listener/tun/tun_adapter.go @@ -151,6 +151,7 @@ func setAtLatest(stackType C.TUNStack, devName string) { switch runtime.GOOS { case "windows": _, _ = cmd.ExecCmd("ipconfig /renew") + case "linux": // _, _ = cmd.ExecCmd("sysctl -w net.ipv4.ip_forward=1") // _, _ = cmd.ExecCmd("sysctl -w net.ipv4.conf.all.forwarding = 1") From 55ce40fbd109e8a7da1cedf616e9d61eb89973b6 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 20:44:52 +0800 Subject: [PATCH 11/15] =?UTF-8?q?[Chore]=E5=8D=87=E7=BA=A7=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BE=9D=E8=B5=96=20[Chore]=E9=9A=90=E8=97=8FTUN?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=9C=A8system=E5=A0=86=E6=A0=88=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/alpha.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index 4db213d3..6f8f8049 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -41,12 +41,31 @@ jobs: tag: alpha deleteOnlyFromDrafts: false + - name: Tag Repo + uses: richardsimko/update-tag@v1 + with: + tag_name: alpha + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Alpha - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/action-gh-release@v1 if: ${{ env.GIT_BRANCH != 'Meta' && success() }} with: tag: ${{ github.ref }} - asset_name: alpha - overwrite: true + tag_name: alpha files: bin/* - prerelease: true \ No newline at end of file + prerelease: true + + - name: send telegram message on push + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TTELEGRAM_CHAT_ID }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + ${{ github.actor }} created commit: + Commit message: ${{ github.event.commits[0].message }} + + Repository: ${{ github.repository }} + + See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} \ No newline at end of file From 705311b70eddcd66ebe05da4e16fc74044a3e725 Mon Sep 17 00:00:00 2001 From: Meta Date: Mon, 28 Mar 2022 20:52:09 +0800 Subject: [PATCH 12/15] =?UTF-8?q?[Chore]=E4=BF=AE=E6=94=B9workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index 6f8f8049..4e4efc72 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -49,7 +49,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Alpha - uses: svenstaro/action-gh-release@v1 + uses: softprops/action-gh-release@v1 if: ${{ env.GIT_BRANCH != 'Meta' && success() }} with: tag: ${{ github.ref }} From 045dd0589ba5b820df5ef5048ed777574d737102 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Mon, 28 Mar 2022 21:04:50 +0800 Subject: [PATCH 13/15] fix: classical missing count --- rule/provider/classical_strategy.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rule/provider/classical_strategy.go b/rule/provider/classical_strategy.go index 45700b81..aba2a4e4 100644 --- a/rule/provider/classical_strategy.go +++ b/rule/provider/classical_strategy.go @@ -37,13 +37,14 @@ func (c *classicalStrategy) OnUpdate(rules []string) { r, err := parseRule(ruleType, rule, "", params) if err != nil { log.Warnln("parse rule error:[%s]", err.Error()) - } + } else { + if !shouldResolveIP { + shouldResolveIP = shouldResolveIP || r.ShouldResolveIP() + } - if !shouldResolveIP { - shouldResolveIP = shouldResolveIP || r.ShouldResolveIP() + classicalRules = append(classicalRules, r) + c.count++ } - - classicalRules = append(classicalRules, r) } c.rules = classicalRules From 63840b33582c22fe2596e7a1213ee4289c6b0e9c Mon Sep 17 00:00:00 2001 From: Markson Hon <50002150+MarksonHon@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:50:12 +0800 Subject: [PATCH 14/15] Fix systemd service --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 86959230..d3834c0c 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ iptables: ### General installation guide for Linux -+ Create user given name `Clash-Meta` ++ Create user given name `clash-meta` + Download and decompress pre-built binaries from [releases](https://github.com/MetaCubeX/Clash.Meta/releases) @@ -236,22 +236,25 @@ iptables: -Run Meta Kernel by user `Clash-Meta` as a daemon. +Run Meta Kernel by user `clash-meta` as a daemon. Create the systemd configuration file at `/etc/systemd/system/Clash-Meta.service`: ``` [Unit] Description=Clash-Meta Daemon, Another Clash Kernel. -After=network.target +After=network.target NetworkManager.service systemd-networkd.service iwd.service [Service] Type=simple -User=Clash-Meta -Group=Clash-Meta +User=clash-meta +Group=clash-meta +LimitNPROC=500 +LimitNOFILE=1000000 CapabilityBoundingSet=cap_net_admin AmbientCapabilities=cap_net_admin Restart=always +ExecStartPre=/usr/bin/sleep 1s ExecStart=/usr/local/bin/Clash-Meta -d /etc/Clash-Meta [Install] From 591ee119c2491730ccb7a842994bf2a17bfc0215 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Wed, 30 Mar 2022 13:05:46 +0800 Subject: [PATCH 15/15] docs: warning --- adapter/provider/provider.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adapter/provider/provider.go b/adapter/provider/provider.go index 30f8d61b..2d449aed 100644 --- a/adapter/provider/provider.go +++ b/adapter/provider/provider.go @@ -40,7 +40,8 @@ func (pp *proxySetProvider) MarshalJSON() ([]byte, error) { "type": pp.Type().String(), "vehicleType": pp.VehicleType().String(), "proxies": pp.Proxies(), - "updatedAt": pp.updatedAt, + //TODO maybe error because year value overflow + "updatedAt": pp.updatedAt, }) }