From 67ee504e5d47db3e727fb0797d1c4b873625f6bf Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sat, 21 Nov 2020 21:13:45 -0800 Subject: [PATCH] starting to setup i2p --- Dockerfile-i2p | 16 ++++++++++++++++ docker-compose.yaml | 8 ++++++++ xmrnodes/app.py | 6 ++++++ xmrnodes/config.example.py | 2 ++ 4 files changed, 32 insertions(+) create mode 100644 Dockerfile-i2p diff --git a/Dockerfile-i2p b/Dockerfile-i2p new file mode 100644 index 0000000..f273254 --- /dev/null +++ b/Dockerfile-i2p @@ -0,0 +1,16 @@ +FROM ubuntu:20.04 + +RUN apt-get -y update && \ + apt-get -y install \ + wget unzip && \ + apt-get clean + +RUN useradd -m -d /home/i2pz i2pz + +USER i2pz + +RUN cd ~/ && \ + wget https://github.com/i2p-zero/i2p-zero/releases/download/v1.18/i2p-zero-linux.v1.18.zip -O i2p-zero.zip && \ + unzip i2p-zero.zip + +ENTRYPOINT ["/home/i2pz/i2p-zero-linux.v1.18/router/bin/tunnel-control.sh", "socks.create", "48080"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 101f0c9..e38eb14 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,3 +8,11 @@ services: restart: unless-stopped ports: - 127.0.0.1:9050:9050 + i2p: + container_name: i2p + build: + context: . + dockerfile: Dockerfile-i2p + restart: unless-stopped + ports: + - 127.0.0.1:4444:4444 diff --git a/xmrnodes/app.py b/xmrnodes/app.py index 9e02bb6..ad44886 100644 --- a/xmrnodes/app.py +++ b/xmrnodes/app.py @@ -188,6 +188,12 @@ def import_(): pass logging.info(f"{len(all_nodes)} node urls imported and ready to be validated") +@app.cli.command("i2p") +def i2p(): + proxies = {"http": f"socks5h://{config.I2P_HOST}:{config.I2P_PORT}"} + r = requests.get("http://vkohxr7ealm23uacawcjpbxi3smas2wajr5ne6sgmmw42ygvjikq.b32.i2p", proxies=proxies) + print(r.content) + @app.template_filter("humanize") def humanize(d): t = arrow.get(d, "UTC") diff --git a/xmrnodes/config.example.py b/xmrnodes/config.example.py index 116a24c..37297b6 100644 --- a/xmrnodes/config.example.py +++ b/xmrnodes/config.example.py @@ -4,3 +4,5 @@ SECRET_KEY = os.environ.get('SECRET_KEY', 'xxxx') DATA_DIR = os.environ.get('DATA_DIR', './data') TOR_HOST = os.environ.get('TOR_HOST', '127.0.0.1') TOR_PORT = os.environ.get('TOR_PORT', 9050) +I2P_HOST = os.environ.get('I2P_HOST', '127.0.0.1') +I2P_PORT = os.environ.get('I2P_PORT', 4444)