Skip to content

Conversation

@xrgzs
Copy link
Member

@xrgzs xrgzs commented Oct 19, 2025

Description / 描述

  1. 为 OpenList 驱动增加「传递 IP 至上游」功能
  2. 在 LinkCacheType 处理中使用位标志

当 「传递 IP 至上游」启用时,会将 IP 地址使用 X-Forwarded-ForX-Real-Ip 请求头传递至上游,方便上游服务器获取/缓存直链。

Motivation and Context / 背景

Relates to #1339

How Has This Been Tested? / 测试

TODO: 需要确定缓存key是否设置正确

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

xrgzs added 2 commits October 19, 2025 17:32
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
@xrgzs xrgzs marked this pull request as ready for review October 19, 2025 12:09
@jyxjjj jyxjjj merged commit 623a120 into OpenListTeam:main Oct 19, 2025
12 checks passed
@xrgzs xrgzs deleted the feat/openlist-ip branch October 19, 2025 15:29
typeKey += "/" + ua
typeKeys = []string{typeKey}
}
if mode&driver.LinkCacheIP == 1 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是不是可以考虑将
if mode&driver.LinkCacheIP == 1
if mode&driver.LinkCacheUA == 1
改为
if mode&driver.LinkCacheIP != 0
if mode&driver.LinkCacheUA != 0
应该需要支持同时开启IP和UA的情况吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement go Module: Driver Driver-Related Issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants