Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add ACL Support

未关闭
#52 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api, backend, testing

调研方向

从 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 ACL resource wrapper
  • lookup(ip) accepts str, IPv4Address, or IPv6Address and returns Optional[dict]
  • Parse JSON body response from WIT layer when IP matches ACL entry
  • Return None when 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fastly/compute-sdk-python 的其他 Issue

查看 fastly/compute-sdk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。