mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
refactor if/else in network and packets packages
This commit is contained in:
parent
1e12891bfb
commit
ed6d40f163
6 changed files with 34 additions and 25 deletions
|
@ -38,11 +38,11 @@ func DHCP6For(what dhcp6.MessageType, to dhcp6.Packet, duid []byte) (err error,
|
|||
}
|
||||
|
||||
var rawCID []byte
|
||||
if raw, found := to.Options[dhcp6.OptionClientID]; !found || len(raw) < 1 {
|
||||
raw, found := to.Options[dhcp6.OptionClientID]
|
||||
if !found || len(raw) < 1 {
|
||||
return ErrNoCID, p
|
||||
} else {
|
||||
rawCID = raw[0]
|
||||
}
|
||||
rawCID = raw[0]
|
||||
|
||||
p.Options.AddRaw(dhcp6.OptionClientID, rawCID)
|
||||
p.Options.AddRaw(dhcp6.OptionServerID, duid)
|
||||
|
|
|
@ -233,9 +233,8 @@ func (q *Queue) Send(raw []byte) error {
|
|||
if err := q.handle.WritePacketData(raw); err != nil {
|
||||
q.TrackError()
|
||||
return err
|
||||
} else {
|
||||
q.TrackSent(uint64(len(raw)))
|
||||
}
|
||||
q.TrackSent(uint64(len(raw)))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue