beginning of branch i2p.i2p.i2p

This commit is contained in:
cvs_import
2004-04-08 04:41:54 +00:00
committed by zzz
commit 77bd69c5e5
292 changed files with 41035 additions and 0 deletions

278
installer/doc/COPYING Normal file
View File

@@ -0,0 +1,278 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

View File

@@ -0,0 +1,10 @@
$Id$
the i2p/installer/ module is the root of the I2P
installer, and everything within it is released
according to the terms of the I2P license policy.
That means everything contained within the
i2p/installer module is released into the public
domain unless otherwise marked. Alternate licenses
that may be used include GPL, GPL + java exception,
BSD, Cryptix, and MIT.

77
installer/java/build.xml Normal file
View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="installer">
<target name="all" depends="clean, build" />
<target name="build" depends="builddep, jar" />
<target name="builddep">
<ant dir="../../core/java/" target="build" />
<ant dir="../../router/java/" target="build" />
<ant dir="../../apps/ministreaming/java/" target="build" />
<ant dir="../../apps/i2ptunnel/java/" target="build" />
</target>
<target name="compile">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac srcdir="./src" debug="true" destdir="./build/obj" />
</target>
<target name="jar" depends="installer, guiinstaller" />
<target name="fetchseeds" depends="compile">
<jar destfile="./build/fetchseeds.jar" >
<fileset dir="./build/obj" includes="FetchSeeds.class" />
<fileset file="../doc/COPYING" />
<manifest>
<attribute name="Main-Class" value="FetchSeeds" />
</manifest>
</jar>
</target>
<target name="installer" depends="compile, fetchseeds">
<jar destfile="./build/install.jar" >
<fileset dir="./build/obj" includes="*.class" />
<fileset dir="./src" includes="*.template" />
<fileset dir="./src" includes="install.config" />
<fileset file="./build/fetchseeds.jar" />
<fileset file="../../core/java/build/i2p.jar" />
<fileset file="../../router/java/build/router.jar" />
<fileset file="../../apps/ministreaming/java/build/mstreaming.jar" />
<fileset file="../../apps/i2ptunnel/java/build/i2ptunnel.jar" />
<fileset file="../doc/COPYING" />
<fileset file="../../readme.txt" />
<fileset file="../../hosts.txt" />
<manifest>
<attribute name="Main-Class" value="Install" />
</manifest>
</jar>
</target>
<target name="guiinstaller" depends="compile, fetchseeds">
<jar destfile="./build/guiinstall.jar" >
<fileset dir="./build/obj" includes="*.class" />
<fileset dir="./src" includes="*.template" />
<fileset dir="./src" includes="install.config" />
<fileset file="./build/fetchseeds.jar" />
<fileset file="../../core/java/build/i2p.jar" />
<fileset file="../../router/java/build/router.jar" />
<fileset file="../../apps/ministreaming/java/build/mstreaming.jar" />
<fileset file="../../apps/i2ptunnel/java/build/i2ptunnel.jar" />
<fileset file="../doc/COPYING" />
<fileset file="../../readme.txt" />
<fileset file="../../hosts.txt" />
<manifest>
<attribute name="Main-Class" value="GUIInstall" />
</manifest>
</jar>
</target>
<target name="clean">
<delete dir="./build" />
</target>
<target name="cleandep" depends="clean">
<ant dir="../../core/java/" target="cleandep" />
<ant dir="../../router/java/" target="cleandep" />
<ant dir="../../apps/ministreaming/java/" target="cleandep" />
<ant dir="../../apps/i2ptunnel/java/" target="cleandep" />
</target>
<target name="distclean" depends="clean">
<ant dir="../../core/java/" target="distclean" />
<ant dir="../../router/java/" target="distclean" />
<ant dir="../../apps/ministreaming/java/" target="distclean" />
<ant dir="../../apps/i2ptunnel/java/" target="distclean" />
</target>
</project>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 1.0//EN" "http://www.netbeans.org/dtds/attributes-1_0.dtd">
<attributes version="1.0">
<fileobject name="startRouter.sh.template">
<attr name="org.netbeans.modules.text.IsTextFile" boolvalue="true"/>
</fileobject>
</attributes>

View File

@@ -0,0 +1,67 @@
import java.io.*;
public class CliInstall extends Install {
private BufferedReader _in;
private PrintStream _out;
public CliInstall() {
_out = System.out;
_in = new BufferedReader(new InputStreamReader(System.in));
}
public void showStatus(String s) {
_out.println(s);
}
public void showOptError(String s) {
_out.println(s);
}
public void handleOptInfo(String s) {
_out.println(s);
}
public void startOptCategory(String s) {
_out.println("* "+s+"\n");
}
public void finishOptions() {}
public void handleOption(int number, String question,
String def, String type) {
Object value;
while(true) {
String answer;
_out.print(question+(def == null?"": (" ["+def+"]"))+": ");
answer = readLine();
if ("".equals(answer) && def != null) {
answer = def;
}
if (setOption(number,answer)) break;
}
}
public boolean confirmOption(String question, boolean defaultYes) {
_out.print(question);
return readBool(defaultYes);
}
private String readLine() {
try {
return _in.readLine().trim();
} catch (IOException ex) {
ex.printStackTrace();
System.exit(1);
return null;
}
}
private boolean readBool(boolean defaultYes) {
String str = readLine().toLowerCase();
if ("".equals(str)) return defaultYes;
return "yes".equals(str) || "y".equals(str) || "true".equals(str)
|| "ok".equals(str) || "sure".equals(str)
|| "whatever".equals(str);
}
}

View File

