text:
/**
 * Transcend Computing, Inc.
 * Confidential and Proprietary
 * Copyright (c) Transcend Computing, Inc. 2013
 * All Rights Reserved.
 */
package com.msi.tough.workflow.core;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.zeromq.ZMQ;

import com.google.common.base.Charsets;
import com.google.protobuf.Message;
import com.msi.tough.core.Appctx;
import com.msi.tough.query.AsyncServiceImpl;
import com.msi.tough.query.ErrorResponse;
import com.msi.tough.query.ProtobufUtil;
import com.msi.tough.query.ServiceRequestContext;
import com.msi.tough.query.ServiceResponse;

/**
 * Deposit a task in a remote workflow engine and listen for a response.
 *
 * This is likely to be used only for tests, where no persistent connection
 * is required.
 *
 * @author jgardner
 *
 */
public class RemoteWorkflow implements Workflow, Runnable {
    private final Logger logger = Appctx
            .getLogger(RemoteWorkflow.class.getName());

    @Resource
    /**
     * Should be ZMQ socket on which a remote workflow is listening.
     */
    private String remoteEndpoint = "tcp://localhost:5560";

    @Resource
    /**
     * Should be ZMQ socket on which to listen for a response.
     */
    private String recvEndpoint = "tcp://localhost:5561";

    @Resource
    /**
     * Should be ZMQ socket to which responses will be sent.
     */
    private String returnAddress = "tcp://localhost:5561";

    @Resource
    AsyncServiceImpl asyncService = null;

    private boolean expectStrings = false;

    private ZMQ.Context zmqContext = null;
    private ZMQ.Socket zmqRecvSocket = null;
    private ZMQ.Poller items = null;
    private Thread recvThread = null;
    private ServiceRequestContext context = null;
    private List<Class<? extends Message>> possibleTypes = null;

    /**
     * @param actionMap
     */
    public RemoteWorkflow() {
    }

    public static RemoteWorkflow getInstance() {
        // Not actually a singleton, since we submit to multiple workflows.
        return new RemoteWorkflow();
    }

    public void setPossibleTypes(List<Class<? extends Message>> possibleTypes) {
        this.possibleTypes = possibleTypes;
    }

    /* (non-Javadoc)
     * @see com.msi.tough.workflow.core.Workflow#doWork(com.google.protobuf.Message)
     */
    @Override
    public Message doWork(Message request, ServiceRequestContext context)
            throws ErrorResponse {
        try {
            // Supply action name, if needed by endpoint.
            String workEndpoint  = remoteEndpoint.replaceFirst("ACTION",
                    context.getAction() != null? context.getAction() : "");
            zmqContext = ZMQ.context(1);

            synchronized (this) {
                if (zmqRecvSocket == null) {
                    logger.debug("Binding to ZMQ socket for receive:" +
                            recvEndpoint);
                    zmqRecvSocket = zmqContext.socket(ZMQ.PULL);
                    zmqRecvSocket.bind(recvEndpoint);
                    items = new ZMQ.Poller(1);
                    items.register(zmqRecvSocket, ZMQ.Poller.POLLIN);
                    recvThread = new Thread(this);
                    recvThread.start();
                }
            }

            this.context = context;
            ZMQ.Socket zmqSocket = zmqContext.socket(ZMQ.PUSH);
            logger.info("Connecting to remote ZMQ socket:" +
                    workEndpoint);
            zmqSocket.connect(workEndpoint);
            boolean sent = zmqSocket.send(request.toByteArray(), ZMQ.SNDMORE);
            // Send my return address as a second part.
            logger.info("Sending as callback ZMQ socket:" +
                    returnAddress);
            sent = zmqSocket.send(returnAddress.getBytes(), 0);
            Object action = ProtobufUtil.getOptionalField(request, "action");
            logger.debug("Sent message: "+
                    (action != null? action.toString() : sent) + " "+ request);
            zmqSocket.close();

        } catch (Exception e) {
            logger.warn("Error submitting to workflow.", e);
            throw ErrorResponse.InternalFailure();
        }
        return null;
    }

    public synchronized void destroy() {
        logger.info("Shutting down remote workflow listener:" + recvEndpoint);
        if (zmqRecvSocket != null) {
            recvThread.interrupt();
        }
        if (zmqContext != null) {
            //zmqContext.term();
        }
    }

    private Object deserializeFromByteArray(byte[] bytes) {
        if (bytes.length == 0) {
            return null;
        }
        if (expectStrings) {
            return new String(bytes, Charsets.UTF_8);
        }
        for (Class<? extends Message> type : possibleTypes) {
            Method parseFromMethod;
            try {
                parseFromMethod = type.getDeclaredMethod("parseFrom",
                        byte[].class);
            } catch (SecurityException e) {
                throw new IllegalStateException("Failed to call parseFrom", e);
            } catch (NoSuchMethodException e) {
                throw new IllegalStateException("Missing parseFrom", e);
            }
            try {
                Object protobufResult = parseFromMethod.invoke(null,
                        bytes);
                return protobufResult;
            } catch (RuntimeException re) {
                // probably not correct type
                continue;
            } catch (IllegalAccessException e) {
                throw new IllegalStateException("Call to parseFrom failed", e);
            } catch (InvocationTargetException e) {
                continue;
            }
        }
        throw new UnexpectedTypeException();
    }

    /* (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    @Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            byte[] messageBytes;
            items.poll(500);
            if (items.pollin(0)) {
                messageBytes = zmqRecvSocket.recv(0);
                try {
                    Object message = deserializeFromByteArray(messageBytes);
                    if (message == null) {
                        logger.error("Unable to deserialize response",
                                new String(messageBytes, "utf-8"));
                    } else {
                        logger.debug("Received response to:"+context.getRequestId());
                        ServiceResponse response = new ServiceResponse(message,
                                context.getRequestId());
                        asyncService.handleResponse(response);
                    }
                } catch (UnexpectedTypeException ute) {
                    try {
                        asyncService.handleError(ute);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        logger.debug("RemoteWorkflow: Exiting receive thread.");
        zmqRecvSocket.close();
    }

    /* (non-Javadoc)
     * @see com.msi.tough.workflow.core.Workflow#doWorkRaw(java.lang.Object)
     */
    @Override
    public void doWorkRaw(Object payload) {
        throw new IllegalArgumentException("Raw not supported for remote.");
    }

    /* (non-Javadoc)
     * @see com.msi.tough.workflow.core.Workflow#forgetWork(com.google.protobuf.Message, com.msi.tough.query.ServiceRequestContext)
     */
    @Override
    public void forgetWork(Message request, ServiceRequestContext context) {
        logger.info("Forgetting about request:" + request);
    }

    public static class UnexpectedTypeException extends ErrorResponse {

        /**
         *
         */
        private static final long serialVersionUID = 1L;

        /**
         * @param type
         * @param message
         * @param code
         */
        public UnexpectedTypeException() {
            super(TYPE_SENDER,
                  "No matching type for wire message.",
                  CODE_INTERNAL_FAILURE);
        }

    }

    /**
     * @param remoteEndpoint the remoteEndpoint to set
     */
    public void setRemoteEndpoint(String remoteEndpoint) {
        this.remoteEndpoint = remoteEndpoint;
    }

    /**
     * @param recvEndpoint the recvEndpoint to set
     */
    public void setRecvEndpoint(String recvEndpoint) {
        this.recvEndpoint = recvEndpoint;
    }

    /**
     * @param returnAddress the returnAddress to set
     */
    public void setReturnAddress(String returnAddress) {
        this.returnAddress = returnAddress;
    }

}


text:
package com.github.rwitzel.streamflyer.regex.addons.tokens;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Test;

/**
 * Learning tests for group related methods in {@link java.util.regex.Matcher}.
 *
 * @author rwoo
 */
public class GroupLearningTest {

