有的没的
快速记忆几个NAT的区别

DNAT:改目标地址(Destination),实现端口转发
SNAT:改源地址(Source),让回包能正确返回
Masquerade:SNAT的自动版本,适合动态IP


#network
answer.html
63.3 KB
为什么我在我的局域网设备可以通过公网ip:端口号来访问到主路由转发的内网服务,但是ssh到主路由访问公网ip:端口号却不行?

#network #snat #masquerade
answer.html
75.5 KB
要善用openwrt的备份系统

记得在系统中做任何的新增文件的时候,要在备份列表里面 添加新增的这个文件 或者文件夹的路径

#openwrt
部分 Cloudflare 免费计划也可以使用 Snippets 了。

Snippets 是一个更轻量的 JS 运行环境。可以做重写、重定向等一些对 CPU 要求不高的业务,重要的不限制请求次数。

你可以:

1. 搭建一个不限流量的 Docker Hub 镜像 https://miantiao.me/posts/cloudflare-docker-mirror/

2. 搭建只需 10 行代码的短链接系统 https://miantiao.me/posts/hink/

3. 一个 IP 信息检测 API https://github.com/ccbikai/ip-api
The last free android version of vidhub .
vidhub-1-3-5.apk
84.8 MB
发现了家里homelab里二进制程序(alist-proxy)从外网访问限速的问题,单线程限速到了1MBps。但是家里局域网内就正常。

claude说很可能和bbr+fq的fq有关系。fq使得高延迟就会限速。在claude的建议下更换成了bbr+cake

docker部署的程序不受影响,因为是走docker自己的adapter

目前还未验证,暂时把程序部署在路由器上了。

#network
Since the last month I found the baidunetdisk mounted on alist has a significant speed drop, which is usually around 300Kbps.

This rate is useless for video streaming.. so my baidunetdisk svip wont make anysense if this situation goes on.
But sometimes I find that, try replaying videos multiple times successively will lead to a speed rising, which makes me think it's because alist connected to another cdn node which has no qos.

Afterwards, i started exploring this phenomenon.
—-
To begin with, I tried using the tempermonkey plugin to get the direct link which starts with "d.pcs.baidu.com". Then I tried resolve the domain using different DNSes and even found the HK cdn node of it. So I edited the hosts to it, but it's always with a low speed or sometimes leads to an error responded by the server. ps: not a cert error. so editing hosts is not a proper solution in 2025. Plus, i was thinking that the direct link may varies in its hostname too, a simple host file that doesnt support regex can't list all the variations of the CDN node hostname. So this is not a good orientation.

After reading the source code from openlist, i found the actual direct link is retrieved in the function of LinkOfficial. The hostname of the download link will be different depending on the location of the IP sending the request. So it’s totally not a DNS resolution deviation thing.

So I started observing the links alist was assgined, trying to figure out the QoSed cdn node sni, which is the root cause of the issue.

1. I set the proxy mode to 302 in alist so i can get the link easily.
2. try sending download request multiple times to capture all possible cdn SNIs. You can use curl parameter -L -v -i -A [ua] to see the redirected link.
Better do this both at night and day, and record the download speed for each of the SNIs. And compare them and find the best one. It’s actually pretty easy to find all possible allocated baiduCDN SNIs
3. After trying multiple times, i found my download request will be redirected to these nodes: that are not QoSed, and the QoSed one .
4. So how to avoid the QoSed node is the root issue. I thought a lot, including the idea to set up a clash rule, but i dont rly want to include the domestic traffics by mihomo core so i gave it up. But this one is probably the easiest solution to block all QoSed SNIs.
5. I later find that the download request will always be redirected to for overseas IPs, which is unlimited. So i think it is promising.
6. I found alist-proxy is the perfect companion to solve this. I reckon that a non-Qosed url could be retrieved by the alist on my VPS, then the download traffic is initiated via the alist-proxy deployed at my homelab.
7. It turned out to be working. Alist-proxy is then deployed on my armbian machine. Plus, AlistProxy will display the assigned CDN SNI in the console, so it’s pretty convenient to debug. Beware that the listening port should be accessible since this actually works like this: 1. send download request to overseas alist 2.alist 302 it to the alist-proxy at home 3. alist-proxy got the direct link and modify the UA and download 4. Respond to the user with the resulted data. So u could see that your player client has a working route to your alist proxy is the fundamental requirement.

PS: this combo is versatile. Even if the SNIs VPS retrieved is QoSed one day, you could always deploy alist anywhere a good sni may emerge. Like cmcc networks, or even edge environments. All are worth trying.

Todo: Researching on Quark that is QoSed pretty violently at night.

PS: clouddrive sucks. streaming experience is quite terrible and it takes longer to buffer. I dunno why tho . Removed already.
#network OpenList/drivers/baidu_netdisk/util.go at d465da43e3cb9f4ec1429398fd270036ea34bce5 · OpenListTeam/OpenList
xa-cu20.baidupcs.com rate limit 200kbps

