2008-01-02 zzz

* Add stats.i2p to the jump list
    * Impose 20MB limit on POSTs and catch OOMs in POST
    * eepsite_index.html: add stats.i2p services
    * addressbook: log source of new keys; disallow dests > 516 bytes
    * addressbook: convert hostnames to lower case to prevent duplicates
    * susidns: generalize references to orion
This commit is contained in:
zzz
2008-01-02 22:08:48 +00:00
committed by zzz
parent 62b18b18b5
commit 5195a5c1fc
8 changed files with 77 additions and 38 deletions

View File

@ -170,7 +170,7 @@ public class AddressBook {
String otherKey = (String) otherIter.next();
String otherValue = (String) other.addresses.get(otherKey);
if (otherKey.endsWith(".i2p") && otherValue.length() >= 516) {
if (otherKey.endsWith(".i2p") && otherValue.length() == 516) {
if (this.addresses.containsKey(otherKey) && !overwrite) {
if (!this.addresses.get(otherKey).equals(otherValue)
&& log != null) {
@ -185,7 +185,7 @@ public class AddressBook {
this.modified = true;
if (log != null) {
log.append("New address " + otherKey
+ " added to address book.");
+ " added to address book. From: " + other.location);
}
}
}

View File

@ -60,6 +60,7 @@ public class ConfigParser {
* a single key, value pair on each line, in the format: key=value. Lines
* starting with '#' or ';' are considered comments, and ignored. Lines that
* are obviously not in the format key=value are also ignored.
* The key is converted to lower case.
*
* @param input
* A BufferedReader with lines in key=value format to parse into
@ -77,7 +78,7 @@ public class ConfigParser {
inputLine = ConfigParser.stripComments(inputLine);
String[] splitLine = inputLine.split("=");
if (splitLine.length == 2) {
result.put(splitLine[0].trim(), splitLine[1].trim());
result.put(splitLine[0].trim().toLowerCase(), splitLine[1].trim());
}
inputLine = input.readLine();
}
@ -301,4 +302,4 @@ public class ConfigParser {
new FileWriter(file, false)));
}
}
}

View File

