# R2-10 — miot_storage.go: CSR 生成 ## 缺失方法 Python `MIoTCert.gen_user_csr()`: ```python def gen_user_csr(self) -> str: """使用 Ed25519 私钥生成 CSR""" ``` ## 目标文件 `D:\miot\go-miot\miot_storage.go` 使用 `crypto/ed25519` + `crypto/x509.CreateCertificateRequest` 生成 CSR。 因依赖 Ed25519 密钥对,需先确保 LoadUserKey/SaveUserKey 已实现。 # R2-11 — miot_matcher.go: 匹配器方法 ## 缺失方法 ```python def iter_all_nodes(self) -> Any: # 遍历所有节点 def get(self, topic: str) -> Optional[Any]: # 按 topic 获取 ``` ## 目标文件 `D:\miot\go-miot\miot_matcher.go` 在 `MIoTMatcher` 上添加 `IterAllNodes()` iterator 和 `Get(topic string)` 方法。 # R2-12 — const.go: CtrlMode.load ## 缺失方法 ```python @staticmethod def load(mode: str) -> 'CtrlMode': """从字符串解析控制模式""" ``` ## 目标文件 `D:\miot\go-miot\const.go` ```go func ParseCtrlMode(s string) (CtrlMode, error) { switch strings.ToLower(s) { case "cloud": return CtrlModeCloud, nil case "gateway": return CtrlModeGateway, nil case "lan": return CtrlModeLAN, nil default: return 0, fmt.Errorf("unknown ctrl mode: %s", s) } } ``` # R2-13 — 资源: lan/profile_models.yaml ## 缺失文件 复制 `D:\miot\py-miot\lan\profile_models.yaml` → `D:\miot\go-miot\lan\profile_models.yaml` miot_lan.go 可能引用此文件用于设备 profile 映射。 # R2-14 — 资源: specs/ 目录 ## 缺失文件 复制 `D:\miot\py-miot\specs\` → `D:\miot\go-miot\specs\` 包含 6 个文件:bool_trans.yaml、multi_lang.json、spec_add.json、spec_filter.yaml、spec_modify.yaml、specv2entity.py。 spec_parser.go 可能引用这些文件用于 SPEC 扩展配置。