Fix lint errors
This commit is contained in:
parent
994d6ccdbf
commit
d1af8aaf7e
6 changed files with 15 additions and 21 deletions
|
|
@ -22,7 +22,6 @@ import (
|
|||
|
||||
"github.com/sagernet/sing-tun/gtcpip"
|
||||
"github.com/sagernet/sing-tun/gtcpip/checksum"
|
||||
"github.com/sagernet/sing/common"
|
||||
)
|
||||
|
||||
// RFC 971 defines the fields of the IPv4 header on page 11 using the following
|
||||
|
|
@ -335,7 +334,7 @@ func (b IPv4) FragmentOffset() uint16 {
|
|||
}
|
||||
|
||||
func (b IPv4) FragmentOffsetDarwinRaw() uint16 {
|
||||
return common.NativeEndian.Uint16(b[flagsFO:]) << 3
|
||||
return binary.NativeEndian.Uint16(b[flagsFO:]) << 3
|
||||
}
|
||||
|
||||
// TotalLength returns the "total length" field of the IPv4 header.
|
||||
|
|
@ -344,7 +343,7 @@ func (b IPv4) TotalLength() uint16 {
|
|||
}
|
||||
|
||||
func (b IPv4) TotalLengthDarwinRaw() uint16 {
|
||||
return common.NativeEndian.Uint16(b[IPv4TotalLenOffset:]) + uint16(b.HeaderLength())
|
||||
return binary.NativeEndian.Uint16(b[IPv4TotalLenOffset:]) + uint16(b.HeaderLength())
|
||||
}
|
||||
|
||||
// Checksum returns the checksum field of the IPv4 header.
|
||||
|
|
@ -441,7 +440,7 @@ func (b IPv4) SetTotalLength(totalLength uint16) {
|
|||
}
|
||||
|
||||
func (b IPv4) SetTotalLengthDarwinRaw(totalLength uint16) {
|
||||
common.NativeEndian.PutUint16(b[IPv4TotalLenOffset:], totalLength)
|
||||
binary.NativeEndian.PutUint16(b[IPv4TotalLenOffset:], totalLength)
|
||||
}
|
||||
|
||||
// SetChecksum sets the checksum field of the IPv4 header.
|
||||
|
|
@ -458,7 +457,7 @@ func (b IPv4) SetFlagsFragmentOffset(flags uint8, offset uint16) {
|
|||
|
||||
func (b IPv4) SetFlagsFragmentOffsetDarwinRaw(flags uint8, offset uint16) {
|
||||
v := (uint16(flags) << 13) | (offset >> 3)
|
||||
common.NativeEndian.PutUint16(b[flagsFO:], v)
|
||||
binary.NativeEndian.PutUint16(b[flagsFO:], v)
|
||||
}
|
||||
|
||||
// SetID sets the identification field.
|
||||
|
|
@ -1179,7 +1178,7 @@ func (s IPv4OptionsSerializer) Serialize(b []byte) uint8 {
|
|||
// header ends on a 32 bit boundary. The padding is zero.
|
||||
padded := padIPv4OptionsLength(total)
|
||||
b = b[:padded-total]
|
||||
common.ClearArray(b)
|
||||
clear(b)
|
||||
return padded
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import (
|
|||
"math"
|
||||
|
||||
"github.com/sagernet/sing-tun/gtcpip"
|
||||
"github.com/sagernet/sing/common"
|
||||
)
|
||||
|
||||
// IPv6ExtensionHeaderIdentifier is an IPv6 extension header identifier.
|
||||
|
|
@ -129,7 +128,7 @@ func padIPv6Option(b []byte) {
|
|||
b[ipv6ExtHdrOptionTypeOffset] = uint8(ipv6Pad1ExtHdrOptionIdentifier)
|
||||
default: // Pad with PadN.
|
||||
s := b[ipv6ExtHdrOptionPayloadOffset:]
|
||||
common.ClearArray(s)
|
||||
clear(s)
|
||||
b[ipv6ExtHdrOptionTypeOffset] = uint8(ipv6PadNExtHdrOptionIdentifier)
|
||||
b[ipv6ExtHdrOptionLengthOffset] = uint8(len(s))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/sagernet/sing-tun/gtcpip"
|
||||
"github.com/sagernet/sing/common"
|
||||
)
|
||||
|
||||
// ndpOptionIdentifier is an NDP option type identifier.
|
||||
|
|
@ -341,7 +340,7 @@ func (b NDPOptions) Serialize(s NDPOptionsSerializer) int {
|
|||
|
||||
// Zero out remaining (padding) bytes, if any exists.
|
||||
if used+2 < l {
|
||||
common.ClearArray(b[used+2 : l])
|
||||
clear(b[used+2 : l])
|
||||
}
|
||||
|
||||
b = b[l:]
|
||||
|
|
@ -567,7 +566,7 @@ func (o NDPPrefixInformation) serializeInto(b []byte) int {
|
|||
|
||||
// Zero out the Reserved2 field.
|
||||
reserved2 := b[ndpPrefixInformationReserved2Offset:][:ndpPrefixInformationReserved2Length]
|
||||
common.ClearArray(reserved2)
|
||||
clear(reserved2)
|
||||
|
||||
return used
|
||||
}
|
||||
|
|
@ -686,7 +685,7 @@ func (o NDPRecursiveDNSServer) serializeInto(b []byte) int {
|
|||
used := copy(b, o)
|
||||
|
||||
// Zero out the reserved bytes that are before the Lifetime field.
|
||||
common.ClearArray(b[0:ndpRecursiveDNSServerLifetimeOffset])
|
||||
clear(b[0:ndpRecursiveDNSServerLifetimeOffset])
|
||||
|
||||
return used
|
||||
}
|
||||
|
|
@ -779,7 +778,7 @@ func (o NDPDNSSearchList) serializeInto(b []byte) int {
|
|||
used := copy(b, o)
|
||||
|
||||
// Zero out the reserved bytes that are before the Lifetime field.
|
||||
common.ClearArray(b[0:ndpDNSSearchListLifetimeOffset])
|
||||
clear(b[0:ndpDNSSearchListLifetimeOffset])
|
||||
|
||||
return used
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue