from p2p.discv5.typing import (
    Nonce,
)


AES128_KEY_SIZE = 16  # size of an AES218 key
NONCE_SIZE = 12  # size of an AESGCM nonce
TAG_SIZE = 32  # size of the tag packet prefix
MAGIC_SIZE = 32  # size of the magic hash in the who are you packet

MAX_PACKET_SIZE = 1280  # maximum allowed size of a packet

ZERO_NONCE = Nonce(b"\x00" * NONCE_SIZE)  # nonce used for the auth header packet

AUTH_SCHEME_NAME = b"gcm"  # the name of the only supported authentication scheme

TOPIC_HASH_SIZE = 32  # size of a topic hash
IP_V4_SIZE = 4  # size of an IPv4 address
IP_V6_SIZE = 16  # size of an IPv6 address

ENR_REPR_PREFIX = "enr:"  # prefix used when printing an ENR
MAX_ENR_SIZE = 300  # maximum allowed size of an ENR

WHO_ARE_YOU_MAGIC_SUFFIX = b"WHOAREYOU"

# buffer size used for incoming UDP datagrams (should be larger than MAX_PACKET_SIZE)
DATAGRAM_BUFFER_SIZE = 2048
