├── LICENSE ├── README.md ├── README_CN.md ├── build.sh ├── data ├── full └── lite ├── go.mod ├── index.html ├── main.go └── update.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 geeklinux-io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CloudFlare Warp KEY Collection Tool 2 | 3 | [English](README.md) | [简体中文](README_CN.md) 4 | 5 | ## Direct Access 6 | 7 | You can directly access Warp KEY from the following URL (Update data every hour): 8 | 9 | - [https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/lite](https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/lite) 10 | - [https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/full](https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/full) 11 | 12 | You can also obtain it through my GitHub Pages:[CloudFlare WARP Key (geeklinux-io.github.io)](https://geeklinux-io.github.io/warpkey/) 13 | 14 | ## Private Deployment 15 | 16 | ### 1. Install Go 17 | 18 | Make sure you have Go installed. You can download and install Go from the [official Go website](https://golang.org/dl/). 19 | 20 | ### 2. Clone the Project 21 | 22 | Clone this repository to your local environment: 23 | 24 | ```bash 25 | git clone https://github.com/geeklinux-io/warpkey.git 26 | cd warpkey 27 | ``` 28 | 29 | ### 3. Configure 30 | 31 | If needed, you can edit the `main.go` file to adjust configurations. 32 | 33 | ### 4. Run/Build 34 | 35 | Once the Go environment is set up, you can use the following command to package the application: 36 | 37 | ```bash 38 | chmod a+x build.sh 39 | ./build.sh 40 | ``` 41 | You can find the program you have compiled in the `./build` directory under the current directory. 42 | 43 | The tool will collect keys from Telegram and save them in the `./data` directory under the current directory. 44 | 45 | If you want to request the CloudFlare Key through a specific Socket or HTTP proxy, you can use the -- proxy parameter. Of course, you can also use the program - h to view specific usage help 46 | 47 | 48 | ## 5. Auto Update 49 | 50 | You can use crontab to schedule tasks to execute the `update.sh `script in your project and submit the updates to your GitHub repository 51 | 52 | ## License 53 | 54 | This project is licensed under the MIT License. For more details, please see the [LICENSE](LICENSE) file. 55 | 56 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # CloudFlare Warp KEY 收集工具 2 | 3 | [English](README.md) | [简体中文](README_CN.md) 4 | 5 | 我的博客:https://www.wanghaoyu.com.cn/archives/cloudflare-warp-key.html 6 | 7 | ## 获取KEY 8 | 9 | 可以从以下 URL 直接获取 Warp KEY(每隔一小时更新数据): 10 | 11 | - [https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/full](https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/lite) 12 | - [https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/full](https://raw.githubusercontent.com/geeklinux-io/warpkey/main/data/full) 13 | 14 | 也可以通过我的GitHub Pages中获取:[CloudFlare WARP Key (geeklinux-io.github.io)](https://geeklinux-io.github.io/warpkey/) 15 | 16 | 17 | 18 | ## 私有化部署 19 | 20 | ### 1. 安装 Go 21 | 22 | 请确保你已经安装了 Go。你可以从 [Go 官方网站](https://golang.org/dl/) 下载并安装 Go。 23 | 24 | ### 2. 克隆项目 25 | 26 | 将此仓库克隆到你的本地环境中: 27 | 28 | ```bash 29 | git clone https://github.com/geeklinux-io/warpkey.git 30 | cd warpkey 31 | ``` 32 | 33 | ### 3. 配置 34 | 35 | 如有需要,可以编辑 `main.go` 文件以调整配置。 36 | 37 | ### 4. 运行/构建 38 | 39 | 在配置好 Go 环境之后,可以使用以下命令打包程序: 40 | 41 | ```bash 42 | chmod a+x build.sh 43 | ./build.sh 44 | ``` 45 | 46 | 构建好的应用程序会自动放置到当前所在目录的`build`目录中。 47 | 48 | 该工具将从 Telegram 收集密钥,并将其保存在当前目录下的`/data`目录中。 49 | 50 | 你也可以通过特定的Socket 或者HTTP代理去请求获取 CloudFlare Key 可以使用 --proxy 参数,当然,你也可以使用 程序 -h 查看具体的使用帮助。 51 | 52 | ## 5. 自动更新 53 | 54 | 您可以使用crontab计划任务执行项目中的update.sh脚本,并将更新提交到您的GitHub存储库中。 55 | 56 | ## 许可 57 | 58 | 该项目使用 MIT 许可。有关详细信息,请参阅 [LICENSE](LICENSE) 文件。 59 | 60 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR="$(dirname "$(realpath "$0")")" 4 | PROJECT_DIR="$SCRIPT_DIR/warpkey" 5 | OUTPUT_DIR="$SCRIPT_DIR/build" 6 | 7 | mkdir -p "$OUTPUT_DIR" 8 | 9 | PLATFORMS=("linux/amd64" "linux/arm64" "windows/amd64" "windows/arm64") 10 | 11 | for PLATFORM in "${PLATFORMS[@]}"; do 12 | IFS="/" read -r OS ARCH <<< "$PLATFORM" 13 | export GOOS=$OS 14 | export GOARCH=$ARCH 15 | 16 | OUTPUT_FILE="$OUTPUT_DIR/warpkey-${OS}-${ARCH}" 17 | 18 | echo "Building for $OS/$ARCH..." 19 | go build -o "$OUTPUT_FILE" 20 | 21 | if [ $? -eq 0 ]; then 22 | echo "Build successful for $OS/$ARCH! Executable is located at $OUTPUT_FILE" 23 | else 24 | echo "Build failed for $OS/$ARCH!" 25 | fi 26 | done 27 | -------------------------------------------------------------------------------- /data/full: -------------------------------------------------------------------------------- 1 | C49K32af-P9T5k61K-79K04zyM 2 | s02eu96S-C38jZ5D6-94V5Y0Kw 3 | 3hW8wl56-69KU8H5s-Q09Az4m2 4 | A9L4Nh27-Sc2I1e93-91iWVs48 5 | 5ZI926RY-j0pno124-l2946nsr 6 | Uy89e60R-17c93YFh-0Yq745Vx 7 | 278lv6pL-TF9f4k17-R0X8x65U 8 | y1d329ha-78y29JQV-2yjf84k7 9 | 58h31TpF-79Y5x8Nu-53ojZY82 10 | bX8349OR-V5ni8a64-R5704PzM 11 | 0E2u8Gg6-83NPuF16-5S70aH1P 12 | 9m2O8Eu4-dFb038J6-L8C74V2o 13 | 57XGm13y-3B0ns1z7-J5v9oE30 14 | q85j04kp-HbI893B1-N8Z12BM5 15 | Cyq371p0-K3b156pD-bE8453th 16 | bgFA7839-0Es2Gn65-d0g27R3V 17 | zp4c93e6-5b108otR-8N3g0K4Z 18 | r06cvZ84-6Gz2Ej83-9xmB1F54 19 | YH9kz021-Qqe432l8-XT147j8C 20 | 1M85YGd2-J46crO12-U1vE32n0 21 | yP69v7C0-70mk98PS-MZ8v1l90 22 | 8l143NBW-J4iCz961-j5d28p3o 23 | h79eH1q6-QN312ry8-2w0UC7Y1 24 | 2ND91H0U-eh948X0w-qFu784b6 25 | 1bU37s6P-W1O4QM60-DpK2P018 26 | 9qc43gu1-IDwz7903-Hj97Sr81 27 | 53k0Zf8i-M12y8ks9-08mcX42R 28 | 0C1UO2Y6-709FZxu3-kQ98L13h 29 | K1v62W9c-k46eE50F-74exZ2U0 30 | t9Hxv718-7Y6P29rk-R15K8c6f 31 | 3G76iPD9-194rio7m-5Db6c47f 32 | An19jq63-SN7U89L2-PN37J60q 33 | 670UZ1Rx-q3Ac105L-27Zu19dX 34 | 9O2c4H6i-6oXZ0x85-052UH3tG 35 | y8Qf467w-j3u9E15m-71Kw95cH 36 | G9JFk586-65ke1Qi8-YZF70L26 37 | 35V7TKR8-91B2uCR0-GsZ5136q 38 | D6im04N1-k21NZY83-2Mn8s95c 39 | sm4532lc-Z47s02dF-87p0X2UL 40 | 8569aLZz-72Hdc6L4-YJ08V2o3 41 | B8y9NJ75-U3N576kZ-5XoT869p 42 | gO738aX5-J4b0N3I2-t6519xrp 43 | Jt5Lf897-128Dwah0-cF4x0b37 44 | 0Mq84k1S-01lO26qg-U03YlP98 45 | d5H7L6v2-kt84Z39J-8R562MSB 46 | 895oUd3H-8tj32aP1-30ViX8T5 47 | 2L1KB36o-bK1Se532-zo4K6Y71 48 | O4F5SP86-7y9Tbp03-34j9A1FY 49 | 14A8sF7c-94WfG7N6-Adi9684Q 50 | 5VjA61I9-jB74R25u-E27gl1i6 51 | FJP4L180-T8P5G0M6-7nt9g6J0 52 | i08ebA24-W6ys450p-m5062MvX 53 | o201q8hV-Y2c348TB-62F7VzE8 54 | l9nd85y7-J76Xt90Q-y75Kd13U 55 | 7a2p1g8O-706ulP2x-6g91Rrj5 56 | dj5r60w8-8z4Pf67h-Sq4680vB 57 | 1PK932EH-r873apw1-Se15Xp38 58 | d0p67Yi2-nQ59D0t2-Ms0D623Z 59 | 5U1d09XG-e0F91Kv6-1lI04G8O 60 | k86P9v1s-g720MZ5N-927eqMn4 61 | Ji9N7D53-57KyZ2F9-E7V46Mm1 62 | 50oOh94B-7XDx80j1-3fJN74K9 63 | 95EqU81Q-m641N2Vk-x807b1yZ 64 | 1749lQug-1j8P35XD-hAJ2315t 65 | L0s8J76o-j95Na0r1-5JE762PZ 66 | 6hSpx923-GS16q38W-4hy90Ks8 67 | c2Zi534V-3C1J9wL0-u0hIE412 68 | 6IKnk513-u267kJd8-7Hi68Vb9 69 | Y1m0A2T7-I62Fkr83-A7F36G4E 70 | mpA260T9-7YI3MZ29-J7h6lH35 71 | K15UF7l0-U018oS2P-kbQ7354Y 72 | 78y1zV4x-49QkW85I-0ew5DB48 73 | f38k5ms0-O4628rSB-p6Td290s 74 | 36b5yFl4-8XL19U3k-z4P5L7F2 75 | zA837fI4-h82aQ0b1-mes83L79 76 | 37CUD19B-C3U58w1p-Xl1u9J50 77 | p6f2lq14-4C9q15fO-G2u8h3J1 78 | oL8r59e7-3NO28lZ5-up95Q6s4 79 | 5GPS3b19-K36VrS85-56PW9mG2 80 | cU41DR03-60SC4vF8-FP47f3v9 81 | k903i8Va-267l4ZtH-c812mFY4 82 | w341lh7W-7d25XjR4-10zh67nj 83 | 40U1lcX8-6Y83E2KI-0q5t7rF8 84 | kWl5n384-1V7Dx34r-r8jQ70i9 85 | Is4qe815-lbm618W9-T8fW16g2 86 | h7tq231S-0w96L2dE-51bc7TM2 87 | D6Ok8h74-9SX1Is04-yt6192fp 88 | U28h6nR7-X1iu5N98-q41ua02v 89 | pP58mF41-k96nuC31-53n07Lyr 90 | 85NwO97q-9f0n82Wg-fy9L80V4 91 | 29ls16Mz-W35F8Vi4-rR872h0U 92 | d2Vg90q1-c42bl0z1-ks0qJ413 93 | h897y4Au-Ox1G46S5-70EoRN13 94 | oU08k59B-TKz317L5-F41o52UT 95 | Vp71X26y-m10w2Z7y-Prc361d7 96 | lG7942FN-U02J9B3i-3106qysi 97 | nc234X5y-kne527T6-Q5l83pY7 98 | 5Z1U2E4o-nz894v0X-z59v67VO 99 | sB2xf935-sx91D52b-rQU21T93 100 | A49Nim58-4tC2o85U-h5y63FV1 -------------------------------------------------------------------------------- /data/lite: -------------------------------------------------------------------------------- 1 | v3I5y89P-314vftp9-UK4m695q 2 | mw278zN1-r6U92PI1-o72Pp95G 3 | 1L25OVz4-250yQ1EJ-CF81s2K3 4 | 3ESt4y51-M0SZ2B78-58f10PVE 5 | 895oUd3H-8tj32aP1-30ViX8T5 6 | 10rw8BN2-r983fm7l-Jc1640Nb 7 | gx85Y9F3-63WEIO19-84e0AZT3 8 | 278lv6pL-TF9f4k17-R0X8x65U 9 | q7x93iI5-8gu0Ic31-NXq23F71 10 | Z1T34Ne2-2b3ox86Z-4B8Pc6X0 11 | 6TQX8i12-371ULN4q-A153Me4S 12 | fp156j9o-4G623Bfs-O65Q38Pv 13 | Ji9N7D53-57KyZ2F9-E7V46Mm1 14 | kWl5n384-1V7Dx34r-r8jQ70i9 15 | O4F5SP86-7y9Tbp03-34j9A1FY -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module warpkey 2 | 3 | go 1.22.5 4 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CloudFlare WARP Key 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 57 | 58 | 59 |
60 | 61 | 62 | 63 | {{ $t('menu.fullVersion') }} 64 | {{ $t('menu.liteVersion') }} 65 | {{ $t('menu.about') }} 66 | {{ $t('menu.github') }} 67 | {{ $t('menu.releases') }} 68 | 69 | 73 | 74 | 75 |
76 |