    @Test
    public void learningTest() throws Exception {

        Matcher matcher = Pattern.compile("((abc)|(def))").matcher("def");
        assertTrue(matcher.matches());
        assertEquals(3, matcher.groupCount());
        assertEquals("def", matcher.group()); // everything
        assertEquals("def", matcher.group(0)); // everything
        assertEquals("def", matcher.group(1)); // () that span the entire input
        assertEquals(null, matcher.group(2)); // () for "abc"
        assertEquals("def", matcher.group(3)); // () for "def"
        try {
            assertEquals(null, matcher.group(4));
            fail("IndexOutOfBoundsException expected");
        } catch (IndexOutOfBoundsException e) {
            // OK, expected exception
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
import owl_config
import smtplib
from email.mime.text import MIMEText

class Mailer:
  def __init__(self, options):
    self.options = options
    self.from_email = owl_config.ALERT_FROM_EMAIL
    self.smtp_host = owl_config.SMTPHOST
    self.password = owl_config.ROBOT_EMAIL_PASSWORD

  def send_email(self, content, subject, to_email, type='plain'):
    send_email(content = content,
               subject = subject,
               from_email = self.from_email,
               to_email = to_email,
               smtp_host = self.smtp_host,
               password = self.password,
               type = type,
              )

def send_email(subject, content, from_email, to_email, smtp_host, password, type):
  if not to_email:
    return

  msg = MIMEText(content, type)
  msg['Subject'] = subject
  msg['From'] = from_email
  to_emails = [addr.strip() for addr in to_email.split(',')]
  msg['To'] = ','.join(to_emails)

  connected = False
  try:
    smtp = smtplib.SMTP(smtp_host)
    if password:
      smtp.login(from_email.split('@')[0], password)
      connected = True

    smtp.sendmail(msg['From'], to_emails, msg.as_string())
  except Exception as e:
    print 'Send email failed: %r' % e
    if connected:
      smtp.quit()


text:
// Original file: deps/envoy-api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

import type { Rds as _envoy_extensions_filters_network_http_connection_manager_v3_Rds, Rds__Output as _envoy_extensions_filters_network_http_connection_manager_v3_Rds__Output } from '../../../../../../envoy/extensions/filters/network/http_connection_manager/v3/Rds';
import type { RouteConfiguration as _envoy_config_route_v3_RouteConfiguration, RouteConfiguration__Output as _envoy_config_route_v3_RouteConfiguration__Output } from '../../../../../../envoy/config/route/v3/RouteConfiguration';
import type { HttpFilter as _envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter, HttpFilter__Output as _envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter__Output } from '../../../../../../envoy/extensions/filters/network/http_connection_manager/v3/HttpFilter';
import type { BoolValue as _google_protobuf_BoolValue, BoolValue__Output as _google_protobuf_BoolValue__Output } from '../../../../../../google/protobuf/BoolValue';
import type { Http1ProtocolOptions as _envoy_config_core_v3_Http1ProtocolOptions, Http1ProtocolOptions__Output as _envoy_config_core_v3_Http1ProtocolOptions__Output } from '../../../../../../envoy/config/core/v3/Http1ProtocolOptions';
import type { Http2ProtocolOptions as _envoy_config_core_v3_Http2ProtocolOptions, Http2ProtocolOptions__Output as _envoy_config_core_v3_Http2ProtocolOptions__Output } from '../../../../../../envoy/config/core/v3/Http2ProtocolOptions';
import type { Duration as _google_protobuf_Duration, Duration__Output as _google_protobuf_Duration__Output } from '../../../../../../google/protobuf/Duration';
import type { AccessLog as _envoy_config_accesslog_v3_AccessLog, AccessLog__Output as _envoy_config_accesslog_v3_AccessLog__Output } from '../../../../../../envoy/config/accesslog/v3/AccessLog';
import type { UInt32Value as _google_protobuf_UInt32Value, UInt32Value__Output as _google_protobuf_UInt32Value__Output } from '../../../../../../google/protobuf/UInt32Value';
import type { ScopedRoutes as _envoy_extensions_filters_network_http_connection_manager_v3_ScopedRoutes, ScopedRoutes__Output as _envoy_extensions_filters_network_http_connection_manager_v3_ScopedRoutes__Output } from '../../../../../../envoy/extensions/filters/network/http_connection_manager/v3/ScopedRoutes';
import type { HttpProtocolOptions as _envoy_config_core_v3_HttpProtocolOptions, HttpProtocolOptions__Output as _envoy_config_core_v3_HttpProtocolOptions__Output } from '../../../../../../envoy/config/core/v3/HttpProtocolOptions';
import type { RequestIDExtension as _envoy_extensions_filters_network_http_connection_manager_v3_RequestIDExtension, RequestIDExtension__Output as _envoy_extensions_filters_network_http_connection_manager_v3_RequestIDExtension__Output } from '../../../../../../envoy/extensions/filters/network/http_connection_manager/v3/RequestIDExtension';
import type { LocalReplyConfig as _envoy_extensions_filters_network_http_connection_manager_v3_LocalReplyConfig, LocalReplyConfig__Output as _envoy_extensions_filters_network_http_connection_manager_v3_LocalReplyConfig__Output } from '../../../../../../envoy/extensions/filters/network/http_connection_manager/v3/LocalReplyConfig';
import type { Http3ProtocolOptions as _envoy_config_core_v3_Http3ProtocolOptions, Http3ProtocolOptions__Output as _envoy_config_core_v3_Http3ProtocolOptions__Output } from '../../../../../../envoy/config/core/v3/Http3ProtocolOptions';
import type { TypedExtensionConfig as _envoy_config_core_v3_TypedExtensionConfig, TypedExtensionConfig__Output as _envoy_config_core_v3_TypedExtensionConfig__Output } from '../../../../../../envoy/config/core/v3/TypedExtensionConfig';
import type { SchemeHeaderTransformation as _envoy_config_core_v3_SchemeHeaderTransformation, SchemeHeaderTransformation__Output as _envoy_config_core_v3_SchemeHeaderTransformation__Output } from '../../../../../../envoy/config/core/v3/SchemeHeaderTransformation';
import type { Percent as _envoy_type_v3_Percent, Percent__Output as _envoy_type_v3_Percent__Output } from '../../../../../../envoy/type/v3/Percent';
import type { CustomTag as _envoy_type_tracing_v3_CustomTag, CustomTag__Output as _envoy_type_tracing_v3_CustomTag__Output } from '../../../../../../envoy/type/tracing/v3/CustomTag';
import type { _envoy_config_trace_v3_Tracing_Http, _envoy_config_trace_v3_Tracing_Http__Output } from '../../../../../../envoy/config/trace/v3/Tracing';
import type { PathTransformation as _envoy_type_http_v3_PathTransformation, PathTransformation__Output as _envoy_type_http_v3_PathTransformation__Output } from '../../../../../../envoy/type/http/v3/PathTransformation';

// Original file: deps/envoy-api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

export enum _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_CodecType {
  /**
   * For every new connection, the connection manager will determine which
   * codec to use. This mode supports both ALPN for TLS listeners as well as
   * protocol inference for plaintext listeners. If ALPN data is available, it
   * is preferred, otherwise protocol inference is used. In almost all cases,
   * this is the right option to choose for this setting.
   */
  AUTO = 0,
  /**
   * The connection manager will assume that the client is speaking HTTP/1.1.
   */
  HTTP1 = 1,
  /**
   * The connection manager will assume that the client is speaking HTTP/2
   * (Envoy does not require HTTP/2 to take place over TLS or to use ALPN.
   * Prior knowledge is allowed).
   */
  HTTP2 = 2,
  /**
   * [#not-implemented-hide:] QUIC implementation is not production ready yet. Use this enum with
   * caution to prevent accidental execution of QUIC code. I.e. `!= HTTP2` is no longer sufficient
   * to distinguish HTTP1 and HTTP2 traffic.
   */
  HTTP3 = 3,
}

// Original file: deps/envoy-api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

/**
 * How to handle the :ref:`config_http_conn_man_headers_x-forwarded-client-cert` (XFCC) HTTP
 * header.
 */
export enum _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ForwardClientCertDetails {
  /**
   * Do not send the XFCC header to the next hop. This is the default value.
   */
  SANITIZE = 0,
  /**
   * When the client connection is mTLS (Mutual TLS), forward the XFCC header
   * in the request.
   */
  FORWARD_ONLY = 1,
  /**
   * When the client connection is mTLS, append the client certificate
   * information to the request's XFCC header and forward it.
   */
  APPEND_FORWARD = 2,
  /**
   * When the client connection is mTLS, reset the XFCC header with the client
   * certificate information and send it to the next hop.
   */
  SANITIZE_SET = 3,
  /**
   * Always forward the XFCC header in the request, regardless of whether the
   * client connection is mTLS.
   */
  ALWAYS_FORWARD_ONLY = 4,
}

export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_InternalAddressConfig {
  /**
   * Whether unix socket addresses should be considered internal.
   */
  'unix_sockets'?: (boolean);
}

export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_InternalAddressConfig__Output {
  /**
   * Whether unix socket addresses should be considered internal.
   */
  'unix_sockets': (boolean);
}

// Original file: deps/envoy-api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

export enum _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_Tracing_OperationName {
  /**
   * The HTTP listener is used for ingress/incoming requests.
   */
  INGRESS = 0,
  /**
   * The HTTP listener is used for egress/outgoing requests.
   */
  EGRESS = 1,
}

/**
 * [#not-implemented-hide:] Transformations that apply to path headers. Transformations are applied
 * before any processing of requests by HTTP filters, routing, and matching. Only the normalized
 * path will be visible internally if a transformation is enabled. Any path rewrites that the
 * router performs (e.g. :ref:`regex_rewrite
 * <envoy_v3_api_field_config.route.v3.RouteAction.regex_rewrite>` or :ref:`prefix_rewrite
 * <envoy_v3_api_field_config.route.v3.RouteAction.prefix_rewrite>`) will apply to the *:path* header
 * destined for the upstream.
 *
 * Note: access logging and tracing will show the original *:path* header.
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathNormalizationOptions {
  /**
   * [#not-implemented-hide:] Normalization applies internally before any processing of requests by
   * HTTP filters, routing, and matching *and* will affect the forwarded *:path* header. Defaults
   * to :ref:`NormalizePathRFC3986
   * <envoy_v3_api_msg_type.http.v3.PathTransformation.Operation.NormalizePathRFC3986>`. When not
   * specified, this value may be overridden by the runtime variable
   * :ref:`http_connection_manager.normalize_path<config_http_conn_man_runtime_normalize_path>`.
   * Envoy will respond with 400 to paths that are malformed (e.g. for paths that fail RFC 3986
   * normalization due to disallowed characters.)
   */
  'forwarding_transformation'?: (_envoy_type_http_v3_PathTransformation | null);
  /**
   * [#not-implemented-hide:] Normalization only applies internally before any processing of
   * requests by HTTP filters, routing, and matching. These will be applied after full
   * transformation is applied. The *:path* header before this transformation will be restored in
   * the router filter and sent upstream unless it was mutated by a filter. Defaults to no
   * transformations.
   * Multiple actions can be applied in the same Transformation, forming a sequential
   * pipeline. The transformations will be performed in the order that they appear. Envoy will
   * respond with 400 to paths that are malformed (e.g. for paths that fail RFC 3986
   * normalization due to disallowed characters.)
   */
  'http_filter_transformation'?: (_envoy_type_http_v3_PathTransformation | null);
}

/**
 * [#not-implemented-hide:] Transformations that apply to path headers. Transformations are applied
 * before any processing of requests by HTTP filters, routing, and matching. Only the normalized
 * path will be visible internally if a transformation is enabled. Any path rewrites that the
 * router performs (e.g. :ref:`regex_rewrite
 * <envoy_v3_api_field_config.route.v3.RouteAction.regex_rewrite>` or :ref:`prefix_rewrite
 * <envoy_v3_api_field_config.route.v3.RouteAction.prefix_rewrite>`) will apply to the *:path* header
 * destined for the upstream.
 *
 * Note: access logging and tracing will show the original *:path* header.
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathNormalizationOptions__Output {
  /**
   * [#not-implemented-hide:] Normalization applies internally before any processing of requests by
   * HTTP filters, routing, and matching *and* will affect the forwarded *:path* header. Defaults
   * to :ref:`NormalizePathRFC3986
   * <envoy_v3_api_msg_type.http.v3.PathTransformation.Operation.NormalizePathRFC3986>`. When not
   * specified, this value may be overridden by the runtime variable
   * :ref:`http_connection_manager.normalize_path<config_http_conn_man_runtime_normalize_path>`.
   * Envoy will respond with 400 to paths that are malformed (e.g. for paths that fail RFC 3986
   * normalization due to disallowed characters.)
   */
  'forwarding_transformation': (_envoy_type_http_v3_PathTransformation__Output | null);
  /**
   * [#not-implemented-hide:] Normalization only applies internally before any processing of
   * requests by HTTP filters, routing, and matching. These will be applied after full
   * transformation is applied. The *:path* header before this transformation will be restored in
   * the router filter and sent upstream unless it was mutated by a filter. Defaults to no
   * transformations.
   * Multiple actions can be applied in the same Transformation, forming a sequential
   * pipeline. The transformations will be performed in the order that they appear. Envoy will
   * respond with 400 to paths that are malformed (e.g. for paths that fail RFC 3986
   * normalization due to disallowed characters.)
   */
  'http_filter_transformation': (_envoy_type_http_v3_PathTransformation__Output | null);
}

// Original file: deps/envoy-api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

/**
 * Determines the action for request that contain %2F, %2f, %5C or %5c sequences in the URI path.
 * This operation occurs before URL normalization and the merge slashes transformations if they were enabled.
 */
export enum _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathWithEscapedSlashesAction {
  /**
   * Default behavior specific to implementation (i.e. Envoy) of this configuration option.
   * Envoy, by default, takes the KEEP_UNCHANGED action.
   * NOTE: the implementation may change the default behavior at-will.
   */
  IMPLEMENTATION_SPECIFIC_DEFAULT = 0,
  /**
   * Keep escaped slashes.
   */
  KEEP_UNCHANGED = 1,
  /**
   * Reject client request with the 400 status. gRPC requests will be rejected with the INTERNAL (13) error code.
   * The "httpN.downstream_rq_failed_path_normalization" counter is incremented for each rejected request.
   */
  REJECT_REQUEST = 2,
  /**
   * Unescape %2F and %5C sequences and redirect request to the new path if these sequences were present.
   * Redirect occurs after path normalization and merge slashes transformations if they were configured.
   * NOTE: gRPC requests will be rejected with the INTERNAL (13) error code.
   * This option minimizes possibility of path confusion exploits by forcing request with unescaped slashes to
   * traverse all parties: downstream client, intermediate proxies, Envoy and upstream server.
   * The "httpN.downstream_rq_redirected_with_normalized_path" counter is incremented for each
   * redirected request.
   */
  UNESCAPE_AND_REDIRECT = 3,
  /**
   * Unescape %2F and %5C sequences.
   * Note: this option should not be enabled if intermediaries perform path based access control as
   * it may lead to path confusion vulnerabilities.
   */
  UNESCAPE_AND_FORWARD = 4,
}

// Original file: deps/envoy-api/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto

export enum _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ServerHeaderTransformation {
  /**
   * Overwrite any Server header with the contents of server_name.
   */
  OVERWRITE = 0,
  /**
   * If no Server header is present, append Server server_name
   * If a Server header is present, pass it through.
   */
  APPEND_IF_ABSENT = 1,
  /**
   * Pass through the value of the server header, and do not append a header
   * if none is present.
   */
  PASS_THROUGH = 2,
}

/**
 * [#next-free-field: 7]
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_SetCurrentClientCertDetails {
  /**
   * Whether to forward the subject of the client cert. Defaults to false.
   */
  'subject'?: (_google_protobuf_BoolValue | null);
  /**
   * Whether to forward the entire client cert in URL encoded PEM format. This will appear in the
   * XFCC header comma separated from other values with the value Cert="PEM".
   * Defaults to false.
   */
  'cert'?: (boolean);
  /**
   * Whether to forward the entire client cert chain (including the leaf cert) in URL encoded PEM
   * format. This will appear in the XFCC header comma separated from other values with the value
   * Chain="PEM".
   * Defaults to false.
   */
  'chain'?: (boolean);
  /**
   * Whether to forward the DNS type Subject Alternative Names of the client cert.
   * Defaults to false.
   */
  'dns'?: (boolean);
  /**
   * Whether to forward the URI type Subject Alternative Name of the client cert. Defaults to
   * false.
   */
  'uri'?: (boolean);
}

