arduino / arduino/ArduinoCore-API

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

Offen
#228 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
C++
Sterne
306
Forks
150
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit den Implementierungen von IPAddress toString() und printTo() und überprüfe anschließend die bestehenden printTo()-Tests für die kanonischen IPv6-Fälle aus RFC 5952. Lass toString() den etablierten printTo()-Algorithmus verwenden, und füge Unit-Tests hinzu, die dessen Ausgabe abdecken; die Aufgabe ist abgeschlossen, wenn beide Methoden das erwartete kanonische Format erzeugen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
api, networking
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.