• Stars
    star
    295
  • Rank 140,902 (Top 3 %)
  • Language
    Go
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web reverse proxy with automatic SSL, LFU caching, command-line configuration 支持自动配置 SSL 证书、LFU 缓存、用命令行配置的 Web 反向代理服务器

yzhanProxy

Web reverse proxy with automatic SSL, LFU caching, command-line configuration
支持自动配置 SSL 证书、LFU 缓存、用命令行配置的 Web 反向代理服务器

Usage

Options:
-s, --src= Source URL List Required
-d, --dst= Destination URL List Required
-o, --opt= Option List: redirect=<30x>&cache_ext=<jpg|png|...>&cache_max_age=<1|2|...>
-g, --global= Global Config: cert_dir=<./cert>&cache_dir=<./cache>&cache_max_size=<100>
Help Options:
-h, --help Show this help message

Example

# sudo yzhanproxy-{platform}-amd64 \
sudo go run main.go \
-s http://localhost,https://localhost,https://x.com:81 \
-d https://localhost,https://www.google.com,https://m.baidu.com \
-o "redirect=302,cache_ext=ico|jpg|png|webp&cache_max_age=60|3600" \
-g "cert_dir=./cert&cache_dir=./cache&cache_max_size=100"

Meaning of Parameters

Redirect:
http://localhostRedirect: 302 —> https://localhost
Reverse Proxy:
https://localhostLocalhost: Self Signed Cert. Cache: ico - 60s, jpg|png|webp - 3600s —> https://www.google.com
https://x.com:81Domain: Auto Get/Renew Cert. No Cache —> https://m.baidu.com
Global Config with default value:
cert_dir: ./cert
cache_dir: ./cache
cache_max_size: 100 MB, LFU used to clean up least used files when exceeding max size

Screenshot

Reverse proxy Google using your own domain

reverseproxy.png

Console output

console.png

Development

Build

# Linux
./scripts/build.sh [name | default: yzhanproxy]
# Windows
./scripts/build.bat [name | default: yzhanproxy]

Unit Test

go test ./...

Thanks

  • ChatGPT: Assisting in coding and unit testing
  • go-flags

Migration Notice

This repo used to be mtfBetter (moved to mtfCOM), now it has be refactored using golang.

More Repositories

1

alipay-global-sdk-php

Alipay global Third Party SDK with Authorization and Auto debit. Alipay 国际版 A+ 接口第三方 PHP SDK,实现了现金支付、用户授权、自动代扣和 RSA2 加密异步通知应答,示例完整,使用简单
PHP
412
star
2

yzhanDanmu

CSS-only bullet screen plugin. Any height, length, speed. Multiple non-overlapping strategies. High efficiency, minimal size (2kb). Channel algorithm patented. 纯 CSS 弹幕插件,任意高度、长度、速度弹幕铺满屏幕,多种不重叠策略,高效极简(2kb)。通道算法受专利权保护。
JavaScript
280
star
3

yzhanPay

简洁、高效的多用户、多语言、用插件扩展的聚合支付系统,已集成 Alipay China, Alipay Global 和 Paypal
PHP
234
star
4

yzhanJSInterpreter

A JavaScript Interpreter Using JS itself. JavaScript 解释器,包含词法分析、语法解析和执行。基于 LR 实现 eval
JavaScript
213
star
5

yzhanWeather

Pure CSS animation for sakura, rain, snow, firefly and butterfly effects, high performance without affecting SEO. 纯 CSS 动画实现樱花、雨、雪、萤火虫和蝴蝶飞舞背景效果,高性能且不影响 SEO
JavaScript
154
star
6

yzhanHTMLParser

A streaming HTML parser based on HTML Standard. 基于 HTML 标准的流式 HTML 解析器
HTML
108
star
7

mtfLive

MTF直播导航源码,将斗鱼、虎牙、触手、YY、龙珠、战旗、章鱼、电视直播按分类/关键词聚合,用户选择分类,可以观看到全网该关键词下正在直播的内容。
PHP
68
star
8

yzhanIP

Crawl, match, parse IP or IP range, check if IP or range is in another range. Support IPv4, IPv6, IP Interval, Wildcard and CIDR. Check if IP is Cloudflare node IP, Google bot IP. 爬取,正则匹配,解析 IP 和 IP 范围,检测 IP 或范围是否在另一个范围中。支持 IPv4,IPv6,区间、通配符或 CIDR 表示的 IP 范围。检测 IP 是否是 Cloudflare 节点或 Google 漫游器 IP
PHP
58
star
9

yZhanCrop

仿 PS 多图层的图片选择、缩放、旋转、裁剪、导出 JS 库 Crop images by dragging, zooming, tilting and rotating them.
JavaScript
56
star
10

yzhanBG

Use multiple videos, images, and weather as background, with mute, hide, text, and cherry blossom, rain, snow, firefly, and butterfly animations. 用多个视频、图片、天气作背景,支持静音、隐藏内容、文字,以及樱花、雨、雪、萤火虫和蝴蝶动画
JavaScript
55
star
11

yzhanNotify

Element and Global Notifications / Toasts with Pure / Vanilla / Native JavaScript. 使用原生 JavaScript 在视窗或元素的指定位置发送通知和提示。
CSS
41
star
12

yzhanCache

Simple, efficient cache for php. 简单、高效的 PHP 缓存类
PHP
38
star
13

yzhanGateway

Developing PHP SDK for any API. 为任何 API 快速开发 PHP SDK
PHP
38
star
14

mtfScrollList

MTF滚动列表插件,支持虚拟化无限滚动,上拉到顶,下拉到底加载更多,下拉刷新。可在原生JS、React和Vue(未来)中使用
JavaScript
36
star
15

yzhanImageViewer

给网站和H5应用增加 像微信朋友圈一样 的看图功能,可看大图,双击双指缩放,滑动切换图片,点击返回。A jQuery Plugin for viewing pictures like Wechat moments.
JavaScript
27
star
16

mtfCOM

mtf 通用组件库,包含多个 PHP 模块和 JavaScript 模块,其中以 mtf 或 yzhan 开头模块,为自有模块,其它为第三方模块。这些模块可独立或组合使用,无需为某一个功能而引入整个框架。
PHP
10
star
17

yzhanCluster

Sources of depolyment yamls and static files for yzhan
JavaScript
8
star
18

mtfSTGMaker

MTF射击游戏生成器,封装角色、装备、碰撞检测、资源预加载、键盘和触屏操控等底层实现,帮助您快速开发射击游戏
JavaScript
7
star
19

mzhanSub

M站字幕组翻译的字幕,包括每周五更新的《3D坦克周报》。不定期更新的《TankiX开发日志》和《可爱女生发型系列视频教程》
6
star
20

yzhanCodeSpace

This is a space for me to investigate Souce Code of Vue.js / React / Webpack / Rollup etc.
JavaScript
2
star
21

yzhanReactResponsiveContent

A powerful and flexible React component for creating responsive content with automatic media query generation. 为响应式内容自动生成媒体查询
TypeScript
2
star
22

yzhanAPI

MTF接口:二维码识别、图片倾斜校正、短链接生成、清晰度增强、答题卡识别和正版验证
PHP
2
star
23

yzhanModal

A jQuery plugin to show a modal dialog with support for iframes
JavaScript
1
star
24

shopxoplugin

shopXO plugin by xiaoyu
HTML
1
star
25

yzhanGoRun

Write once, run everywhere
Go
1
star
26

yZhanWeather

Y站天气库,动态生成雪、雨、光、樱花、蝴蝶和气泡效果,可作为H5活动页的装饰动画和背景。
1
star