arduino / arduino/ArduinoCore-API

IPAddress toString should use existing printTo algorithm and conform to RFC 5952 canonical format for IPv6 addresses

未关闭
#228 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
C++
星标
306
派生
150
PR 合并指标
30 天内没有已合并 PR

描述

### API component

IPAddress

### Description

The `toString()` for an IPv6 type address has a different output from `printTo()`, and does not follow the RFC 5952 canonical format. It has an unnecessarily long fixed length format. Note that IPv4 does not use a fixed length format.

Also note that the existing `printTo()` method already implements the RFC 5952 canonical format algorithm, and has extensive tests (there are no tests for the `toString()` method).

The recommendation would be for `toString()` simply to use the existing algorithm from `printTo()` (and add some unit tests for `toString`).

### Is this a breaking change?

No. Both formats are valid string formats for IPv6, and `fromString()` handles both of them (and all other valid formats), as should any other system. The canonical format is usually shorter, but will not exceed the fixed length format, so there is no issue with overruns.

贡献指南

这个仓库没有索引到贡献指南

调研方向

先从 IPAddress toString() 和 printTo() 的实现开始,然后检查现有的 printTo() 测试中针对 RFC 5952 规范 IPv6 情况的测试。让 toString() 使用已建立的 printTo() 算法,并添加覆盖其输出的单元测试;当两个方法都生成预期的规范格式时即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
api, networking
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

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