/**
 * [#next-free-field: 7]
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_SetCurrentClientCertDetails__Output {
  /**
   * Whether to forward the subject of the client cert. Defaults to false.
   */
  'subject': (_google_protobuf_BoolValue__Output | null);
  /**
   * Whether to forward the entire client cert in URL encoded PEM format. This will appear in the
   * XFCC header comma separated from other values with the value Cert="PEM".
   * Defaults to false.
   */
  'cert': (boolean);
  /**
   * Whether to forward the entire client cert chain (including the leaf cert) in URL encoded PEM
   * format. This will appear in the XFCC header comma separated from other values with the value
   * Chain="PEM".
   * Defaults to false.
   */
  'chain': (boolean);
  /**
   * Whether to forward the DNS type Subject Alternative Names of the client cert.
   * Defaults to false.
   */
  'dns': (boolean);
  /**
   * Whether to forward the URI type Subject Alternative Name of the client cert. Defaults to
   * false.
   */
  'uri': (boolean);
}

/**
 * [#next-free-field: 10]
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_Tracing {
  /**
   * Target percentage of requests managed by this HTTP connection manager that will be force
   * traced if the :ref:`x-client-trace-id <config_http_conn_man_headers_x-client-trace-id>`
   * header is set. This field is a direct analog for the runtime variable
   * 'tracing.client_sampling' in the :ref:`HTTP Connection Manager
   * <config_http_conn_man_runtime>`.
   * Default: 100%
   */
  'client_sampling'?: (_envoy_type_v3_Percent | null);
  /**
   * Target percentage of requests managed by this HTTP connection manager that will be randomly
   * selected for trace generation, if not requested by the client or not forced. This field is
   * a direct analog for the runtime variable 'tracing.random_sampling' in the
   * :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
   * Default: 100%
   */
  'random_sampling'?: (_envoy_type_v3_Percent | null);
  /**
   * Target percentage of requests managed by this HTTP connection manager that will be traced
   * after all other sampling checks have been applied (client-directed, force tracing, random
   * sampling). This field functions as an upper limit on the total configured sampling rate. For
   * instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1%
   * of client requests with the appropriate headers to be force traced. This field is a direct
   * analog for the runtime variable 'tracing.global_enabled' in the
   * :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
   * Default: 100%
   */
  'overall_sampling'?: (_envoy_type_v3_Percent | null);
  /**
   * Whether to annotate spans with additional data. If true, spans will include logs for stream
   * events.
   */
  'verbose'?: (boolean);
  /**
   * Maximum length of the request path to extract and include in the HttpUrl tag. Used to
   * truncate lengthy request paths to meet the needs of a tracing backend.
   * Default: 256
   */
  'max_path_tag_length'?: (_google_protobuf_UInt32Value | null);
  /**
   * A list of custom tags with unique tag name to create tags for the active span.
   */
  'custom_tags'?: (_envoy_type_tracing_v3_CustomTag)[];
  /**
   * Configuration for an external tracing provider.
   * If not specified, no tracing will be performed.
   *
   * .. attention::
   * Please be aware that *envoy.tracers.opencensus* provider can only be configured once
   * in Envoy lifetime.
   * Any attempts to reconfigure it or to use different configurations for different HCM filters
   * will be rejected.
   * Such a constraint is inherent to OpenCensus itself. It cannot be overcome without changes
   * on OpenCensus side.
   */
  'provider'?: (_envoy_config_trace_v3_Tracing_Http | null);
}

/**
 * [#next-free-field: 10]
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_Tracing__Output {
  /**
   * Target percentage of requests managed by this HTTP connection manager that will be force
   * traced if the :ref:`x-client-trace-id <config_http_conn_man_headers_x-client-trace-id>`
   * header is set. This field is a direct analog for the runtime variable
   * 'tracing.client_sampling' in the :ref:`HTTP Connection Manager
   * <config_http_conn_man_runtime>`.
   * Default: 100%
   */
  'client_sampling': (_envoy_type_v3_Percent__Output | null);
  /**
   * Target percentage of requests managed by this HTTP connection manager that will be randomly
   * selected for trace generation, if not requested by the client or not forced. This field is
   * a direct analog for the runtime variable 'tracing.random_sampling' in the
   * :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
   * Default: 100%
   */
  'random_sampling': (_envoy_type_v3_Percent__Output | null);
  /**
   * Target percentage of requests managed by this HTTP connection manager that will be traced
   * after all other sampling checks have been applied (client-directed, force tracing, random
   * sampling). This field functions as an upper limit on the total configured sampling rate. For
   * instance, setting client_sampling to 100% but overall_sampling to 1% will result in only 1%
   * of client requests with the appropriate headers to be force traced. This field is a direct
   * analog for the runtime variable 'tracing.global_enabled' in the
   * :ref:`HTTP Connection Manager <config_http_conn_man_runtime>`.
   * Default: 100%
   */
  'overall_sampling': (_envoy_type_v3_Percent__Output | null);
  /**
   * Whether to annotate spans with additional data. If true, spans will include logs for stream
   * events.
   */
  'verbose': (boolean);
  /**
   * Maximum length of the request path to extract and include in the HttpUrl tag. Used to
   * truncate lengthy request paths to meet the needs of a tracing backend.
   * Default: 256
   */
  'max_path_tag_length': (_google_protobuf_UInt32Value__Output | null);
  /**
   * A list of custom tags with unique tag name to create tags for the active span.
   */
  'custom_tags': (_envoy_type_tracing_v3_CustomTag__Output)[];
  /**
   * Configuration for an external tracing provider.
   * If not specified, no tracing will be performed.
   *
   * .. attention::
   * Please be aware that *envoy.tracers.opencensus* provider can only be configured once
   * in Envoy lifetime.
   * Any attempts to reconfigure it or to use different configurations for different HCM filters
   * will be rejected.
   * Such a constraint is inherent to OpenCensus itself. It cannot be overcome without changes
   * on OpenCensus side.
   */
  'provider': (_envoy_config_trace_v3_Tracing_Http__Output | null);
}

