version: '3.8'

# Simplified NAT Traversal Test
# All components on same network with different IP ranges to simulate NAT

networks:
  test_network:
    driver: bridge
    ipam:
      config:
        - subnet: 172.20.0.0/16

services:
  # Bootstrap/Coordinator node
  bootstrap:
    build:
      context: ..
      dockerfile: docker/Dockerfile.ant-quic
      target: runtime
    container_name: ant-quic-bootstrap-simplified
    networks:
      test_network:
        ipv4_address: 172.20.0.10
    ports:
      - "9000:9000/udp"
      - "9000:9000/tcp"
    environment:
      - RUST_LOG=ant_quic=debug,ant_quic::nat_traversal=trace
    volumes:
      - ./logs/bootstrap:/app/logs
    command: >
      ant-quic
      --force-coordinator
      --listen 0.0.0.0:9000
    healthcheck:
      test: ["CMD-SHELL", "ss -u -l | grep -q ':9000' "]
      interval: 10s
      timeout: 5s
      retries: 5

  # Client 1 - Full Cone NAT simulation (192.168.1.x range)
  client1:
    build:
      context: ..
      dockerfile: docker/Dockerfile.ant-quic
      target: runtime
    container_name: ant-quic-client1-simplified
    networks:
      test_network:
        ipv4_address: 172.20.1.100
    environment:
      - RUST_LOG=ant_quic=debug,ant_quic::nat_traversal=trace
      - ANT_QUIC_BOOTSTRAP=172.20.0.10:9000
    depends_on:
      - bootstrap
    volumes:
      - ./logs/client1:/app/logs
      - ./shared:/shared
    command: ["tail", "-f", "/dev/null"]

  # Client 2 - Symmetric NAT simulation (192.168.2.x range)
  client2:
    build:
      context: ..
      dockerfile: docker/Dockerfile.ant-quic
      target: runtime
    container_name: ant-quic-client2-simplified
    networks:
      test_network:
        ipv4_address: 172.20.2.100
    environment:
      - RUST_LOG=ant_quic=debug,ant_quic::nat_traversal=trace
      - ANT_QUIC_BOOTSTRAP=172.20.0.10:9000
    depends_on:
      - bootstrap
    volumes:
      - ./logs/client2:/app/logs
      - ./shared:/shared
    command: ["tail", "-f", "/dev/null"]

  # Client 3 - Port Restricted NAT simulation (10.0.0.x range)
  client3:
    build:
      context: ..
      dockerfile: docker/Dockerfile.ant-quic
      target: runtime
    container_name: ant-quic-client3-simplified
    networks:
      test_network:
        ipv4_address: 172.20.3.100
    environment:
      - RUST_LOG=ant_quic=debug,ant_quic::nat_traversal=trace
      - ANT_QUIC_BOOTSTRAP=172.20.0.10:9000
    depends_on:
      - bootstrap
    volumes:
      - ./logs/client3:/app/logs
      - ./shared:/shared
    command: ["tail", "-f", "/dev/null"]

  # Client 4 - CGNAT simulation (10.1.0.x range)
  client4:
    build:
      context: ..
      dockerfile: docker/Dockerfile.ant-quic
      target: runtime
    container_name: ant-quic-client4-simplified
    networks:
      test_network:
        ipv4_address: 172.20.4.100
    environment:
      - RUST_LOG=ant_quic=debug,ant_quic::nat_traversal=trace
      - ANT_QUIC_BOOTSTRAP=172.20.0.10:9000
    depends_on:
      - bootstrap
    volumes:
      - ./logs/client4:/app/logs
      - ./shared:/shared
    command: ["tail", "-f", "/dev/null"]