blob: d07c4d501ba2121e2d866abf335922dad196f61e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package dhcpv6
import (
"fmt"
)
// OptClientID represents a Client Identifier option as defined by RFC 3315
// Section 22.2.
func OptClientID(d DUID) Option {
return &optClientID{d}
}
type optClientID struct {
DUID
}
func (*optClientID) Code() OptionCode {
return OptionClientID
}
func (op *optClientID) String() string {
return fmt.Sprintf("%s: %s", op.Code(), op.DUID)
}
// parseOptClientID builds an OptClientId structure from a sequence
// of bytes. The input data does not include option code and length
// bytes.
func parseOptClientID(data []byte) (*optClientID, error) {
cid, err := DUIDFromBytes(data)
if err != nil {
return nil, err
}
return &optClientID{cid}, nil
}
|