code: func sendUDP(r *stack.Route, data buffer.VectorisedView, localPort, remotePort uint16, ttl uint8) *tcpip.Error {
  	// Allocate a buffer for the UDP header.
  	hdr := buffer.NewPrependable(header.UDPMinimumSize + int(r.MaxHeaderLength()))
  
  	// Initialize the header.
  	udp := header.UDP(hdr.Prepend(header.UDPMinimumSize))
  
  	length := uint16(hdr.UsedLength() + data.Size())
  	udp.Encode(&header.UDPFields{
  		SrcPort: localPort,
  		DstPort: remotePort,
  		Length:  length,
  	})
  
  	// Only calculate the checksum if offloading isn't supported.
  	if r.Capabilities()&stack.CapabilityTXChecksumOffload == 0 {
  		xsum := r.PseudoHeaderChecksum(ProtocolNumber, length)
  		for _, v := range data.Views() {
  			xsum = header.Checksum(v, xsum)
  		}
  		udp.SetChecksum(^udp.CalculateChecksum(xsum))
  	}
  
  	// Track count of packets sent.
  	r.Stats().UDP.PacketsSent.Increment()
  
  	return r.WritePacket(nil /* gso */, hdr, data, ProtocolNumber, ttl)
  }
docs: // sendUDP sends a UDP segment via the provided network endpoint and under the
  // provided identity.