code: func NewWithFile(lower tcpip.LinkEndpointID, file *os.File, snapLen uint32) (tcpip.LinkEndpointID, error) {
  	if err := writePCAPHeader(file, snapLen); err != nil {
  		return 0, err
  	}
  	return stack.RegisterLinkEndpoint(&endpoint{
  		lower:      stack.FindLinkEndpoint(lower),
  		file:       file,
  		maxPCAPLen: snapLen,
  	}), nil
  }
docs: // NewWithFile creates a new sniffer link-layer endpoint. It wraps around
  // another endpoint and logs packets and they traverse the endpoint.
  //
  // Packets can be logged to file in the pcap format. A sniffer created
  // with this function will not emit packets using the standard log
  // package.
  //
  // snapLen is the maximum amount of a packet to be saved. Packets with a length
  // less than or equal too snapLen will be saved in their entirety. Longer
  // packets will be truncated to snapLen.