/**
 * The configuration for HTTP upgrades.
 * For each upgrade type desired, an UpgradeConfig must be added.
 *
 * .. warning::
 *
 * The current implementation of upgrade headers does not handle
 * multi-valued upgrade headers. Support for multi-valued headers may be
 * added in the future if needed.
 *
 * .. warning::
 * The current implementation of upgrade headers does not work with HTTP/2
 * upstreams.
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_UpgradeConfig {
  /**
   * The case-insensitive name of this upgrade, e.g. "websocket".
   * For each upgrade type present in upgrade_configs, requests with
   * Upgrade: [upgrade_type]
   * will be proxied upstream.
   */
  'upgrade_type'?: (string);
  /**
   * If present, this represents the filter chain which will be created for
   * this type of upgrade. If no filters are present, the filter chain for
   * HTTP connections will be used for this upgrade type.
   */
  'filters'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter)[];
  /**
   * Determines if upgrades are enabled or disabled by default. Defaults to true.
   * This can be overridden on a per-route basis with :ref:`cluster
   * <envoy_v3_api_field_config.route.v3.RouteAction.upgrade_configs>` as documented in the
   * :ref:`upgrade documentation <arch_overview_upgrades>`.
   */
  'enabled'?: (_google_protobuf_BoolValue | null);
}

/**
 * The configuration for HTTP upgrades.
 * For each upgrade type desired, an UpgradeConfig must be added.
 *
 * .. warning::
 *
 * The current implementation of upgrade headers does not handle
 * multi-valued upgrade headers. Support for multi-valued headers may be
 * added in the future if needed.
 *
 * .. warning::
 * The current implementation of upgrade headers does not work with HTTP/2
 * upstreams.
 */
export interface _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_UpgradeConfig__Output {
  /**
   * The case-insensitive name of this upgrade, e.g. "websocket".
   * For each upgrade type present in upgrade_configs, requests with
   * Upgrade: [upgrade_type]
   * will be proxied upstream.
   */
  'upgrade_type': (string);
  /**
   * If present, this represents the filter chain which will be created for
   * this type of upgrade. If no filters are present, the filter chain for
   * HTTP connections will be used for this upgrade type.
   */
  'filters': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter__Output)[];
  /**
   * Determines if upgrades are enabled or disabled by default. Defaults to true.
   * This can be overridden on a per-route basis with :ref:`cluster
   * <envoy_v3_api_field_config.route.v3.RouteAction.upgrade_configs>` as documented in the
   * :ref:`upgrade documentation <arch_overview_upgrades>`.
   */
  'enabled': (_google_protobuf_BoolValue__Output | null);
}

/**
 * [#next-free-field: 49]
 */