@ -131,6 +131,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"Your browser is misconfigured. Do not use the proxy to access the router console or other localhost destinations.<BR>")
.getBytes();
private final static int MAX_POSTBYTES = 20*1024*1024; // arbitrary but huge - all in memory, no temp file
private final static byte[] ERR_MAXPOST =
("HTTP/1.1 503 Bad POST\r\n"+
"Content-Type: text/html; charset=iso-8859-1\r\n"+
"Cache-control: no-cache\r\n"+
"\r\n"+
"<html><body><H1>I2P ERROR: REQUEST DENIED</H1>"+
"The maximum POST size is " + MAX_POSTBYTES + " bytes.<BR>")
.getBytes();
/** used to assign unique IDs to the threads / clients. no logic or functionality */
private static volatile long __clientId = 0;
@ -503,12 +513,25 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
if (_log.shouldLog(Log.DEBUG))
_log.debug(getPrefix(requestId) + "NewRequest header: [" + newRequest.toString() + "]");
int postbytes = 0;
while (br.ready()) { // empty the buffer (POST requests)
int i = br.read();
if (i != -1) {
newRequest.append((char) i);
if (++postbytes > MAX_POSTBYTES) {
if (out != null) {
out.write(ERR_MAXPOST);
out.write("<p /><i>Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
}
s.close();
return;
}
}
}
if (method == null || destination == null) {
l.log("No HTTP method found in the request.");
if (out != null) {
@ -578,6 +601,12 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
l.log(ex.getMessage());
handleHTTPClientException(ex, out, targetRequest, usingWWWProxy, currentProxy, requestId);
closeSocket(s);
} catch (OutOfMemoryError oom) { // mainly for huge POSTs
IOException ex = new IOException("OOM (in POST?)");
_log.info("getPrefix(requestId) + Error trying to connect", ex);
l.log(ex.getMessage());
handleHTTPClientException(ex, out, targetRequest, usingWWWProxy, currentProxy, requestId);
closeSocket(s);
}
}
@ -616,10 +645,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
}
}
private static String jumpServers[] = {"http://orion.i2p/jump/",
"http://trevorreznik.i2p/cgi-bin/jump.php?hostname=",
"http://i2host.i2p/cgi-bin/i2hostjump?"
private static String jumpServers[] = {
"http://i2host.i2p/cgi-bin/i2hostjump?",
"http://orion.i2p/jump/",
"http://stats.i2p/cgi-bin/jump.cgi?a=",
"http://trevorreznik.i2p/cgi-bin/jump.php?hostname="
};
private static void writeErrorMessage(byte[] errMessage, OutputStream out, String targetRequest,
boolean usingWWWProxy, String wwwProxy, boolean showAddrHelper) throws IOException {

View File

@ -52,14 +52,13 @@
<h3>Huh? what addressbook?</h3>
<p>
The addressbook application is part of your i2p installation. It regularly updates your hosts.txt file
from distributed sources. It keeps your hosts.txt up to date, so it automatically contains all new
eepsites announced on <a href="http://orion.i2p">orion</a>
or in the <a href="http://forum.i2p/viewforum.php?f=16">forum</a>.
from distributed sources. It keeps your hosts.txt up to date, so it can automatically add
eepsites announced on other sites if you subscribe to those sites' addressbooks.
</p>
<p>
(To speak the truth: In its default configuration the addressbook does not poll
orion, but dev.i2p only. Subscribing to <a href="http://orion.i2p">orion</a> is an easy task,
just add <a href="http://orion.i2p/hosts.txt">http://orion.i2p/hosts.txt</a> to your <a href="subscriptions.jsp">subscriptions</a> file.)
additional sites, but dev.i2p only. Subscribing to additional sites is an easy task,
just add them to your <a href="subscriptions.jsp">subscriptions</a> file.)
</p>
<p>If you have questions about naming in i2p, there is an excellent <a href="http://forum.i2p.net/viewtopic.php?t=134">introduction</a>
from duck in the forum.</p>

View File

@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Revision: 1.7 $
* $Revision: 1.1 $
*/
%>
<%@ page contentType="text/html"%>
@ -66,9 +66,8 @@
<p class="help">
The subscription file contains a list of (i2p) URLs. The addressbook application
regularly (once per hour) checks this list for new eepsites. Those URLs simply contain the published hosts.txt
file of other people. Default subscription is the hosts.txt from dev.i2p. The most
popular collaboration site for eepsite is orion.i2p. So its a good idea to add http://orion.i2p/hosts.txt
as a 2nd subscription.
file of other people. The default subscription is the hosts.txt from dev.i2p, which is updated infrequently.
So it is a good idea to add additional subscriptions to sites that have the latest addresses.
</p>
</div>
<div id="footer">

View File

@ -1,4 +1,12 @@
$Id: history.txt,v 1.608 2007-12-29 18:59:26 zzz Exp $
$Id: history.txt,v 1.609 2007-12-29 22:45:12 zzz Exp $
2008-01-02 zzz
* Add stats.i2p to the jump list
* Impose 20MB limit on POSTs and catch OOMs in POST
* eepsite_index.html: add stats.i2p services
* addressbook: log source of new keys; disallow dests > 516 bytes
* addressbook: convert hostnames to lower case to prevent duplicates
* susidns: generalize references to orion
2007-12-29 zzz
* Tweak IRC inbound PONG filtering to fix xchat/BitchX lagometers

View File

@ -14,16 +14,15 @@
<a href="http://localhost:7657/i2ptunnel/edit.jsp?tunnel=3">configuration page</a>).
The instructions below detail how to assign a name like "mysite.i2p" to your key and
start up your eepsite.</p>
<p>You can also reach your eepsite locally through
<a href="http://localhost:7658/">http://localhost:7658/</a>. If you
want to change the port number, edit the file ./eepsite/jetty.xml and
update the I2PTunnel configuration accordingly.</p>
<p>You can reach your eepsite locally through
<a href="http://localhost:7658/">http://localhost:7658/</a>.
</p>
<h2>Step-by-step instructions for starting your new eepsite and announcing it to the I2P community</h2>
Your eepsite is stopped by default.
After you start it, it will be difficult for other people to find because it
doesn't have a name and they don't have your really long Base64 key.
You could just tell people that really long key but thankfully i2p has an address book
You could just tell people that really long key, but thankfully i2p has an address book
and several easy ways to tell people about your eepsite. Here's detailed instructions.
<ul>
<li>Pick a name for your eepsite (<i>something</i>.i2p). Use all lower-case.
@ -52,44 +51,47 @@
<li>Before you tell the world about your new eepsite, you should add some content.
Go to i2p/eepsite/docroot and copy this document (index.html) to help.html so you can refer to it later.
Now edit index.html and add content, pictures, and whatever you would like to share.
<li>Now it's time to add your eepsite to an I2P address book
such as <a href="http://orion.i2p/">orion.i2p</a> or
<a href="http://trevorreznik.i2p/">trevorreznik.i2p</a>.
<li>Now it's time to add your eepsite to an I2P address book hosted by a site
such as <a href="http://stats.i2p/">stats.i2p</a>.
That is, you must enter
your eepsite name and key into a web interface on one or more of these sites.
Here is <a href="http://orion.i2p/list/">the key entry form at orion.i2p</a> and
Here is <a href="http://stats.i2p/i2p/addkey.html">the key entry form at stats.i2p</a>,
here is <a href="http://orion.i2p/list/">the key entry form at orion.i2p</a> and
here is <a href="http://trevorreznik.i2p/host-database/">the key entry form at trevorreznik.i2p</a>.
Again, your key is the entire "Local destination" key on the
<a href="http://localhost:7657/i2ptunnel/edit.jsp?tunnel=3">eepsite i2ptunnel configuration page</a>.
Be sure you get the whole thing, ending with "AAAA".
Don't forget to click "add a key".
Check to see if it reports the key was added.
Since many routers periodically get address book updates from orion or trevorreznik, within several hours others will be able to find your
Since many routers periodically get address book updates from these sites, within several hours others will be able to find your
website by simply typing <i>something</i>.i2p into their browser.
<li>Speaking of address book updates, this would be a good time to add orion, trevorreznik, or both
<li>Speaking of address book updates, this would be a good time to add some more addressbooks
to your own subscription list. Go to your <a href="http://localhost:7657/susidns/subscriptions.jsp">subscriptions configuration page</a>
and add <a href="http://orion.i2p/hosts.txt">http://orion.i2p/hosts.txt</a> and/or
<a href="http://trevorreznik.i2p/hosts.txt">http://trevorreznik.i2p/hosts.txt</a> to the list and hit "Save".
and add a couple of these -
<a href="http://orion.i2p/hosts.txt">http://orion.i2p/hosts.txt</a>,
<a href="http://tino.i2p/hosts.txt">http://tino.i2p/hosts.txt</a>,
<a href="http://stats.i2p/newhosts.txt">http://stats.i2p/newhosts.txt</a>,
<a href="http://trevorreznik.i2p/hosts.txt">http://trevorreznik.i2p/hosts.txt</a> and hit "Save".
Now you will get updates too!
<li>If you are in a hurry and can't wait a few hours, you can tell people to use a "jump" address helper redirection service.
This will work within a few minutes of your entering the key to an address book.
Test it yourself first by entering http://orion.i2p/jump/<i>something</i>.i2p
or http://trevorreznik.i2p/cgi-bin/jump.php?hostname=<i>something</i>.i2p/ into your browser.
or http://stats.i2p/cgi-bin/jump.cgi?a=<i>something</i>.i2p or
or http://trevorreznik.i2p/cgi-bin/jump.php?hostname=<i>something</i>.i2p into your browser.
Once it's working, then you can tell others to use it.
<li>Some people check <a href="http://orion.i2p/list/">orion.i2p/list/</a> and
<li>Some people check eepsite lists such as
<a href="http://inproxy.tino.i2p/status.php">inproxy.tino.i2p/status.php</a> for new eepsites, so you may start getting
a few visitors. But there are plenty of other ways to tell people. Here are a few ideas:
<ul>
<li>Post a message on the <a href="http://forum.i2p/viewforum.php?f=16">Eepsite announce forum</a>
on <a href="http://forum.i2p/">forum.i2p</a>.
<li>Tell people about it on the #i2p or #i2p-chat channels on IRC.
<li>Put it in a new post on <a href="syndie.i2p.net">the new Syndie</a>.
<li>Put it in a new post on <a href="http://syndie.i2p.net">the new Syndie</a>.
<li>Put it in <a href="http://ugha.i2p/EepsiteIndex">Ugha's Eepsite Index Wiki</a>
</ul>
Note that some sites recommend pasting in that really long destination key.
You can if you want - but
if you have successfully posted your key at <a href="http://orion.i2p/list/">orion</a> or
<a href="http://trevorreznik.i2p/host-database/">trevorreznik</a>,
if you have successfully posted your key at an add-key service,
tested it using a jump service, and waited 24 hours for the
address book update to propagate to others, that shouldn't be necessary.
<li>If you have any questions try IRC #i2p or the

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.543 $ $Date: 2007-12-29 18:59:24 $";
public final static String ID = "$Revision: 1.544 $ $Date: 2007-12-29 22:45:09 $";
public final static String VERSION = "0.6.1.30";
public final static long BUILD = 15;
public final static long BUILD = 16;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);