code: func httpStreamReceived(ctx context.Context, streams chan httpstream.Stream) func(httpstream.Stream, <-chan struct{}) error {
  	return func(stream httpstream.Stream, replySent <-chan struct{}) error {
  		// make sure it has a valid port header
  		portString := stream.Headers().Get(PortHeader)
  		if len(portString) == 0 {
  			return trace.BadParameter("%q header is required", PortHeader)
  		}
  		port, err := strconv.ParseUint(portString, 10, 16)
  		if err != nil {
  			return trace.BadParameter("unable to parse %q as a port: %v", portString, err)
  		}
  		if port < 1 {
  			return trace.BadParameter("port %q must be > 0", portString)
  		}
  
  		// make sure it has a valid stream type header
  		streamType := stream.Headers().Get(StreamType)
  		if len(streamType) == 0 {
  			return trace.BadParameter("%q header is required", StreamType)
  		}
  		if streamType != StreamTypeError && streamType != StreamTypeData {
  			return trace.BadParameter("invalid stream type %q", streamType)
  		}
  
  		select {
  		case streams <- stream:
  			return nil
  		case <-ctx.Done():
  			return trace.BadParameter("request has been cancelled")
  		}
  	}
  }
docs: // httpStreamReceived is the httpstream.NewStreamHandler for port
  // forward streams. It checks each stream's port and stream type headers,
  // rejecting any streams that with missing or invalid values. Each valid
  // stream is sent to the streams channel.