Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifersanthem authored Apr 28, 2024
0 parents commit f26a7a0
Show file tree
Hide file tree
Showing 10 changed files with 3,011 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/cf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: ⛅ CF Worker
on:
# docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
# docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch
# docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
workflow_dispatch:
# github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
# docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
inputs:
# docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
environment:
description: 'wrangler env to deploy to'
required: true
default: 'dev'
type: choice
options:
- dev
- prod
- one
commit:
description: 'git tip commit to deploy'
default: 'main'
required: true

push:
# TODO: inputs.environment and inputs.commit
branches:
- "main"
tags:
- "v*"
paths-ignore:
- ".github/**"
- "!.github/workflows/cf.yml"
- ".env.example"
- ".eslintrc.cjs"
- ".prettierignore"
- "fly.toml"
- "README.md"
- "node.Dockerfile"
- "deno.Dockerfile"
- "import_map.json"
- ".vscode/*"
- ".husky/*"
- ".prettierrc.json"
- "LICENSE"
- "run"
repository_dispatch:

env:
GIT_REF: ${{ github.event.inputs.commit || github.ref }}
# default is 'dev' which is really empty/no env
WORKERS_ENV: ''

jobs:
deploy:
name: 🚀 Deploy worker
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ env.GIT_REF }}
fetch-depth: 0

- name: 🛸 Env?
# 'dev' env deploys to default WORKERS_ENV, which is, '' (an empty string)
if: github.event.inputs.environment == 'prod' || github.event.inputs.environment == 'one'
run: |
echo "WORKERS_ENV=${WENV}" >> $GITHUB_ENV
echo "COMMIT_SHA=${COMMIT_SHA}" >> $GITHUB_ENV
shell: bash
env:
WENV: ${{ github.event.inputs.environment }}
COMMIT_SHA: ${{ github.sha }}

- name: 🎱 Tag?
# docs.github.com/en/actions/learn-github-actions/contexts#github-context
if: github.ref_type == 'tag'
run: |
echo "WORKERS_ENV=${WENV}" >> $GITHUB_ENV
echo "COMMIT_SHA=${COMMIT_SHA}" >> $GITHUB_ENV
shell: bash
env:
# tagged deploys always deploy to prod
WENV: 'prod'
COMMIT_SHA: ${{ github.sha }}

# npm (and node16) are installed by wrangler-action in a pre-job setup
- name: 🏗 Get dependencies
run: npm i

- name: 📚 Wrangler publish
# github.com/cloudflare/wrangler-action
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
# input overrides env-defaults, regardless
environment: ${{ env.WORKERS_ENV }}
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
GIT_COMMIT_ID: ${{ env.GIT_REF }}

- name: 🎤 Notice
run: |
echo "::notice::Deployed to ${WORKERS_ENV} / ${GIT_REF} @ ${COMMIT_SHA}"
39 changes: 39 additions & 0 deletions .github/workflows/create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "🌲 Create many branches"

on:
workflow_dispatch:

jobs:
create_branches:
runs-on: ubuntu-latest
name: "🌲 Create and push branches"
env:
EMAIL: ${{ secrets.GH_EMAIL }}
NAME: ${{ secrets.GH_USERNAME }}
TOKEN: ${{ secrets.TOKEN }}
REMOTE_NAME: origin
BRANCH_BASE_NAME: proxyip
BRANCH_COUNT: 300

steps:
- name: ⚙️ Set up Git config
run: |
git config --global user.email "${{ env.EMAIL }}"
git config --global user.name "${{ env.NAME }}"
- name: 📦 Clone repository
run: |
git clone https://${{ env.TOKEN }}@github.com/${{github.repository}}.git
cd $(echo ${{github.repository}} | awk -F'/' '{print $2}')
- name: 🌿 Create and push branches
run: |
cd $(echo ${{github.repository}} | awk -F'/' '{print $2}')
for ((i=1; i<=${{ env.BRANCH_COUNT }}; i++)); do
branch_name="${{ env.BRANCH_BASE_NAME }}${i}"
git branch $branch_name
git checkout $branch_name
git commit --allow-empty -m "Create branch ${branch_name}"
git push ${{ env.REMOTE_NAME }} $branch_name
git checkout main
done
40 changes: 40 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "🔄 Sync all branches with main"

