# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: core/config.proto
# plugin: python-betterproto2
# This file has been @generated

__all__ = (
    "Config",
    "InboundHandlerConfig",
    "OutboundHandlerConfig",
)

from dataclasses import dataclass

import betterproto2

from ...message_pool import default_message_pool

betterproto2.check_compiler_version("0.5.1")


@dataclass(eq=False, repr=False)
class Config(betterproto2.Message):
    """
    Config is the master config of Xray. Xray takes this config as input and
    functions accordingly.
    """

    inbound: "list[InboundHandlerConfig]" = betterproto2.field(
        1, betterproto2.TYPE_MESSAGE, repeated=True
    )
    """
    Inbound handler configurations. Must have at least one item.
    """

    outbound: "list[OutboundHandlerConfig]" = betterproto2.field(
        2, betterproto2.TYPE_MESSAGE, repeated=True
    )
    """
    Outbound handler configurations. Must have at least one item. The first
    item is used as default for routing.
    """

    app: "list[_common__serial__.TypedMessage]" = betterproto2.field(
        4, betterproto2.TYPE_MESSAGE, repeated=True
    )
    """
    App is for configurations of all features in Xray. A feature must
    implement the Feature interface, and its config type must be registered
    through common.RegisterConfig.
    """

    extension: "list[_common__serial__.TypedMessage]" = betterproto2.field(
        6, betterproto2.TYPE_MESSAGE, repeated=True
    )
    """
    Configuration for extensions. The config may not work if corresponding
    extension is not loaded into Xray. Xray will ignore such config during
    initialization.
    """


default_message_pool.register_message("xray.core", "Config", Config)


@dataclass(eq=False, repr=False)
class InboundHandlerConfig(betterproto2.Message):
    """
    InboundHandlerConfig is the configuration for inbound handler.
    """

    tag: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
    """
    Tag of the inbound handler. The tag must be unique among all inbound
    handlers
    """

    receiver_settings: "_common__serial__.TypedMessage | None" = betterproto2.field(
        2, betterproto2.TYPE_MESSAGE, optional=True
    )
    """
    Settings for how this inbound proxy is handled.
    """

    proxy_settings: "_common__serial__.TypedMessage | None" = betterproto2.field(
        3, betterproto2.TYPE_MESSAGE, optional=True
    )
    """
    Settings for inbound proxy. Must be one of the inbound proxies.
    """


default_message_pool.register_message(
    "xray.core", "InboundHandlerConfig", InboundHandlerConfig
)


@dataclass(eq=False, repr=False)
class OutboundHandlerConfig(betterproto2.Message):
    """
    OutboundHandlerConfig is the configuration for outbound handler.
    """

    tag: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)
    """
    Tag of this outbound handler.
    """

    sender_settings: "_common__serial__.TypedMessage | None" = betterproto2.field(
        2, betterproto2.TYPE_MESSAGE, optional=True
    )
    """
    Settings for how to dial connection for this outbound handler.
    """

    proxy_settings: "_common__serial__.TypedMessage | None" = betterproto2.field(
        3, betterproto2.TYPE_MESSAGE, optional=True
    )
    """
    Settings for this outbound proxy. Must be one of the outbound proxies.
    """

    expire: "int" = betterproto2.field(4, betterproto2.TYPE_INT64)
    """
    If not zero, this outbound will be expired in seconds. Not used for now.
    """

    comment: "str" = betterproto2.field(5, betterproto2.TYPE_STRING)
    """
    Comment of this outbound handler. Not used for now.
    """


default_message_pool.register_message(
    "xray.core", "OutboundHandlerConfig", OutboundHandlerConfig
)


from ..common import serial as _common__serial__
