惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threat Research - Cisco Blogs
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
博客园 - 【当耐特】
AWS News Blog
AWS News Blog
U
Unit 42
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
T
Tor Project blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Recorded Future
Recorded Future
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
Latest news
Latest news
GbyAI
GbyAI
S
SegmentFault 最新的问题
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Hacker News: Ask HN
Hacker News: Ask HN
美团技术团队
N
News | PayPal Newsroom
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Hacker News
The Hacker News
The GitHub Blog
The GitHub Blog
V
V2EX
N
News and Events Feed by Topic
T
Troy Hunt's Blog
Security Latest
Security Latest
博客园 - 叶小钗
P
Palo Alto Networks Blog

博客 on 打工人日志

k8s RKE2 cilium L2 + envoy gateway 安装配置 k8s RKE2 vSphere 存储配置 OpenClaw 全能指南:从安装到进阶自动化实战 (2026 最终版) Kubernetes — skywalking + banyanDB APM监控部署 Kubernetes — promtail + loki + grafana 日志系统部署 k8s master 节点 Unauthorized Kubernetes — metalLB + Traefik 部署 Kubernetes — SSL 证书自动更新 Kubernetes — RKE2 + kube-vip + cilium 部署 使用TLSv1.3 升级nginx和openssl Proxmox VE(PVE) 更新到最新版本 kindle 邮件发送失败,错误代码E999 metallb + ingress-nginx + argocd 本地部署 iStoreOS(旁路由)使用openclash实现dns劫持 异常流量分析:图片库服务黑客入侵 openwrt 硬盘扩容 搭建ip地址检索服务 Kubernetes — k8s 手动安装 1.17.9 SELinux 问题:导致端口无法创建,无法访问 【福利】免费!本地部署!去除视频中移动的物体 通知:《打工人日报》迁移到独立板块 KyBook 3 | calibre-web - IOS系统最佳图书伴侣 Tmux 安装和使用教程 DockerHub 加速镜像部署 - 使用cloudflare 代理 docker的零停机部署 SD-webui 批量处理图片 ubuntu 安装 ComfyUI ubuntu 安装 stable-diffusion-webui 测试策略:微服务架构 单元测试:测试单元质量提升 端到端测试:模拟用户体验 Kubernetes — containerd 安装和部署 CI/CD 可观察性-基于grafana Argo cd 安装和部署 linux服务器进程打开文件过多导致服务异常 使用 ElasticSearch Curator 7天定期删除日志 sonarqube docker安装和配置 SSH 通过 443 端口连接 GitHub iOS 17 「待机显示」适配普通 iPhone(非 Pro/Max),屏幕在充电时常亮 GNU/Linux 一键更换系统软件源脚本 解决Elasticsearch索引只读(read-only) 【福利】埃隆·马斯克传 [沃尔特·艾萨克森] 在线下载 【破解】小鹏P5和小鹏G9开启adb和网络adb Kubernetes — kubecost 分析 Kubernetes 成本 3D Gaussian Splatting:3D模型渲染 Linux 系统收包流程以及内核参数优化 2023亚运会电竞门票民购买指南(报名+抽签) Vue3 + vite + nginx项目部署后404问题 大麦抢票辅助软件(福利 TFBOYS十年之约演唱会 2023 全机位 视频) 黑群晖最新安装教程 Ansible部署ceph集群 最好的微信朋友圈集赞神器-福利推荐 推荐一下 容器云资源 2010年的天涯神贴聊房价 如何礼貌回绝不合理的需求 nginx 配置和编译 使用scrapy-redis实现增量爬取 逆境和成长-2022年终总结 优雅的使用Conda管理python环境 Jenkins 编译Android apk 流水线 Kubernetes — 更新证书 shell功能脚本集合 Nexus3 使用和部署 githubAction set-output弃用错误 Kubernetes — Rook云存储介绍和部署 Kubernetes — 基于K8S搭建Ceph分布式存储 Kubernetes — 探针和生命周期 Kubernetes — 开放标准(OCI、CRI、CNI、CSI、SMI、CPI)概述 kubernetes 部署插件 (Flannel、Web UI、CoreDNS、Ingress Controller) Cloudflare Zero Trust 内网穿透 k8s CNI 问题 连接认证失效 k8s.gcr.io国内无法连接解决方法 headscale 部署使用 羊了个羊小程序 破解通关 K8S 问题排查:cgroup 内存泄露问题 RocketMQ k8s部署 4主4从集群 docker 问题处理 kubernetes 存储 linux服务器 删除空间却未释放 kubernetes 从1.23.x 升级到 1.24.x 编写 kubernetes 资源描述文件 nginx ssh-key connection exception kubernetes manual expansion VSCode插件推荐=> Code Runner ant build.xml 编写 kubernetes 调度过程 记录一次上门打散工 k8s本地联调神器kt-connect Ant中如何添加第三方jar包依赖 OpenELB:让k8s私有环境对外暴露端口 linux 网络测速 安装 docker 出现 ERROR: Unsupported distribution 'ol' 问题 logrotate 日志滚动的使用 nginx 编译参数详解 nginx 重写规则 rewrite模块 nginx.conf 配置文件详解 rsync 文件同步 nginx 日志格式整理 163企业邮箱设置教程 2021年第50周记
github 国内代理访问下载
2023-04-11 · via 博客 on 打工人日志
1#例子
2git clone https://github.jobcher.com/gh/https://github.com/jobcher/blog.git
  1'use strict'
  2
  3/**
  4 * static files (404.html, sw.js, conf.js)
  5 */
  6const ASSET_URL = 'https://jobcher.github.io/'
  7// 前缀,如果自定义路由为example.com/gh/*,将PREFIX改为 '/gh/',注意,少一个杠都会错!
  8const PREFIX = '/gh/'
  9// 分支文件使用jsDelivr镜像的开关,0为关闭,默认关闭
 10const Config = {
 11    jsdelivr: 0
 12}
 13
 14const whiteList = [] // 白名单,路径里面有包含字符的才会通过,e.g. ['/username/']
 15
 16/** @type {RequestInit} */
 17const PREFLIGHT_INIT = {
 18    status: 204,
 19    headers: new Headers({
 20        'access-control-allow-origin': '*',
 21        'access-control-allow-methods': 'GET,POST,PUT,PATCH,TRACE,DELETE,HEAD,OPTIONS',
 22        'access-control-max-age': '1728000',
 23    }),
 24}
 25
 26
 27const exp1 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:releases|archive)\/.*$/i
 28const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob|raw)\/.*$/i
 29const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-).*$/i
 30const exp4 = /^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+?\/.+$/i
 31const exp5 = /^(?:https?:\/\/)?gist\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+$/i
 32const exp6 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/tags.*$/i
 33
 34/**
 35 * @param {any} body
 36 * @param {number} status
 37 * @param {Object<string, string>} headers
 38 */
 39function makeRes(body, status = 200, headers = {}) {
 40    headers['access-control-allow-origin'] = '*'
 41    return new Response(body, {status, headers})
 42}
 43
 44
 45/**
 46 * @param {string} urlStr
 47 */
 48function newUrl(urlStr) {
 49    try {
 50        return new URL(urlStr)
 51    } catch (err) {
 52        return null
 53    }
 54}
 55
 56
 57addEventListener('fetch', e => {
 58    const ret = fetchHandler(e)
 59        .catch(err => makeRes('cfworker error:\n' + err.stack, 502))
 60    e.respondWith(ret)
 61})
 62
 63
 64function checkUrl(u) {
 65    for (let i of [exp1, exp2, exp3, exp4, exp5, exp6]) {
 66        if (u.search(i) === 0) {
 67            return true
 68        }
 69    }
 70    return false
 71}
 72
 73/**
 74 * @param {FetchEvent} e
 75 */
 76async function fetchHandler(e) {
 77    const req = e.request
 78    const urlStr = req.url
 79    const urlObj = new URL(urlStr)
 80    let path = urlObj.searchParams.get('q')
 81    if (path) {
 82        return Response.redirect('https://' + urlObj.host + PREFIX + path, 301)
 83    }
 84    // cfworker 会把路径中的 `//` 合并成 `/`
 85    path = urlObj.href.substr(urlObj.origin.length + PREFIX.length).replace(/^https?:\/+/, 'https://')
 86    if (path.search(exp1) === 0 || path.search(exp5) === 0 || path.search(exp6) === 0 || path.search(exp3) === 0 || path.search(exp4) === 0) {
 87        return httpHandler(req, path)
 88    } else if (path.search(exp2) === 0) {
 89        if (Config.jsdelivr) {
 90            const newUrl = path.replace('/blob/', '@').replace(/^(?:https?:\/\/)?github\.com/, 'https://cdn.jsdelivr.net/gh')
 91            return Response.redirect(newUrl, 302)
 92        } else {
 93            path = path.replace('/blob/', '/raw/')
 94            return httpHandler(req, path)
 95        }
 96    } else if (path.search(exp4) === 0) {
 97        const newUrl = path.replace(/(?<=com\/.+?\/.+?)\/(.+?\/)/, '@$1').replace(/^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com/, 'https://cdn.jsdelivr.net/gh')
 98        return Response.redirect(newUrl, 302)
 99    } else {
100        return fetch(ASSET_URL + path)
101    }
102}
103
104
105/**
106 * @param {Request} req
107 * @param {string} pathname
108 */
109function httpHandler(req, pathname) {
110    const reqHdrRaw = req.headers
111
112    // preflight
113    if (req.method === 'OPTIONS' &&
114        reqHdrRaw.has('access-control-request-headers')
115    ) {
116        return new Response(null, PREFLIGHT_INIT)
117    }
118
119    const reqHdrNew = new Headers(reqHdrRaw)
120
121    let urlStr = pathname
122    let flag = !Boolean(whiteList.length)
123    for (let i of whiteList) {
124        if (urlStr.includes(i)) {
125            flag = true
126            break
127        }
128    }
129    if (!flag) {
130        return new Response("blocked", {status: 403})
131    }
132    if (urlStr.startsWith('github')) {
133        urlStr = 'https://' + urlStr
134    }
135    const urlObj = newUrl(urlStr)
136
137    /** @type {RequestInit} */
138    const reqInit = {
139        method: req.method,
140        headers: reqHdrNew,
141        redirect: 'manual',
142        body: req.body
143    }
144    return proxy(urlObj, reqInit)
145}
146
147
148/**
149 *
150 * @param {URL} urlObj
151 * @param {RequestInit} reqInit
152 */
153async function proxy(urlObj, reqInit) {
154    const res = await fetch(urlObj.href, reqInit)
155    const resHdrOld = res.headers
156    const resHdrNew = new Headers(resHdrOld)
157
158    const status = res.status
159
160    if (resHdrNew.has('location')) {
161        let _location = resHdrNew.get('location')
162        if (checkUrl(_location))
163            resHdrNew.set('location', PREFIX + _location)
164        else {
165            reqInit.redirect = 'follow'
166            return proxy(newUrl(_location), reqInit)
167        }
168    }
169    resHdrNew.set('access-control-expose-headers', '*')
170    resHdrNew.set('access-control-allow-origin', '*')
171
172    resHdrNew.delete('content-security-policy')
173    resHdrNew.delete('content-security-policy-report-only')
174    resHdrNew.delete('clear-site-data')
175
176    return new Response(res.body, {
177        status,
178        headers: resHdrNew,
179    })
180}
1git config --global https.proxy http://127.0.0.1:1080
2#取消设置
3git config --global --unset https.proxy