I2P Layer of diva.exchange. Based on i2pd, see https://github.com/PurpleI2P/i2pd https://diva.exchange
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.
 
 
 
 

46 lines
1.3 KiB

  1. #!/bin/sh
  2. #
  3. # Author/Maintainer: konrad@diva.exchange
  4. #
  5. # -e Exit immediately if a simple command exits with a non-zero status
  6. set -e
  7. ENABLE_TUNNELS=${ENABLE_TUNNELS:-0}
  8. IP_BRIDGE=${IP_BRIDGE:-`ip route | awk '/default/ { print $3; }'`}
  9. TUNNELS_DIR=/home/i2pd/tunnels.null
  10. IP_CONTAINER=`ip route get 1 | awk '{ print $NF; exit; }'`
  11. if [[ ${ENABLE_TUNNELS} == 1 ]]
  12. then
  13. TUNNELS_DIR=/home/i2pd/tunnels.conf.d
  14. rm -f ${TUNNELS_DIR}/*.conf
  15. [[ -f /home/i2pd/tunnels.source.conf.d/*.conf ]] && cp \
  16. /home/i2pd/tunnels.source.conf.d/*.conf ${TUNNELS_DIR}
  17. # replace environment variables in the tunnels config files
  18. if [[ -f ${TUNNELS_DIR}/*.conf ]]
  19. then
  20. for pathFile in ${TUNNELS_DIR}/*.conf
  21. do
  22. eval "echo \"$(cat ${pathFile})\"" >${pathFile}
  23. done
  24. fi
  25. fi
  26. # replace variables in the i2pd config files
  27. sed \
  28. 's!\$IP_CONTAINER!'"${IP_CONTAINER}"'!g ; s!\$IP_BRIDGE!'"${IP_BRIDGE}"'!g ; s!\$TUNNELS_DIR!'"${TUNNELS_DIR}"'!g' \
  29. /home/i2pd/conf/i2pd.org.conf >/home/i2pd/conf/i2pd.conf
  30. # overwrite resolv.conf - forces the container to use stubby as a resolver
  31. cat </home/i2pd/network/resolv.conf >/etc/resolv.conf
  32. # DNS-over-TLS, -C path to config
  33. /usr/local/bin/stubby -l -C /home/i2pd/network/stubby.yml &
  34. # see configs: /conf/i2pd.conf
  35. su i2pd -c "/home/i2pd/bin/i2pd --datadir=/home/i2pd/data --conf=/home/i2pd/conf/i2pd.conf"