- 📒 Table of Contents
- 📍 Overview
- ⚙️ Features
- 📂 Project Structure
- 🚀 Deploying a Worker
- 🗺 Roadmap
- 🤝 Contributing
- نسخه فارسی
This repository contains a new worker.js that aims for better solutions in terms of performance and features regarding common worker issues such as supporting IPv6, the UDP protocol, and more stable communication with Cloudflare IPs (loopback connections).
As you know, Cloudflare workers are currently unable to connect to hosts that have Cloudflare IPs (this is considered a loopback).This worker uses relay nodes to work around that limitation.
The worker also implements an advanced DNS DOH client/proxy for dns routing/serving purposes.
- Supports IPv6
- Supports UDP through relays
- More reliable loopback connection handling and routing
- Embedded DOH DNS Client/Proxy
- Overall improved performance and stability
├── src
│ ├── dns.js // DNS message encoding/parsing
│ └── worker.ts // Main worker code
├── dist
│ └── worker.js // Compiled worker script
To manually deploy the worker:
- Sign up at the Cloudflare signup page
- From the main navbar, choose Workers & Pages
- Click the Create Application button
- Click the Create Worker button
- Copy the worker.js file contents from this repository
- Fill in a name for your worker and click the Deploy button
- Click the Quick Edit button
- Paste your clipboard contents and replace the worker's default code
- Click the Save and Deploy button
- Write down the newly created worker address, it should be something like [name].[username].workers.dev
- Change your Bepass configuration to https://[name].[username].workers.dev/dns-query
You can deploy this worker to your Cloudflare account automatically with one click using the button below.
1. Follow the relay set-up instructions to run your own relay server.
2. Edit the worker.js
file and add your server IP or domain to the proxyIPs
array.
In the worker.js
file, locate the following code:
// src/worker.ts
var proxyIPs = ["relay1.bepass.org", "relay2.bepass.org", "relay3.bepass.org"];
var proxyPort = 6666;
var proxyIP = proxyIPs[Math.floor(Math.random() * proxyIPs.length)];
Remove public relay addresses and Add the IP address or domain of your relay server. For example:
// src/worker.ts
var proxyIPs = ["relay.example.com", "123.45.67.89"]; // Add your server IP/domain here
var proxyPort = 6666;
var proxyIP = proxyIPs[Math.floor(Math.random() * proxyIPs.length)];
Cloudflare's free workers are limited to 100,000 requests per day. This is sufficient for personal use by one user or a small family.
For most personal usage, the free worker should be adequate. But if you experience rate limiting, you may need to deploy workers on multiple accounts.
- Clone the bepass-worker repository:
git clone https://github.com/uoosef/bepass-worker
- Change to the project directory:
cd bepass-worker
- Install the dependencies:
npm install
npm run build && node dist/worker.js
npm test
Task 1: Implement worker's range detection
Task 2: Better loopback support
Task 3: DNS Resolving
Task 4: ...
Contributions are always welcome! Please follow these steps:
- Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
- Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
- Create a new branch with a descriptive name (e.g.,
new-feature-branch
orbugfix-issue-123
).
git checkout -b new-feature-branch
- Make changes to the project's codebase.
- Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
- Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
- Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.
This project is licensed under the MIT License - see the LICENSE file for details.