code: func writer(ch chan struct{}, ep tcpip.Endpoint) {
  	defer func() {
  		ep.Shutdown(tcpip.ShutdownWrite)
  		close(ch)
  	}()
  
  	r := bufio.NewReader(os.Stdin)
  	for {
  		v := buffer.NewView(1024)
  		n, err := r.Read(v)
  		if err != nil {
  			return
  		}
  
  		v.CapLength(n)
  		for len(v) > 0 {
  			n, _, err := ep.Write(tcpip.SlicePayload(v), tcpip.WriteOptions{})
  			if err != nil {
  				fmt.Println("Write failed:", err)
  				return
  			}
  
  			v.TrimFront(int(n))
  		}
  	}
  }
docs: // writer reads from standard input and writes to the endpoint until standard
  // input is closed. It signals that it's done by closing the provided channel.