@@ -0,0 +1,86 @@
/*
* $Id $
* Copyright (c) 2003 mihi
* Licensed under the GNU Public License (GPL) as published by the
* Free Software Foundation, using version 2 or later of the GPL. You
* should have recieved the GPL with this source code, otherwise see
* http://www.fsf.org/copyleft/
*/
import java.io.*;
import java.net.*;
public class FetchSeeds {
/**
* Fetch seednodes.
*
* @param destination the dir to store the seednodes to
* @param sourceURL the URL to fetch the seednode from - must end
* with a slash
* @return whether new seed nodes could be fetched
*/
public static boolean fetchSeeds(File destination, String sourceURL) {
InputStream in = null;
try {
URL source = new URL(sourceURL);
URLConnection con = source.openConnection();
in = con.getInputStream();
BufferedReader br = new BufferedReader
(new InputStreamReader(in));
String line;
while ((line = br.readLine())!= null) {
int pos = line.indexOf(" <a href=\"routerInfo-");
if (pos == -1) continue;
line=line.substring(pos+10);
pos=line.indexOf("\"");
if (pos == -1) continue;
line=line.substring(0,pos);
fetchFile(new File(destination, line), sourceURL+line);
System.out.println(line);
}
br.close();
return true;
} catch (IOException ex) {
System.err.println("Unable to fetch seeds from " + sourceURL + ": " + ex.getMessage());
//ex.printStackTrace();
return false;
} finally {
if (in != null) try { in.close(); } catch (IOException ioe) {}
}
}
public static void fetchFile(File destFile, String fileURL)
throws IOException {
URL url = new URL(fileURL);
InputStream in = url.openStream();
OutputStream out = new FileOutputStream(destFile);
byte[] buf = new byte[1024];
int len;
while ((len=in.read(buf)) != -1) {
out.write(buf,0,len);
}
in.close();
out.flush();
out.close();
}
/**
* test main method.
*/
public static void main(String[] args) {
switch (args.length) {
case 1:
fetchSeeds(new File(args[0]), "http://i2p.dnsalias.net/i2pdb/");
return;
case 2:
fetchSeeds(new File(args[0]), args[1]);
return;
default:
System.out.println("Usage: FetchSeeds <outDir>");
System.out.println(" or FetchSeeds <outDir> <seedURL>");
System.out.println("The default seedURL is http://i2p.dnsalias.net/i2pdb/");
return;
}
}
}

View File

