Skip to content

Commit

Permalink
Initial project
Browse files Browse the repository at this point in the history
  • Loading branch information
ittuann committed Aug 18, 2024
0 parents commit a2e36a3
Show file tree
Hide file tree
Showing 15 changed files with 1,928 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ittuann
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install dependencies
run: npm install

- name: Lint code
run: npm run lint

- name: Pretty code
run: npm run pretty

- name: Build website
run: npm run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore artifacts:
dist

# Ignore files:
package-lock.json
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Route2CIDR
Copyright (C) 2024 ittuann

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Route to CIDR Converter

## <https://ittuann.github.io/Route2CIDR/>

本项目是一个在线工具,用于将路由表转换为 CIDR (无类域间路由,Classless Inter-Domain Routing),并支持转换为Clash、SSTap和Netch代理规则。

工具会自动排除本地网络、专用网络地址及环回地址,并剔除CIDR地址超网包含的子网。

可用于提取 UU 等游戏加速器的规则,详细教程请参考 [SSTap-Rule](https://github.com/FQrabbit/SSTap-Rule/blob/master/doc/UU-extract.md)
1 change: 1 addition & 0 deletions dist/bundle.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import globals from "globals";
import js from "@eslint/js";

export default [
js.configs.recommended,

{
languageOptions: {
globals: {
...globals.browser,
...globals.node, // require
},
},
rules: {
"no-unused-vars": "warn",
"no-undef": "warn",
},
},
];
84 changes: 84 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta charset="UTF-8">
<title>Route to CIDR Converter</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex justify-center items-center min-h-screen">
<div id="container" class="relative bg-white p-8 rounded-lg shadow-lg w-full max-w-screen-2xl">

<div class="flex justify-center items-center mb-6">
<h1 class="text-2xl font-bold text-gray-700 text-center">Route to CIDR Converter</h1>

<a href="https://github.com/ittuann/Route2CIDR" class="absolute top-2 right-2 w-10 h-10" target="_blank">
<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub"
class="w-10 h-10">
</a>
</div>

<div class="mt-8 bg-gray-50 p-6 rounded-lg shadow-md">
<h2 class="text-lg font-semibold text-gray-700">工具介绍</h2>
<p class="text-gray-600 mt-2">
本在线工具用于将路由表转换为代理规则。工具会自动排除本地网络、专用网络地址及环回地址,并剔除CIDR地址超网包含的子网。可用于提取 UU 等游戏加速器的规则,详细教程请参考
<a href="https://github.com/FQrabbit/SSTap-Rule/blob/master/doc/UU-extract.md"
class="text-blue-500 hover:text-blue-700" target="_blank">SSTap-Rule</a>
</p>
<p class="text-gray-600 mt-2">
工具为开源项目,完整代码已上传至
<a href="https://github.com/ittuann/Route2CIDR"
class="text-blue-500 hover:text-blue-700"
target="_blank">GitHub</a>。所有转换操作均仅在本地浏览器内进行,网页不会对您的输入进行存储,无需担心数据安全。
</p>
</div>

<div class="input-info mt-8 mb-6">
<strong class="text-gray-700">粘贴路由表至此:</strong>
<p class="text-sm text-gray-500">Tip: 获取路由表的方式为,在 Windows 终端中执行命令 "route print -4"</p>
</div>

<textarea id="input" rows="10"
class="w-full p-3 border rounded-lg whitespace-pre-wrap focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>

<div class="button-container mt-6 flex justify-center space-x-4">
<button id="buttonToClash" class="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600">转换为 Clash
规则</button>
<button id="buttonToSSTap" class="bg-green-500 text-white px-4 py-2 rounded-lg hover:bg-green-600">转换为 SSTap
规则</button>
<button id="buttonToNetch" class="bg-yellow-500 text-white px-4 py-2 rounded-lg hover:bg-yellow-600">转换为
Netch 规则</button>
</div>

<div id="config-container" class="mt-6">
<strong class="block text-gray-700 mb-2">SSTap 规则头:</strong>
<p class="text-sm text-gray-500 mb-4">Tip: SSTap 规则头格式详情可参考 GitHub:
<a href="https://github.com/FQrabbit/SSTap-Rule/blob/master/doc/home.md#%E8%A7%84%E5%88%99%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E"
class="text-blue-500 hover:text-blue-700" target="_blank">FQrabbit/SSTap-Rule</a>
</p>
<input type="text" id="sstapHeader" value="#gameEnglishName,游戏中文名,0,0,1,0,1,0,By-yourName"
class="w-full p-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>

<div class="flex justify-between items-center mt-8">
<h2 class="text-xl font-semibold text-gray-700">转换结果:</h2>
<div class="flex space-x-4">
<button id="copyButton"
class="bg-purple-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600">复制</button>
<button id="downloadButton"
class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-green-600">下载</button>
</div>
</div>

<div id="notification"
class="fixed bottom-4 right-4 bg-gray-800 text-white py-2 px-4 rounded-lg shadow-lg opacity-0 transition-opacity duration-300">
</div>

<pre id="output" class="bg-gray-100 p-4 rounded-lg mt-4 border max-h-64 overflow-auto"></pre>
</div>

<script src="./dist/bundle.js"></script>
</body>

</html>
Loading

0 comments on commit a2e36a3

Please sign in to comment.