code: func (h *cryptoSetup) WriteRecord(p []byte) (int, error) {
  	defer func() {
  		select {
  		case h.writeRecord <- struct{}{}:
  		default:
  		}
  	}()
  
  	h.mutex.Lock()
  	defer h.mutex.Unlock()
  
  	switch h.writeEncLevel {
  	case protocol.EncryptionInitial:
  		// assume that the first WriteRecord call contains the ClientHello
  		n, err := h.initialStream.Write(p)
  		if !h.clientHelloWritten && h.perspective == protocol.PerspectiveClient {
  			h.clientHelloWritten = true
  			close(h.clientHelloWrittenChan)
  		}
  		return n, err
  	case protocol.EncryptionHandshake:
  		return h.handshakeStream.Write(p)
  	case protocol.Encryption1RTT:
  		return h.oneRTTStream.Write(p)
  	default:
  		panic(fmt.Sprintf("unexpected write encryption level: %s", h.writeEncLevel))
  	}
  }
docs: // WriteRecord is called when TLS writes data