Add ACL Support
还没有人认领这个 Issue。
评估
调研方向
从 stubs/wit_world/imports/acl.py 中的 WIT binding 开始,检查此 issue 中的 ACL 接口和 API 要求。使用 test.toml、data/acl.json 以及 @on_viceroy 测试,验证打开 ACL、匹配 IPv4 和 IPv6 地址、解析条目元数据,以及在未命中时返回 None。
由索引模型根据 Issue 内容生成。
描述
Overview
Add support for Fastly's Access Control Lists (ACLs), providing IP-based blocklists and access control.
WIT Interface
interface acl {
use types.{error, open-error, ip-address};
resource acl {
open: static func(name: string) -> result<acl, open-error>;
lookup: func(ip-addr: ip-address) -> result<option<body>, acl-error>;
}
enum acl-error {
too-many-requests,
generic-error
}
}
WIT bindings: stubs/wit_world/imports/acl.py
API Design
- Implement
ACLresource wrapper lookup(ip)acceptsstr,IPv4Address, orIPv6Addressand returnsOptional[dict]- Parse JSON body response from WIT layer when IP matches ACL entry
- Return
Nonewhen IP not found in ACL (no match)
Cross-SDK Comparison: All SDKs expose open(name) and lookup(ip) returning entry with prefix, action, id fields. Simple consistent API across languages.
Viceroy Testing
Viceroy supports ACL with JSON file-based test data via test.toml:
[local_server]
# Path to JSON file with ACL entries
acls.my_blocklist = "../data/acl.json"
# Or using object syntax
acls.my_allowlist = { file = "../data/allowlist.json" }
ACL JSON file format maps IP addresses to metadata objects. Lookup operations work with test data. Tests can use @on_viceroy with file references in TOML configuration.
Reference
- 主要语言
- Python
- 星标
- 5
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fastly/compute-sdk-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
fastly/compute-sdk-python#116 ·
-
难度 4/5 3-5 天 新手友好度 35/100
fastly/compute-sdk-python#98 ·
-
难度 5/5 一周以上 新手友好度 35/100
fastly/compute-sdk-python#74 ·
-
难度 5/5 一周以上 新手友好度 35/100
fastly/compute-sdk-python#61 ·
-
fastly/compute-sdk-python#60 · 已指派 1 人 ·
查看 fastly/compute-sdk-python 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
sublimehq/package_control#1780 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·