# Tor transport integration test — socks5-outbound
#
# Topology:
#   [fips-a] --tor/socks5--> test-us01 (test-us01.fips.network:443) <--tor/socks5-- [fips-b]
#
# Both FIPS nodes connect outbound through a local Tor daemon's SOCKS5
# proxy to test-us01's TCP listener. test-us01 routes between them.
# Ping between fips-a and fips-b validates the full Tor transport path.

networks:
  tor-test:
    driver: bridge
    labels:
      - "com.corganlabs.fips-ci=1"

services:
  tor-daemon:
    image: osminogin/tor-simple:latest
    container_name: tor-daemon${FIPS_CI_NAME_SUFFIX:-}
    restart: "no"
    volumes:
      - ../common/torrc:/etc/tor/torrc:ro
    networks:
      tor-test:

  fips-a:
    image: fips-test:latest
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    restart: "no"
    container_name: fips-tor-a${FIPS_CI_NAME_SUFFIX:-}
    hostname: fips-tor-a
    depends_on:
      - tor-daemon
    volumes:
      - ./configs/node-a.yaml:/etc/fips/fips.yaml:ro
    environment:
      - RUST_LOG=info,fips::transport::tor=debug
      - FIPS_TEST_MODE=tor-socks5
    networks:
      tor-test:

  fips-b:
    image: fips-test:latest
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    restart: "no"
    container_name: fips-tor-b${FIPS_CI_NAME_SUFFIX:-}
    hostname: fips-tor-b
    depends_on:
      - tor-daemon
    volumes:
      - ./configs/node-b.yaml:/etc/fips/fips.yaml:ro
    environment:
      - RUST_LOG=info,fips::transport::tor=debug
      - FIPS_TEST_MODE=tor-socks5
    networks:
      tor-test:
