func (b UDP) CalculateChecksum(partialChecksum uint16) uint16 {
	return Checksum(b[:UDPMinimumSize], partialChecksum)
}
CalculateChecksum calculates the checksum of the udp packet, given the
checksum of the network-layer pseudo-header and the checksum of the payload.
package header
import (
	"encoding/binary"
	"github.com/google/netstack/tcpip"
)
const (
	udpSrcPort  = 0
	udpDstPort  = 2
	udpLength   = 4
	udpChecksum = 6
)
const (
	UDPMaximumPacketSize = 0xffff
)
type UDPFields struct {
	SrcPort uint16
	DstPort uint16
	Length uint16
	Checksum uint16
}
type UDP []byte
const (
	UDPMinimumSize = 8
	UDPProtocolNumber tcpip.TransportProtocolNumber = 17
)
func (b UDP) SourcePort() uint16 {
	return binary.BigEndian.Uint16(b[udpSrcPort:])
}
func (b UDP) DestinationPort() uint16 {
	return binary.BigEndian.Uint16(b[udpDstPort:])
}
func (b UDP) Length() uint16 {
	return binary.BigEndian.Uint16(b[udpLength:])
}
func (b UDP) Payload() []byte {
	return b[UDPMinimumSize:]
}
func (b UDP) Checksum() uint16 {
	return binary.BigEndian.Uint16(b[udpChecksum:])
}
func (b UDP) SetSourcePort(port uint16) {
	binary.BigEndian.PutUint16(b[udpSrcPort:], port)
}
func (b UDP) SetDestinationPort(port uint16) {
	binary.BigEndian.PutUint16(b[udpDstPort:], port)
}
func (b UDP) SetChecksum(checksum uint16) {
	binary.BigEndian.PutUint16(b[udpChecksum:], checksum)
}