forked from netptop/siteproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2.3.0 first version to display warning top bar for proxied website
- Loading branch information
0 parents
commit 0dc014d
Showing
14 changed files
with
343 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
indent_style: 'space', | ||
indent_size: 2, | ||
charset: 'utf-8', | ||
trim_trailing_whitespace: true, | ||
insert_final_newline: true, | ||
tab_width: 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
dist | ||
src/renderer/pages/.umi | ||
src/renderer/pages/.umi-production | ||
release | ||
yarn-error.log | ||
yarn.lock | ||
.history | ||
.umirc.local.js | ||
.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Current File", | ||
"type": "python", | ||
"request": "launch", | ||
"program": "${file}", | ||
"args": ["web-result.txt"], | ||
"console": "integratedTerminal" | ||
}, | ||
{ | ||
"name": "Debug tests single run", | ||
"type": "node", | ||
"request": "launch", | ||
"env": { | ||
"localFlag": "true" | ||
}, | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/jest", | ||
"args": ["siteproxylocal.test.js"], | ||
"cwd": "${workspaceRoot}", | ||
"protocol": "inspector", | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": ["<node_internals>/**"], | ||
"env": { | ||
"PORT": "8011", | ||
"localFlag": "true", | ||
"runtimeArgs": ["--tls-min-v1.0"], | ||
"args": [] | ||
}, | ||
"program": "${workspaceFolder}/index.js" | ||
}, | ||
{ | ||
"type": "node", | ||
"name": "vscode-jest-tests", | ||
"request": "launch", | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
"disableOptimisticBPs": true, | ||
"program": "${workspaceRoot}/node_modules/.bin/jest", | ||
"cwd": "${workspaceFolder}", | ||
"args": ["siteproxylocal2.test.js", "--runInBand", "--watchAll=false"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 netptop | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
|
||
# siteproxy 2.0 | ||
<a href="https://github.com/netptop/siteproxy/blob/master/README_english.md"><strong>English</strong></a> | ||
Siteproxy 2.0 使用了service worker, 使得代理更加稳定, 可以代理了的网站更多。 | ||
同时使用hono替代express,速度提高4倍。 支持cloudflare worker部署。 | ||
反向代理, 免翻墙访问youtube/google, 支持github和telegram web登录(请注意不要通过不信任的代理登录)。 | ||
纯web页面的在线代理, 客户端无需任何配置,反向代理到internet。 | ||
|
||
``` | ||
+----> google/youtube | ||
+----------------+ | | ||
| | | | ||
user browser +-------------->+ siteproxy +-------> wikipedia | ||
| | | | ||
+----------------+ | | ||
+----> chinese forums | ||
``` | ||
请勿将本项目用于非法用途,否则后果自负。 | ||
注意: 由于支持多个网站的login,为了减少钓鱼风险,siteproxy2.0代码进行了混淆,同时禁止了默认主页网址的修改。 | ||
|
||
来自telegram网友的展示siteproxy部署后,加上优选IP的速度测试: | ||
![Download Speed test](https://raw.githubusercontent.com/netptop/siteproxy/master/test.png) | ||
|
||
## 目录 | ||
|
||
- [特点](#特点) | ||
- [使用技巧](#使用技巧) | ||
- [部署到cloudflare_worker](#部署到cloudflare_worker) | ||
- [部署到vps或者云服务器](#部署到vps或者云服务器) | ||
- [docker部署](#docker部署) | ||
- [联系方式](#联系方式) | ||
|
||
### 特点 | ||
- 使用hono替代express,速度提高4倍。 | ||
- 支持cloudflare worker部署。 | ||
- 支持密码控制代理,知道密码才能访问代理。 | ||
- 不需要客户端的任何配置,访问代理网址即可访问全世界。 | ||
- 支持github和telegram web登录。 | ||
- 使用RSA+AES加密用户login密码,减少中间人攻击。 | ||
- 输入部署siteproxy的代理网址,就可以访问全世界,并隐藏你的IP。 | ||
- 客户端不需要任何软件安装,客户浏览器也不需要任何配置。 | ||
|
||
### 使用技巧 | ||
1. 可以通过部署的siteproxy进行git clone,方法: | ||
``` | ||
git clone https://your-proxy-domain.name/user-your-password/https/github.com/the-repo-to-clone | ||
``` | ||
|
||
### 部署到cloudflare_worker | ||
- 假设你的域名已经管理在cloudflare名下; | ||
- git clone本项目,并使用文本编辑器打开build/worker.js (不用git clone,直接下载这个文件也可以) | ||
- 搜索```http://localhost:5006```字符串,将它替换为你的代理服务器的域名,比如```https://your-proxy-domain.name```,注意是https | ||
- 同时搜索user22334455,将其修改为你自己想设置的密码, 为空时表示不需要密码就可以访问。 | ||
- 创建一个worker,并编辑worker,将上一步编辑过的worker.js拷贝粘贴到worker里面,保存部署。 | ||
- 在Workers & Pages页面,打开刚才保存的worker,点顶部的'触发器', 之后'添加自定义域', 设置为你的代理域名。自定义域名设置成功后,dns页面下面显示对应的dns类型应该是worker。 | ||
- 现在可以直接访问```https://your-proxy-domain.name/user-your-password/```, 最后的斜杠不能少。注意这里的域名和密码替换为你自己的域名和密码。 | ||
|
||
### 部署到vps或者云服务器 | ||
- 注意必须使用node v21或以上版本。 如果出现UND_ERR_INVALID_ARG错误,试试2.2.2版本。 | ||
``` | ||
1. 创建一个ssl website(使用certbot and nginx, google下用法), 配置nginx, | ||
/etc/nginx/conf.d/default.conf需要包含以下内容: | ||
... | ||
server { | ||
server_name your-proxy.domain.name | ||
location / { | ||
proxy_pass http://localhost:5006; | ||
} | ||
} | ||
2. 执行:sudo systecmctl restart nginx | ||
3. 用户环境下执行下列命令安装node v21或者以上版本: | ||
(1)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
(2)source ~/.bashrc | ||
(3)nvm install v21 | ||
4. 执行:git clone https://github.com/netptop/siteproxy.git; | ||
5. 执行:cd siteproxy; | ||
6. 测试是否能运行: node bundle.js, 如果没有错误,按ctrl+c结束程序。 | ||
7. 打开并修改保存config.json文件: | ||
{ | ||
"proxy_url": "https://your-proxy.domain.name", //这个是你申请到的代理服务器域名,注意是https | ||
"token_prefix": "/user-SetYourPasswordHere/", //这个实际上是你的网站密码,用来防止非法访问,注意保留首尾的斜杠。为空时表示不设置密码 | ||
"local_listen_port": 5006, // 这个不要修改, 以便和前面nginx配置一致。 | ||
"description": "注意:token_prefix相当于网站密码,请谨慎设置。 proxy_url和token_prefix合起来就是访问网址。" | ||
} | ||
8. 安装forever: npm install -g forever; | ||
9. 执行:forever stopall; forever start bundle.js | ||
10. 现在就可以在浏览器中访问你的域名了, 网址就是前面的proxy_url加上token_prefix. | ||
11. 如果想套CloudFlare加速, 可以参考CloudFlare说明 | ||
``` | ||
### docker部署 | ||
- 如果出现UND_ERR_INVALID_ARG错误,试试2.2.2版本。 | ||
``` | ||
1. 配置域名对应的ssl证书和nginx,指向本地5006端口。 | ||
2. git clone本项目. | ||
3. 打开并修改保存config.json文件: | ||
{ | ||
"proxy_url": "https://your-proxy.domain.name", // 这个是你申请到的代理服务器域名 | ||
"token_prefix": "/user-SetYourPasswordHere/", // 这个实际上是你的网站密码,用来防止非法访问,注意保留首尾的斜杠。 | ||
"description": "注意:token_prefix相当于网站密码,请谨慎设置。 proxy_url和token_prefix合起来就是访问网址。" | ||
} | ||
4. 进入docker-node子目录。 sudo docker compose up | ||
5. 现在可以直接访问https://your-proxy-domain.name/user-your-password/, 就可以了。注意这里的域名和密码替换为你自己的域名和密码。 | ||
``` | ||
### 联系方式 | ||
Telegram群: @siteproxy | ||
<br /> | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Siteproxy 2.0 | ||
<br> | ||
Siteproxy 2.0 uses a service worker to make the proxy more stable, enabling it to support a wider range of websites. It replaces Express with Hono, which increases the speed by four times. It supports deployment on Cloudflare Workers. This reverse proxy allows for the access to YouTube/Google without the need for a VPN, and supports login for GitHub and Telegram web (please be cautious not to log in through untrusted proxies). It's a purely web-based online proxy that requires no configuration on the client's side, acting as a reverse proxy to the internet. | ||
<br> | ||
Please do not use this project for illegal purposes, or you will bear the consequences. | ||
<br> | ||
Note: To reduce the risk of phishing, the code of siteproxy 2.0 is obfuscated, and the modification of the default homepage URL is prohibited. | ||
|
||
## Contents | ||
- [Features](#features) | ||
- [Usage Tips](#usage-tips) | ||
- [Deploying to Cloudflare Worker](#deploying-to-cloudflare-worker) | ||
- [Deploying to VPS or Cloud Server](#deploying-to-vps-or-cloud-server) | ||
- [Docker deployment](#docker-deployment) | ||
- [Contact Information](#contact-information) | ||
|
||
### Features | ||
- Replaces Express with Hono, improving speed by four times. | ||
- Supports deployment on Cloudflare Workers. | ||
- Supports password-controlled access to the proxy; only those with the password can access the proxy. | ||
- No configuration is required on the client side; simply access the proxy URL to reach the entire world. | ||
- Supports login for GitHub and Telegram web. | ||
- Uses RSA+AES encryption to protect user login passwords to reduce the risk of man-in-the-middle attacks. | ||
- By entering the deployed Siteproxy proxy URL, you can access the entire world and hide your IP. | ||
- No software installation is required on the client side, and the client's browser does not need any configuration. | ||
|
||
### Usage Tips | ||
1. You can use the deployed Siteproxy to perform a git clone, for example: | ||
``` | ||
git clone https://your-proxy-domain.name/user-your-password/https/github.com/the-repo-to-clone | ||
``` | ||
|
||
### Deploying to Cloudflare Worker | ||
- Assume your domain is already managed under Cloudflare (in case you want to use your domain name) | ||
- Git clone this project and use a text editor to open build/worker.js (you can also download this file directly without cloning) | ||
- Search for the string http://localhost:5006 and replace it with your proxy server's domain, such as https://your-proxy-domain.name. Must be https please. Also, search for user22334455 and change it to a password of your choosing, empty password means no password is needed. | ||
- Create a worker and edit it by copying and pasting the modified worker.js into the worker, then save and deploy. | ||
- If you use cloudflare worker domain, skip this step, If you want to use your own domain name, on the Workers & Pages page, open the worker you just saved, click 'Triggers' at the top, then 'Add custom domain', setting it to your proxy domain. | ||
- Now you can directly access https://your-proxy-domain.name/user-your-password/, don't miss the last '/' please. And please replace the domain and password with your own. | ||
|
||
### Deploying to VPS or Cloud Server | ||
- node v21 or above version is needed. | ||
``` | ||
1. Set up an SSL website (using Certbot and Nginx, Google for instructions) and configure Nginx. Your /etc/nginx/conf.d/default.conf should include the following: | ||
... | ||
server { | ||
server_name your-proxy.domain.name | ||
location / { | ||
proxy_pass http://localhost:5006; | ||
} | ||
} | ||
2. Execute: sudo systemctl restart nginx | ||
3. Install Node v21 or above version in user space, if you don't already have Node v21 installed: | ||
(1)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
(2)source ~/.bashrc | ||
(3)nvm install v21 | ||
4. Execute: git clone https://github.com/netptop/siteproxy.git; | ||
5. Execute: cd siteproxy; | ||
6. Test if it can run: node bundle.js, if there are no errors, end the program with Ctrl+C. | ||
7. Open and modify the config.json file, saving it: | ||
{ | ||
"proxy_url": "https://your-proxy.domain.name", // This is your proxy server domain, must be https please. | ||
"token_prefix": "/user-SetYourPasswordHere/", // This acts as your site password to prevent unauthorized access. Keep the slashes at the start and end. empty password means no password is needed. | ||
"local_listen_port": 5006, // Do not modify this, to keep it consistent with the previous nginx configuration. | ||
"description": "Note: The token_prefix acts as the site password. Please set it carefully. The proxy_url combined with the token_prefix forms the access URL." | ||
} | ||
8. Install forever: npm install -g forever; | ||
9 .Execute: forever stopall; forever start bundle.js | ||
10. Now you can access your domain in the browser, the URL is the aforementioned proxy_url followed by token_prefix. | ||
11. If you want to use CloudFlare for acceleration, you can refer to the CloudFlare instructions. | ||
``` | ||
### Docker deployment | ||
``` | ||
1. Configure the domain's SSL certificate and nginx, directing it to the local port 5006. | ||
2. Git clone this project. | ||
3. Open and modify the config.json file then save it: | ||
{ | ||
"proxy_url": "https://your-proxy.domain.name", // This is the domain name of your proxy server | ||
"token_prefix": "/user-SetYourPasswordHere/", // This is essentially your website password, used to prevent unauthorized access. Be sure to retain the slashes at the start and end. | ||
"description": "Note: The token_prefix acts as a website password, please set it carefully. The proxy_url combined with the token_prefix forms the access URL." | ||
} | ||
4. Enter the docker-node subdirectory. sudo docker compose up | ||
5. Now, you can directly access https://your-proxy-domain.name/user-your-password/, and it should work. Note that you should replace the domain and password with your own. | ||
``` | ||
### Contact Information | ||
Telegram group: @siteproxy | ||
<br /> | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const ProxyMiddleware = require('http-proxy-middleware') | ||
var Proxy = require('../Proxy') | ||
|
||
let { blockedSites, urlModify, httpprefix, serverName, port, locationReplaceMap302, regReplaceMap, siteSpecificReplace, pathReplace } = require('../config') | ||
|
||
let cookieDomainRewrite = serverName | ||
|
||
let proxy = Proxy({ ProxyMiddleware, blockedSites, urlModify, httpprefix, serverName, port, cookieDomainRewrite, locationReplaceMap302, regReplaceMap, siteSpecificReplace, pathReplace }) | ||
export default (req, res) => { | ||
const dirPath = path.join(__dirname + '/..', req.url) | ||
console.log(`x-forward-for:${req.headers['x-forwarded-for']}, req.url:${req.url}`) | ||
if (req.url === '/' || req.url === '/index.html') { | ||
let body = fs.readFileSync(path.join(__dirname, '../index.html'), 'utf-8') | ||
res.status(200).send(body) | ||
return | ||
} else | ||
if (fs.existsSync(dirPath) && !fs.lstatSync(dirPath).isDirectory()) { | ||
let body = fs.readFileSync(dirPath) | ||
return res.status(200).send(body) | ||
} | ||
proxy(req, res, null) // next: null | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"proxy_url": "http://localhost:5006", | ||
"token_prefix": "/user22334455/", | ||
"local_listen_port": 5006, | ||
"description": "注意:token_prefix相当于网站密码,请谨慎设置。 proxy_url和token_prefix合起来就是访问网址。" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
services: | ||
siteproxy: | ||
image: node:21 | ||
container_name: siteproxy-node | ||
restart: unless-stopped | ||
ports: | ||
- 127.0.0.1:5006:5006 | ||
volumes: | ||
- ../:/home/node/siteproxy/ | ||
working_dir: /home/node/siteproxy/ | ||
entrypoint: ["node","/home/node/siteproxy/bundle.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "." | ||
}, | ||
{ | ||
"path": "../netptop-github-docker" | ||
} | ||
], | ||
"settings": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"type": "module"} |