insomniacslk / dhcp

DHCPv6 and DHCPv4 packet library, client and server written in Go
BSD 3-Clause "New" or "Revised" License
685 stars 168 forks source link

dhcpv6: switch every Option to parse using FromBytes #491

Closed hugelgupf closed 1 year ago

hugelgupf commented 1 year ago

Adds

FromBytes([]byte) error

type to the Option interface.

This is a pre-requisite for doing either #487 or lazy option parsing. I'm experimenting with both, and unhappy with everything I come up with, so for now I want to merge this improvement.

codecov[bot] commented 1 year ago

Codecov Report

Base: 69.46% // Head: 69.55% // Increases project coverage by +0.09% :tada:

Coverage data is based on head (16b6fd4) compared to base (5989848). Patch coverage: 85.35% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #491 +/- ## ========================================== + Coverage 69.46% 69.55% +0.09% ========================================== Files 90 90 Lines 5737 5656 -81 ========================================== - Hits 3985 3934 -51 + Misses 1571 1546 -25 + Partials 181 176 -5 ``` | [Impacted Files](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac) | Coverage Δ | | |---|---|---| | [dhcpv6/dhcpv6message.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L2RoY3B2Nm1lc3NhZ2UuZ28=) | `56.85% <0.00%> (+0.25%)` | :arrow_up: | | [dhcpv6/options.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbnMuZ28=) | `78.65% <57.89%> (+5.82%)` | :arrow_up: | | [dhcpv6/option\_ntp\_server.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9udHBfc2VydmVyLmdv) | `66.66% <68.00%> (+3.25%)` | :arrow_up: | | [dhcpv6/option\_fqdn.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9mcWRuLmdv) | `83.33% <80.00%> (-0.88%)` | :arrow_down: | | [dhcpv6/option\_4rd.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl80cmQuZ28=) | `83.90% <100.00%> (-0.71%)` | :arrow_down: | | [dhcpv6/option\_archtype.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9hcmNodHlwZS5nbw==) | `100.00% <100.00%> (ø)` | | | [dhcpv6/option\_bootfileparam.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9ib290ZmlsZXBhcmFtLmdv) | `86.36% <100.00%> (+9.44%)` | :arrow_up: | | [dhcpv6/option\_bootfileurl.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9ib290ZmlsZXVybC5nbw==) | `100.00% <100.00%> (ø)` | | | [dhcpv6/option\_clientid.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9jbGllbnRpZC5nbw==) | `100.00% <100.00%> (ø)` | | | [dhcpv6/option\_clientlinklayeraddress.go](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac#diff-ZGhjcHY2L29wdGlvbl9jbGllbnRsaW5rbGF5ZXJhZGRyZXNzLmdv) | `100.00% <100.00%> (ø)` | | | ... and [24 more](https://codecov.io/gh/insomniacslk/dhcp/pull/491?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=insomniac)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.