github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/test/p2p/address.sh (about)

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