on:
workflow_dispatch:

jobs:
sync_branches:
runs-on: ubuntu-latest
name: "🔄 Sync branches with main"
env:
EMAIL: ${{ secrets.GH_EMAIL }}
NAME: ${{ secrets.GH_USERNAME }}
TOKEN: ${{ secrets.TOKEN }}
REMOTE_NAME: origin
BRANCH_BASE_NAME: proxyip
BRANCH_COUNT: 200

steps:
- name: 🛠 Set up Git config
run: |
git config --global user.email "${{ env.EMAIL }}"
git config --global user.name "${{ env.NAME }}"
- name: 📥 Clone repository
run: |
git clone https:///${{ env.TOKEN }}@github.com/${{github.repository}}.git
cd $(echo ${{github.repository}} | awk -F'/' '{print $2}')
- name: 🔄 Sync and push branches
run: |
cd $(echo ${{github.repository}} | awk -F'/' '{print $2}')
git checkout main
git pull ${REMOTE_NAME} main
for ((i=1; i<=${{ env.BRANCH_COUNT }}; i++)); do
branch_name="${{ env.BRANCH_BASE_NAME }}${i}"
git checkout $branch_name
git merge main --no-edit
git push ${REMOTE_NAME} $branch_name
git checkout main
done
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
.wrangler
# Dependency directories
node_modules/

# Environment variables
.env

# Build output
build/
dist/

# IDE files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace

# Miscellaneous
.DS_Store
Thumbs.db
.env
node_modules/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 3Kmfi6HP

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
134 changes: 134 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# EDtunnel

<p align="center">
<img src="https://cloudflare-ipfs.com/ipfs/bafybeigd6i5aavwpr6wvnwuyayklq3omonggta4x2q7kpmgafj357nkcky" alt="edgetunnel" style="margin-bottom: -50px;">
</p>

