diff --git a/.github/workflows/tool.yaml b/.github/workflows/tool.yaml index 45ff77a..8517443 100644 --- a/.github/workflows/tool.yaml +++ b/.github/workflows/tool.yaml @@ -62,7 +62,7 @@ jobs: - name: Docker Buildx (push) run: | docker buildx build --no-cache \ - --platform linux/arm64,linux/amd64 \ + --platform linux/amd64,linux/arm64 \ --output "type=image,push=true" \ --tag ${{ env.REGISTRY_NAME }}/yylt/tool:latest \ --tag ${{ env.REGISTRY_NAME }}/yylt/tool:${{ env.date }} \ diff --git a/Dockerfile-tool b/Dockerfile-tool index faacf7a..9e1236e 100644 --- a/Dockerfile-tool +++ b/Dockerfile-tool @@ -31,13 +31,14 @@ ARG TARGETARCH # COPY --from=helm /usr/bin/helm /usr/bin/ # COPY --from=kube /opt/bitnami/kubectl/bin/kubectl /usr/bin/ -RUN apk -U --no-cache add curl jq git bash netcat-openbsd wrk buildah python3 openssh py3-pip && \ +RUN apk -U --no-cache add curl jq git bash netcat-openbsd wrk buildah python3 openssh py3-pip buildah podman skopeo && \ pip3 install --break-system-packages requests # RUN pip3 install --no-cache-dir s3cmd # COPY --from=builder /workspace/usr/local/bin/ctr /usr/bin/ # COPY --from=builder /workspace/usr/local/bin/crictl /usr/bin/ # COPY --from=builder /workspace/gomplate /usr/bin/ + COPY --from=builder /workspace/crane /usr/bin/ COPY --from=builder /workspace/yq /usr/bin/ COPY --from=builder /workspace/mc /usr/bin/ diff --git a/gfwlist/autoproxy_rule.md b/gfwlist/autoproxy_rule.md deleted file mode 100644 index f8c8bf5..0000000 --- a/gfwlist/autoproxy_rule.md +++ /dev/null @@ -1,63 +0,0 @@ -## Basic - -``` -example.com -``` - -- 匹配:http://www.example.com/foo -- 匹配:http://www.google.com/search?q=www.example.com -- 不匹配:https://www.example.com/ - -用于表明字符串 example.com 为 URL 关键词。任何含关键词的 http 连接(不包括 https)皆会使用代理。 - ----- - -``` -||example.com -``` - -- 匹配:http://example.com/foo -- 匹配:https://subdomain.example.com/bar -- 不匹配:http://www.google.com/search?q=example.com - -匹配整个域名(含子域名)(不论是 http 还是 https),一般用于该站点的 IP 被封锁的情况。 - ----- - -``` -@@||example.com -``` - -这种规则的优先级最高,表示所有匹配 ||example.com 规则的网址均 禁止 代理。一般用于特殊情况,比如禁止对国内的网站误用代理。 - -## Others - -``` -|https://ssl.example.com -``` - -这种规则匹配的是所有以 https://ssl.example.com 开头的地址。一般用于某些 IP 的 HTTPS 访问被定点封锁的情况。 - ---- - -``` -|http://example.com -``` - -这种规则匹配的是所有以 http://example.com 开头的地址。一般用于某些域名较短的网站,例如短网址服务,可以防止出现慢规则,也用于暂时应付 issue 117。 - ---- - -``` -/^https?:\/\/[^\/]+example\.com/ -``` - -这种规则匹配的是域名中含有 example.com 这个字符串的,是正则表达式,较不常见。一般用于该字符串被 DNS 污染的情况。 - ---- - -``` -!Comment -``` - -注释,以英文感叹号开头,解释说明,不起实际作用。 \ No newline at end of file diff --git a/gfwlist/go.mod b/gfwlist/go.mod deleted file mode 100644 index 5c44f3c..0000000 --- a/gfwlist/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module gfwlist - -go 1.20 diff --git a/gfwlist/go.sum b/gfwlist/go.sum deleted file mode 100644 index e69de29..0000000 diff --git a/gfwlist/main.go b/gfwlist/main.go deleted file mode 100644 index e5e2b5f..0000000 --- a/gfwlist/main.go +++ /dev/null @@ -1,168 +0,0 @@ -package main - -import ( - "bufio" - "bytes" - "encoding/base64" - "flag" - "fmt" - "io" - "net" - "net/http" - "os" - "regexp" - "strings" - "sync" - "time" -) - -var ( - wg = sync.WaitGroup{} - timeout = time.Second * 2 - tlds, fpath string - mydomain string - - domainCh = make(chan string, 1024) - blackCh = make(chan string, 1024) - - re = regexp.MustCompile(`^[a-zA-Z0-9.\|]+$`) -) - -func removeSecondDot(s string) string { - // 查找第一个 . 的位置 - firstDotIndex := strings.Index(s, ".") - if firstDotIndex == -1 { - // 如果没有找到 .,直接返回原字符串 - return s - } - - // 查找第二个 . 的位置 - secondDotIndex := strings.Index(s[firstDotIndex+1:], ".") - if secondDotIndex == -1 { - return s - } - secondDotIndex += firstDotIndex + 1 - return s[firstDotIndex+1:] -} - -func download() { - url := "https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt" - - // 下载文件 - resp, err := http.Get(url) - if err != nil { - fmt.Printf("读取 %s 失败: %s\n", url, err) - return - } - defer resp.Body.Close() - if resp.StatusCode != 200 { - fmt.Printf("读取 %s 失败,code: %d\n", url, resp.StatusCode) - return - } - // 读取文件内容 - body, err := io.ReadAll(resp.Body) - if err != nil { - fmt.Printf("读取 %s 失败: %s\n", url, err) - return - } - - // Base64 解码 - decoded, err := base64.StdEncoding.DecodeString(string(body)) - if err != nil { - fmt.Println("Base64 解码失败:", err) - return - } - // tld - var tld []string - tldSlice := strings.Split(tlds, ",") - for _, v := range tldSlice { - tld = append(tld, strings.TrimSpace(v)) - } - - // 逐行 - scanner := bufio.NewScanner(strings.NewReader(string(decoded))) - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - - if !strings.HasPrefix(line, "||") { - continue - } - // 检查行是否符合正则表达式 - if !re.MatchString(line) { - continue - } - var include bool = false - for _, v := range tld { - if strings.HasSuffix(line, v) { - include = true - break - } - } - if len(tld) == 0 { - include = true - } - if !include { - continue - } - wg.Add(1) - domainCh <- strings.TrimLeft(line, "||") - } - close(domainCh) -} - -func update() { - var ( - i int - buf bytes.Buffer - keys = map[string]struct{}{} - ) - buf.WriteString(` -[AutoProxy 0.2.9] -! Expires: 72h -! Title: GFW_Black_list by yylt - -`) - - for b := range blackCh { - b := removeSecondDot(b) - if _, ok := keys[b]; ok { - continue - } - keys[b] = struct{}{} - buf.WriteString(fmt.Sprintf("||%s\n", b)) - i++ - } - err := os.WriteFile(fpath, buf.Bytes(), 0644) - if err != nil { - fmt.Printf("写入文件 %s 错误: %s", fpath, err) - } - fmt.Println("总共数量:", i) -} - -func main() { - num := flag.Int("num", 100, "number of goroutine") - flag.StringVar(&tlds, "tld", "com,io", "tld domain") - flag.StringVar(&fpath, "file", "./gfwblack", "file path") - flag.StringVar(&mydomain, "include", "google.com", "custom black domain") - flag.Parse() - - for i := 0; i < *num; i++ { - // 使用执行任务 - go func() { - for domain := range domainCh { - conn, err := net.DialTimeout("tcp", domain+":80", timeout) - if err == nil { - blackCh <- domain - conn.Close() - } - wg.Done() - } - }() - } - download() - go func() { - wg.Wait() - close(blackCh) - }() - update() -}