@@ -0,0 +1,338 @@
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
public class GUIInstall extends Install {
static final GridBagConstraints gbcLeft=new GridBagConstraints();
static final GridBagConstraints gbcRight=new GridBagConstraints();
static final GridBagConstraints gbcBottom=new GridBagConstraints();
static {
gbcLeft.anchor=GridBagConstraints.EAST;
gbcRight.fill=GridBagConstraints.HORIZONTAL;
gbcRight.gridwidth=GridBagConstraints.REMAINDER;
gbcRight.weightx=1.0;
gbcBottom.weighty=1.0;
gbcBottom.gridwidth=GridBagConstraints.REMAINDER;
gbcBottom.fill=GridBagConstraints.BOTH;
gbcBottom.insets=new Insets(4,4,4,4);
}
public static void main(String[] args) {
new GUIInstall().runInstall();
}
private InstallFrame frame;
boolean installing=false;
ArrayList categories = new ArrayList();
InstallCategory currentCategory = null;
public String handleSpliceParams(String s) {
// any better ideas?
return s;
}
public GUIInstall() {
frame = new InstallFrame();
}
public void showStatus(String s) {
if (!installing)
throw new RuntimeException("Not installing yet!");
frame.showStatus(s);
}
public void showOptError(String s) {
frame.showOptError(s);
}
public void handleOptInfo(String s) {
currentCategory.addInfo(s);
}
public void startOptCategory(String s) {
currentCategory = new InstallCategory();
categories.add(currentCategory);
}
public void finishOptions() {
frame.startInstall(categories);
System.out.println("Starting install...");
}
public void handleOption(int number, String question,
String def, String type) {
currentCategory.addOption(number, question, def, type);
}
public boolean confirmOption(String question, boolean defaultYes) {
ConfirmFrame cf = new ConfirmFrame(frame, question, defaultYes);
return cf.getResult();
}
private class ConfirmFrame extends Dialog {
private boolean result;
private ConfirmFrame(Frame parent, String msg,
boolean defaultYes) {
super(parent,"Installer question",true);
setBackground(Color.lightGray);
setLayout(new BorderLayout());
TextArea ta;
Panel p;
Button b1, b2;
add("Center", ta = new TextArea(msg, 3, 80));
ta.setEditable(false);
add("South", p = new Panel(new FlowLayout()));
p.add(b1 = new Button("Yes"));
p.add(b2 = new Button("No"));
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
result = evt.getActionCommand().equals("Yes");
ConfirmFrame.this.dispose();
}
};
b1.addActionListener(al);
b2.addActionListener(al);
pack();
// java 1.4
//setLocationRelativeTo(parent);
show();
(defaultYes?b1:b2).requestFocus();
}
private boolean getResult() {
return result;
}
}
private class InstallCategory extends ArrayList {
public void addInfo(String s) {
add(new InfoOption(s));
}
public void addOption(int number, String question,
String def, String type) {
add(new RealOption(number, question, def, type));
}
}
private interface InstallOption {
public Component getComponent1();
public Component getComponent2();
public boolean setValue();
public String getQuestion();
}
private class InfoOption extends Panel implements InstallOption {
public InfoOption(String s) {
super(new GridLayout(0,1,0,0));
for(StringTokenizer st = new StringTokenizer(s,"\n");
st.hasMoreTokens();) {
add(new Label(st.nextToken()));
}
}
public Component getComponent1() { return null;}
public Component getComponent2() { return this;}
public boolean setValue() {return true;}
public String getQuestion() { return "<no question>";}
}
private class RealOption implements InstallOption {
private int number;
private String def, question;
private Label l;
private TextField t;
public RealOption(int number, String question,
String def, String type) {
this.number = number;
l = new Label(question);
t = new TextField(def);
this.def=def;
this.question=question;
// type is not needed yet
}
public void reset() {t.setText(def);}
public String getQuestion() { return question; }
public boolean setValue() {
return GUIInstall.this.setOption(number, t.getText());
}
public Component getComponent1() { return l;}
public Component getComponent2() { return t;}
}
private class InstallFrame extends Frame {
private int current = -1;
private Panel cats;
private CardLayout cl;
private boolean windowOpen = true;
private TextArea log;
public InstallFrame() {
super("I2P Installer");
setBackground(Color.lightGray);
Panel p;
Button b;
setLayout(new BorderLayout());
add("Center", cats = new Panel(cl = new CardLayout()));
cats.add("Start", p= new Panel(new BorderLayout()));
p.add("Center", new Label("Loading installer..."));
cats.add("Install", p= new Panel(new BorderLayout()));
p.add("Center", log=new TextArea("Installing...\n\n"));
log.setEditable(false);
add("South", p = new Panel(new FlowLayout()));
p.add(b = new Button("<< Back"));
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (current > 0) {
current --;
cl.show(cats,""+current);
}
}
});
p.add(b = new Button("Next >>"));
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (current != -1) {
if (!saveCurrent()) return;
current ++;
if (current == categoryPanels.length) {
cl.show(cats,"Install");
current = -1;
synchronized(InstallFrame.this) {
installing=true;
windowOpen=false;
InstallFrame.this.notify();
}
} else {
cl.show(cats,""+current);
}
}
}
});
p.add(b = new Button("Quit"));
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.exit(0);
}
});
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
});
setSize(600,450);
// java 1.4
//setLocationRelativeTo(null);
show();
}
public void showStatus(String s) {
log.append(s+"\n");
}
public void showOptError(String s) {
if (current == -1) throw new RuntimeException("No options here!");
categoryPanels[current].showError(s);
}
private CategoryPanel[] categoryPanels;
public void startInstall(ArrayList categories) {
Panel p;
categoryPanels = new CategoryPanel[categories.size()];
//build a panel for each category
Iterator it = categories.iterator();
for (int i=0; it.hasNext(); i++) {
cats.add(""+i, categoryPanels[i] =
new CategoryPanel((InstallCategory)it.next()));
}
current = 0;
cl.show(cats,"0");
// wait till config is complete
synchronized(this) {
while(windowOpen) {
try {
wait();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
}
private boolean saveCurrent() {
return categoryPanels[current].saveOptions();
}
}
private class CategoryPanel extends Panel {
private TextArea errorBox;
private InstallCategory ic;
public CategoryPanel(InstallCategory ic) {
super(new GridBagLayout());
this.ic=ic;
for (Iterator it = ic.iterator(); it.hasNext();) {
InstallOption io = (InstallOption) it.next();
Component c1 = io.getComponent1(),
c2 = io.getComponent2();
if (c1 != null) add(c1, gbcLeft);
add(c2, gbcRight);
}
add (errorBox = new TextArea(), gbcBottom);
errorBox.setEditable(false);
}
private InstallOption currentOption;
public boolean saveOptions() {
errorBox.setText("Saving options...\n\n");
for (Iterator it = ic.iterator(); it.hasNext();) {
InstallOption io = (InstallOption) it.next();
currentOption=io;
if (!io.setValue()) return false;
currentOption= null;
}
return true;
}
public void showError(String s) {
if (currentOption==null) {
throw new RuntimeException("No option to test");
}
errorBox.append("While setting \""+currentOption.getQuestion()+
"\":\n"+s+"\n\n");
}
}
}

View File

@@ -0,0 +1,612 @@
/*
* free (adj.): unencumbered; not under the control of others
* Written by jrandom in 2003 and released into the public domain
* with no warranty of any kind, either expressed or implied.
* It probably won't make your computer catch on fire, or eat
* your children, but it might. Use at your own risk.
*
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
/**
* Please could someone write a real installer? Please.
* I should be shot for doing this.
*
* Note: this has dependencies upon how i2p/build.xml executes the "installer"
* task - namely that this class is in the jar "install.jar", and in that jar
* are the files COPYING, i2p.jar, i2ptunnel.jar, phttprelay.war, readme.txt,
* hosts.txt, and router.jar.
*
* Can you say "fragile code"?
* (oh well, enough caveats. commit)
*/
public abstract class Install {
private File _installDir;
private String _externalAddress;
private boolean _externalAddressIsReachable;
private int _inTCP;
private int _i2cpPort;
private String _phttpRegister;
private String _phttpSend;
private int _inBPS;
private int _outBPS;
private HashMap _answers;
private Properties _p;
private boolean _isWindows;
/**
* Show some installation status.
*/
public abstract void showStatus(String s);
/**
* Show an error when setting an option.
*/
public abstract void showOptError(String s);
/**
* Show some information about the following/preceding options
*/
public abstract void handleOptInfo(String s);
/**
* Start a new Option category
*/
public abstract void startOptCategory(String s);
/**
* Handle an option.
*/
public abstract void handleOption(int number, String question,
String def, String type);
/**
* Tell the installer that all options have been given.
* Install will not continue until this method has ended.
* When this method has ended, all options must have been set.
*/
public abstract void finishOptions();
/**
* Confirm an option. This can occur both while verifying options
* and later in the install process.
*/
public abstract boolean confirmOption(String question, boolean defaultYes);
public static void main(String args[]) {
Install install = new CliInstall();
install.runInstall();
}
public Install() {
_inTCP = -2;
_i2cpPort = -2;
_phttpRegister = null;
_phttpSend = null;
_inBPS = -2;
_outBPS = -2;
_externalAddressIsReachable = false;
}
public void runInstall() {
askQuestions();
detectOS();
configureAll();
createConfigFile();
createLoggerConfig();
createStartScript();
createReseedScript();
createEepProxyScript();
//createScripts("startSquid.sh", "startSquid.bat", 5555, "squid.i2p", "log-squid-#.txt", "Squid Proxy", "Squid proxying scripts written to startSquid");
createScripts("startIrcProxy.sh", "startIrcProxy.bat", 6668, "irc.duck.i2p", "log-irc-#.txt", "IRC Proxy", "IRC proxying scripts written to startIrcProxy", "Starting IRC proxy (when you see Ready! you can connect your IRC client to localhost:6668)");
//createScripts("startI2PCVSProxy.sh", "startI2PCVSProxy.bat", 2401, "i2pcvs.i2p", "log-i2pcvs-#.txt", "CVS Proxy", "Proxying scripts for I2P's CVS server written to startCVSProxy");
// only pulling them temporarily, duck, until the network is
// reliable enough
//createScripts("startJabber.sh", "startJabber.bat", 5222, "jabber.duck.i2p", "log-jabber-#.txt", "Jabber Proxy", "Squid proxying scripts written to startSquid");
//createScripts("startNntpProxy.sh", "startNntpProxy.bat", 1119, "nntp.duck.i2p", "log-nntp-#.txt", "NNTP Proxy","NNTP proxying scripts written to startNntpProxy");
createSeedNodes();
copyLibraries();
if (_isWindows) {
showStatus("To run the router, please run startRouter.bat in " + _installDir.getAbsolutePath());
} else {
showStatus("To run the router, please run startRouter.sh in " + _installDir.getAbsolutePath());
}
showStatus("");
}
private String numberTo4Digits(int number) {
String res = "0000"+number; // use four digit indices
return res.substring(res.length()-4);
}
private void askQuestions() {
try {
InputStream in =
Install.class.getResourceAsStream("/install.config");
_p = new Properties();
_p.load(in);
in.close();
} catch (IOException ex) {
ex.printStackTrace();
System.exit(1);
}
int count = Integer.parseInt(_p.getProperty("qs.count"));
_answers = new HashMap(count+count); // load factor is 0.75, so
// there is some room left
for (int i=1;i<=count;i++) {
String ii = numberTo4Digits(i);
String question = _p.getProperty("qs."+ii+".question"),
param = _p.getProperty("qs."+ii+".param"),
type = _p.getProperty("qs."+ii+".type"),
def = _p.getProperty("qs."+ii+".default");
if (question == null) continue;
if (type == null || "info".equals(type)) {
// just print some text
handleOptInfo(question);
} else if ("info_spliced".equals(type)) {
// splice in some params already queried
handleOptInfo(handleSpliceParams(question));
} else if ("category".equals(type)) {
startOptCategory(question);
} else if ("skip".equals(type)) {
i = Integer.parseInt(question)-1;
} else { // a real question
if ("<none>".equals(question)) {
if (!setOption(i, def))
throw new RuntimeException("Fixed and invalid value");
} else {
handleOption(i,question,def,type);
}
}
}
finishOptions();
}
public /* overridable */ String handleSpliceParams(String s) {
return spliceParams(s);
}
public boolean setOption(int number, String answer) {
String ii = numberTo4Digits(number);
String param = _p.getProperty("qs."+ii+".param"),
type = _p.getProperty("qs."+ii+".type");
Object value = getOptionValue(answer, type);
if (value == null) {
return false;
} else {
if (param == null || value == null)
throw new NullPointerException();
_answers.put(param,value);
return true;
}
}
private Object getOptionValue(String answer, String type) {
if ("string".equals(type)) {
// everything's okay till the very end
return answer;
} else if ("string>0".equals(type)) {
if (answer.length() > 0) {
return answer;
} else {
showOptError("Empty answers are not allowed.");
}
} else if ("directory".equals(type)) {
File f = new File(answer);
if (f.exists()) {
if (f.isDirectory()) {
showOptError("Using existing target directory " + f.getAbsolutePath());
return f;
} else {
showOptError("Location " + f.getAbsolutePath()+
" is not a directory. "+
"Lets try again");
}
} else {
boolean create = confirmOption
("Target directory " + f.getAbsolutePath() +
" does not exist - create? ", false);
if (!create) {
showOptError("Lets try that again");
} else {
boolean created = f.mkdirs();
if (created) {
showOptError("Target directory " +
f.getAbsolutePath() +
" created");
return f;
} else {
showOptError("Failed to create the "+
"directory. Lets choose "+
"another.");
}
}
}
} else if ("boolean".equals(type)) {
answer=answer.toLowerCase();
if ("yes".equals(answer) || "y".equals(answer))
answer="true";
if ("no".equals(answer) || "n".equals(answer))
answer="false";
if ("true".equals(answer) || "false".equals(answer)) {
return new Boolean("true".equals(answer));
}
showOptError("Incorrect boolean value, try `yes' <20>r `no'");
} else if ("numeric".equals(type) || "port".equals(type)) {
try {
int num = Integer.parseInt(answer);
if ("numeric".equals(type) ||
(num >0 && num < 65536)) {
return new Integer(num);
}
showOptError("Port number must be from 1 to 65535");
} catch (NumberFormatException ex) {
showOptError("Incorrect value: "+ex.getMessage());
}
} else if ("bandwidth".equals(type)) {
try {
answer = answer.toLowerCase();
int factor = 1;
// first check to see if it ends with m, k, or g
if (answer.endsWith("g"))
factor = 1024*1024*1024;
if (answer.endsWith("m"))
factor = 1024*1024;
if (answer.endsWith("k"))
factor = 1024;
if (factor > 1)
answer = answer.substring(0, answer.length()-1);
int val = factor * Integer.parseInt(answer);
if (val == -1 || val >0 ) {
return new Integer(val);
}
showOptError("Value must be -1 or positive.");
} catch (NumberFormatException ex) {
showOptError("Invalid number [" + answer + "]. Valid numbers are of the form -1, 42, 68k, 7m, 9g");
}
} else {
throw new RuntimeException ("cannot read installer option: " + type);
}
return null;
}
private String spliceParams(String s) {
StringBuffer txt = new StringBuffer(s.length()+100);
int ind;
while((ind = s.indexOf("##")) != -1) {
txt.append(s.substring(0,ind));
String temp = s.substring(ind+2);
ind = temp.indexOf("##");
if (ind == -1) throw new RuntimeException
("Incorrect info_spliced param");
s=temp.substring(ind+2);
Object value = _answers.get(temp.substring(0,ind));
if (value == null) {
System.err.println("ERROR: Could not insert parameter "+temp.substring(0,ind));
System.exit(1);
} else {
txt.append(value.toString());
}
}
txt.append(s);
return txt.toString();
}
private void detectOS() {
String os = System.getProperty("os.name");
if (os.toLowerCase().indexOf("win") != -1)
_isWindows = true;
else
_isWindows = false;
// yes, this treats pre-os-x macs as unix, and perhaps some
// windows-esque OSes don't have "win" in their name, or some
// unix-esque OS does. fix when it occurs.
}
private void configureAll() {
_installDir = (File) _answers.get("installDir");
_externalAddress = _answers.get("externalAddress").toString();
_externalAddressIsReachable = ((Boolean)_answers.get("externalAddressIsReachable")).booleanValue();
_inTCP=((Integer)_answers.get("inTCP")).intValue();
_phttpRegister = _answers.get("phttpRegister").toString();
_phttpSend = _answers.get("phttpSend").toString();
_i2cpPort = ((Integer)_answers.get("i2cpPort")).intValue();
_inBPS = ((Integer)_answers.get("inBPS")).intValue();
_outBPS = ((Integer)_answers.get("outBPS")).intValue();
}
private void useTemplate(String templateName, File destFile) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(destFile));
BufferedReader br = new BufferedReader
(new InputStreamReader
(Install.class.getResourceAsStream(templateName)));
String line;
while ((line = br.readLine()) != null) {
if (!line.startsWith("####")) {
bw.write(spliceParams(line));
bw.newLine();
}
}
br.close();
bw.close();
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(0);
}
}
private void createLoggerConfig() {
boolean verbose = ((Boolean)_answers.get("verboseLogs")).booleanValue();
createLogConfigOptions(verbose);
File logCfgFile = new File(_installDir, "logger.config");
useTemplate("logger.config.template",logCfgFile);
}
private void createSeedNodes() {
showStatus("To connect to I2P, you will need a reference to at least one other I2P router");
showStatus("Rather than bundle some (soon to be out of date) references with the software, ");
showStatus("you can either run the included reseed script or get get your own references ");
showStatus("from some out of band location. ");
showStatus("");
showStatus("The reseed script simply connects to http://i2p.net/i2pdb/ and downloads all");
showStatus("of the routerInfo-*.dat files and save them into " + (new File(_installDir, "i2pdb")).getAbsolutePath());
showStatus("That ../i2pdb/ directory is simply a mirror of one router's netDb directory, so those files");
showStatus("can come from anyone else too");
showStatus("");
showStatus("You can run the reseed script or download references (from your friends, etc) as often");
showStatus("as you like without restarting your router. If you find your netDb directory to have ");
showStatus("only one file in it (thats your router info), you will need more peers to get anything done.");
showStatus("");
boolean reseed = confirmOption("Do you want to run the reseed script now? ", true);
if (reseed) {
reseed();
} else {
showStatus("Ok ok, not reseeding - but please reseed before running the router");
}
}
private void reseed() {
try {
URL dir = new URL("http://i2p.net/i2pdb/");
String content = new String(readURL(dir));
Set urls = new HashSet();
int cur = 0;
while (true) {
int start = content.indexOf("href=\"routerInfo-", cur);
if (start < 0)
break;
int end = content.indexOf(".dat\">", start);
String name = content.substring(start+"href=\"routerInfo-".length(), end);
urls.add(name);
cur = end + 1;
}
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
fetchSeed((String)iter.next());
}
} catch (Throwable t) {
t.printStackTrace();
showStatus("Error reseeding - " + t.getMessage());
}
}
private void fetchSeed(String peer) throws Exception {
URL url = new URL("http://i2p.net/i2pdb/routerInfo-" + peer + ".dat");
showStatus("Fetching seed from " + url.toExternalForm());
byte data[] = readURL(url);
writeSeed(peer, data);
}
private byte[] readURL(URL url) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
URLConnection con = url.openConnection();
InputStream in = con.getInputStream();
byte buf[] = new byte[1024];
while (true) {
int read = in.read(buf);
if (read < 0)
break;
baos.write(buf, 0, read);
}
in.close();
return baos.toByteArray();
}
private void writeSeed(String name, byte data[]) throws Exception {
File netDbDir = new File(_installDir, "netDb");
if (!netDbDir.exists())
netDbDir.mkdirs();
FileOutputStream fos = new FileOutputStream(new File(netDbDir, "routerInfo-" + name + ".dat"));
fos.write(data);
fos.close();
}
private void copyLibraries() {
File libDir = new File(_installDir, "lib");
if (!libDir.exists()) {
boolean libCreated = libDir.mkdirs();
if (!libCreated) {
showStatus("Error creating library directory " + libDir.getAbsolutePath());
return;
}
}
showStatus("Installing the libraries into " + libDir.getAbsolutePath());
int cnt = Integer.parseInt(_p.getProperty("libs.count"));
try {
for (int i=1;i<=cnt;i++) {
String ii = numberTo4Digits(i),
file = _p.getProperty("libs."+ii+".name");
boolean isLib = "true".equals(_p.getProperty("libs."+ii+".islib"));
InputStream is = Install.class.getResourceAsStream("/"+file);
if (is == null) throw new IOException("Resource /"+file+" not found");
copyFile(is, file, isLib?libDir:_installDir);
}
} catch (IOException ioe) {
showStatus("Error extracting the libraries: " + ioe.getMessage());
}
File dbDir = new File(_installDir, "netDb");
dbDir.mkdirs();
File logDir = new File(_installDir, "logs");
logDir.mkdirs();
}
private void copyFile(InputStream in, String name, File destDir) {
File destFile = new File(destDir, name);
try {
byte buf[] = new byte[16*1024];
FileOutputStream out = new FileOutputStream(destFile);
while (true) {
int read = in.read(buf);
if (read == -1)
break;
out.write(buf, 0, read);
}
in.close();
out.close();
showStatus("Installed file " + destFile.getName() + " in " + destFile.getParent());
} catch (IOException ioe) {
showStatus("Error saving " + name + " to " + destFile.getAbsolutePath() + ": " + ioe.getMessage());
}
}
private void createLogConfigOptions(boolean verbose) {
_answers.put("_logger_level", verbose?"DEBUG":"INFO");
_answers.put("_logger_level2", verbose?"WARN":"ERROR");
StringBuffer buf = new StringBuffer();
if (!verbose) {
// overrides for particularly chatty classes
_answers.put("_logger_notverbose",
"logger.record.net.i2p.router.transport.Triv=ERROR"+NL+
"logger.record.net.i2p.router.transport.Band=ERROR"+NL+
"logger.record.net.i2p.crypto=ERROR" +NL+
"logger.record.net.i2p.crypto.DH=ERROR");
} else {
_answers.put("_logger_notverbose","");
}
}
private void createScripts(String unixName, String windowsName, int listenPort, String targetDest, String logfilePattern, String windowTitle, String message, String scriptMessage) {
createScripts(unixName, windowsName, "client "+listenPort+" "+targetDest, logfilePattern, windowTitle, message, scriptMessage);
}
private void createScripts(String unixName, String windowsName, String command, String logfilePattern, String windowTitle, String message, String scriptMessage) {
_answers.put("_scripts_port", ""+_i2cpPort);
_answers.put("_scripts_cmd", command);
_answers.put("_scripts_logname", logfilePattern);
_answers.put("_scripts_winttl", windowTitle);
_answers.put("_scripts_message", scriptMessage);
if (_isWindows) {
File windowsFile = new File(_installDir, windowsName);
useTemplate("startFoo.bat.template", windowsFile);
} else {
File unixFile = new File(_installDir, unixName);
useTemplate("startFoo.sh.template", unixFile);
chmodaplusx(unixFile);
}
showStatus(message);
}
private void createEepProxyScript() {
StringBuffer buf = new StringBuffer(512);
buf.append("Eepsite proxying scripts written to startEepProxy").append(NL);
buf.append("IMPORTANT: While this installer packages the latest hosts.txt file available at the time ($Date: 2004/03/25 00:56:23 $), ").append(NL);
buf.append("a more recently updated one may be available. You can check for updates by fetching the file ").append(NL);
buf.append("http://i2p.net/i2p/hosts.txt and saving it in ").append(_installDir.getAbsolutePath()).append(NL);
buf.append("Or, of course, you can edit and update hosts.txt yourself to include mappings of your liking").append(NL);
createScripts("startEepProxy.sh", "startEepProxy.bat", "httpclient 4444", "log-eepProxy-#.txt", "Eep Proxy", buf.toString(), "Starting EepProxy (when you see Ready, set your browsers HTTP proxy to localhost:4444)");
}
private void createReseedScript() {
if (_isWindows) {
File windowsFile = new File(_installDir, "reseed.bat");
useTemplate("reseed.bat.template", windowsFile);
} else {
File unixFile = new File(_installDir, "reseed.sh");
useTemplate("reseed.sh.template", unixFile);
chmodaplusx(unixFile);
}
}
private void chmodaplusx(File f) {
try {
Runtime.getRuntime().exec("chmod a+x " + f.getAbsolutePath());
} catch (IOException ioe) {
showStatus("Error setting "+f.getName()+" as executable");
}
}
private void createStartScript() {
_answers.put("_scripts_installdir", _installDir.getAbsolutePath());
if (_isWindows) {
File windowsFile = new File(_installDir, "startRouter.bat");
useTemplate("startRouter.bat.template", windowsFile);
} else {
File unixFile = new File(_installDir, "startRouter.sh");
useTemplate("startRouter.sh.template", unixFile);
File unixStopFile = new File(_installDir, "stopRouter.sh");
useTemplate("stopRouter.sh.template", unixStopFile);
chmodaplusx(unixFile);
chmodaplusx(unixStopFile);
}
}
private void createConfigFile() {
File configFile = new File(_installDir, "router.config");
setConfigFileOptions();
useTemplate("router.config.template", configFile);
showStatus("Router configuration file written to " + configFile.getAbsolutePath());
showStatus("");
}
private final static String NL = System.getProperty("line.separator");
private void setConfigFileOptions() {
// set fields needed for the config template
_answers.put("NOW", new Date().toString());
if (_inTCP <= 0) {
_answers.put("_router_hn", "#i2np.tcp.hostname=[externally reachable hostname or IP address goes here]");
_answers.put("_router_port", "#i2np.tcp.port=[TCP/IP port number]");
_answers.put("_router_lavalid","#i2np.tcp.listenAddressIsValid=[true/false for whether your external address is locally reachable]");
_answers.put("_router_tcpdisable","#i2np.tcp.disable=[true/false for whether you want absolutely no tcp connections to be established (forcing phttp, etc)])");
} else {
_answers.put("_router_hn","i2np.tcp.hostname="+_externalAddress);
_answers.put("_router_port","i2np.tcp.port="+_inTCP);
_answers.put("_router_lavalid","i2np.tcp.listenAddressIsValid="+_externalAddressIsReachable);
_answers.put("_router_tcpdisable","i2np.tcp.disable=false");
}
if ( (_phttpRegister == null) || (_phttpSend == null) ) {
_answers.put("_router_phttpreg","#i2np.phttp.registerURL=[full URL to a PHTTP registration server, e.g. http://someHost:8080/phttprelay/phttpRegister]");
_answers.put("_router_phttpsend","#i2np.phttp.sendURL=[full URL to a PHTTP relay server, e.g. http://someHost:8080/phttprelay/phttpSend]");
} else {
_answers.put("_router_phttpreg","i2np.phttp.registerURL="+_phttpRegister);
_answers.put("_router_phttpsend","i2np.phttp.sendURL="+_phttpSend);
}
_answers.put("_router_i2cp_port",""+_i2cpPort);
_answers.put("_router_inbps",""+(_inBPS*60));
_answers.put("_router_outbps",""+(_outBPS*60));
}
}

