mirror of
https://github.com/danderson/netboot.git
synced 2025-08-20 06:01:21 +02:00
Add a Uint16 reader for dhcp.Options.
This commit is contained in:
parent
33e5e06817
commit
af2fc8892a
@ -2,6 +2,7 @@ package dhcp
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -121,3 +122,11 @@ func (o Options) Byte(n int) (byte, bool) {
|
||||
}
|
||||
return v[0], true
|
||||
}
|
||||
|
||||
func (o Options) Uint16(n int) (uint16, bool) {
|
||||
v := o[n]
|
||||
if v == nil || len(v) != 2 {
|
||||
return 0, false
|
||||
}
|
||||
return binary.BigEndian.Uint16(v[:2]), true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user