mirror of
https://github.com/danderson/netboot.git
synced 2025-12-16 23:11:26 +01:00
Remove unneccessary conversions, further appeasing lint.
This commit is contained in:
parent
6061bfbc73
commit
baf5793687
@ -88,8 +88,8 @@ func UnmarshalOptions(bs []byte) (Options, error) {
|
|||||||
|
|
||||||
// UnmarshalOption de-serializes an Option
|
// UnmarshalOption de-serializes an Option
|
||||||
func UnmarshalOption(bs []byte) (*Option, error) {
|
func UnmarshalOption(bs []byte) (*Option, error) {
|
||||||
optionLength := uint16(binary.BigEndian.Uint16(bs[2:4]))
|
optionLength := binary.BigEndian.Uint16(bs[2:4])
|
||||||
optionID := uint16(binary.BigEndian.Uint16(bs[0:2]))
|
optionID := binary.BigEndian.Uint16(bs[0:2])
|
||||||
switch optionID {
|
switch optionID {
|
||||||
// parse client_id
|
// parse client_id
|
||||||
// parse server_id
|
// parse server_id
|
||||||
@ -134,8 +134,8 @@ func (o Options) humanReadableIaNa(opt Option) []string {
|
|||||||
|
|
||||||
iaOptions := opt.Value[12:]
|
iaOptions := opt.Value[12:]
|
||||||
for len(iaOptions) > 0 {
|
for len(iaOptions) > 0 {
|
||||||
l := uint16(binary.BigEndian.Uint16(iaOptions[2:4]))
|
l := binary.BigEndian.Uint16(iaOptions[2:4])
|
||||||
id := uint16(binary.BigEndian.Uint16(iaOptions[0:2]))
|
id := binary.BigEndian.Uint16(iaOptions[0:2])
|
||||||
|
|
||||||
switch id {
|
switch id {
|
||||||
case OptIaAddr:
|
case OptIaAddr:
|
||||||
@ -250,7 +250,7 @@ func (o Options) UnmarshalOptionRequestOption() map[uint16]bool {
|
|||||||
|
|
||||||
value := o[OptOro][0].Value
|
value := o[OptOro][0].Value
|
||||||
for i := 0; i < int(o[OptOro][0].Length)/2; i++ {
|
for i := 0; i < int(o[OptOro][0].Length)/2; i++ {
|
||||||
ret[uint16(binary.BigEndian.Uint16(value[i*2:(i+1)*2]))] = true
|
ret[binary.BigEndian.Uint16(value[i*2:(i+1)*2])] = true
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ func MakeStaticBootConfiguration(httpBootURL, ipxeBootURL string, preference uin
|
|||||||
ret := &StaticBootConfiguration{HTTPBootURL: []byte(httpBootURL), IPxeBootURL: []byte(ipxeBootURL), UsePreference: usePreference}
|
ret := &StaticBootConfiguration{HTTPBootURL: []byte(httpBootURL), IPxeBootURL: []byte(ipxeBootURL), UsePreference: usePreference}
|
||||||
if usePreference {
|
if usePreference {
|
||||||
ret.Preference = make([]byte, 1)
|
ret.Preference = make([]byte, 1)
|
||||||
ret.Preference[0] = byte(preference)
|
ret.Preference[0] = preference
|
||||||
}
|
}
|
||||||
ret.RecursiveDNS = dnsServerAddresses
|
ret.RecursiveDNS = dnsServerAddresses
|
||||||
return ret
|
return ret
|
||||||
@ -74,7 +74,7 @@ func MakeAPIBootConfiguration(url string, timeout time.Duration, preference uint
|
|||||||
}
|
}
|
||||||
if usePreference {
|
if usePreference {
|
||||||
ret.Preference = make([]byte, 1)
|
ret.Preference = make([]byte, 1)
|
||||||
ret.Preference[0] = byte(preference)
|
ret.Preference[0] = preference
|
||||||
}
|
}
|
||||||
ret.RecursiveDNS = dnsServerAddresses
|
ret.RecursiveDNS = dnsServerAddresses
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user