View File

@@ -0,0 +1,108 @@
# config file for the installer
# intention for this file is that a gui installer can use the same
# settings as the cli installer
qs.count=50
qs.0001.question=General settings
qs.0001.type=category
qs.0002.question=Installation directory
qs.0002.param=installDir
qs.0002.type=directory
qs.0002.default=.
qs.0003.question=
qs.0006.question=Network settings
qs.0006.type=category
qs.0007.question=Currently, to use I2P you must have a publicly reachable TCP/IP address \nthat you can receive new connections on. This means that if you're\nbehind a firewall or NAT, you will have to poke a hole in it for the \ninbound TCP port (which you'll specify in a moment), and if you have DHCP,\nyou must use a service like dyndns.org and specify that hostname as your\nexternal address.
qs.0007.type=info
qs.0008.question=External address
qs.0008.param=externalAddress
qs.0008.type=string>0
qs.0009.question=Note to advanced users: the default settings bind any TCP listeners to \nall local IP addresses, but you can have it bind to a specific one if necessary\nPlease see the router.config for the options i2np.tcp.listenAddressIsValid
qs.0009.type=info
qs.0010.question=<none>
qs.0010.param=externalAddressIsReachable
qs.0010.type=boolean
qs.0010.default=false
qs.0011.question=Inbound TCP port? (any unused port will do, just pick a number)
qs.0011.param=inTCP
qs.0011.type=port
qs.0011.default=8887
qs.0012.question=If you have a NAT or firewall, please be sure port ##inTCP## is open and can receive inbound connections!
qs.0012.type=info_spliced
qs.0015.question=<none>
qs.0015.param=phttpRegister
qs.0015.type=string>0
qs.0015.default=http://i2p.net:8080/phttprelay/phttpRegister
qs.0016.question=<none>
qs.0016.param=phttpSend
qs.0016.type=string>0
qs.0016.default=http://i2p.net:8080/phttprelay/phttpSend
qs.0017.question=<none>
qs.0017.param=i2cpPort
qs.0017.type=port
qs.0017.default=7654
qs.0018.question=
qs.0019.question=40
qs.0019.type=skip
## leave some numbers free, for future additions
## bandwidth questions, skipped over
qs.0030.question=Bandwidth limits
qs.0030.type=category
qs.0031.question=These bandwidth limits are fairly hard and unforgiving.\nWe do our best to not let any data beyond these limits be transferred at all, ever.\nSo keep that in mind, and set the limits to the upper bounds of what you can handle.\n\nPlease take note that these bandwidth limits are currently very, very strict, and the network itself does not consume\nmuch bandwidth. Everything will stop transferring data without warning if the limits are met - you really should set\nthis to -1 for now, at least until the new classed bandwidth limiter is implemented (currently planned for the 0.3.2 release)
qs.0031.type=info
qs.0032.question=
qs.0033.question=Inbound bytes per second: (e.g. 16K, 16384, or -1 for unlimited)
qs.0033.param=inBPS
qs.0033.type=bandwidth
qs.0033.default=-1
qs.0034.question=Outbound bytes per second: (e.g. 16K, 16384, or -1 for unlimited)
qs.0034.param=outBPS
qs.0034.type=bandwidth
qs.0034.default=-1
qs.0035.question=
qs.0036.question=45
qs.0036.type=skip
qs.0040.question=<none>
qs.0040.param=inBPS
qs.0040.default=-1
qs.0040.type=numeric
qs.0041.question=<none>
qs.0041.param=outBPS
qs.0041.default=-1
qs.0041.type=numeric
qs.0042.question=45
qs.0042.type=skip
qs.0045.question=<none>
#qs.0045.question=Do you want very verbose debug logs when running the router by default (y/n)
qs.0045.param=verboseLogs
qs.0045.default=no
qs.0045.type=boolean
qs.0050.question=End of configuration.
libs.count=8
libs.0001.name=i2p.jar
libs.0001.islib=true
libs.0002.name=i2ptunnel.jar
libs.0002.islib=true
libs.0003.name=router.jar
libs.0003.islib=true
libs.0004.name=fetchseeds.jar
libs.0004.islib=true
libs.0005.name=COPYING
libs.0005.islib=false
libs.0006.name=readme.txt
libs.0006.islib=false
libs.0007.name=hosts.txt
libs.0007.islib=false
libs.0008.name=mstreaming.jar
libs.0008.islib=true

