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

__all__ = (
    "AuthType",
    "Account",
    "ClientConfig",
    "ServerConfig",
)

from dataclasses import dataclass

import betterproto2

from ....message_pool import default_message_pool

betterproto2.check_compiler_version("0.5.1")


class AuthType(betterproto2.Enum):
    """
    AuthType is the authentication type of Socks proxy.
    """

    NO_AUTH = 0
    """
    NO_AUTH is for anonymous authentication.
    """

    PASSWORD = 1
    """
    PASSWORD is for username/password authentication.
    """


@dataclass(eq=False, repr=False)
class Account(betterproto2.Message):
    """
    Account represents a Socks account.
    """

    username: "str" = betterproto2.field(1, betterproto2.TYPE_STRING)

    password: "str" = betterproto2.field(2, betterproto2.TYPE_STRING)


default_message_pool.register_message("xray.proxy.socks", "Account", Account)


@dataclass(eq=False, repr=False)
class ClientConfig(betterproto2.Message):
    """
    ClientConfig is the protobuf config for Socks client.
    """

    server: "list[__common__protocol__.ServerEndpoint]" = betterproto2.field(
        1, betterproto2.TYPE_MESSAGE, repeated=True
    )
    """
    Sever is a list of Socks server addresses.
    """


default_message_pool.register_message("xray.proxy.socks", "ClientConfig", ClientConfig)


@dataclass(eq=False, repr=False)
class ServerConfig(betterproto2.Message):
    """
    ServerConfig is the protobuf config for Socks server.
    """

    auth_type: "AuthType" = betterproto2.field(
        1, betterproto2.TYPE_ENUM, default_factory=lambda: AuthType(0)
    )

    accounts: "dict[str, str]" = betterproto2.field(
        2,
        betterproto2.TYPE_MAP,
        map_meta=betterproto2.map_meta(
            betterproto2.TYPE_STRING, betterproto2.TYPE_STRING
        ),
    )

    address: "__common__net__.IpOrDomain | None" = betterproto2.field(
        3, betterproto2.TYPE_MESSAGE, optional=True
    )

    udp_enabled: "bool" = betterproto2.field(4, betterproto2.TYPE_BOOL)

    user_level: "int" = betterproto2.field(6, betterproto2.TYPE_UINT32)


default_message_pool.register_message("xray.proxy.socks", "ServerConfig", ServerConfig)


from ...common import net as __common__net__
from ...common import protocol as __common__protocol__