export interface HttpConnectionManager {
  /**
   * Supplies the type of codec that the connection manager should use.
   */
  'codec_type'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_CodecType | keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_CodecType);
  /**
   * The human readable prefix to use when emitting statistics for the
   * connection manager. See the :ref:`statistics documentation <config_http_conn_man_stats>` for
   * more information.
   */
  'stat_prefix'?: (string);
  /**
   * The connection manager's route table will be dynamically loaded via the RDS API.
   */
  'rds'?: (_envoy_extensions_filters_network_http_connection_manager_v3_Rds | null);
  /**
   * The route table for the connection manager is static and is specified in this property.
   */
  'route_config'?: (_envoy_config_route_v3_RouteConfiguration | null);
  /**
   * A list of individual HTTP filters that make up the filter chain for
   * requests made to the connection manager. :ref:`Order matters <arch_overview_http_filters_ordering>`
   * as the filters are processed sequentially as request events happen.
   */
  'http_filters'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter)[];
  /**
   * Whether the connection manager manipulates the :ref:`config_http_conn_man_headers_user-agent`
   * and :ref:`config_http_conn_man_headers_downstream-service-cluster` headers. See the linked
   * documentation for more information. Defaults to false.
   */
  'add_user_agent'?: (_google_protobuf_BoolValue | null);
  /**
   * Presence of the object defines whether the connection manager
   * emits :ref:`tracing <arch_overview_tracing>` data to the :ref:`configured tracing provider
   * <envoy_v3_api_msg_config.trace.v3.Tracing>`.
   */
  'tracing'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_Tracing | null);
  /**
   * Additional HTTP/1 settings that are passed to the HTTP/1 codec.
   */
  'http_protocol_options'?: (_envoy_config_core_v3_Http1ProtocolOptions | null);
  /**
   * Additional HTTP/2 settings that are passed directly to the HTTP/2 codec.
   */
  'http2_protocol_options'?: (_envoy_config_core_v3_Http2ProtocolOptions | null);
  /**
   * An optional override that the connection manager will write to the server
   * header in responses. If not set, the default is *envoy*.
   */
  'server_name'?: (string);
  /**
   * The time that Envoy will wait between sending an HTTP/2 "shutdown
   * notification" (GOAWAY frame with max stream ID) and a final GOAWAY frame.
   * This is used so that Envoy provides a grace period for new streams that
   * race with the final GOAWAY frame. During this grace period, Envoy will
   * continue to accept new streams. After the grace period, a final GOAWAY
   * frame is sent and Envoy will start refusing new streams. Draining occurs
   * both when a connection hits the idle timeout or during general server
   * draining. The default grace period is 5000 milliseconds (5 seconds) if this
   * option is not specified.
   */
  'drain_timeout'?: (_google_protobuf_Duration | null);
  /**
   * Configuration for :ref:`HTTP access logs <arch_overview_access_logs>`
   * emitted by the connection manager.
   */
  'access_log'?: (_envoy_config_accesslog_v3_AccessLog)[];
  /**
   * If set to true, the connection manager will use the real remote address
   * of the client connection when determining internal versus external origin and manipulating
   * various headers. If set to false or absent, the connection manager will use the
   * :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header. See the documentation for
   * :ref:`config_http_conn_man_headers_x-forwarded-for`,
   * :ref:`config_http_conn_man_headers_x-envoy-internal`, and
   * :ref:`config_http_conn_man_headers_x-envoy-external-address` for more information.
   */
  'use_remote_address'?: (_google_protobuf_BoolValue | null);
  /**
   * Whether the connection manager will generate the :ref:`x-request-id
   * <config_http_conn_man_headers_x-request-id>` header if it does not exist. This defaults to
   * true. Generating a random UUID4 is expensive so in high throughput scenarios where this feature
   * is not desired it can be disabled.
   */
  'generate_request_id'?: (_google_protobuf_BoolValue | null);
  /**
   * How to handle the :ref:`config_http_conn_man_headers_x-forwarded-client-cert` (XFCC) HTTP
   * header.
   */
  'forward_client_cert_details'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ForwardClientCertDetails | keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ForwardClientCertDetails);
  /**
   * This field is valid only when :ref:`forward_client_cert_details
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.forward_client_cert_details>`
   * is APPEND_FORWARD or SANITIZE_SET and the client connection is mTLS. It specifies the fields in
   * the client certificate to be forwarded. Note that in the
   * :ref:`config_http_conn_man_headers_x-forwarded-client-cert` header, *Hash* is always set, and
   * *By* is always set when the client certificate presents the URI type Subject Alternative Name
   * value.
   */
  'set_current_client_cert_details'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_SetCurrentClientCertDetails | null);
  /**
   * If proxy_100_continue is true, Envoy will proxy incoming "Expect:
   * 100-continue" headers upstream, and forward "100 Continue" responses
   * downstream. If this is false or not set, Envoy will instead strip the
   * "Expect: 100-continue" header, and send a "100 Continue" response itself.
   */
  'proxy_100_continue'?: (boolean);
  /**
   * The number of additional ingress proxy hops from the right side of the
   * :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header to trust when
   * determining the origin client's IP address. The default is zero if this option
   * is not specified. See the documentation for
   * :ref:`config_http_conn_man_headers_x-forwarded-for` for more information.
   */
  'xff_num_trusted_hops'?: (number);
  /**
   * If
   * :ref:`use_remote_address
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.use_remote_address>`
   * is true and represent_ipv4_remote_address_as_ipv4_mapped_ipv6 is true and the remote address is
   * an IPv4 address, the address will be mapped to IPv6 before it is appended to *x-forwarded-for*.
   * This is useful for testing compatibility of upstream services that parse the header value. For
   * example, 50.0.0.1 is represented as ::FFFF:50.0.0.1. See `IPv4-Mapped IPv6 Addresses
   * <https://tools.ietf.org/html/rfc4291#section-2.5.5.2>`_ for details. This will also affect the
   * :ref:`config_http_conn_man_headers_x-envoy-external-address` header. See
   * :ref:`http_connection_manager.represent_ipv4_remote_address_as_ipv4_mapped_ipv6
   * <config_http_conn_man_runtime_represent_ipv4_remote_address_as_ipv4_mapped_ipv6>` for runtime
   * control.
   * [#not-implemented-hide:]
   */
  'represent_ipv4_remote_address_as_ipv4_mapped_ipv6'?: (boolean);
  /**
   * If set, Envoy will not append the remote address to the
   * :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header. This may be used in
   * conjunction with HTTP filters that explicitly manipulate XFF after the HTTP connection manager
   * has mutated the request headers. While :ref:`use_remote_address
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.use_remote_address>`
   * will also suppress XFF addition, it has consequences for logging and other
   * Envoy uses of the remote address, so *skip_xff_append* should be used
   * when only an elision of XFF addition is intended.
   */
  'skip_xff_append'?: (boolean);
  /**
   * Via header value to append to request and response headers. If this is
   * empty, no via header will be appended.
   */
  'via'?: (string);
  'upgrade_configs'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_UpgradeConfig)[];
  /**
   * The stream idle timeout for connections managed by the connection manager.
   * If not specified, this defaults to 5 minutes. The default value was selected
   * so as not to interfere with any smaller configured timeouts that may have
   * existed in configurations prior to the introduction of this feature, while
   * introducing robustness to TCP connections that terminate without a FIN.
   *
   * This idle timeout applies to new streams and is overridable by the
   * :ref:`route-level idle_timeout
   * <envoy_v3_api_field_config.route.v3.RouteAction.idle_timeout>`. Even on a stream in
   * which the override applies, prior to receipt of the initial request
   * headers, the :ref:`stream_idle_timeout
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.stream_idle_timeout>`
   * applies. Each time an encode/decode event for headers or data is processed
   * for the stream, the timer will be reset. If the timeout fires, the stream
   * is terminated with a 408 Request Timeout error code if no upstream response
   * header has been received, otherwise a stream reset occurs.
   *
   * This timeout also specifies the amount of time that Envoy will wait for the peer to open enough
   * window to write any remaining stream data once the entirety of stream data (local end stream is
   * true) has been buffered pending available window. In other words, this timeout defends against
   * a peer that does not release enough window to completely write the stream, even though all
   * data has been proxied within available flow control windows. If the timeout is hit in this
   * case, the :ref:`tx_flush_timeout <config_http_conn_man_stats_per_codec>` counter will be
   * incremented. Note that :ref:`max_stream_duration
   * <envoy_v3_api_field_config.core.v3.HttpProtocolOptions.max_stream_duration>` does not apply to
   * this corner case.
   *
   * If the :ref:`overload action <config_overload_manager_overload_actions>` "envoy.overload_actions.reduce_timeouts"
   * is configured, this timeout is scaled according to the value for
   * :ref:`HTTP_DOWNSTREAM_STREAM_IDLE <envoy_v3_api_enum_value_config.overload.v3.ScaleTimersOverloadActionConfig.TimerType.HTTP_DOWNSTREAM_STREAM_IDLE>`.
   *
   * Note that it is possible to idle timeout even if the wire traffic for a stream is non-idle, due
   * to the granularity of events presented to the connection manager. For example, while receiving
   * very large request headers, it may be the case that there is traffic regularly arriving on the
   * wire while the connection manage is only able to observe the end-of-headers event, hence the
   * stream may still idle timeout.
   *
   * A value of 0 will completely disable the connection manager stream idle
   * timeout, although per-route idle timeout overrides will continue to apply.
   */
  'stream_idle_timeout'?: (_google_protobuf_Duration | null);
  /**
   * Configures what network addresses are considered internal for stats and header sanitation
   * purposes. If unspecified, only RFC1918 IP addresses will be considered internal.
   * See the documentation for :ref:`config_http_conn_man_headers_x-envoy-internal` for more
   * information about internal/external addresses.
   */
  'internal_address_config'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_InternalAddressConfig | null);
  /**
   * The delayed close timeout is for downstream connections managed by the HTTP connection manager.
   * It is defined as a grace period after connection close processing has been locally initiated
   * during which Envoy will wait for the peer to close (i.e., a TCP FIN/RST is received by Envoy
   * from the downstream connection) prior to Envoy closing the socket associated with that
   * connection.
   * NOTE: This timeout is enforced even when the socket associated with the downstream connection
   * is pending a flush of the write buffer. However, any progress made writing data to the socket
   * will restart the timer associated with this timeout. This means that the total grace period for
   * a socket in this state will be
   * <total_time_waiting_for_write_buffer_flushes>+<delayed_close_timeout>.
   *
   * Delaying Envoy's connection close and giving the peer the opportunity to initiate the close
   * sequence mitigates a race condition that exists when downstream clients do not drain/process
   * data in a connection's receive buffer after a remote close has been detected via a socket
   * write(). This race leads to such clients failing to process the response code sent by Envoy,
   * which could result in erroneous downstream processing.
   *
   * If the timeout triggers, Envoy will close the connection's socket.
   *
   * The default timeout is 1000 ms if this option is not specified.
   *
   * .. NOTE::
   * To be useful in avoiding the race condition described above, this timeout must be set
   * to *at least* <max round trip time expected between clients and Envoy>+<100ms to account for
   * a reasonable "worst" case processing time for a full iteration of Envoy's event loop>.
   *
   * .. WARNING::
   * A value of 0 will completely disable delayed close processing. When disabled, the downstream
   * connection's socket will be closed immediately after the write flush is completed or will
   * never close if the write flush does not complete.
   */
  'delayed_close_timeout'?: (_google_protobuf_Duration | null);
  /**
   * The amount of time that Envoy will wait for the entire request to be received.
   * The timer is activated when the request is initiated, and is disarmed when the last byte of the
   * request is sent upstream (i.e. all decoding filters have processed the request), OR when the
   * response is initiated. If not specified or set to 0, this timeout is disabled.
   */
  'request_timeout'?: (_google_protobuf_Duration | null);
  /**
   * The maximum request headers size for incoming connections.
   * If unconfigured, the default max request headers allowed is 60 KiB.
   * Requests that exceed this limit will receive a 431 response.
   */
  'max_request_headers_kb'?: (_google_protobuf_UInt32Value | null);
  /**
   * Should paths be normalized according to RFC 3986 before any processing of
   * requests by HTTP filters or routing? This affects the upstream *:path* header
   * as well. For paths that fail this check, Envoy will respond with 400 to
   * paths that are malformed. This defaults to false currently but will default
   * true in the future. When not specified, this value may be overridden by the
   * runtime variable
   * :ref:`http_connection_manager.normalize_path<config_http_conn_man_runtime_normalize_path>`.
   * See `Normalization and Comparison <https://tools.ietf.org/html/rfc3986#section-6>`_
   * for details of normalization.
   * Note that Envoy does not perform
   * `case normalization <https://tools.ietf.org/html/rfc3986#section-6.2.2.1>`_
   */
  'normalize_path'?: (_google_protobuf_BoolValue | null);
  /**
   * A route table will be dynamically assigned to each request based on request attributes
   * (e.g., the value of a header). The "routing scopes" (i.e., route tables) and "scope keys" are
   * specified in this message.
   */
  'scoped_routes'?: (_envoy_extensions_filters_network_http_connection_manager_v3_ScopedRoutes | null);
  /**
   * Whether the connection manager will keep the :ref:`x-request-id
   * <config_http_conn_man_headers_x-request-id>` header if passed for a request that is edge
   * (Edge request is the request from external clients to front Envoy) and not reset it, which
   * is the current Envoy behaviour. This defaults to false.
   */
  'preserve_external_request_id'?: (boolean);
  /**
   * Determines if adjacent slashes in the path are merged into one before any processing of
   * requests by HTTP filters or routing. This affects the upstream *:path* header as well. Without
   * setting this option, incoming requests with path `//dir///file` will not match against route
   * with `prefix` match set to `/dir`. Defaults to `false`. Note that slash merging is not part of
   * `HTTP spec <https://tools.ietf.org/html/rfc3986>`_ and is provided for convenience.
   */
  'merge_slashes'?: (boolean);
  /**
   * Defines the action to be applied to the Server header on the response path.
   * By default, Envoy will overwrite the header with the value specified in
   * server_name.
   */
  'server_header_transformation'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ServerHeaderTransformation | keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ServerHeaderTransformation);
  /**
   * Additional settings for HTTP requests handled by the connection manager. These will be
   * applicable to both HTTP1 and HTTP2 requests.
   */
  'common_http_protocol_options'?: (_envoy_config_core_v3_HttpProtocolOptions | null);
  /**
   * The configuration of the request ID extension. This includes operations such as
   * generation, validation, and associated tracing operations. If empty, the
   * :ref:`UuidRequestIdConfig <envoy_v3_api_msg_extensions.request_id.uuid.v3.UuidRequestIdConfig>`
   * default extension is used with default parameters. See the documentation for that extension
   * for details on what it does. Customizing the configuration for the default extension can be
   * achieved by configuring it explicitly here. For example, to disable trace reason packing,
   * the following configuration can be used:
   *
   * .. validated-code-block:: yaml
   * :type-name: envoy.extensions.filters.network.http_connection_manager.v3.RequestIDExtension
   *
   * typed_config:
   * "@type": type.googleapis.com/envoy.extensions.request_id.uuid.v3.UuidRequestIdConfig
   * pack_trace_reason: false
   *
   * [#extension-category: envoy.request_id]
   */
  'request_id_extension'?: (_envoy_extensions_filters_network_http_connection_manager_v3_RequestIDExtension | null);
  /**
   * If set, Envoy will always set :ref:`x-request-id <config_http_conn_man_headers_x-request-id>` header in response.
   * If this is false or not set, the request ID is returned in responses only if tracing is forced using
   * :ref:`x-envoy-force-trace <config_http_conn_man_headers_x-envoy-force-trace>` header.
   */
  'always_set_request_id_in_response'?: (boolean);
  /**
   * The configuration to customize local reply returned by Envoy. It can customize status code,
   * body text and response content type. If not specified, status code and text body are hard
   * coded in Envoy, the response content type is plain text.
   */
  'local_reply_config'?: (_envoy_extensions_filters_network_http_connection_manager_v3_LocalReplyConfig | null);
  /**
   * Determines if the port part should be removed from host/authority header before any processing
   * of request by HTTP filters or routing. The port would be removed only if it is equal to the :ref:`listener's<envoy_v3_api_field_config.listener.v3.Listener.address>`
   * local port. This affects the upstream host header unless the method is
   * CONNECT in which case if no filter adds a port the original port will be restored before headers are
   * sent upstream.
   * Without setting this option, incoming requests with host `example:443` will not match against
   * route with :ref:`domains<envoy_v3_api_field_config.route.v3.VirtualHost.domains>` match set to `example`. Defaults to `false`. Note that port removal is not part
   * of `HTTP spec <https://tools.ietf.org/html/rfc3986>`_ and is provided for convenience.
   * Only one of `strip_matching_host_port` or `strip_any_host_port` can be set.
   */
  'strip_matching_host_port'?: (boolean);
  /**
   * Governs Envoy's behavior when receiving invalid HTTP from downstream.
   * If this option is false (default), Envoy will err on the conservative side handling HTTP
   * errors, terminating both HTTP/1.1 and HTTP/2 connections when receiving an invalid request.
   * If this option is set to true, Envoy will be more permissive, only resetting the invalid
   * stream in the case of HTTP/2 and leaving the connection open where possible (if the entire
   * request is read for HTTP/1.1)
   * In general this should be true for deployments receiving trusted traffic (L2 Envoys,
   * company-internal mesh) and false when receiving untrusted traffic (edge deployments).
   *
   * If different behaviors for invalid_http_message for HTTP/1 and HTTP/2 are
   * desired, one should use the new HTTP/1 option :ref:`override_stream_error_on_invalid_http_message
   * <envoy_v3_api_field_config.core.v3.Http1ProtocolOptions.override_stream_error_on_invalid_http_message>` or the new HTTP/2 option
   * :ref:`override_stream_error_on_invalid_http_message
   * <envoy_v3_api_field_config.core.v3.Http2ProtocolOptions.override_stream_error_on_invalid_http_message>`
   * *not* the deprecated but similarly named :ref:`stream_error_on_invalid_http_messaging
   * <envoy_v3_api_field_config.core.v3.Http2ProtocolOptions.stream_error_on_invalid_http_messaging>`
   */
  'stream_error_on_invalid_http_message'?: (_google_protobuf_BoolValue | null);
  /**
   * The amount of time that Envoy will wait for the request headers to be received. The timer is
   * activated when the first byte of the headers is received, and is disarmed when the last byte of
   * the headers has been received. If not specified or set to 0, this timeout is disabled.
   */
  'request_headers_timeout'?: (_google_protobuf_Duration | null);
  /**
   * Determines if the port part should be removed from host/authority header before any processing
   * of request by HTTP filters or routing.
   * This affects the upstream host header unless the method is CONNECT in
   * which case if no filter adds a port the original port will be restored before headers are sent upstream.
   * Without setting this option, incoming requests with host `example:443` will not match against
   * route with :ref:`domains<envoy_v3_api_field_config.route.v3.VirtualHost.domains>` match set to `example`. Defaults to `false`. Note that port removal is not part
   * of `HTTP spec <https://tools.ietf.org/html/rfc3986>`_ and is provided for convenience.
   * Only one of `strip_matching_host_port` or `strip_any_host_port` can be set.
   */
  'strip_any_host_port'?: (boolean);
  /**
   * [#not-implemented-hide:] Path normalization configuration. This includes
   * configurations for transformations (e.g. RFC 3986 normalization or merge
   * adjacent slashes) and the policy to apply them. The policy determines
   * whether transformations affect the forwarded *:path* header. RFC 3986 path
   * normalization is enabled by default and the default policy is that the
   * normalized header will be forwarded. See :ref:`PathNormalizationOptions
   * <envoy_v3_api_msg_extensions.filters.network.http_connection_manager.v3.PathNormalizationOptions>`
   * for details.
   */
  'path_normalization_options'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathNormalizationOptions | null);
  /**
   * Additional HTTP/3 settings that are passed directly to the HTTP/3 codec.
   * [#not-implemented-hide:]
   */
  'http3_protocol_options'?: (_envoy_config_core_v3_Http3ProtocolOptions | null);
  /**
   * Action to take when request URL path contains escaped slash sequences (%2F, %2f, %5C and %5c).
   * The default value can be overridden by the :ref:`http_connection_manager.path_with_escaped_slashes_action<config_http_conn_man_runtime_path_with_escaped_slashes_action>`
   * runtime variable.
   * The :ref:`http_connection_manager.path_with_escaped_slashes_action_sampling<config_http_conn_man_runtime_path_with_escaped_slashes_action_enabled>` runtime
   * variable can be used to apply the action to a portion of all requests.
   */
  'path_with_escaped_slashes_action'?: (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathWithEscapedSlashesAction | keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathWithEscapedSlashesAction);
  /**
   * The configuration for the original IP detection extensions.
   *
   * When configured the extensions will be called along with the request headers
   * and information about the downstream connection, such as the directly connected address.
   * Each extension will then use these parameters to decide the request's effective remote address.
   * If an extension fails to detect the original IP address and isn't configured to reject
   * the request, the HCM will try the remaining extensions until one succeeds or rejects
   * the request. If the request isn't rejected nor any extension succeeds, the HCM will
   * fallback to using the remote address.
   *
   * .. WARNING::
   * Extensions cannot be used in conjunction with :ref:`use_remote_address
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.use_remote_address>`
   * nor :ref:`xff_num_trusted_hops
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.xff_num_trusted_hops>`.
   *
   * [#extension-category: envoy.http.original_ip_detection]
   */
  'original_ip_detection_extensions'?: (_envoy_config_core_v3_TypedExtensionConfig)[];
  /**
   * Determines if trailing dot of the host should be removed from host/authority header before any
   * processing of request by HTTP filters or routing.
   * This affects the upstream host header.
   * Without setting this option, incoming requests with host `example.com.` will not match against
   * route with :ref:`domains<envoy_v3_api_field_config.route.v3.VirtualHost.domains>` match set to `example.com`. Defaults to `false`.
   * When the incoming request contains a host/authority header that includes a port number,
   * setting this option will strip a trailing dot, if present, from the host section,
   * leaving the port as is (e.g. host value `example.com.:443` will be updated to `example.com:443`).
   */
  'strip_trailing_host_dot'?: (boolean);
  /**
   * Allows for explicit transformation of the :scheme header on the request path.
   * If not set, Envoy's default :ref:`scheme  <config_http_conn_man_headers_scheme>`
   * handling applies.
   */
  'scheme_header_transformation'?: (_envoy_config_core_v3_SchemeHeaderTransformation | null);
  'route_specifier'?: "rds"|"route_config"|"scoped_routes";
  'strip_port_mode'?: "strip_any_host_port";
}

