summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_fqdn.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2023-02-18 20:31:32 -0800
committerChris K <c@chrisko.ch>2023-02-19 22:39:16 -0800
commit336d4b9bd652b2bf0bc1bd0feae3f2f51009c13f (patch)
tree9c99ebb8f3067a39981d8bea07109fd7e7ba0d17 /dhcpv6/option_fqdn.go
parent1e0fe5ce427973ca92a0dfb1a06a252ddb0dd4be (diff)
dhcpv6: convert every Parse function to FromBytes
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_fqdn.go')
-rw-r--r--dhcpv6/option_fqdn.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/dhcpv6/option_fqdn.go b/dhcpv6/option_fqdn.go
index 73a525a..adb47fb 100644
--- a/dhcpv6/option_fqdn.go
+++ b/dhcpv6/option_fqdn.go
@@ -32,15 +32,14 @@ func (op *OptFQDN) String() string {
return fmt.Sprintf("%s: {Flags=%d DomainName=%s}", op.Code(), op.Flags, op.DomainName)
}
-// ParseOptFQDN deserializes from bytes to build a OptFQDN structure.
-func ParseOptFQDN(data []byte) (*OptFQDN, error) {
- var opt OptFQDN
+// FromBytes deserializes from bytes to build a OptFQDN structure.
+func (op *OptFQDN) FromBytes(data []byte) error {
var err error
buf := uio.NewBigEndianBuffer(data)
- opt.Flags = buf.Read8()
- opt.DomainName, err = rfc1035label.FromBytes(buf.ReadAll())
+ op.Flags = buf.Read8()
+ op.DomainName, err = rfc1035label.FromBytes(buf.ReadAll())
if err != nil {
- return nil, err
+ return err
}
- return &opt, buf.FinError()
+ return buf.FinError()
}