tried requesting multiple times and found out this.
Vercel的function竟然需要手动去调整它部署的机房 默认的话是部署在北美 调整的方法就是在settings然后function

那么应该把它部署到亚太地区,比如东京或者是新加坡或者是香港,和家里网络出口尽可能相近。

静态网页应该都是部署在全球各地的cdn,这个就不用调整。

这是最近发现连接upstash 延迟比较高而发现的

#programming
编辑 cf worker、vercel单文件工程的 workflow:

cf worker: 更新一版,文件名前头加个 [v1], 然后把修改完的代码粘贴到 panel 里,完美。然后再 git commit

vercel: 工程新建一个分支效仿以上

#programming
vercel 纯动态网页的 prompt:
请帮我创建一个单JS文件的Vercel Web应用工程,要求如下:

🎯 **核心架构要求**:

- 使用纯动态网页架构,HTML内容通过JS模板字符串动态生成
- 所有逻辑写在单个JS文件中,不拆分多个文件
- 同时提供网页访问和RESTful API接口功能
- 采用现代ES6+语法,支持async/await
- 响应式设计,支持移动端访问

📋 **具体功能需求**:

* 实现一个北京时间的实时时钟,精确到秒。
* 前端展示方面,时间要大一点,因为后面要放在公共大屏展示。
* 并且提供api接口/json来返回相关时间数据,包含年月日时分秒
* 前端展示的时间应该使用vercel的后短时间,方式用户浏览器时间不准

⚙️ **技术规范**:

- 单一入口文件处理所有路由(网页、API、静态资源等)
- 使用 `req.url` 和 `req.method` 进行路由判断
- HTML使用 Tailwind CSS 或现代CSS,默认暗色模式
- 代码注释清晰,便于理解和维护
- 考虑性能优化和用户体验

📁 **部署配置**:

- 主要部署平台:Vercel Serverless Functions
- 文件结构:`package.json` + `vercel.json` + `api/index.js`
- 兼容 Vercel 的请求/响应对象规范
- 可以使用vercel.json的rewrite,不要用redirect和route.

📦 **输出要求**:

1. **项目结构**:完整的文件目录和配置
2. **核心代码**:单文件实现,包含路由、业务逻辑、UI渲染
3. **配置文件**:package.json、vercel.json等部署配置

**质量标准**:

- 代码具备良好的可读性和可维护性
- UI设计现代美观,避免纯文本展示
- 性能优化:缓存策略、响应压缩等

#programming #prompt
gemini pro 和 claude 相互做代码审查非常好。

以下是我写的一个 telegram聊天记录搜索api.他部署在 cf worker.
他接到请求之后会先读取存储到 r2 的聊天记录 ndjson,再按照关键字搜索。
上次我已经更改了诸多特性,请你进行代码审查。
下面我附上上次的 checkpoint prompt,以及代码


每次审查出问题修复,并且出一个 checkpoint prompt
好的,就目前版本做出的改变和脚本总体的feature,总结一个 checkpoint prompt, 以便下轮对话使用。


ai 优化后的 checkpoint summary prompt:
请根据截至目前的对话内容,生成一个结构化的 checkpoint 总结,用于在后续对话中快速恢复上下文。总结应包含以下部分:

1. 【项目目标】简要重述当前脚本的核心功能与设计初衷。
2. 【已实现功能】列出目前已完成的主要特性或模块,按优先级或逻辑分组。
3. 【关键变更记录】概述本轮迭代中做出的重要修改及其原因(如重构、新增逻辑、修复问题等)。
4. 【待办事项 & 下一步计划】明确接下来需要实现的功能、待验证的问题或潜在优化方向。
5. 【上下文提示】提取可用于下轮对话的关键词、技术栈、约束条件或特殊需求。

请保持语言简洁准确,便于复制粘贴作为新对话的起始 prompt。

#ai #programming #prompt
说到agent vibe coding, 我已经被最先使用全自动agent vibe coding的那些人落下了得有一年的时间了

以前以为用个copilot edit打开VSc,然后对我标签页的代码删删改改就是vibe coding

现在才知道啥是真正的vibe coding

但是这最大的原因是因为我感觉cursor搞起来很麻烦 经常被和谐 这么繁琐的事情也并不是我急切需要,没有就不行的 所以也就一直搁置了

还好现在有gemini qwen 两个大善人能给我开放免费名额,让我一试

还是便宜治百病呀~

#ai
经过了AI编程差不多两三年的时间

越来越能理解一些广东非白化区的人说粤语识听唔识讲了

因为看的多了也就能理解了,但是想要主动输出那就是另外一码事了。。。

以上指的就是我在做js后端编程,网络编程方面的感想

#programming
Back to Top