/**
 * [#next-free-field: 49]
 */
export interface HttpConnectionManager__Output {
  /**
   * Supplies the type of codec that the connection manager should use.
   */
  'codec_type': (keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_CodecType);
  /**
   * The human readable prefix to use when emitting statistics for the
   * connection manager. See the :ref:`statistics documentation <config_http_conn_man_stats>` for
   * more information.
   */
  'stat_prefix': (string);
  /**
   * The connection manager's route table will be dynamically loaded via the RDS API.
   */
  'rds'?: (_envoy_extensions_filters_network_http_connection_manager_v3_Rds__Output | null);
  /**
   * The route table for the connection manager is static and is specified in this property.
   */
  'route_config'?: (_envoy_config_route_v3_RouteConfiguration__Output | null);
  /**
   * A list of individual HTTP filters that make up the filter chain for
   * requests made to the connection manager. :ref:`Order matters <arch_overview_http_filters_ordering>`
   * as the filters are processed sequentially as request events happen.
   */
  'http_filters': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter__Output)[];
  /**
   * Whether the connection manager manipulates the :ref:`config_http_conn_man_headers_user-agent`
   * and :ref:`config_http_conn_man_headers_downstream-service-cluster` headers. See the linked
   * documentation for more information. Defaults to false.
   */
  'add_user_agent': (_google_protobuf_BoolValue__Output | null);
  /**
   * Presence of the object defines whether the connection manager
   * emits :ref:`tracing <arch_overview_tracing>` data to the :ref:`configured tracing provider
   * <envoy_v3_api_msg_config.trace.v3.Tracing>`.
   */
  'tracing': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_Tracing__Output | null);
  /**
   * Additional HTTP/1 settings that are passed to the HTTP/1 codec.
   */
  'http_protocol_options': (_envoy_config_core_v3_Http1ProtocolOptions__Output | null);
  /**
   * Additional HTTP/2 settings that are passed directly to the HTTP/2 codec.
   */
  'http2_protocol_options': (_envoy_config_core_v3_Http2ProtocolOptions__Output | null);
  /**
   * An optional override that the connection manager will write to the server
   * header in responses. If not set, the default is *envoy*.
   */
  'server_name': (string);
  /**
   * The time that Envoy will wait between sending an HTTP/2 "shutdown
   * notification" (GOAWAY frame with max stream ID) and a final GOAWAY frame.
   * This is used so that Envoy provides a grace period for new streams that
   * race with the final GOAWAY frame. During this grace period, Envoy will
   * continue to accept new streams. After the grace period, a final GOAWAY
   * frame is sent and Envoy will start refusing new streams. Draining occurs
   * both when a connection hits the idle timeout or during general server
   * draining. The default grace period is 5000 milliseconds (5 seconds) if this
   * option is not specified.
   */
  'drain_timeout': (_google_protobuf_Duration__Output | null);
  /**
   * Configuration for :ref:`HTTP access logs <arch_overview_access_logs>`
   * emitted by the connection manager.
   */
  'access_log': (_envoy_config_accesslog_v3_AccessLog__Output)[];
  /**
   * If set to true, the connection manager will use the real remote address
   * of the client connection when determining internal versus external origin and manipulating
   * various headers. If set to false or absent, the connection manager will use the
   * :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header. See the documentation for
   * :ref:`config_http_conn_man_headers_x-forwarded-for`,
   * :ref:`config_http_conn_man_headers_x-envoy-internal`, and
   * :ref:`config_http_conn_man_headers_x-envoy-external-address` for more information.
   */
  'use_remote_address': (_google_protobuf_BoolValue__Output | null);
  /**
   * Whether the connection manager will generate the :ref:`x-request-id
   * <config_http_conn_man_headers_x-request-id>` header if it does not exist. This defaults to
   * true. Generating a random UUID4 is expensive so in high throughput scenarios where this feature
   * is not desired it can be disabled.
   */
  'generate_request_id': (_google_protobuf_BoolValue__Output | null);
  /**
   * How to handle the :ref:`config_http_conn_man_headers_x-forwarded-client-cert` (XFCC) HTTP
   * header.
   */
  'forward_client_cert_details': (keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ForwardClientCertDetails);
  /**
   * This field is valid only when :ref:`forward_client_cert_details
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.forward_client_cert_details>`
   * is APPEND_FORWARD or SANITIZE_SET and the client connection is mTLS. It specifies the fields in
   * the client certificate to be forwarded. Note that in the
   * :ref:`config_http_conn_man_headers_x-forwarded-client-cert` header, *Hash* is always set, and
   * *By* is always set when the client certificate presents the URI type Subject Alternative Name
   * value.
   */
  'set_current_client_cert_details': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_SetCurrentClientCertDetails__Output | null);
  /**
   * If proxy_100_continue is true, Envoy will proxy incoming "Expect:
   * 100-continue" headers upstream, and forward "100 Continue" responses
   * downstream. If this is false or not set, Envoy will instead strip the
   * "Expect: 100-continue" header, and send a "100 Continue" response itself.
   */
  'proxy_100_continue': (boolean);
  /**
   * The number of additional ingress proxy hops from the right side of the
   * :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header to trust when
   * determining the origin client's IP address. The default is zero if this option
   * is not specified. See the documentation for
   * :ref:`config_http_conn_man_headers_x-forwarded-for` for more information.
   */
  'xff_num_trusted_hops': (number);
  /**
   * If
   * :ref:`use_remote_address
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.use_remote_address>`
   * is true and represent_ipv4_remote_address_as_ipv4_mapped_ipv6 is true and the remote address is
   * an IPv4 address, the address will be mapped to IPv6 before it is appended to *x-forwarded-for*.
   * This is useful for testing compatibility of upstream services that parse the header value. For
   * example, 50.0.0.1 is represented as ::FFFF:50.0.0.1. See `IPv4-Mapped IPv6 Addresses
   * <https://tools.ietf.org/html/rfc4291#section-2.5.5.2>`_ for details. This will also affect the
   * :ref:`config_http_conn_man_headers_x-envoy-external-address` header. See
   * :ref:`http_connection_manager.represent_ipv4_remote_address_as_ipv4_mapped_ipv6
   * <config_http_conn_man_runtime_represent_ipv4_remote_address_as_ipv4_mapped_ipv6>` for runtime
   * control.
   * [#not-implemented-hide:]
   */
  'represent_ipv4_remote_address_as_ipv4_mapped_ipv6': (boolean);
  /**
   * If set, Envoy will not append the remote address to the
   * :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header. This may be used in
   * conjunction with HTTP filters that explicitly manipulate XFF after the HTTP connection manager
   * has mutated the request headers. While :ref:`use_remote_address
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.use_remote_address>`
   * will also suppress XFF addition, it has consequences for logging and other
   * Envoy uses of the remote address, so *skip_xff_append* should be used
   * when only an elision of XFF addition is intended.
   */
  'skip_xff_append': (boolean);
  /**
   * Via header value to append to request and response headers. If this is
   * empty, no via header will be appended.
   */
  'via': (string);
  'upgrade_configs': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_UpgradeConfig__Output)[];
  /**
   * The stream idle timeout for connections managed by the connection manager.
   * If not specified, this defaults to 5 minutes. The default value was selected
   * so as not to interfere with any smaller configured timeouts that may have
   * existed in configurations prior to the introduction of this feature, while
   * introducing robustness to TCP connections that terminate without a FIN.
   *
   * This idle timeout applies to new streams and is overridable by the
   * :ref:`route-level idle_timeout
   * <envoy_v3_api_field_config.route.v3.RouteAction.idle_timeout>`. Even on a stream in
   * which the override applies, prior to receipt of the initial request
   * headers, the :ref:`stream_idle_timeout
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.stream_idle_timeout>`
   * applies. Each time an encode/decode event for headers or data is processed
   * for the stream, the timer will be reset. If the timeout fires, the stream
   * is terminated with a 408 Request Timeout error code if no upstream response
   * header has been received, otherwise a stream reset occurs.
   *
   * This timeout also specifies the amount of time that Envoy will wait for the peer to open enough
   * window to write any remaining stream data once the entirety of stream data (local end stream is
   * true) has been buffered pending available window. In other words, this timeout defends against
   * a peer that does not release enough window to completely write the stream, even though all
   * data has been proxied within available flow control windows. If the timeout is hit in this
   * case, the :ref:`tx_flush_timeout <config_http_conn_man_stats_per_codec>` counter will be
   * incremented. Note that :ref:`max_stream_duration
   * <envoy_v3_api_field_config.core.v3.HttpProtocolOptions.max_stream_duration>` does not apply to
   * this corner case.
   *
   * If the :ref:`overload action <config_overload_manager_overload_actions>` "envoy.overload_actions.reduce_timeouts"
   * is configured, this timeout is scaled according to the value for
   * :ref:`HTTP_DOWNSTREAM_STREAM_IDLE <envoy_v3_api_enum_value_config.overload.v3.ScaleTimersOverloadActionConfig.TimerType.HTTP_DOWNSTREAM_STREAM_IDLE>`.
   *
   * Note that it is possible to idle timeout even if the wire traffic for a stream is non-idle, due
   * to the granularity of events presented to the connection manager. For example, while receiving
   * very large request headers, it may be the case that there is traffic regularly arriving on the
   * wire while the connection manage is only able to observe the end-of-headers event, hence the
   * stream may still idle timeout.
   *
   * A value of 0 will completely disable the connection manager stream idle
   * timeout, although per-route idle timeout overrides will continue to apply.
   */
  'stream_idle_timeout': (_google_protobuf_Duration__Output | null);
  /**
   * Configures what network addresses are considered internal for stats and header sanitation
   * purposes. If unspecified, only RFC1918 IP addresses will be considered internal.
   * See the documentation for :ref:`config_http_conn_man_headers_x-envoy-internal` for more
   * information about internal/external addresses.
   */
  'internal_address_config': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_InternalAddressConfig__Output | null);
  /**
   * The delayed close timeout is for downstream connections managed by the HTTP connection manager.
   * It is defined as a grace period after connection close processing has been locally initiated
   * during which Envoy will wait for the peer to close (i.e., a TCP FIN/RST is received by Envoy
   * from the downstream connection) prior to Envoy closing the socket associated with that
   * connection.
   * NOTE: This timeout is enforced even when the socket associated with the downstream connection
   * is pending a flush of the write buffer. However, any progress made writing data to the socket
   * will restart the timer associated with this timeout. This means that the total grace period for
   * a socket in this state will be
   * <total_time_waiting_for_write_buffer_flushes>+<delayed_close_timeout>.
   *
   * Delaying Envoy's connection close and giving the peer the opportunity to initiate the close
   * sequence mitigates a race condition that exists when downstream clients do not drain/process
   * data in a connection's receive buffer after a remote close has been detected via a socket
   * write(). This race leads to such clients failing to process the response code sent by Envoy,
   * which could result in erroneous downstream processing.
   *
   * If the timeout triggers, Envoy will close the connection's socket.
   *
   * The default timeout is 1000 ms if this option is not specified.
   *
   * .. NOTE::
   * To be useful in avoiding the race condition described above, this timeout must be set
   * to *at least* <max round trip time expected between clients and Envoy>+<100ms to account for
   * a reasonable "worst" case processing time for a full iteration of Envoy's event loop>.
   *
   * .. WARNING::
   * A value of 0 will completely disable delayed close processing. When disabled, the downstream
   * connection's socket will be closed immediately after the write flush is completed or will
   * never close if the write flush does not complete.
   */
  'delayed_close_timeout': (_google_protobuf_Duration__Output | null);
  /**
   * The amount of time that Envoy will wait for the entire request to be received.
   * The timer is activated when the request is initiated, and is disarmed when the last byte of the
   * request is sent upstream (i.e. all decoding filters have processed the request), OR when the
   * response is initiated. If not specified or set to 0, this timeout is disabled.
   */
  'request_timeout': (_google_protobuf_Duration__Output | null);
  /**
   * The maximum request headers size for incoming connections.
   * If unconfigured, the default max request headers allowed is 60 KiB.
   * Requests that exceed this limit will receive a 431 response.
   */
  'max_request_headers_kb': (_google_protobuf_UInt32Value__Output | null);
  /**
   * Should paths be normalized according to RFC 3986 before any processing of
   * requests by HTTP filters or routing? This affects the upstream *:path* header
   * as well. For paths that fail this check, Envoy will respond with 400 to
   * paths that are malformed. This defaults to false currently but will default
   * true in the future. When not specified, this value may be overridden by the
   * runtime variable
   * :ref:`http_connection_manager.normalize_path<config_http_conn_man_runtime_normalize_path>`.
   * See `Normalization and Comparison <https://tools.ietf.org/html/rfc3986#section-6>`_
   * for details of normalization.
   * Note that Envoy does not perform
   * `case normalization <https://tools.ietf.org/html/rfc3986#section-6.2.2.1>`_
   */
  'normalize_path': (_google_protobuf_BoolValue__Output | null);
  /**
   * A route table will be dynamically assigned to each request based on request attributes
   * (e.g., the value of a header). The "routing scopes" (i.e., route tables) and "scope keys" are
   * specified in this message.
   */
  'scoped_routes'?: (_envoy_extensions_filters_network_http_connection_manager_v3_ScopedRoutes__Output | null);
  /**
   * Whether the connection manager will keep the :ref:`x-request-id
   * <config_http_conn_man_headers_x-request-id>` header if passed for a request that is edge
   * (Edge request is the request from external clients to front Envoy) and not reset it, which
   * is the current Envoy behaviour. This defaults to false.
   */
  'preserve_external_request_id': (boolean);
  /**
   * Determines if adjacent slashes in the path are merged into one before any processing of
   * requests by HTTP filters or routing. This affects the upstream *:path* header as well. Without
   * setting this option, incoming requests with path `//dir///file` will not match against route
   * with `prefix` match set to `/dir`. Defaults to `false`. Note that slash merging is not part of
   * `HTTP spec <https://tools.ietf.org/html/rfc3986>`_ and is provided for convenience.
   */
  'merge_slashes': (boolean);
  /**
   * Defines the action to be applied to the Server header on the response path.
   * By default, Envoy will overwrite the header with the value specified in
   * server_name.
   */
  'server_header_transformation': (keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_ServerHeaderTransformation);
  /**
   * Additional settings for HTTP requests handled by the connection manager. These will be
   * applicable to both HTTP1 and HTTP2 requests.
   */
  'common_http_protocol_options': (_envoy_config_core_v3_HttpProtocolOptions__Output | null);
  /**
   * The configuration of the request ID extension. This includes operations such as
   * generation, validation, and associated tracing operations. If empty, the
   * :ref:`UuidRequestIdConfig <envoy_v3_api_msg_extensions.request_id.uuid.v3.UuidRequestIdConfig>`
   * default extension is used with default parameters. See the documentation for that extension
   * for details on what it does. Customizing the configuration for the default extension can be
   * achieved by configuring it explicitly here. For example, to disable trace reason packing,
   * the following configuration can be used:
   *
   * .. validated-code-block:: yaml
   * :type-name: envoy.extensions.filters.network.http_connection_manager.v3.RequestIDExtension
   *
   * typed_config:
   * "@type": type.googleapis.com/envoy.extensions.request_id.uuid.v3.UuidRequestIdConfig
   * pack_trace_reason: false
   *
   * [#extension-category: envoy.request_id]
   */
  'request_id_extension': (_envoy_extensions_filters_network_http_connection_manager_v3_RequestIDExtension__Output | null);
  /**
   * If set, Envoy will always set :ref:`x-request-id <config_http_conn_man_headers_x-request-id>` header in response.
   * If this is false or not set, the request ID is returned in responses only if tracing is forced using
   * :ref:`x-envoy-force-trace <config_http_conn_man_headers_x-envoy-force-trace>` header.
   */
  'always_set_request_id_in_response': (boolean);
  /**
   * The configuration to customize local reply returned by Envoy. It can customize status code,
   * body text and response content type. If not specified, status code and text body are hard
   * coded in Envoy, the response content type is plain text.
   */
  'local_reply_config': (_envoy_extensions_filters_network_http_connection_manager_v3_LocalReplyConfig__Output | null);
  /**
   * Determines if the port part should be removed from host/authority header before any processing
   * of request by HTTP filters or routing. The port would be removed only if it is equal to the :ref:`listener's<envoy_v3_api_field_config.listener.v3.Listener.address>`
   * local port. This affects the upstream host header unless the method is
   * CONNECT in which case if no filter adds a port the original port will be restored before headers are
   * sent upstream.
   * Without setting this option, incoming requests with host `example:443` will not match against
   * route with :ref:`domains<envoy_v3_api_field_config.route.v3.VirtualHost.domains>` match set to `example`. Defaults to `false`. Note that port removal is not part
   * of `HTTP spec <https://tools.ietf.org/html/rfc3986>`_ and is provided for convenience.
   * Only one of `strip_matching_host_port` or `strip_any_host_port` can be set.
   */
  'strip_matching_host_port': (boolean);
  /**
   * Governs Envoy's behavior when receiving invalid HTTP from downstream.
   * If this option is false (default), Envoy will err on the conservative side handling HTTP
   * errors, terminating both HTTP/1.1 and HTTP/2 connections when receiving an invalid request.
   * If this option is set to true, Envoy will be more permissive, only resetting the invalid
   * stream in the case of HTTP/2 and leaving the connection open where possible (if the entire
   * request is read for HTTP/1.1)
   * In general this should be true for deployments receiving trusted traffic (L2 Envoys,
   * company-internal mesh) and false when receiving untrusted traffic (edge deployments).
   *
   * If different behaviors for invalid_http_message for HTTP/1 and HTTP/2 are
   * desired, one should use the new HTTP/1 option :ref:`override_stream_error_on_invalid_http_message
   * <envoy_v3_api_field_config.core.v3.Http1ProtocolOptions.override_stream_error_on_invalid_http_message>` or the new HTTP/2 option
   * :ref:`override_stream_error_on_invalid_http_message
   * <envoy_v3_api_field_config.core.v3.Http2ProtocolOptions.override_stream_error_on_invalid_http_message>`
   * *not* the deprecated but similarly named :ref:`stream_error_on_invalid_http_messaging
   * <envoy_v3_api_field_config.core.v3.Http2ProtocolOptions.stream_error_on_invalid_http_messaging>`
   */
  'stream_error_on_invalid_http_message': (_google_protobuf_BoolValue__Output | null);
  /**
   * The amount of time that Envoy will wait for the request headers to be received. The timer is
   * activated when the first byte of the headers is received, and is disarmed when the last byte of
   * the headers has been received. If not specified or set to 0, this timeout is disabled.
   */
  'request_headers_timeout': (_google_protobuf_Duration__Output | null);
  /**
   * Determines if the port part should be removed from host/authority header before any processing
   * of request by HTTP filters or routing.
   * This affects the upstream host header unless the method is CONNECT in
   * which case if no filter adds a port the original port will be restored before headers are sent upstream.
   * Without setting this option, incoming requests with host `example:443` will not match against
   * route with :ref:`domains<envoy_v3_api_field_config.route.v3.VirtualHost.domains>` match set to `example`. Defaults to `false`. Note that port removal is not part
   * of `HTTP spec <https://tools.ietf.org/html/rfc3986>`_ and is provided for convenience.
   * Only one of `strip_matching_host_port` or `strip_any_host_port` can be set.
   */
  'strip_any_host_port'?: (boolean);
  /**
   * [#not-implemented-hide:] Path normalization configuration. This includes
   * configurations for transformations (e.g. RFC 3986 normalization or merge
   * adjacent slashes) and the policy to apply them. The policy determines
   * whether transformations affect the forwarded *:path* header. RFC 3986 path
   * normalization is enabled by default and the default policy is that the
   * normalized header will be forwarded. See :ref:`PathNormalizationOptions
   * <envoy_v3_api_msg_extensions.filters.network.http_connection_manager.v3.PathNormalizationOptions>`
   * for details.
   */
  'path_normalization_options': (_envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathNormalizationOptions__Output | null);
  /**
   * Additional HTTP/3 settings that are passed directly to the HTTP/3 codec.
   * [#not-implemented-hide:]
   */
  'http3_protocol_options': (_envoy_config_core_v3_Http3ProtocolOptions__Output | null);
  /**
   * Action to take when request URL path contains escaped slash sequences (%2F, %2f, %5C and %5c).
   * The default value can be overridden by the :ref:`http_connection_manager.path_with_escaped_slashes_action<config_http_conn_man_runtime_path_with_escaped_slashes_action>`
   * runtime variable.
   * The :ref:`http_connection_manager.path_with_escaped_slashes_action_sampling<config_http_conn_man_runtime_path_with_escaped_slashes_action_enabled>` runtime
   * variable can be used to apply the action to a portion of all requests.
   */
  'path_with_escaped_slashes_action': (keyof typeof _envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_PathWithEscapedSlashesAction);
  /**
   * The configuration for the original IP detection extensions.
   *
   * When configured the extensions will be called along with the request headers
   * and information about the downstream connection, such as the directly connected address.
   * Each extension will then use these parameters to decide the request's effective remote address.
   * If an extension fails to detect the original IP address and isn't configured to reject
   * the request, the HCM will try the remaining extensions until one succeeds or rejects
   * the request. If the request isn't rejected nor any extension succeeds, the HCM will
   * fallback to using the remote address.
   *
   * .. WARNING::
   * Extensions cannot be used in conjunction with :ref:`use_remote_address
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.use_remote_address>`
   * nor :ref:`xff_num_trusted_hops
   * <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.xff_num_trusted_hops>`.
   *
   * [#extension-category: envoy.http.original_ip_detection]
   */
  'original_ip_detection_extensions': (_envoy_config_core_v3_TypedExtensionConfig__Output)[];
  /**
   * Determines if trailing dot of the host should be removed from host/authority header before any
   * processing of request by HTTP filters or routing.
   * This affects the upstream host header.
   * Without setting this option, incoming requests with host `example.com.` will not match against
   * route with :ref:`domains<envoy_v3_api_field_config.route.v3.VirtualHost.domains>` match set to `example.com`. Defaults to `false`.
   * When the incoming request contains a host/authority header that includes a port number,
   * setting this option will strip a trailing dot, if present, from the host section,
   * leaving the port as is (e.g. host value `example.com.:443` will be updated to `example.com:443`).
   */
  'strip_trailing_host_dot': (boolean);
  /**
   * Allows for explicit transformation of the :scheme header on the request path.
   * If not set, Envoy's default :ref:`scheme  <config_http_conn_man_headers_scheme>`
   * handling applies.
   */
  'scheme_header_transformation': (_envoy_config_core_v3_SchemeHeaderTransformation__Output | null);
  'route_specifier': "rds"|"route_config"|"scoped_routes";
  'strip_port_mode': "strip_any_host_port";
}


