You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
542 B

  1. #! /bin/bash
  2. set -eu
  3. IPV=$1
  4. ID=$2
  5. PORT=${3:-}
  6. DOCKER_IMAGE=${4:-}
  7. if [[ "$IPV" == 6 ]]; then
  8. ADDRESS="fd80:b10c::"
  9. else
  10. ADDRESS="172.57.0."
  11. fi
  12. ADDRESS="$ADDRESS$((100+$ID))"
  13. if [[ -n "$PORT" ]]; then
  14. if [[ "$IPV" == 6 ]]; then
  15. ADDRESS="[$ADDRESS]"
  16. fi
  17. ADDRESS="$ADDRESS:$PORT"
  18. fi
  19. if [[ -n "$DOCKER_IMAGE" ]]; then
  20. NODEID="$(docker run --rm -e TMHOME=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$((ID-1)) $DOCKER_IMAGE tendermint show_node_id)"
  21. ADDRESS="$NODEID@$ADDRESS"
  22. fi
  23. echo $ADDRESS