forked from I2P_Developers/i2p.i2p
Compare commits
9 Commits
test-conte
...
build-debi
| Author | SHA1 | Date | |
|---|---|---|---|
| c0a0aa7700 | |||
| 4a9131c39d | |||
| b47269f14e | |||
| fb317b44ba | |||
| e64e12b3fb | |||
| f71e59a049 | |||
| 169fb59d7d | |||
|
|
922178b2c7 | ||
|
|
74a9193ba5 |
31
.dockerignore
Normal file
31
.dockerignore
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
.idea
|
||||||
|
.git
|
||||||
|
Dockerfile
|
||||||
|
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.gradle
|
||||||
|
build
|
||||||
|
apps/BOB/build
|
||||||
|
apps/addressbook/build
|
||||||
|
apps/desktopgui/build
|
||||||
|
apps/i2pcontrol/build
|
||||||
|
apps/i2psnark/build
|
||||||
|
apps/i2ptunnel/build
|
||||||
|
apps/imagegen/build
|
||||||
|
apps/jetty/build
|
||||||
|
apps/jrobin/build
|
||||||
|
apps/ministreaming/java/build
|
||||||
|
apps/ministreaming/build
|
||||||
|
apps/routerconsole/build
|
||||||
|
apps/sam/build
|
||||||
|
apps/streaming/build
|
||||||
|
apps/susidns/build
|
||||||
|
apps/susimail/build
|
||||||
|
apps/systray/build
|
||||||
|
core/java/build
|
||||||
|
core/build
|
||||||
|
installer/build
|
||||||
|
router/java/build
|
||||||
|
router/build
|
||||||
|
|
||||||
@@ -22,3 +22,45 @@ test:
|
|||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- tags
|
- tags
|
||||||
|
|
||||||
|
# Make sure we can build a docker image
|
||||||
|
# It's cached for later jobs
|
||||||
|
build_docker:
|
||||||
|
stage: test
|
||||||
|
image: docker:19.03.12
|
||||||
|
services:
|
||||||
|
- docker:19.03.12-dind
|
||||||
|
script:
|
||||||
|
# Try to load latest branch image from local tar or from registry
|
||||||
|
- docker load -i ci-exports/$CI_COMMIT_REF_SLUG.tar || docker pull $CI_REGISTRY_IMAGE:latest || true
|
||||||
|
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:latest .
|
||||||
|
- mkdir -p ci-exports/
|
||||||
|
- docker save $CI_REGISTRY_IMAGE:latest > ci-exports/$CI_COMMIT_REF_SLUG.tar
|
||||||
|
variables:
|
||||||
|
# When using dind service, we need to instruct docker to talk with
|
||||||
|
# the daemon started inside of the service. The daemon is available
|
||||||
|
# with a network connection instead of the default
|
||||||
|
# /var/run/docker.sock socket. Docker 19.03 does this automatically
|
||||||
|
# by setting the DOCKER_HOST in
|
||||||
|
# https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03/docker-entrypoint.sh#L23-L29
|
||||||
|
#
|
||||||
|
# The 'docker' hostname is the alias of the service container as described at
|
||||||
|
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
|
||||||
|
#
|
||||||
|
# Specify to Docker where to create the certificates, Docker will
|
||||||
|
# create them automatically on boot, and will create
|
||||||
|
# `/certs/client` that will be shared between the service and job
|
||||||
|
# container, thanks to volume mount from config.toml
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
|
||||||
|
DOCKER_HOST: tcp://docker:2376
|
||||||
|
cache:
|
||||||
|
# The same key should be used across branches
|
||||||
|
key: "$CI_COMMIT_REF_SLUG"
|
||||||
|
paths:
|
||||||
|
- ci-exports/*.tar
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- merge_requests
|
||||||
|
- tags
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
export JAVA_HOME=/opt/jdk/jre
|
|
||||||
|
|
||||||
# Ensure user rights
|
|
||||||
chown -R i2p:nobody /opt/i2p
|
|
||||||
chmod -R u+rwx /opt/i2p
|
|
||||||
|
|
||||||
gosu i2p /opt/i2p/i2psvc /opt/i2p/wrapper.config wrapper.pidfile=/var/tmp/i2p.pid \
|
|
||||||
wrapper.name=i2p \
|
|
||||||
wrapper.displayname="I2P Service" \
|
|
||||||
wrapper.statusfile=/var/tmp/i2p.status \
|
|
||||||
wrapper.java.statusfile=/var/tmp/i2p.java.status \
|
|
||||||
wrapper.logfile=/var/tmp/wrapper.log
|
|
||||||
80
Dockerfile
80
Dockerfile
@@ -1,62 +1,40 @@
|
|||||||
FROM meeh/java8server:latest
|
# Use a multi-stage build to reduce the size of the resulting image
|
||||||
# Docker image based on Alpine with Java.
|
# We need alpine >v3 in order to install an apache-ant > 1.9
|
||||||
|
FROM debian:buster-slim as builder
|
||||||
|
|
||||||
# We use Oracle Java to run I2P, but uses the openjdk to build it.
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Build installer
|
||||||
|
RUN apt-get update \
|
||||||
|
# Workaround for installing openjdk-11-jre-headless
|
||||||
|
&& mkdir -p /usr/share/man/man1 \
|
||||||
|
&& apt-get -qqqy install debhelper ant debconf gettext libgmp-dev po-debconf fakeroot \
|
||||||
|
build-essential quilt dh-apparmor dh-systemd libservice-wrapper-java libjson-simple-java \
|
||||||
|
devscripts libjetty9-java libtomcat9-java libtaglibs-standard-jstlel-java libgetopt-java \
|
||||||
|
bash-completion
|
||||||
|
|
||||||
MAINTAINER Mikal Villa <mikal@sigterm.no>
|
WORKDIR /tmp/build
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
ENV GIT_BRANCH="master"
|
RUN ant debian
|
||||||
ENV I2P_PREFIX="/opt/i2p"
|
|
||||||
ENV PATH=${I2P_PREFIX}/bin:$PATH
|
|
||||||
ENV JAVA_HOME=/usr/lib/jvm/default-jvm
|
|
||||||
|
|
||||||
ENV GOSU_VERSION=1.7
|
# Second stage only using the installer from the last stage
|
||||||
ENV GOSU_SHASUM="34049cfc713e8b74b90d6de49690fa601dc040021980812b2f1f691534be8a50 /usr/local/bin/gosu"
|
# ---------------------------------------------------------
|
||||||
|
# We can't use alpine here as the java service wrapper is built with glibc
|
||||||
RUN mkdir /user && adduser -S -h /user i2p && chown -R i2p:nobody /user
|
# alpine uses musl
|
||||||
|
FROM openjdk:11.0-jre-slim
|
||||||
# Adding files first, since Docker.expt is required for installation
|
|
||||||
ADD Docker.expt /tmp/Docker.expt
|
|
||||||
ADD Docker.entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
# Required for wget https
|
|
||||||
RUN apk add --no-cache openssl
|
|
||||||
# Gosu is a replacement for su/sudo in docker and not a backdoor :) See https://github.com/tianon/gosu
|
|
||||||
RUN wget -O /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64 \
|
|
||||||
&& echo "${GOSU_SHASUM}" | sha256sum -c && chmod +x /usr/local/bin/gosu
|
|
||||||
|
|
||||||
#
|
|
||||||
# Each RUN is a layer, adding the dependencies and building i2pd in one layer takes around 8-900Mb, so to keep the
|
|
||||||
# image under 200mb we need to remove all the build dependencies in the same "RUN" / layer.
|
|
||||||
#
|
|
||||||
|
|
||||||
# The main layer
|
|
||||||
RUN apk --no-cache add build-base git gettext tar bzip2 apache-ant openjdk8 expect \
|
|
||||||
&& mkdir -p /usr/src/build \
|
|
||||||
&& cd /usr/src/build \
|
|
||||||
&& git clone -b ${GIT_BRANCH} https://github.com/i2p/i2p.i2p.git \
|
|
||||||
&& cd /usr/src/build/i2p.i2p \
|
|
||||||
&& echo "noExe=true" >> build.properties \
|
|
||||||
&& ant installer-linux \
|
|
||||||
&& cp i2pinstall*.jar /tmp/i2pinstall.jar \
|
|
||||||
&& mkdir -p /opt \
|
|
||||||
&& chown i2p:root /opt \
|
|
||||||
&& chmod u+rw /opt \
|
|
||||||
&& gosu i2p expect -f /tmp/Docker.expt \
|
|
||||||
&& cd ${I2P_PREFIX} \
|
|
||||||
&& rm -fr man docs *.bat *.command *.app /tmp/i2pinstall.jar /tmp/Docker.expt \
|
|
||||||
&& rm -fr /usr/src/build \
|
|
||||||
&& apk --purge del build-base apache-ant expect tcl expat git openjdk8 openjdk8-jre openjdk8-jre-base openjdk8-jre-lib bzip2 tar \
|
|
||||||
binutils-libs binutils pkgconfig libcurl libc-dev musl-dev g++ make fortify-headers pkgconf giflib libssh2 libxdmcp libxcb \
|
|
||||||
libx11 pcre alsa-lib libxi libxrender libxml2 readline bash openssl \
|
|
||||||
&& rm -fr /usr/lib/jvm/default-jre \
|
|
||||||
&& ln -sf /opt/jdk/jre /usr/lib/jvm/default-jre \
|
|
||||||
&& chmod a+x /entrypoint.sh
|
|
||||||
|
|
||||||
|
# "install" i2p by copying over installed files
|
||||||
|
COPY --from=builder /tmp/*.deb /tmp/
|
||||||
|
|
||||||
|
# Install and configure
|
||||||
|
RUN apt-get update -qqq \
|
||||||
|
&& apt-get -qqqy install geoip-database famfamfam-flag-png \
|
||||||
|
&& dpkb -i /tmp/*
|
||||||
|
|
||||||
EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445 15000-20000
|
EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445 15000-20000
|
||||||
|
|
||||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
USER i2psvc
|
||||||
|
ENTRYPOINT [ "/usr/bin/i2prouter" ]
|
||||||
|
CMD start
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th id="upnpconfig"><%=intl._t("UPnP Configuration")%> <a href="peers#upnp">[<%=intl._t("UPnP Status")%>]</a></th>
|
<th id="upnpconfig"><%=intl._t("UPnP Configuration")%> <a href="peers?tx=upnp">[<%=intl._t("UPnP Status")%>]</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
69
core/java/test/junit/net/i2p/util/ConvertToHashTest.java
Normal file
69
core/java/test/junit/net/i2p/util/ConvertToHashTest.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package net.i2p.util;
|
||||||
|
|
||||||
|
import net.i2p.data.Hash;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class ConvertToHashTest {
|
||||||
|
private static final String zzzDotI2pBase32Hash = "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua";
|
||||||
|
private static final String zzzDotI2pBase64Hash = "WcI~uSICHFCVVPoufn4J7v5u~1lhxi45C60Nm43jMeg=";
|
||||||
|
private static final String zzzDotI2pBase64Dest = "GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dmXl51cJn9MVTRrEqRWSJVXbUUz9t5Po6Xa247Vr0sJn27R4KoKP8QVj1GuH6dB3b6wTPbOamC3dkO18vkQkfZWUdRMDXk0d8AdjB0E0864nOT~J9Fpnd2pQE5uoFT6P0DqtQR2jsFvf9ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpne8cuesn3NDXIpNnqEE6Oe5Qm5YOJykrX~Vx~cFFT3QzDGkIjjxlFBsjUJyYkFjBQAEAAcAAA==";
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashNullPeer() {
|
||||||
|
assertNull(ConvertToHash.getHash(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB64() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Hash);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB64DotI2P() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Hash + ".i2p");
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashDestinationB64() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Dest);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashDestinationB64DotI2P() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Dest + ".i2p");
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB32() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase32Hash);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase32(), zzzDotI2pBase32Hash + ".b32.i2p");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB32DotI2P() {
|
||||||
|
String zzzB32I2P = zzzDotI2pBase32Hash + ".b32.i2p";
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzB32I2P);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase32(), zzzB32I2P);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The case where a destination cannot be resolved at all
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getHashResolveDestinationFail() {
|
||||||
|
assertNull(ConvertToHash.getHash("unknown.i2p"));
|
||||||
|
}
|
||||||
|
}
|
||||||
19
history.txt
19
history.txt
@@ -1,3 +1,22 @@
|
|||||||
|
2021-01-20 zzz
|
||||||
|
* Console: Fix link to UPnP status
|
||||||
|
* SSU: Fix deadlock with router restart
|
||||||
|
|
||||||
|
2021-01-14 zzz
|
||||||
|
* Router:
|
||||||
|
- Change default encryption type to ECIES-X25519 (proposal 156)
|
||||||
|
- Move Sybil subsystem from console to router
|
||||||
|
- Limit max addresses in RI
|
||||||
|
|
||||||
|
2021-01-13 zzz
|
||||||
|
* Jetty: Fix URI in request logs
|
||||||
|
|
||||||
|
2021-01-12 zzz
|
||||||
|
* i2psnark: Don't decrement downloaded counter after receiving bad piece
|
||||||
|
|
||||||
|
2021-01-11 zzz
|
||||||
|
* Console: Delete rrd files for no-longer-configured stats at startup
|
||||||
|
|
||||||
2021-01-08 zzz
|
2021-01-08 zzz
|
||||||
* i2ptunnel: Disable shared clients (DSA) (part 2)
|
* i2ptunnel: Disable shared clients (DSA) (part 2)
|
||||||
* SSU: Fix bandwidth estimator deadlock (ticket #2798)
|
* SSU: Fix bandwidth estimator deadlock (ticket #2798)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 13;
|
public final static long BUILD = 14;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
|||||||
@@ -2455,7 +2455,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
||||||
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
||||||
if (allowRebuildRouterInfo)
|
if (allowRebuildRouterInfo)
|
||||||
_context.router().rebuildRouterInfo();
|
rebuildRouterInfo();
|
||||||
} else {
|
} else {
|
||||||
addr = null;
|
addr = null;
|
||||||
}
|
}
|
||||||
@@ -2510,11 +2510,35 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
||||||
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
||||||
if (allowRebuildRouterInfo)
|
if (allowRebuildRouterInfo)
|
||||||
_context.router().rebuildRouterInfo();
|
rebuildRouterInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Avoid deadlocks part 999
|
||||||
|
* @since 0.9.49
|
||||||
|
*/
|
||||||
|
private void rebuildRouterInfo() {
|
||||||
|
(new RebuildEvent()).schedule(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.49
|
||||||
|
*/
|
||||||
|
private class RebuildEvent extends SimpleTimer2.TimedEvent {
|
||||||
|
/**
|
||||||
|
* Caller must schedule
|
||||||
|
*/
|
||||||
|
public RebuildEvent() {
|
||||||
|
super(_context.simpleTimer2());
|
||||||
|
}
|
||||||
|
public void timeReached() {
|
||||||
|
_context.router().rebuildRouterInfo(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple fetch of stored IP and port, since
|
* Simple fetch of stored IP and port, since
|
||||||
* we don't put them in the real, published RouterAddress anymore
|
* we don't put them in the real, published RouterAddress anymore
|
||||||
|
|||||||
Reference in New Issue
Block a user