code: func (e *endpoint) DeliverNetworkPacket(linkEP stack.LinkEndpoint, remote, local tcpip.LinkAddress, protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView) {
  	if atomic.LoadUint32(&LogPackets) == 1 && e.file == nil {
  		logPacket("recv", protocol, vv.First())
  	}
  	if e.file != nil && atomic.LoadUint32(&LogPacketsToFile) == 1 {
  		vs := vv.Views()
  		length := vv.Size()
  		if length > int(e.maxPCAPLen) {
  			length = int(e.maxPCAPLen)
  		}
  
  		buf := bytes.NewBuffer(make([]byte, 0, pcapPacketHeaderLen+length))
  		if err := binary.Write(buf, binary.BigEndian, newPCAPPacketHeader(uint32(length), uint32(vv.Size()))); err != nil {
  			panic(err)
  		}
  		for _, v := range vs {
  			if length == 0 {
  				break
  			}
  			if len(v) > length {
  				v = v[:length]
  			}
  			if _, err := buf.Write([]byte(v)); err != nil {
  				panic(err)
  			}
  			length -= len(v)
  		}
  		if _, err := e.file.Write(buf.Bytes()); err != nil {
  			panic(err)
  		}
  	}
  	e.dispatcher.DeliverNetworkPacket(e, remote, local, protocol, vv)
  }
docs: // DeliverNetworkPacket implements the stack.NetworkDispatcher interface. It is
  // called by the link-layer endpoint being wrapped when a packet arrives, and
  // logs the packet before forwarding to the actual dispatcher.