arduino / arduino/ArduinoCore-API

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

Đang mở
#228 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
C++
Star
306
Fork
150
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với các triển khai của IPAddress toString() và printTo(), sau đó xem lại các kiểm thử printTo() hiện có cho những trường hợp IPv6 canonical của RFC 5952. Làm cho toString() sử dụng thuật toán printTo() đã được thiết lập và thêm các kiểm thử đơn vị bao quát đầu ra của nó; hoàn tất khi cả hai phương thức tạo ra định dạng canonical như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
api, networking
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.