View File

@@ -0,0 +1,66 @@
# I2P Log Configuration File
# Format:
# d = date
# c = class or log name
# t = thread name
# p = priority level of the log record
# m = message
logger.format=d p [t] c: m
# Date format:
# uses the java.text.SimpleDateFormat
logger.dateFormat=HH:mm:ss.SSS
# Log file name:
# This is the log file name before being rotated
# '#' is replaced with the current log number for that day
# If # is not specified, logs are not rotated
logger.logFileName=log-#.txt
# Log file size:
# Maximum size of each log file:
# 32g <-- 32 gigabytes (32*1024*1024*1024 bytes)
# 10m <-- 10 megabytes (10*1024*1024 bytes)
# 66k <-- 66 kilobytes (66*1024 bytes)
# 42 <-- 42 bytes
logger.logFileSize=3m
# Log rotation limit:
# Maximum number of logs to keep per day - lower log numbers
# are reused once the limit is reached. Ignored if there is no
# '#' in the logFileName.
logger.logRotationLimit=3
# Display on screen:
# In addition to the logging, send filtered log messages to the
# standard output
# true or false
logger.displayOnScreen=true
# Default level:
# Define the minimum log level to be displayed unless
# specified otherwise.
#
# Log levels, from least severe to most, are:
# DEBUG : verbose debugging info
# INFO : component status messages
# WARN : bad situation but recoverable
# ERROR : component error
# CRIT : your hard drive is on fire
#
# Less severe levels always include more severe ones (e.g.
# if you're listening to debug messages, you'll get info messages
# too)
logger.defaultLevel=##_logger_level##
# Minimum log level for a record to be displayed on the screen
# This check occurs after other filters occur, and only affects what is
# show on console, and only does anything if displayOnScreen=true
logger.minimumOnScreenLevel=DEBUG
# Records:
# Override the defaultLevel for all classes under the given package
# or class
logger.record.net.i2p=##_logger_level2##
##_logger_notverbose##