{{ $t('about.title') }}

77 |

{{ $t('about.description') }}

78 |

{{ $t('about.blog') }}: wanghaoyu.com.cn

79 |

{{ $t('about.readme') }}: README

80 |

{{ $t('about.update') }}

81 |
82 | 83 | 84 | 87 | 88 | 89 |
90 | 93 |
94 |
95 | 96 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "io/ioutil" 7 | "log" 8 | "math/rand" 9 | "net/http" 10 | "net/url" 11 | "os" 12 | "regexp" 13 | "time" 14 | ) 15 | 16 | const ( 17 | outputDir = "data" 18 | fullPath = "data/full" 19 | litePath = "data/lite" 20 | ) 21 | 22 | // fetchKeysFromURL fetches the content from the given URL and extracts keys 23 | func fetchKeysFromURL(urlStr string, proxyURL *url.URL) ([]string, error) { 24 | var client *http.Client 25 | 26 | if proxyURL != nil { 27 | transport := &http.Transport{ 28 | Proxy: http.ProxyURL(proxyURL), 29 | } 30 | client = &http.Client{Transport: transport} 31 | } else { 32 | client = &http.Client{} 33 | } 34 | 35 | response, err := client.Get(urlStr) 36 | if err != nil { 37 | return nil, err 38 | } 39 | defer response.Body.Close() 40 | 41 | body, err := ioutil.ReadAll(response.Body) 42 | if err != nil { 43 | return nil, err 44 | } 45 | 46 | // Regular expression to find keys in the format key 47 | pattern := `([A-Za-z0-9-]+)` 48 | re := regexp.MustCompile(pattern) 49 | matches := re.FindAllStringSubmatch(string(body), -1) 50 | 51 | var keys []string 52 | for _, match := range matches { 53 | keys = append(keys, match[1]) 54 | } 55 | return keys, nil 56 | } 57 | 58 | // writeKeysToFile writes the list of keys to the specified file path 59 | func writeKeysToFile(keys []string, path string) error { 60 | file, err := os.Create(path) 61 | if err != nil { 62 | return err 63 | } 64 | defer file.Close() 65 | 66 | for i, key := range keys { 67 | if i > 0 { 68 | file.WriteString("\n") 69 | } 70 | file.WriteString(key) 71 | } 72 | return nil 73 | } 74 | 75 | func main() { 76 | proxy := flag.String("proxy", "", "HTTP or SOCKS5 proxy URL (e.g., http://proxy.example.com:8080 or socks5://localhost:1080)") 77 | flag.Parse() 78 | 79 | var proxyURL *url.URL 80 | if *proxy != "" { 81 | var err error 82 | proxyURL, err = url.Parse(*proxy) 83 | if err != nil { 84 | log.Fatalf("Invalid proxy URL: %v", err) 85 | } 86 | } 87 | 88 | sources := []string{ 89 | "https://t.me/s/warpplus", 90 | "https://t.me/s/warppluscn", 91 | "https://t.me/s/warpPlusHome", 92 | "https://t.me/s/warp_veyke", 93 | } 94 | 95 | var allKeys []string 96 | for _, url := range sources { 97 | keys, err := fetchKeysFromURL(url, proxyURL) 98 | if err != nil { 99 | log.Printf("Error fetching keys from %s: %v", url, err) 100 | continue 101 | } 102 | allKeys = append(allKeys, keys...) 103 | } 104 | 105 | // Remove duplicates from the keys list 106 | uniqueKeys := make(map[string]struct{}) 107 | for _, key := range allKeys { 108 | uniqueKeys[key] = struct{}{} 109 | } 110 | 111 | var keysList []string 112 | for key := range uniqueKeys { 113 | keysList = append(keysList, key) 114 | } 115 | 116 | if len(keysList) > 0 { 117 | // Create output directory if it does not exist 118 | if err := os.MkdirAll(outputDir, os.ModePerm); err != nil { 119 | log.Fatalf("Error creating directory %s: %v", outputDir, err) 120 | } 121 | 122 | // Generate full file with up to 100 keys 123 | x := 0 124 | var fullKeys []string 125 | for _, key := range keysList { 126 | if x >= 100 { 127 | break 128 | } 129 | fullKeys = append(fullKeys, key) 130 | x++ 131 | } 132 | if err := writeKeysToFile(fullKeys, fullPath); err != nil { 133 | log.Fatalf("Error writing to file %s: %v", fullPath, err) 134 | } 135 | 136 | // Generate lite file with up to 15 keys, shuffled 137 | rand.Seed(time.Now().UnixNano()) 138 | rand.Shuffle(len(keysList), func(i, j int) { 139 | keysList[i], keysList[j] = keysList[j], keysList[i] 140 | }) 141 | 142 | i := 0 143 | var liteKeys []string 144 | for _, key := range keysList { 145 | if i >= 15 { 146 | break 147 | } 148 | liteKeys = append(liteKeys, key) 149 | i++ 150 | } 151 | if err := writeKeysToFile(liteKeys, litePath); err != nil { 152 | log.Fatalf("Error writing to file %s: %v", litePath, err) 153 | } 154 | 155 | fmt.Println("successfully.") 156 | } else { 157 | fmt.Println("No keys found.") 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Author: geeklinux-io(GitHub) 3 | # Blog: https://www.geeklinux.cn 4 | # Regularly update scripts 5 | # You can use crontab to schedule tasks to execute this script and submit updates to your GitHub repository 6 | 7 | # Set Env 8 | TOOL_DIR="" 9 | PROJECT_DIR="" 10 | DATA_DIR="$TOOL_DIR/data" 11 | PROJECT_DATA_DIR="$PROJECT_DIR/data" 12 | EXECUTABLE="$TOOL_DIR/warpkey-linux-amd64" 13 | 14 | cd "$TOOL_DIR" || exit 1 15 | if [ -x "$EXECUTABLE" ]; then 16 | "$EXECUTABLE" || exit 1 17 | else 18 | echo "Executable $EXECUTABLE not found or not executable" 19 | exit 1 20 | fi 21 | 22 | rm -rf "$PROJECT_DATA_DIR"/* 23 | cp -r "$DATA_DIR"/* "$PROJECT_DATA_DIR/" 24 | cd "$PROJECT_DIR" || exit 1 25 | 26 | if git status --porcelain | grep -q '^'; then 27 | current_time=$(date +"%Y-%m-%d %H:%M:%S") 28 | git add ./data 29 | git commit -m "🚀Automatic update - $current_time" 30 | git push || exit 1 31 | else 32 | echo "No changes to commit" 33 | fi 34 | --------------------------------------------------------------------------------