I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9f31b1fe authored by zzz's avatar zzz
Browse files

propagate from branch 'i2p.i2p.zzz.gmp6-prop' (head 416ef26df4b91fb9de3e27623551c7f87ec2bfe0)

            to branch 'i2p.i2p' (head 9466fdeae338d6b0bf049d86975db9b6ddbd3064)
parents 414522f8 a2873c42
No related branches found
No related tags found
No related merge requests found
Showing
with 255 additions and 98 deletions
......@@ -28,9 +28,9 @@ web-fragment.xml
web-out.xml
# Temporary/build dirs
^build
^build$
^pkg-temp
/build
/build$
/classes
/dist
^installer/resources/locale/mo
......@@ -45,7 +45,6 @@ core/c/jcpuid/msvc/*.user
# Debian-related
^debian/copyright
^debian/changelog
^.pc/
# Build property overrides
......
......@@ -23,6 +23,7 @@ trans.sv_SE = apps/i2ptunnel/locale/messages_sv.po
trans.uk_UA = apps/i2ptunnel/locale/messages_uk.po
trans.vi = apps/i2ptunnel/locale/messages_vi.po
trans.zh_CN = apps/i2ptunnel/locale/messages_zh.po
trans.zh_TW = apps/i2ptunnel/locale/messages_zh_TW.po
[I2P.proxy]
source_file = apps/i2ptunnel/locale-proxy/messages_en.po
......@@ -33,6 +34,8 @@ trans.de = apps/i2ptunnel/locale-proxy/messages_de.po
trans.es = apps/i2ptunnel/locale-proxy/messages_es.po
trans.fr = apps/i2ptunnel/locale-proxy/messages_fr.po
trans.hu = apps/i2ptunnel/locale-proxy/messages_hu.po
;; Java converts id to in
trans.id = apps/i2ptunnel/locale-proxy/messages_in.po
trans.it = apps/i2ptunnel/locale-proxy/messages_it.po
trans.nb = apps/i2ptunnel/locale-proxy/messages_nb.po
trans.nl = apps/i2ptunnel/locale-proxy/messages_nl.po
......@@ -74,6 +77,7 @@ trans.tr_TR = apps/routerconsole/locale/messages_tr.po
trans.uk_UA = apps/routerconsole/locale/messages_uk.po
trans.vi = apps/routerconsole/locale/messages_vi.po
trans.zh_CN = apps/routerconsole/locale/messages_zh.po
trans.zh_TW = apps/routerconsole/locale/messages_zh_TW.po
[I2P.welcome]
source_file = apps/routerconsole/locale-news/messages_en.po
......@@ -81,11 +85,15 @@ source_lang = en
trans.ar = apps/routerconsole/locale-news/messages_ar.po
trans.de = apps/routerconsole/locale-news/messages_de.po
trans.es = apps/routerconsole/locale-news/messages_es.po
trans.fi = apps/routerconsole/locale-news/messages_fi.po
trans.fr = apps/routerconsole/locale-news/messages_fr.po
trans.he = apps/routerconsole/locale-news/messages_he.po
;; Java converts id to in
trans.id = apps/routerconsole/locale-news/messages_in.po
trans.it = apps/routerconsole/locale-news/messages_it.po
trans.ja = apps/routerconsole/locale-news/messages_ja.po
trans.ko = apps/routerconsole/locale-news/messages_ko.po
trans.mg = apps/routerconsole/locale-news/messages_mg.po
trans.nb = apps/routerconsole/locale-news/messages_nb.po
trans.nl = apps/routerconsole/locale-news/messages_nl.po
trans.pl = apps/routerconsole/locale-news/messages_pl.po
......@@ -94,10 +102,12 @@ trans.pt_BR = apps/routerconsole/locale-news/messages_pt_BR.po
trans.ro = apps/routerconsole/locale-news/messages_ro.po
trans.ru_RU = apps/routerconsole/locale-news/messages_ru.po
trans.sk = apps/routerconsole/locale-news/messages_sk.po
trans.sq = apps/routerconsole/locale-news/messages_sq.po
trans.sv_SE = apps/routerconsole/locale-news/messages_sv.po
trans.tr_TR = apps/routerconsole/locale-news/messages_tr.po
trans.uk_UA = apps/routerconsole/locale-news/messages_uk.po
trans.zh_CN = apps/routerconsole/locale-news/messages_zh.po
trans.zh_TW = apps/routerconsole/locale-news/messages_zh_TW.po
[I2P.countries]
type = PO
......@@ -114,6 +124,7 @@ trans.fr = apps/routerconsole/locale-countries/messages_fr.po
trans.hu = apps/routerconsole/locale-countries/messages_hu.po
trans.it = apps/routerconsole/locale-countries/messages_it.po
trans.ja = apps/routerconsole/locale-countries/messages_ja.po
trans.mg = apps/routerconsole/locale-countries/messages_mg.po
trans.nb = apps/routerconsole/locale-countries/messages_nb.po
trans.nl = apps/routerconsole/locale-countries/messages_nl.po
trans.pl = apps/routerconsole/locale-countries/messages_pl.po
......@@ -128,6 +139,7 @@ trans.uk_UA = apps/routerconsole/locale-countries/messages_uk.po
trans.tr_TR = apps/routerconsole/locale-countries/messages_tr.po
trans.vi = apps/routerconsole/locale-countries/messages_vi.po
trans.zh_CN = apps/routerconsole/locale-countries/messages_zh.po
trans.zh_TW = apps/routerconsole/locale-countries/messages_zh_TW.po
[I2P.i2psnark]
source_file = apps/i2psnark/locale/messages_en.po
......@@ -208,17 +220,22 @@ trans.cs = apps/susimail/locale/messages_cs.po
trans.da = apps/susimail/locale/messages_da.po
trans.de = apps/susimail/locale/messages_de.po
trans.es = apps/susimail/locale/messages_es.po
trans.fi = apps/susimail/locale/messages_fi.po
trans.fr = apps/susimail/locale/messages_fr.po
trans.hu = apps/susimail/locale/messages_hu.po
;; Java converts id to in
trans.id = apps/susimail/locale/messages_in.po
trans.it = apps/susimail/locale/messages_it.po
trans.ja = apps/susimail/locale/messages_ja.po
trans.mg = apps/susimail/locale/messages_mg.po
trans.nl = apps/susimail/locale/messages_nl.po
trans.ru_RU = apps/susimail/locale/messages_ru.po
trans.sv_SE = apps/susimail/locale/messages_sv.po
trans.pl = apps/susimail/locale/messages_pl.po
trans.pt = apps/susimail/locale/messages_pt.po
trans.pt_BR = apps/susimail/locale/messages_pt_BR.po
trans.ro = apps/susimail/locale/messages_ro.po
trans.ru_RU = apps/susimail/locale/messages_ru.po
trans.sq = apps/susimail/locale/messages_sq.po
trans.sv_SE = apps/susimail/locale/messages_sv.po
trans.uk_UA = apps/susimail/locale/messages_uk.po
trans.vi = apps/susimail/locale/messages_vi.po
trans.zh_CN = apps/susimail/locale/messages_zh.po
......@@ -230,16 +247,21 @@ trans.cs = debian/po/cs.po
trans.de = debian/po/de.po
trans.el = debian/po/el.po
trans.es = debian/po/es.po
trans.fi = debian/po/fi.po
trans.fr = debian/po/fr.po
trans.id = debian/po/id.po
trans.it = debian/po/it.po
trans.hu = debian/po/hu.po
trans.ja = debian/po/ja.po
trans.ko = debian/po/ko.po
trans.nl = debian/po/nl.po
trans.pl = debian/po/pl.po
trans.pt = debian/po/pt.po
trans.pt_BR = debian/po/pt_BR.po
trans.ro = debian/po/ro.po
trans.ru_RU = debian/po/ru.po
trans.sk = debian/po/sk.po
trans.sq = debian/po/sq.po
trans.sv_SE = debian/po/sv.po
trans.uk_UA = debian/po/uk.po
trans.tr_TR = debian/po/tr.po
......@@ -248,12 +270,20 @@ trans.zh_CN = debian/po/zh.po
[I2P.i2prouter-script]
source_file = installer/resources/locale/po/messages_en.po
source_lang = en
;; currently fails check
;;trans.ca = installer/resources/locale/po/messages_ca.po
trans.de = installer/resources/locale/po/messages_de.po
trans.es = installer/resources/locale/po/messages_es.po
;; currently fails check
;;trans.fi = installer/resources/locale/po/messages_fi.po
trans.fr = installer/resources/locale/po/messages_fr.po
trans.id = installer/resources/locale/po/messages_id.po
trans.it = installer/resources/locale/po/messages_it.po
trans.pl = installer/resources/locale/po/messages_pl.po
trans.ja = installer/resources/locale/po/messages_ja.po
;; currently fails check
;;trans.ko = installer/resources/locale/po/messages_ko.po
trans.nl = installer/resources/locale/po/messages_nl.po
trans.pl = installer/resources/locale/po/messages_pl.po
trans.pt = installer/resources/locale/po/messages_pt.po
trans.pt_BR = installer/resources/locale/po/messages_pt_BR.po
......@@ -262,6 +292,8 @@ trans.ru_RU = installer/resources/locale/po/messages_ru.po
trans.sk = installer/resources/locale/po/messages_sk.po
trans.sv_SE = installer/resources/locale/po/messages_sv.po
trans.tr_TR = installer/resources/locale/po/messages_tr.po
;; currently fails check
;;trans.uk_UA = installer/resources/locale/po/messages_uk.po
trans.zh_CN = installer/resources/locale/po/messages_zh.po
[I2P.getopt]
......@@ -271,28 +303,44 @@ type = PROPERTIES
trans.cs = core/java/src/gnu/getopt/MessagesBundle_cs.properties
trans.de = core/java/src/gnu/getopt/MessagesBundle_de.properties
trans.es = core/java/src/gnu/getopt/MessagesBundle_es.properties
trans.fi = core/java/src/gnu/getopt/MessagesBundle_fi.properties
trans.fr = core/java/src/gnu/getopt/MessagesBundle_fr.properties
trans.hu = core/java/src/gnu/getopt/MessagesBundle_hu.properties
;; Java converts id to in
trans.id = core/java/src/gnu/getopt/MessagesBundle_in.properties
trans.it = core/java/src/gnu/getopt/MessagesBundle_it.properties
trans.ja = core/java/src/gnu/getopt/MessagesBundle_ja.properties
trans.ko = core/java/src/gnu/getopt/MessagesBundle_ko.properties
trans.nl = core/java/src/gnu/getopt/MessagesBundle_nl.properties
trans.nb = core/java/src/gnu/getopt/MessagesBundle_nb.properties
trans.pl = core/java/src/gnu/getopt/MessagesBundle_pl.properties
trans.pt_BR = core/java/src/gnu/getopt/MessagesBundle_pt_BR.properties
;; currently corrupt, non-UTF-8
;;trans.pt = core/java/src/gnu/getopt/MessagesBundle_pt.properties
;; currently corrupt, non-UTF-8
;;trans.pt_BR = core/java/src/gnu/getopt/MessagesBundle_pt_BR.properties
trans.ro = core/java/src/gnu/getopt/MessagesBundle_ro.properties
trans.ru_RU = core/java/src/gnu/getopt/MessagesBundle_ru.properties
trans.sk = core/java/src/gnu/getopt/MessagesBundle_sk.properties
;; currently corrupt, non-UTF-8
;;trans.sq = core/java/src/gnu/getopt/MessagesBundle_sq.properties
trans.uk_UA = core/java/src/gnu/getopt/MessagesBundle_uk.properties
trans.zh_CN = core/java/src/gnu/getopt/MessagesBundle_zh.properties
[I2P.streaming]
source_file = apps/ministreaming/locale/messages_en.po
source_lang = en
trans.ca = apps/ministreaming/locale/messages_ca.po
trans.de = apps/ministreaming/locale/messages_de.po
trans.es = apps/ministreaming/locale/messages_es.po
trans.fr = apps/ministreaming/locale/messages_fr.po
;; Java converts id to in
trans.id = apps/ministreaming/locale/messages_in.po
trans.it = apps/ministreaming/locale/messages_it.po
trans.nb = apps/ministreaming/locale/messages_nb.po
trans.pl = apps/ministreaming/locale/messages_pl.po
trans.ro = apps/ministreaming/locale/messages_ro.po
trans.ru_RU = apps/ministreaming/locale/messages_ru.po
trans.sv_SE = apps/ministreaming/locale/messages_sv.po
trans.uk_UA = apps/ministreaming/locale/messages_uk.po
trans.zh_CN = apps/ministreaming/locale/messages_zh.po
......
......@@ -25,21 +25,22 @@ where there are comments labeled "PORTABLE". Do this before you
run I2P for the first time.
To start I2P:
(*nix): sh i2prouter start
(*nix, BSD, Mac): sh i2prouter start
(win*): I2P.exe
(non-x86 platforms PPC, ARM, etc): sh runplain.sh
(platforms without wrapper support): sh runplain.sh
To stop I2P (gracefully):
lynx http://localhost:7657/summaryframe (click "Shutdown")
or (*nix, BSD, Mac) sh i2prouter graceful
To stop I2P immediately:
sh i2prouter stop
(*nix, BSD, Mac) sh i2prouter stop
To uninstall I2P:
rm -rf $I2PInstallDir ~/.i2p
Supported JVMs:
All platforms: Java 1.6 or higher required; 1.7 or higher recommended
All platforms: Java 1.7 or higher required
Windows: OpenJDK or Oracle from http://java.com/download
Linux: OpenJDK or Oracle from http://java.com/download
FreeBSD: OpenJDK or Oracle from http://java.com/download
......
I2P source installation instructions
Prerequisites to build from source:
Java SDK (preferably Oracle/Sun or OpenJDK) 1.6.0 or higher
Java SDK (preferably Oracle/Sun or OpenJDK) 1.7.0 or higher
Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
Certain subsystems for embedded (core, router, mstreaming, streaming, i2ptunnel) require only Java 1.6
Apache Ant 1.7.0 or higher
The xgettext, msgfmt, and msgmerge tools installed
from the GNU gettext package http://www.gnu.org/software/gettext/
from the GNU gettext package http://www.gnu.org/software/gettext/
Build environment must use a UTF-8 locale.
To build and install I2P from source, you must first build
and package up the appropriate installer by running:
......@@ -40,29 +42,30 @@ or on Windows, just double-click on i2pinstall.exe.
Or move the i2pupdate.zip file into an existing installation directory and restart.
To start I2P:
(*nix): sh i2prouter start
(*nix, BSD, Mac): sh i2prouter start
(win*): I2P.exe or i2prouter.bat
(non-x86 platforms PPC, ARM, etc): sh runplain.sh
(platforms without wrapper support): sh runplain.sh
To install I2P as a system service:
(*nix) sh i2prouter install
(*nix, BSD, Mac) sh i2prouter install
(win*) install_i2p_service_winnt.bat
To uninstall I2P as a system service:
(*nix) sh i2prouter remove
(*nix, BSD, Mac) sh i2prouter remove
(win*) uninstall_i2p-service_winnt.bat
To stop I2P (gracefully):
lynx http://localhost:7657/summaryframe (click "Shutdown")
or (*nix, BSD, Mac) sh i2prouter graceful
To stop I2P immediately:
sh i2prouter stop
(*nix, BSD, Mac) sh i2prouter stop
To uninstall I2P:
rm -rf $I2PInstallDir ~/.i2p
Supported JVMs:
Windows: Latest available from http://java.com/download (1.5+ supported)
Linux: Latest available from http://java.com/download (1.5+ supported)
FreeBSD: 1.5-compatible (NIO required)
Windows: Latest available from http://java.com/download (1.7+ supported)
Linux: Latest available from http://java.com/download (1.7+ supported)
FreeBSD: 1.7-compatible (NIO required)
Other operating systems and JVMs: See http://trac.i2p2.de/wiki/java
......@@ -40,6 +40,10 @@ Public domain except as listed below:
Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
See licenses/LICENSE-SHA256.txt
ElGamal:
Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org)
See licenses/LICENSE-SHA256.txt
AES code:
Copyright (c) 1995-2005 The Cryptix Foundation Limited.
See licenses/LICENSE-Cryptix.txt
......@@ -80,6 +84,10 @@ Public domain except as listed below:
Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
See licenses/LICENSE-LGPLv2.1.txt
HostnameVerifier:
From Apache HttpClient 4.4.1 and HttpCore 4.4.1
See licenses/LICENSE-Apache2.0.txt
Router (router.jar):
Public domain except as listed below:
......@@ -87,7 +95,7 @@ Public domain except as listed below:
From freenet
See licenses/LICENSE-GPLv2.txt
UPnP subsystem (CyberLink) 2.1:
UPnP subsystem (CyberLink) 3.0:
Copyright (C) 2003-2010 Satoshi Konno
See licenses/LICENSE-UPnP.txt
......@@ -95,9 +103,14 @@ Public domain except as listed below:
http://creativecommons.org/licenses/by-sa/3.0/
This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/
GeoIP API 1.3.1:
See licenses/LICENSE-LGPLv2.1.txt
Installer:
Launch4j 3.0.1:
(Launch4j is only included in the upstream source package and Windows binaries.
Not applicable for non-Windows binaries or Debian/Launchpad packages.)
Copyright (c) 2004, 2008 Grzegorz Kowal
See licenses/LICENSE-Launch4j.txt (in binary packages)
See installer/lib/launch4j/LICENSE.txt (in source packages)
......@@ -182,7 +195,18 @@ Applications:
By welterde.
See licenses/LICENSE-GPLv2.txt
Jetty 8.1.16.v20140903:
Imagegen:
Identicon:
Copyright (c) 2007-2014 Don Park <donpark@docuverse.com>
See licenses/LICENSE-Identicon.txt
RandomArt:
Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
Copyright (c) 2008 Alexander von Gernler. All rights reserved.
See licenses/LICENSE-BSD.txt
Zxing:
See licenses/LICENSE-Apache2.0.txt
Jetty 8.1.17.v20150415:
See licenses/ABOUT-Jetty.html
See licenses/NOTICE-Jetty.html
See licenses/LICENSE-Apache2.0.txt
......@@ -248,8 +272,8 @@ Applications:
Bundles systray4j-2.4.1:
See licenses/LICENSE-LGPLv2.1.txt
Tomcat 6.0.41:
Copyright 1999-2014 The Apache Software Foundation
Tomcat 6.0.44:
Copyright 1999-2015 The Apache Software Foundation
See licenses/LICENSE-Apache2.0.txt
See licenses/NOTICE-Tomcat.txt
......
Prerequisites to build from source:
Java SDK (preferably Oracle/Sun or OpenJDK) 1.6.0 or higher
Java SDK (preferably Oracle/Sun or OpenJDK) 1.7.0 or higher
Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
Certain subsystems for embedded (core, router, mstreaming, streaming, i2ptunnel) require only Java 1.6
Apache Ant 1.7.0 or higher
The xgettext, msgfmt, and msgmerge tools installed
from the GNU gettext package http://www.gnu.org/software/gettext/
Build environment must use a UTF-8 locale.
To build:
On x86 systems do:
......@@ -19,7 +21,8 @@ To build:
Documentation:
https://geti2p.net/how
API: run 'ant javadoc' then start at build/javadoc/index.html
API: http://docs.i2p-projekt.de/javadoc/
or run 'ant javadoc' then start at build/javadoc/index.html
Latest release:
https://geti2p.net/download
......@@ -34,6 +37,15 @@ Need help?
IRC irc.freenode.net #i2p
http://forum.i2p/
Bug reports:
https://trac.i2p2.de/report/1
Contact information, security issues, press inquiries:
https://geti2p.net/en/contact
Twitter:
@i2p, @geti2p
Licenses:
See LICENSE.txt
......@@ -66,7 +66,7 @@ public class Main {
}
static void wrtxt(OutputStream CMDout, String s) throws IOException {
CMDout.write(s.getBytes());
CMDout.write(DataHelper.getUTF8(s));
CMDout.write('\n');
CMDout.flush();
}
......
......@@ -63,7 +63,7 @@ public class Main {
}
static void wrtxt(OutputStream CMDout, String s) throws IOException {
CMDout.write(s.getBytes());
CMDout.write(DataHelper.getUTF8(s));
CMDout.write('\n');
CMDout.flush();
}
......
......@@ -38,7 +38,6 @@ import net.i2p.I2PAppContext;
import net.i2p.app.*;
import net.i2p.client.I2PClient;
import net.i2p.util.I2PAppThread;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer2;
/**
......@@ -144,6 +143,7 @@ public class BOB implements Runnable, ClientApp {
* Stop BOB gracefully
* @deprecated unused
*/
@Deprecated
public synchronized static void stop() {
if (_bob != null)
_bob.shutdown(null);
......@@ -214,9 +214,7 @@ public class BOB implements Runnable, ClientApp {
// Re-reading the config file in each thread is pretty damn stupid.
String configLocation = System.getProperty(PROP_CONFIG_LOCATION, "bob.config");
// This is here just to ensure there is no interference with our threadgroups.
SimpleScheduler Y1 = SimpleScheduler.getInstance();
SimpleTimer2 Y2 = SimpleTimer2.getInstance();
i = Y1.hashCode();
i = Y2.hashCode();
{
File cfg = new File(configLocation);
......@@ -250,11 +248,11 @@ public class BOB implements Runnable, ClientApp {
save = true;
}
if (!props.containsKey("inbound.length")) {
props.setProperty("inbound.length", "1");
props.setProperty("inbound.length", "3");
save = true;
}
if (!props.containsKey("outbound.length")) {
props.setProperty("outbound.length", "1");
props.setProperty("outbound.length", "3");
save = true;
}
if (!props.containsKey("inbound.lengthVariance")) {
......@@ -341,7 +339,7 @@ public class BOB implements Runnable, ClientApp {
if (g) {
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
Thread t = new Thread(conn_c);
Thread t = new I2PAppThread(conn_c);
t.setName("BOB.DoCMDS " + i);
t.start();
i++;
......
......@@ -25,12 +25,13 @@ import java.util.Locale;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PClientFactory;
//import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
//import net.i2p.i2ptunnel.I2PTunnel;
import net.i2p.util.I2PAppThread;
// needed only for debugging.
// import java.util.logging.Level;
// import java.util.logging.Logger;
......@@ -909,6 +910,8 @@ public class DoCMDS implements Runnable {
} else if (Command.equals(C_getnick)) {
// Get the NamedDB to work with...
boolean nsfail = false;
try {
database.getReadLock();
} catch (Exception ex) {
......@@ -919,6 +922,7 @@ public class DoCMDS implements Runnable {
ns = true;
} catch (RuntimeException b) {
try {
nsfail = true;
nns(out);
} catch (Exception ex) {
try {
......@@ -931,7 +935,7 @@ public class DoCMDS implements Runnable {
}
database.releaseReadLock();
if (ns) {
if (ns && !nsfail) {
try {
rlock();
} catch (Exception e) {
......@@ -1307,7 +1311,7 @@ public class DoCMDS implements Runnable {
// wait
}
tunnel = new MUXlisten(lock, database, nickinfo, _log);
Thread t = new Thread(tunnel);
Thread t = new I2PAppThread(tunnel);
t.start();
// try {
// Thread.sleep(1000 * 10); // Slow down the startup.
......
......@@ -18,10 +18,12 @@ package net.i2p.BOB;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.I2PAppThread;
/**
* Listen on I2P and connect to TCP
......@@ -30,16 +32,15 @@ import net.i2p.client.streaming.I2PSocketManager;
*/
public class I2Plistener implements Runnable {
private NamedDB info, database;
private Logger _log;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private AtomicBoolean lives;
private final NamedDB info, database;
private final Logger _log;
private final I2PServerSocket serverSocket;
private final AtomicBoolean lives;
/**
* Constructor
* @param SS
* @param S
* @param S unused
* @param info
* @param database
* @param _log
......@@ -48,7 +49,6 @@ public class I2Plistener implements Runnable {
this.database = database;
this.info = info;
this._log = _log;
this.socketManager = S;
this.serverSocket = SS;
this.lives = lives;
}
......@@ -79,7 +79,7 @@ public class I2Plistener implements Runnable {
conn++;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
Thread t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
t.start();
}
......
......@@ -19,7 +19,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.data.DataHelper;
import net.i2p.util.I2PAppThread;
/**
* Process I2P->TCP
......@@ -104,15 +107,15 @@ public class I2PtoTCP implements Runnable {
if (tell) {
// tell who is connecting
out.write(I2P.getPeerDestination().toBase64().getBytes());
out.write(DataHelper.getASCII(I2P.getPeerDestination().toBase64()));
out.write(10); // nl
out.flush(); // not really needed, but...
}
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout, lives); // app -> I2P
TCPio conn_a = new TCPio(Iin, out, lives); // I2P -> app
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new I2PAppThread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();
......
......@@ -21,11 +21,13 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PException;
import net.i2p.client.I2PClient;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
/**
......@@ -201,14 +203,14 @@ public class MUXlisten implements Runnable {
// I2P -> TCP
SS = socketManager.getServerSocket();
I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log, lives);
t = new Thread(tg, conn, "BOBI2Plistener " + N);
t = new I2PAppThread(tg, conn, "BOBI2Plistener " + N);
t.start();
}
if (come_in) {
// TCP -> I2P
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log, lives);
q = new Thread(tg, conn, "BOBTCPlistener " + N);
q = new I2PAppThread(tg, conn, "BOBTCPlistener " + N);
q.start();
}
......
......@@ -15,7 +15,6 @@
*/
package net.i2p.BOB;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer2;
/**
......@@ -31,12 +30,10 @@ public class Main {
*/
public static void main(String[] args) {
// THINK THINK THINK THINK THINK THINK
SimpleScheduler Y1 = SimpleScheduler.getInstance();
SimpleTimer2 Y2 = SimpleTimer2.getInstance();
BOB.main(args);
Y2.stop();
Y1.stop();
}
}
......@@ -64,7 +64,7 @@ public class NamedDB {
}
/**
* Find objects in the array, returns it's index or throws exception
* Find objects in the array, returns its index or throws exception
* @param key
* @return an objects index
* @throws ArrayIndexOutOfBoundsException when key does not exist
......
......@@ -20,8 +20,10 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.I2PAppThread;
/**
* Listen on TCP port and connect to I2P
......@@ -30,12 +32,11 @@ import net.i2p.client.streaming.I2PSocketManager;
*/
public class TCPlistener implements Runnable {
private NamedDB info, database;
private Logger _log;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private ServerSocket listener;
private AtomicBoolean lives;
private final NamedDB info, database;
private final Logger _log;
private final I2PSocketManager socketManager;
private final ServerSocket listener;
private final AtomicBoolean lives;
/**
* Constructor
......@@ -76,7 +77,7 @@ public class TCPlistener implements Runnable {
conn++;
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
Thread t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
......
......@@ -24,13 +24,14 @@ import java.net.NoRouteToHostException;
import java.net.Socket;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
//import net.i2p.i2ptunnel.I2PTunnel;
import net.i2p.I2PAppContext;
import net.i2p.util.I2PAppThread;
/**
*
......@@ -158,8 +159,8 @@ public class TCPtoI2P implements Runnable {
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout, lives); // app -> I2P
TCPio conn_a = new TCPio(Iin, out, lives); // I2P -> app
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new I2PAppThread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();
......
......@@ -34,15 +34,18 @@ import net.i2p.util.Log;
* The skeletal frame is here, just needs to be finished.
*
* @author sponge
* @deprecated incomplete, unused
*/
@Deprecated
public class UDPIOthread implements I2PSessionListener, Runnable {
private NamedDB info;
private Log _log;
private Socket socket;
private final NamedDB info;
private final Log _log;
private final Socket socket;
private DataInputStream in;
private DataOutputStream out;
private I2PSession _session;
private final I2PSession _session;
// FIXME never set
private Destination _peerDestination;
private boolean up;
......@@ -58,7 +61,6 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
this._log = _log;
this.socket = socket;
this._session = _session;
}
/**
......
......@@ -77,15 +77,15 @@
<!-- unused for now (except for Android), as we oddly ship addressbook as a .war -->
<target name="jar" depends="compile, changes">
<!-- set if unset -->
<property name="workspace.changes" value="" />
<property name="workspace.changes.tr" value="" />
<jar basedir="${build}" destfile="${dist}/${jar}">
<manifest>
<attribute name="Main-Class" value="addressbook.Daemon"/>
<attribute name="Main-Class" value="net.i2p.addressbook.Daemon"/>
<attribute name="Implementation-Version" value="${full.version}" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes}" />
<attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
</manifest>
</jar>
</target>
......
......@@ -27,8 +27,10 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Pattern;
import net.i2p.I2PAppContext;
import net.i2p.client.naming.HostTxtEntry;
import net.i2p.util.EepGet;
import net.i2p.util.SecureFile;
......@@ -37,18 +39,40 @@ import net.i2p.util.SecureFile;
* destinations. AddressBooks can be created from local and remote files, merged
* together, and written out to local files.
*
* Methods are NOT thread-safe.
*
* @author Ragnarok
*
*/
class AddressBook {
class AddressBook implements Iterable<Map.Entry<String, HostTxtEntry>> {
private final String location;
/** either addresses or subFile will be non-null, but not both */
private final Map<String, String> addresses;
private final Map<String, HostTxtEntry> addresses;
private final File subFile;
private boolean modified;
private static final boolean DEBUG = false;
private static final int MIN_DEST_LENGTH = 516;
private static final int MAX_DEST_LENGTH = MIN_DEST_LENGTH + 100; // longer than any known cert type for now
/**
* 5-67 chars lower/upper case
*/
private static final Pattern HOST_PATTERN =
Pattern.compile("^[0-9a-zA-Z\\.-]{5,67}$");
/**
* 52 chars lower/upper case
* Always ends in 'a' or 'q'
*/
private static final Pattern B32_PATTERN =
Pattern.compile("^[2-7a-zA-Z]{51}[aAqQ]$");
/** not a complete qualification, just a quick check */
private static final Pattern B64_PATTERN =
Pattern.compile("^[0-9a-zA-Z~-]{" + MIN_DEST_LENGTH + ',' + MAX_DEST_LENGTH + "}={0,2}$");
/**
* Construct an AddressBook from the contents of the Map addresses.
*
......@@ -56,7 +80,7 @@ class AddressBook {
* A Map containing human readable addresses as keys, mapped to
* base64 i2p destinations.
*/
public AddressBook(Map<String, String> addresses) {
public AddressBook(Map<String, HostTxtEntry> addresses) {
this.addresses = addresses;
this.subFile = null;
this.location = null;
......@@ -86,7 +110,7 @@ class AddressBook {
new File("addressbook.tmp").delete();
}
*/
static final long MAX_SUB_SIZE = 3 * 1024 * 1024l; //about 5,000 hosts
static final long MAX_SUB_SIZE = 5 * 1024 * 1024l; //about 8,000 hosts
/**
* Construct an AddressBook from the Subscription subscription. If the
......@@ -107,7 +131,7 @@ class AddressBook {
* @param proxyPort port number of proxy
*/
public AddressBook(Subscription subscription, String proxyHost, int proxyPort) {
Map<String, String> a = null;
Map<String, HostTxtEntry> a = null;
File subf = null;
try {
File tmp = SecureFile.createTempFile("addressbook", null, I2PAppContext.getGlobalContext().getTempDir());
......@@ -144,23 +168,40 @@ class AddressBook {
*/
public AddressBook(File file) {
this.location = file.toString();
Map<String, String> a;
Map<String, HostTxtEntry> a;
try {
a = ConfigParser.parse(file);
a = HostTxtParser.parse(file);
} catch (IOException exp) {
a = new HashMap<String, String>();
a = new HashMap<String, HostTxtEntry>();
}
this.addresses = a;
this.subFile = null;
}
/**
* Test only.
*
* @param testsubfile path to a file containing the simulated fetch of a subscription
* @since 0.9.26
*/
public AddressBook(String testsubfile) {
this.location = testsubfile;
this.addresses = null;
this.subFile = new File(testsubfile);
}
/**
* Return an iterator over the addresses in the AddressBook.
* @since 0.8.7
*/
public Iterator<Map.Entry<String, String>> iterator() {
if (this.subFile != null)
return new ConfigIterator(this.subFile);
public Iterator<Map.Entry<String, HostTxtEntry>> iterator() {
if (this.subFile != null) {
try {
return new HostTxtIterator(this.subFile);
} catch (IOException ioe) {
return new HostTxtIterator();
}
}
return this.addresses.entrySet().iterator();
}
......@@ -201,12 +242,9 @@ class AddressBook {
return "Map containing " + this.addresses.size() + " entries";
}
private static final int MIN_DEST_LENGTH = 516;
private static final int MAX_DEST_LENGTH = MIN_DEST_LENGTH + 100; // longer than any known cert type for now
/**
* Do basic validation of the hostname
* hostname was already converted to lower case by ConfigParser.parse()
* hostname was already converted to lower case by HostTxtParser.parse()
*/
public static boolean isValidKey(String host) {
return
......@@ -220,9 +258,10 @@ class AddressBook {
host.indexOf("..") < 0 &&
// IDN - basic check, not complete validation
(host.indexOf("--") < 0 || host.startsWith("xn--") || host.indexOf(".xn--") > 0) &&
host.replaceAll("[a-z0-9.-]", "").length() == 0 &&
HOST_PATTERN.matcher(host).matches() &&
// Base32 spoofing (52chars.i2p)
(! (host.length() == 56 && host.substring(0,52).replaceAll("[a-z2-7]", "").length() == 0)) &&
// We didn't do it this way, we use a .b32.i2p suffix, but let's prohibit it anyway
(! (host.length() == 56 && B32_PATTERN.matcher(host.substring(0,52)).matches())) &&
// ... or maybe we do Base32 this way ...
(! host.equals("b32.i2p")) &&
(! host.endsWith(".b32.i2p")) &&
......@@ -246,7 +285,7 @@ class AddressBook {
(dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) &&
// B64 comes in groups of 2, 3, or 4 chars, but never 1
((dest.length() % 4) != 1) &&
dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0
B64_PATTERN.matcher(dest).matches()
;
}
......@@ -267,15 +306,15 @@ class AddressBook {
public void merge(AddressBook other, boolean overwrite, Log log) {
if (this.addresses == null)
throw new IllegalStateException();
for (Iterator<Map.Entry<String, String>> iter = other.iterator(); iter.hasNext(); ) {
Map.Entry<String, String> entry = iter.next();
for (Iterator<Map.Entry<String, HostTxtEntry>> iter = other.iterator(); iter.hasNext(); ) {
Map.Entry<String, HostTxtEntry> entry = iter.next();
String otherKey = entry.getKey();
String otherValue = entry.getValue();
HostTxtEntry otherValue = entry.getValue();
if (isValidKey(otherKey) && isValidDest(otherValue)) {
if (isValidKey(otherKey) && isValidDest(otherValue.getDest())) {
if (this.addresses.containsKey(otherKey) && !overwrite) {
if (DEBUG && log != null &&
!this.addresses.get(otherKey).equals(otherValue)) {
!this.addresses.get(otherKey).equals(otherValue.getDest())) {
log.append("Conflict for " + otherKey + " from "
+ other.location
+ ". Destination in remote address book is "
......@@ -308,7 +347,7 @@ class AddressBook {
throw new IllegalStateException();
if (this.modified) {
try {
ConfigParser.write(this.addresses, file);
HostTxtParser.write(this.addresses, file);
} catch (IOException exp) {
System.err.println("Error writing addressbook " + file.getAbsolutePath() + " : " + exp.toString());
}
......@@ -332,4 +371,27 @@ class AddressBook {
protected void finalize() {
delete();
}
/****
public static void main(String[] args) {
String[] tests = { "foo.i2p",
"3bnipzzu67cdq2rcygyxz52xhvy6ylokn4zfrk36ywn6pixmaoza.b32.i2p",
"9rhEy4dT9fMlcSOhDzfWRxCV2aen4Zp4eSthOf5f9gVKMa4PtQJ-wEzm2KEYeDXkbM6wEDvMQ6ou4LIniSE6bSAwy7fokiXk5oabels-sJmftnQWRbZyyXEAsLc3gpJJvp9km7kDyZ0z0YGL5tf3S~OaWdptB5tSBOAOjm6ramcYZMWhyUqm~xSL1JyXUqWEHRYwhoDJNL6-L516VpDYVigMBpIwskjeFGcqK8BqWAe0bRwxIiFTPN6Ck8SDzQvS1l1Yj-zfzg3X3gOknzwR8nrHUkjsWtEB6nhbOr8AR21C9Hs0a7MUJvSe2NOuBoNTrtxT76jDruI78JcG5r~WKl6M12yM-SqeBNE9hQn2QCHeHAKju7FdRCbqaZ99IwyjfwvZbkiYYQVN1xlUuGaXrj98XDzK7GORYdH-PrVGfEbMXQ40KLHUWHz8w4tQXAOQrCHEichod0RIzuuxo3XltCWKrf1xGZhkAo9bk2qXi6digCijvYNaKmQdXZYWW~RtAAAA",
"6I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MMk7v5ufFKobLAX~1k-E4WVsJVlkYvkHVOjxix-uT1IdewKmLd81s5wZtz0GQ3ZC6p0C3S2cOxz7kQqf7QYSR0BrhZC~2du3-GdQO9TqNmsnHrah5lOZf0LN2JFEFPqg8ZB5JNm3JjJeSqePBRk3zAUogNaNK3voB1MVI0ZROKopXAJM4XMERNqI8tIH4ngGtV41SEJJ5pUFrrTx~EiUPqmSEaEA6UDYZiqd23ZlewZ31ExXQj97zvkuhKCoS9A9MNkzZejJhP-TEXWF8~KHur9f51H--EhwZ42Aj69-3GuNjsMdTwglG5zyIfhd2OspxJrXzCPqIV2sXn80IbPgwxHu0CKIJ6X43B5vTyVu87QDI13MIRNGWNZY5KmM5pilGP7jPkOs4xQDo4NHzpuJR5igjWgJIBPU6fI9Pzq~BMzjLiZOMp8xNWey1zKC96L0eX4of1MG~oUvq0qmIHGNa1TlUwBQAEAAEAAA==",
"x"
};
for (String s : tests) {
test(s);
}
}
public static void test(String s) {
System.out.println(s + " valid host? " + isValidKey(s) + " valid dest? " + isValidDest(s));
}
****/
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment