# This is a network definition for use with chutney.

# Bring up directory authorities first. Everything else depends on these.
# There will be a bit of chaos in the logs as these come up due to:
# * auths trying to contact other auths before they're up.
# * auths trying to create exit circuits before exit relays are created or up.
LAUNCH_PHASE_DIR_AUTHS=1
# Need dirauths.
LAUNCH_PHASE_RELAYS=2
# Needs dirauths, and to a lesser extent some exit relay.
LAUNCH_PHASE_BRIDGE_AUTH=3
# Needs bridge authority.
LAUNCH_PHASE_BRIDGES=4
# Clients need everything else up (including bridges, for bridge-clients) to
# bootstrap cleanly.
LAUNCH_PHASE_CLIENTS=5

ConfigureNodes(
    # Authorities
    Node(tag="a", authority=1, relay=1, launch_phase=LAUNCH_PHASE_DIR_AUTHS).getN(4)
    # Exits. We don't need many since authorities also function as exits,
    # but let's have at least 1 non-authority exit relay.
    + Node(tag="r", relay=1, exit=1, launch_phase=LAUNCH_PHASE_RELAYS).getN(2)
    # Simple tor client. Useful as a baseline check for "chutney verify",
    # and used in arti-bench for comparison.
    + Node(tag="torc", client=1, backend=NodeBackend.TOR, launch_phase=LAUNCH_PHASE_CLIENTS).getN(1)
    # Simple arti client. DNS port enabled for DNS test.
    + Node(tag="artic", client=1, enable_dnsport=True, backend=NodeBackend.ARTI, launch_phase=LAUNCH_PHASE_CLIENTS).getN(1)

    # bridge authority
    + Node(tag="ba", authority=1, bridgeauthority=1, relay=1, launch_phase=LAUNCH_PHASE_BRIDGE_AUTH).getN(1)
    # Bridge
    + Node(tag="br", bridge=1, relay=1, launch_phase=LAUNCH_PHASE_BRIDGES).getN(2)
    # arti bridge client
    + Node(tag="bc", client=1, backend=NodeBackend.ARTI, bridgeclient=1, launch_phase=LAUNCH_PHASE_CLIENTS).getN(1)
)