View File

@@ -0,0 +1,3 @@
cd ##_scripts_installdir##
java -jar lib\fetchseeds.jar netDb
pause

View File

@@ -0,0 +1,4 @@
#!/bin/sh
cd ##_scripts_installdir##
java -jar lib/fetchseeds.jar netDb
echo Router network database reseeded

View File

@@ -0,0 +1,152 @@
# I2P router configuration
# Created on ##NOW##
# TCP configuration, for inbound TCP/IP connections
##_router_hn##
##_router_port##
##_router_lavalid##
# unless you really really know what you're doing, keep listenAddressIsValid=false
##_router_tcpdisable##
# maximum number of TCP connections we will want to
# attempt to establish at once (each of which
# requires a 2048bit DH exchange)
i2np.tcp.concurrentEstablishers=5
# Polling HTTP configuration, which is used to keep your router's clock in sync
# [also for communication when no inbound connections are possible, once its fixed up again]
##_router_phttpreg##
##_router_phttpsend##
# The following option specifies whether the router wants to keep the router's internal time in sync
# with the PHTTP relay's clock (which should be NTP synced). If however you are sure your local machine
# always has the correct time, you can set this to false (but your clock MUST be synced - see
# http://wiki.invisiblenet.net/iip-wiki?I2PTiming for more info.
i2np.phttp.trustRelayTime=true
# I2CP client port, for client connections
i2cp.port=##_router_i2cp_port##
# I2P router administrative web port (currently only responds to /routerConsole.html)
router.adminPort=7655
# Bandwidth limits
# These limits are for all i2np connections - tcp or whatever
# They are hard enforced with no smoothing.
# XXX Until the 0.3.2 release, these should NOT BE USED. Their values will be ignored!!!
i2np.bandwidth.inboundBytesPerMinute=##_router_inbps##
i2np.bandwidth.outboundBytesPerMinute=##_router_outbps##
# Publish peer rankings
# If true, include the current liveliness and reliability rankings in one's published RouterInfo data
# Setting this to true will help debug the network and is especially useful while we'return still testing
# However, traffic analysis may be easier with this data published (though there's no reason to think people
# can't just fake the info in this).
# Since we're still very much < 1.0, this will be true for the current release by default. As we get some
# network helth information and tune the ranking algorithms, this will become false by default.
# You, of course, can change this to either true or false whenever you'd like. This is only read
# on router startup though, so you need to restart the router if you change it.
router.publishPeerRankings=true
# Keep message history
# This series of options can help out in debugging the network by keeping a
# seperate log of all messages sent over the network (but without any personally identifiable information)
# This is entirely optional, but would be greatly appreciated during the
# development phase of the network since it would allow the developers to detect
# errors much more easily
router.keepHistory=false
# Submit message history
# This option works only if router.keepHistory is true and periodically sends
# in the router history logs to the developers (specifically, it submits the file
# via HTTP POST to http://i2p.net/cgi-bin/submitMessageHistory - you can see a sample of what
# one of those files looks like at http://i2p.net/~jrandom/sampleHist.txt)
# After submitting this file, it deletes the local copy (otherwise the file will grow
# without bound - tens of MB per day)
# Again, this is entirely optional, but would be greatly appreciated as it should help
# out the development process
router.submitHistory=false
# If your router is really slow, you'll need to update the following job parameters
# limit the maximum number of concurrent operations
router.maxJobRunners=1
# if a job waits more than this amount of time (in
# milliseconds) before running, spit out a warning
router.jobLagWarning=8000
# if a job waits more than this amount of time (in
# milliseconds) before running, kill the router
router.jobLagFatal=30000
# if a job takes more than this amount of time (in
# milliseconds) to run, spit out a warning
router.jobRunWarning=8000
# if a job takes more than this amount of time (in
# milliseconds) to run, kill the router
router.jobRunFatal=30000
# wait until the router has been up for this long
# (in milliseconds) before honoring any fatalities
# since during startup, jobs are run sequentially
# and CPU intensive tasks are needed
router.jobWarmupTime=600000
# Target clients
# How many concurrent clients the router should prepare for
# This, factored in with the tunnel settings, determines the size of the pools -
# too many, and your machine consumes excessive CPU and bandwidth, too few and your
# clients take too long to startup.
# e.g. If you are running an eepsite, an eepProxy, an irc proxy, and a squid proxy, set this to 4
router.targetClients=2
# Number of inbound tunnels per client
# This determines how many inbound tunnels will be allocated per client at a time.
# This is a key factor in the reliability of a client receiving messages
# As above, too many and your machine gets hosed, too few and the pool is slow.
# 2 should be sufficient - prior to 0.2.5, we have all had only 1
tunnels.numInbound=2
# Number of outbound tunnels per client
# This determines how many outbound tunnels must exist when a client is in operation.
# XXX Not currently enforced - ignore this setting
tunnels.numOutbound=2
# Depth of inbound tunnels
# This determines the length of inbound tunnels created - how many remote routers to
# include (0 means no remote routers, 3 means a total of four routers, including
# the local one, etc). This is a key factor in the reliability and anonymity
# provided by I2P
# Users should simply leave this as 2 for now, at least until the tunnels are more reliable (post 0.3)
tunnels.depthInbound=2
# Depth of outbound tunnels
# This determines the length of outbound tunnels created - how many remote routers to
# include (0 means no remote routers, 3 means a total of four routers, including
# the local one, etc). This is a key factor in the reliability and anonymity
# provided by I2P
# Users should simply leave this as 2 for now, at least until the tunnels are more reliable (post 0.3)
tunnels.depthOutbound=2
# Tunnel duration
# This determines how long tunnels we create should last for (in milliseconds). Too
# long and they are more prone to failure, too short and people need to do more network
# database lookups. The default of 10 minutes (600000 ms) should be used
# You should not change this setting unless you really know what you're doing
tunnels.tunnelDuration=600000
# Max waiting jobs
# If your router is getting heavily overloaded (due to slow CPU or excess network
# activity), your router's performance will seriously degrade, increasing its
# load further and delaying any messages sent through your router. The max waiting
# jobs configuration parameter is a throttle, saying that if there are more than
# that many 'jobs' that want to run ASAP at any given time, additional jobs may
# be summarily dropped. That will reduce your load and cause others to reduce
# their dependence on you (further reducing your load). The default value of 20
# should be sufficient, but may be increased if desired. Less than 20 is not
# recommended, as certain normal events can queue up 10 or so jobs at a time
# (all of which only take a few milliseconds). Leave this alone unless you know
# what you're doing
router.maxWaitingJobs=20

