code: func ServeNFC(w http.ResponseWriter, r *http.Request) {
  	p := strings.Split(r.URL.Path, "/")
  	id, name := p[len(p)-2], p[len(p)-1]
  	ref := types.ManagedObjectReference{Type: "HttpNfcLease", Value: id}
  	l, ok := nfcLease.Load(ref)
  	if !ok {
  		log.Printf("invalid NFC lease: %s", id)
  		http.NotFound(w, r)
  		return
  	}
  	lease := l.(*HttpNfcLease)
  	file, ok := lease.files[name]
  	if !ok {
  		log.Printf("invalid NFC device id: %s", name)
  		http.NotFound(w, r)
  		return
  	}
  
  	status := http.StatusOK
  	var dst io.Writer
  	var src io.ReadCloser
  
  	switch r.Method {
  	case http.MethodPut, http.MethodPost:
  		dst = ioutil.Discard
  		src = r.Body
  	case http.MethodGet:
  		f, err := os.Open(file)
  		if err != nil {
  			http.NotFound(w, r)
  			return
  		}
  		src = f
  	default:
  		status = http.StatusMethodNotAllowed
  	}
  
  	n, err := io.Copy(dst, src)
  	_ = src.Close()
  
  	msg := fmt.Sprintf("transferred %d bytes", n)
  	if err != nil {
  		status = http.StatusInternalServerError
  		msg = err.Error()
  	}
  	log.Printf("nfc %s %s: %s", r.Method, file, msg)
  	w.WriteHeader(status)
  }
docs: // ServeNFC handles NFC file upload/download