diff options
author | insomniac <insomniacslk@users.noreply.github.com> | 2018-05-02 00:08:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-02 00:08:35 +0200 |
commit | 412a04020e7b7082b33269fd236fa539a7d8720b (patch) | |
tree | 5bbdb031f35aa864caa840a639d2e56db68b2947 /dhcpv6 | |
parent | 0a594bd0cd2eedcdb3b3c0ae394d03d2036e8e2c (diff) |
ClientID and ServerID are now public, with no setter/getter (#52)
Diffstat (limited to 'dhcpv6')
-rw-r--r-- | dhcpv6/dhcpv6message.go | 15 | ||||
-rw-r--r-- | dhcpv6/option_clientid.go | 8 | ||||
-rw-r--r-- | dhcpv6/option_serverid.go | 18 |
3 files changed, 13 insertions, 28 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go index 9bfe932..1ea73f7 100644 --- a/dhcpv6/dhcpv6message.go +++ b/dhcpv6/dhcpv6message.go @@ -77,13 +77,14 @@ func NewSolicitForInterface(ifname string, modifiers ...Modifier) (DHCPv6, error if err != nil { return nil, err } - cid := OptClientId{} - cid.SetClientID(Duid{ - Type: DUID_LLT, - HwType: iana.HwTypeEthernet, - Time: GetTime(), - LinkLayerAddr: iface.HardwareAddr, - }) + cid := OptClientId{ + Cid: Duid{ + Type: DUID_LLT, + HwType: iana.HwTypeEthernet, + Time: GetTime(), + LinkLayerAddr: iface.HardwareAddr, + }, + } d.AddOption(&cid) oro := OptRequestedOption{} diff --git a/dhcpv6/option_clientid.go b/dhcpv6/option_clientid.go index 47ab685..2e24abb 100644 --- a/dhcpv6/option_clientid.go +++ b/dhcpv6/option_clientid.go @@ -24,14 +24,6 @@ func (op *OptClientId) ToBytes() []byte { return buf } -func (op *OptClientId) ClientID() Duid { - return op.Cid -} - -func (op *OptClientId) SetClientID(cid Duid) { - op.Cid = cid -} - func (op *OptClientId) Length() int { return op.Cid.Length() } diff --git a/dhcpv6/option_serverid.go b/dhcpv6/option_serverid.go index 75aea9b..298b095 100644 --- a/dhcpv6/option_serverid.go +++ b/dhcpv6/option_serverid.go @@ -9,7 +9,7 @@ import ( ) type OptServerId struct { - sid Duid + Sid Duid } func (op *OptServerId) Code() OptionCode { @@ -20,24 +20,16 @@ func (op *OptServerId) ToBytes() []byte { buf := make([]byte, 4) binary.BigEndian.PutUint16(buf[0:2], uint16(OPTION_SERVERID)) binary.BigEndian.PutUint16(buf[2:4], uint16(op.Length())) - buf = append(buf, op.sid.ToBytes()...) + buf = append(buf, op.Sid.ToBytes()...) return buf } -func (op *OptServerId) ServerID() Duid { - return op.sid -} - -func (op *OptServerId) SetServerID(sid Duid) { - op.sid = sid -} - func (op *OptServerId) Length() int { - return op.sid.Length() + return op.Sid.Length() } func (op *OptServerId) String() string { - return fmt.Sprintf("OptServerId{sid=%v}", op.sid.String()) + return fmt.Sprintf("OptServerId{sid=%v}", op.Sid.String()) } // build an OptServerId structure from a sequence of bytes. @@ -52,6 +44,6 @@ func ParseOptServerId(data []byte) (*OptServerId, error) { if err != nil { return nil, err } - opt.sid = *sid + opt.Sid = *sid return &opt, nil } |