View File

@@ -0,0 +1,5 @@
@echo off
title ##_scripts_winttl##
cd ##_scripts_installdir##
echo ##_scripts_message##
java -DloggerFilenameOverride=logs\##_scripts_logname## -Djava.library.path=. -Dcrypto.dh.precalc.min=0 -cp lib\mstreaming.jar;lib\i2p.jar -jar lib\i2ptunnel.jar -nocli -e "config localhost ##_scripts_port##" -e "##_scripts_cmd##"

View File

@@ -0,0 +1,6 @@
#!/bin/sh
cd ##_scripts_installdir##
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
nohup nice java -DloggerFilenameOverride=logs/##_scripts_logname## -Djava.library.path=. -Dcrypto.dh.precalc.min=0 -cp lib/mstreaming.jar:lib/i2p.jar -jar lib/i2ptunnel.jar -nocli -e "config localhost ##_scripts_port##" -e "##_scripts_cmd##" > /dev/null &
echo '##_scripts_message##'

View File

@@ -0,0 +1,9 @@
@echo off
title I2P Router
cd ##_scripts_installdir##
REM the -XX args are workarounds for bugs in java 1.4.2's garbage collector
REM replace java with javaw if you don't want a window to pop up
java -cp lib\i2p.jar;lib\router.jar -Djava.library.path=. -DloggerFilenameOverride=logs\log-router-#.txt -XX:NewSize=4M -XX:MaxNewSize=8M -XX:PermSize=8M -XX:MaxPermSize=32M net.i2p.router.Router
pause

View File

@@ -0,0 +1,8 @@
#!/bin/sh
cd ##_scripts_installdir##
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
# the -XX args are workarounds for bugs in java 1.4.2's garbage collector
nohup nice java -cp lib/i2p.jar:lib/router.jar -Djava.library.path=. -DloggerFilenameOverride=logs/log-router-#.txt -XX:NewSize=4M -XX:MaxNewSize=8M -XX:PermSize=8M -XX:MaxPermSize=32M net.i2p.router.Router --quiet > /dev/null &
# Save the pid just in case we ever want to stop the router
echo $! > router.pid
echo I2P Router started

View File

@@ -0,0 +1,3 @@
#!/bin/sh
cd ##_scripts_installdir##
kill `cat router.pid`