GitHub Repository for [https://github.com/zizifn/edgetunnel](https://github.com/zizifn/edgetunnel)

ask question and cloudflare ips: [https://t.me/edtunnel](https://t.me/edtunnel)

[![Repository](https://img.shields.io/badge/View%20on-GitHub-blue.svg)](https://github.com/zizifn/edgetunnel)

## available branches and explain

| Branch Name | Description |
| ------------- | ------------------------------------------------------------- |
| remote-socks5 | Branch for remote SOCKS5 proxy pool used implementation |
| socks5 | Branch for SOCKS5 proxyIP implementation |
| vless | Branch for outbound VLESS protocol implementation |
| vless2 | Branch for alternative outbound VLESS protocol implementation |
| code1 | Branch for code1 feature development |
| code2 | Branch for code2 alternative feature development |
| dns | Branch for DNS alternative related development |
| main | Main branch for the project |
| pages | New version for deployment on Cloudflare Pages |

## Deploy in pages.dev

1. See YouTube Video:

[https://www.youtube.com/watch?v=8I-yTNHB0aw](https://www.youtube.com/watch?v=8I-yTNHB0aw)

2. Clone this repository deploy in cloudflare pages.

## Deploy in worker.dev

1. Copy `_worker.js` code from [here](https://github.com/3Kmfi6HP/EDtunnel/blob/main/_worker.js).

2. Alternatively, you can click the button below to deploy directly.

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/3Kmfi6HP/EDtunnel)

## Lazy to deploy

`aHR0cHM6Ly9vc3MudjJyYXlzZS5jb20vcHJveGllcy9kYXRhLzIwMjMtMDctMzAvRnJFS1lvQS50eHQ=` (free clash.meta subscribe config)

## UUID Setting (Optional)

1. When deploy in cloudflare pages, you can set uuid in `wrangler.toml` file. variable name is `UUID`. `wrangler.toml` file is also supported. (recommended) in case deploy in webpages, you can not set uuid in `wrangler.toml` file.

2. When deploy in worker.dev, you can set uuid in `_worker.js` file. variable name is `userID`. `wrangler.toml` file is also supported. (recommended) in case deploy in webpages, you can not set uuid in `wrangler.toml` file. in this case, you can also set uuid in `UUID` enviroment variable.

Note: `UUID` is the uuid you want to set. pages.dev and worker.dev all of them method supported, but depend on your deploy method.

### UUID Setting Example

1. single uuid environment variable

```.environment
UUID = "uuid here your want to set"
```

2. multiple uuid environment variable

```.environment
UUID = "uuid1,uuid2,uuid3"
```

note: uuid1, uuid2, uuid3 are separated by commas`,`.
when you set multiple uuid, you can use `https://edtunnel.pages.dev/uuid1` to get the clash config and vless:// link.

## subscribe vless:// link (Optional)

1. visit `https://edtunnel.pages.dev/uuid your set` to get the subscribe link.

2. visit `https://edtunnel.pages.dev/sub/uuid your set` to get the subscribe content with `uuid your set` path.

note: `uuid your set` is the uuid you set in UUID enviroment or `wrangler.toml`, `_worker.js` file.
when you set multiple uuid, you can use `https://edtunnel.pages.dev/sub/uuid1` to get the subscribe content with `uuid1` path.(only support first uuid in multiple uuid set)

3. visit `https://edtunnel.pages.dev/sub/uuid your set/?format=clash` to get the subscribe content with `uuid your set` path and `clash` format. content will return with base64 encode.

note: `uuid your set` is the uuid you set in UUID enviroment or `wrangler.toml`, `_worker.js` file.
when you set multiple uuid, you can will use `https://edtunnel.pages.dev/sub/uuid1/?format=clash` to get the subscribe content with `uuid1` path and `clash` format.(only support first uuid in multiple uuid set)

## subscribe Cloudflare bestip(pure ip) link

1. visit `https://edtunnel.pages.dev/bestip/uuid your set` to get subscribe info.

2. cpoy subscribe url link `https://edtunnel.pages.dev/bestip/uuid your set` to any clients(clash/v2rayN/v2rayNG) you want to use.

3. done. if have any questions please join [@edtunnel](https://t.me/edtunnel)

## multiple port support (Optional)

<!-- let portArray_http = [80, 8080, 8880, 2052, 2086, 2095];
let portArray_https = [443, 8443, 2053, 2096, 2087, 2083]; -->

For a list of Cloudflare supported ports, please refer to the [official documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/ports).

By default, the port is 80 and 443. If you want to add more ports, you can use the following ports:

```text
80, 8080, 8880, 2052, 2086, 2095, 443, 8443, 2053, 2096, 2087, 2083
http port: 80, 8080, 8880, 2052, 2086, 2095
https port: 443, 8443, 2053, 2096, 2087, 2083
```

if you deploy in cloudflare pages, https port is not supported. Simply add multiple ports node drictly use subscribe link, subscribe content will return all Cloudflare supported ports.

## proxyIP (Optional)

1. When deploy in cloudflare pages, you can set proxyIP in `wrangler.toml` file. variable name is `PROXYIP`.

2. When deploy in worker.dev, you can set proxyIP in `_worker.js` file. variable name is `proxyIP`.

note: `proxyIP` is the ip or domain you want to set. this means that the proxyIP is used to route traffic through a proxy rather than directly to a website that is using Cloudflare's (CDN). if you don't set this variable, connection to the Cloudflare IP will be cancelled (or blocked)...

resons: Outbound TCP sockets to Cloudflare IP ranges are temporarily blocked, please refer to the [tcp-sockets documentation](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/#considerations)

## Usage

frist, open your pages.dev domain `https://edtunnel.pages.dev/` in your browser, then you can see the following page:
The path `/uuid your seetting` to get the clash config and vless:// link.

## Star History

<a href="https://star-history.com/#3Kmfi6HP/EDtunnel&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=3Kmfi6HP/EDtunnel&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=3Kmfi6HP/EDtunnel&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=3Kmfi6HP/EDtunnel&type=Date" />
</picture>
</a>
Loading

0 comments on commit f26a7a0

Please sign in to comment.