text:
using namespace clusteringimplicit;

int main(int argc, char *argv[])
{
    std::ifstream infile;
    infile.open("../clustering_big.txt");
    if (!infile) {
	std::cout << "Opening file failed." << std::endl;
	return -1;
    }

    std::string line;
    std::size_t n_vertices;
    int n_bits;

    std::getline(infile, line);
    std::istringstream iss(line);
    iss >> n_vertices >> n_bits;
    if (iss.fail()) {
	std::cout << "Reading error or incorrect type." << std::endl;
	return -1;
    }

    std::vector<int> nodes;

    while(std::getline(infile, line)) {
	std::istringstream iss(line);
	int node = 0;
	int cur_bit;
	for (int i = 0; i < n_bits; ++i) {
	    node <<= 1;
	    iss >> cur_bit;
	    if (iss.fail()) {
		std::cout << "Reading error or incorrect type." << std::endl;
		return -1;
	    }
	    node += cur_bit;

	}
	nodes.emplace_back(node);
    }
    assert(nodes.size() == n_vertices);

    Clustering clustering(nodes, n_bits);

    SteadyClockTimer timer;
    timer.start();
    clustering.mergeAllClustersWithDistOneAndTwo();

    std::cout << "Number of clusters such that spacing is at least 3 is : " << clustering.nClusters() << std::endl;
    std::cout << "time taken is: " << timer.getMs() << " ms" << std::endl;
    return 0;
}