code: func httpStreamReceived(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(api.PortHeader)
  		if len(portString) == 0 {
  			return fmt.Errorf("%q header is required", api.PortHeader)
  		}
  		port, err := strconv.ParseUint(portString, 10, 16)
  		if err != nil {
  			return fmt.Errorf("unable to parse %q as a port: %v", portString, err)
  		}
  		if port < 1 {
  			return fmt.Errorf("port %q must be > 0", portString)
  		}
  
  		// make sure it has a valid stream type header
  		streamType := stream.Headers().Get(api.StreamType)
  		if len(streamType) == 0 {
  			return fmt.Errorf("%q header is required", api.StreamType)
  		}
  		if streamType != api.StreamTypeError && streamType != api.StreamTypeData {
  			return fmt.Errorf("invalid stream type %q", streamType)
  		}
  
  		streams <- stream
  		return nil
  	}
  }
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.