diff --git a/apps/BOB/nbproject/private/private.xml b/apps/BOB/nbproject/private/private.xml
index c1f155a78..2482568bf 100644
--- a/apps/BOB/nbproject/private/private.xml
+++ b/apps/BOB/nbproject/private/private.xml
@@ -1,4 +1,7 @@
+
+ file:/root/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/MUXlisten.java
+
diff --git a/apps/BOB/src/net/i2p/BOB/BOB.java b/apps/BOB/src/net/i2p/BOB/BOB.java
index 3ca733158..f08d27c2f 100644
--- a/apps/BOB/src/net/i2p/BOB/BOB.java
+++ b/apps/BOB/src/net/i2p/BOB/BOB.java
@@ -23,6 +23,7 @@
*/
package net.i2p.BOB;
+import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -34,6 +35,8 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
+
+import net.i2p.I2PAppContext;
import net.i2p.client.I2PClient;
import net.i2p.client.streaming.RetransmissionTimer;
import net.i2p.util.Log;
@@ -185,16 +188,19 @@ public class BOB {
i = Y2.hashCode();
try {
{
+ File cfg = new File(configLocation);
+ if (!cfg.isAbsolute())
+ cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
try {
- FileInputStream fi = new FileInputStream(configLocation);
+ FileInputStream fi = new FileInputStream(cfg);
props.load(fi);
fi.close();
} catch (FileNotFoundException fnfe) {
- warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
+ warn("Unable to load up the BOB config file " + cfg.getAbsolutePath() + ", Using defaults.");
warn(fnfe.toString());
save = true;
} catch (IOException ioe) {
- warn("IOException on BOB config file " + configLocation + ", using defaults.");
+ warn("IOException on BOB config file " + cfg.getAbsolutePath() + ", using defaults.");
warn(ioe.toString());
}
}
@@ -227,13 +233,16 @@ public class BOB {
props.setProperty(PROP_BOB_HOST, "localhost");
}
if (save) {
+ File cfg = new File(configLocation);
+ if (!cfg.isAbsolute())
+ cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
try {
- warn("Writing new defaults file " + configLocation);
- FileOutputStream fo = new FileOutputStream(configLocation);
- props.store(fo, configLocation);
+ warn("Writing new defaults file " + cfg.getAbsolutePath());
+ FileOutputStream fo = new FileOutputStream(cfg);
+ props.store(fo, cfg.getAbsolutePath());
fo.close();
} catch (IOException ioe) {
- error("IOException on BOB config file " + configLocation + ", " + ioe);
+ error("IOException on BOB config file " + cfg.getAbsolutePath() + ", " + ioe);
}
}
diff --git a/apps/addressbook/java/src/addressbook/AddressBook.java b/apps/addressbook/java/src/addressbook/AddressBook.java
index a46c256c8..2694cae78 100644
--- a/apps/addressbook/java/src/addressbook/AddressBook.java
+++ b/apps/addressbook/java/src/addressbook/AddressBook.java
@@ -94,20 +94,21 @@ public class AddressBook {
* @param proxyPort port number of proxy
*/
public AddressBook(Subscription subscription, String proxyHost, int proxyPort) {
+ File tmp = new File(I2PAppContext.getGlobalContext().getTempDir(), "addressbook.tmp");
this.location = subscription.getLocation();
EepGet get = new EepGet(I2PAppContext.getGlobalContext(), true,
- proxyHost, proxyPort, 0, -1l, MAX_SUB_SIZE, "addressbook.tmp", null,
+ proxyHost, proxyPort, 0, -1l, MAX_SUB_SIZE, tmp.getAbsolutePath(), null,
subscription.getLocation(), true, subscription.getEtag(), subscription.getLastModified(), null);
if (get.fetch()) {
subscription.setEtag(get.getETag());
subscription.setLastModified(get.getLastModified());
}
try {
- this.addresses = ConfigParser.parse(new File("addressbook.tmp"));
+ this.addresses = ConfigParser.parse(tmp);
} catch (IOException exp) {
this.addresses = new HashMap();
}
- new File("addressbook.tmp").delete();
+ tmp.delete();
}
/**
diff --git a/apps/addressbook/java/src/addressbook/Daemon.java b/apps/addressbook/java/src/addressbook/Daemon.java
index a1b1ae18a..a8a9a2da6 100644
--- a/apps/addressbook/java/src/addressbook/Daemon.java
+++ b/apps/addressbook/java/src/addressbook/Daemon.java
@@ -28,6 +28,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import net.i2p.I2PAppContext;
+
/**
* Main class of addressbook. Performs updates, and runs the main loop.
*
@@ -125,11 +127,13 @@ public class Daemon {
public void run(String[] args) {
String settingsLocation = "config.txt";
- String home;
+ File homeFile;
if (args.length > 0) {
- home = args[0];
+ homeFile = new File(args[0]);
+ if (!homeFile.isAbsolute())
+ homeFile = new File(I2PAppContext.getGlobalContext().getRouterDir(), args[0]);
} else {
- home = ".";
+ homeFile = new File(System.getProperty("user.dir"));
}
Map defaultSettings = new HashMap();
@@ -145,7 +149,6 @@ public class Daemon {
defaultSettings.put("last_modified", "last_modified");
defaultSettings.put("update_delay", "12");
- File homeFile = new File(home);
if (!homeFile.exists()) {
boolean created = homeFile.mkdirs();
if (created)
@@ -169,7 +172,7 @@ public class Daemon {
delay = 1;
}
- update(settings, home);
+ update(settings, homeFile.getAbsolutePath());
try {
synchronized (this) {
wait(delay * 60 * 60 * 1000);
diff --git a/apps/desktopgui/build.xml b/apps/desktopgui/build.xml
index 795edf046..8138f14c5 100644
--- a/apps/desktopgui/build.xml
+++ b/apps/desktopgui/build.xml
@@ -77,11 +77,13 @@
+
+
diff --git a/apps/desktopgui/nbproject/project.properties b/apps/desktopgui/nbproject/project.properties
index fb880932f..a02ea8207 100644
--- a/apps/desktopgui/nbproject/project.properties
+++ b/apps/desktopgui/nbproject/project.properties
@@ -22,6 +22,7 @@ dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.appframework.jar=lib/appframework.jar
file.reference.i2p.jar=../../core/java/build/i2p.jar
+file.reference.i2ptunnel.jar=../i2ptunnel/java/build/i2ptunnel.jar
file.reference.router.jar=../../router/java/build/router.jar
file.reference.routerconsole.jar=../routerconsole/java/build/routerconsole.jar
file.reference.swing-worker.jar=lib/swing-worker.jar
@@ -32,7 +33,8 @@ javac.classpath=\
${file.reference.appframework.jar}:\
${file.reference.swing-worker.jar}:\
${file.reference.i2p.jar}:\
- ${file.reference.routerconsole.jar}
+ ${file.reference.routerconsole.jar}:\
+ ${file.reference.i2ptunnel.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/desktopgui/GUIVersion.java b/apps/desktopgui/src/net/i2p/desktopgui/desktopgui/GUIVersion.java
index 10a6e5293..21f0e04cf 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/desktopgui/GUIVersion.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/desktopgui/GUIVersion.java
@@ -10,5 +10,5 @@ package net.i2p.desktopgui.desktopgui;
* @author mathias
*/
public class GUIVersion {
- public static final String VERSION = "0.0.1.3";
+ public static final String VERSION = "0.0.2";
}
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/ClientTunnelWindow.form b/apps/desktopgui/src/net/i2p/desktopgui/gui/ClientTunnelWindow.form
new file mode 100644
index 000000000..0f07284d5
--- /dev/null
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/ClientTunnelWindow.form
@@ -0,0 +1,396 @@
+
+
+
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/ClientTunnelWindow.java b/apps/desktopgui/src/net/i2p/desktopgui/gui/ClientTunnelWindow.java
new file mode 100644
index 000000000..b7102b3ce
--- /dev/null
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/ClientTunnelWindow.java
@@ -0,0 +1,434 @@
+/*
+ * ClientTunnelWindow.java
+ *
+ * Created on 10-jun-2009, 16:49:12
+ */
+
+package net.i2p.desktopgui.gui;
+
+import net.i2p.i2ptunnel.web.EditBean;
+import java.awt.event.ActionListener;
+
+/**
+ *
+ * @author mathias
+ */
+public class ClientTunnelWindow extends javax.swing.JFrame {
+
+ /** Creates new form ClientTunnelWindow */
+ public ClientTunnelWindow(int tunnelNumber, ActionListener al) {
+ initComponents();
+ this.tunnelNumber = tunnelNumber;
+ this.al = al;
+ extraInitComponents();
+ this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+ this.setSize(600, 600);
+ this.setLocationRelativeTo(null);
+ this.requestFocus();
+ this.changeTunnelState.setVisible(false); //TODO: implement tunnel state change
+ this.setVisible(true);
+ }
+
+ public void extraInitComponents() {
+ EditBean bean = new EditBean();
+ if(!bean.isClient(tunnelNumber)) {
+ this.dispose();
+ }
+ else {
+ this.tunnelName.setText(bean.getTunnelName(tunnelNumber));
+ this.tunnelType.setText(bean.getTunnelType(tunnelNumber));
+ this.tunnelPort.setText(bean.getClientPort(tunnelNumber));
+ this.tunnelDestination.setText(bean.getClientDestination(tunnelNumber));
+
+ if(bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
+ tunnelProfile.setVisible(false);
+ tunnelProfileLabel.setVisible(false);
+ this.delayConnect.setVisible(false);
+ this.sharedClient.setVisible(false);
+ this.autoStart.setVisible(false);
+ }
+ else {
+ if(bean.isInteractive(tunnelNumber)) {
+ tunnelProfile.setSelectedIndex(TUNNEL_INTERACTIVE);
+ }
+ else {
+ tunnelProfile.setSelectedIndex(TUNNEL_BULK);
+ }
+
+ this.delayConnect.setSelected(bean.shouldDelay(tunnelNumber));
+ this.sharedClient.setSelected(bean.isSharedClient(tunnelNumber));
+ this.autoStart.setSelected(bean.startAutomatically(tunnelNumber));
+ }
+
+ this.tunnelDepth.setSelectedIndex(bean.getTunnelDepth(tunnelNumber, 2));
+
+ int variance = bean.getTunnelVariance(tunnelNumber, 0);
+ if(variance == 0) {
+ this.depthVariance.setSelectedIndex(0);
+ }
+ else if(variance == 1) {
+ this.depthVariance.setSelectedIndex(1);
+ }
+ else if(variance == 2) {
+ this.depthVariance.setSelectedIndex(2);
+ }
+ else if(variance == -1) {
+ this.depthVariance.setSelectedIndex(3);
+ }
+ else if(variance == -2) {
+ this.depthVariance.setSelectedIndex(4);
+ }
+
+ int tunnelQuantity = bean.getTunnelQuantity(tunnelNumber, 2) - 1;
+ if(tunnelQuantity >= 0 && tunnelQuantity <= 2) {
+ this.tunnelCount.setSelectedIndex(tunnelQuantity);
+ }
+
+ int backupTunnelQuantity = bean.getTunnelBackupQuantity(tunnelNumber, 0);
+ if(backupTunnelQuantity >= 0 && backupTunnelQuantity <= 3) {
+ this.backupTunnelCount.setSelectedIndex(backupTunnelQuantity);
+ }
+
+
+ if(bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
+ this.reduceIdle.setVisible(false);
+ this.closeIdle.setVisible(false);
+ this.delayIdle.setVisible(false);
+ }
+ else {
+ this.reduceIdle.setSelected(bean.getReduce(tunnelNumber));
+ this.closeIdle.setSelected(bean.getClose(tunnelNumber));
+ this.delayIdle.setSelected(bean.getDelayOpen(tunnelNumber));
+ }
+ }
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ tunnelNameLabel = new javax.swing.JLabel();
+ tunnelTypeLabel = new javax.swing.JLabel();
+ tunnelPortLabel = new javax.swing.JLabel();
+ tunnelDestinationLabel = new javax.swing.JLabel();
+ tunnelProfileLabel = new javax.swing.JLabel();
+ delayConnect = new javax.swing.JCheckBox();
+ sharedClient = new javax.swing.JCheckBox();
+ autoStart = new javax.swing.JCheckBox();
+ jSeparator1 = new javax.swing.JSeparator();
+ tunnelDepthLabel = new javax.swing.JLabel();
+ depthVarianceLabel = new javax.swing.JLabel();
+ tunnelCountLabel = new javax.swing.JLabel();
+ backupTunnelCountLabel = new javax.swing.JLabel();
+ jSeparator2 = new javax.swing.JSeparator();
+ reduceIdle = new javax.swing.JCheckBox();
+ closeIdle = new javax.swing.JCheckBox();
+ delayIdle = new javax.swing.JCheckBox();
+ jSeparator3 = new javax.swing.JSeparator();
+ save = new javax.swing.JButton();
+ cancel = new javax.swing.JButton();
+ tunnelName = new javax.swing.JTextField();
+ tunnelType = new javax.swing.JLabel();
+ tunnelPort = new javax.swing.JTextField();
+ tunnelDestination = new javax.swing.JTextField();
+ tunnelProfile = new javax.swing.JComboBox();
+ tunnelDepth = new javax.swing.JComboBox();
+ depthVariance = new javax.swing.JComboBox();
+ tunnelCount = new javax.swing.JComboBox();
+ backupTunnelCount = new javax.swing.JComboBox();
+ changeTunnelState = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(ClientTunnelWindow.class);
+ setTitle(resourceMap.getString("Form.title")); // NOI18N
+ setName("Form"); // NOI18N
+ getContentPane().setLayout(null);
+
+ tunnelNameLabel.setText(resourceMap.getString("tunnelNameLabel.text")); // NOI18N
+ tunnelNameLabel.setName("tunnelNameLabel"); // NOI18N
+ getContentPane().add(tunnelNameLabel);
+ tunnelNameLabel.setBounds(20, 20, 120, 17);
+
+ tunnelTypeLabel.setText(resourceMap.getString("tunnelTypeLabel.text")); // NOI18N
+ tunnelTypeLabel.setName("tunnelTypeLabel"); // NOI18N
+ getContentPane().add(tunnelTypeLabel);
+ tunnelTypeLabel.setBounds(20, 50, 120, 17);
+
+ tunnelPortLabel.setText(resourceMap.getString("tunnelPortLabel.text")); // NOI18N
+ tunnelPortLabel.setName("tunnelPortLabel"); // NOI18N
+ getContentPane().add(tunnelPortLabel);
+ tunnelPortLabel.setBounds(20, 80, 110, 17);
+
+ tunnelDestinationLabel.setText(resourceMap.getString("tunnelDestinationLabel.text")); // NOI18N
+ tunnelDestinationLabel.setName("tunnelDestinationLabel"); // NOI18N
+ getContentPane().add(tunnelDestinationLabel);
+ tunnelDestinationLabel.setBounds(20, 110, 110, 17);
+
+ tunnelProfileLabel.setText(resourceMap.getString("tunnelProfileLabel.text")); // NOI18N
+ tunnelProfileLabel.setName("tunnelProfileLabel"); // NOI18N
+ getContentPane().add(tunnelProfileLabel);
+ tunnelProfileLabel.setBounds(20, 140, 110, 17);
+
+ delayConnect.setText(resourceMap.getString("delayConnect.text")); // NOI18N
+ delayConnect.setName("delayConnect"); // NOI18N
+ getContentPane().add(delayConnect);
+ delayConnect.setBounds(20, 170, 160, 22);
+
+ sharedClient.setText(resourceMap.getString("sharedClient.text")); // NOI18N
+ sharedClient.setName("sharedClient"); // NOI18N
+ getContentPane().add(sharedClient);
+ sharedClient.setBounds(20, 200, 160, 22);
+
+ autoStart.setText(resourceMap.getString("autoStart.text")); // NOI18N
+ autoStart.setName("autoStart"); // NOI18N
+ getContentPane().add(autoStart);
+ autoStart.setBounds(20, 230, 160, 22);
+
+ jSeparator1.setName("jSeparator1"); // NOI18N
+ getContentPane().add(jSeparator1);
+ jSeparator1.setBounds(0, 510, 750, 10);
+
+ tunnelDepthLabel.setText(resourceMap.getString("tunnelDepthLabel.text")); // NOI18N
+ tunnelDepthLabel.setName("tunnelDepthLabel"); // NOI18N
+ getContentPane().add(tunnelDepthLabel);
+ tunnelDepthLabel.setBounds(20, 280, 160, 17);
+
+ depthVarianceLabel.setText(resourceMap.getString("depthVarianceLabel.text")); // NOI18N
+ depthVarianceLabel.setName("depthVarianceLabel"); // NOI18N
+ getContentPane().add(depthVarianceLabel);
+ depthVarianceLabel.setBounds(20, 310, 160, 17);
+
+ tunnelCountLabel.setText(resourceMap.getString("tunnelCountLabel.text")); // NOI18N
+ tunnelCountLabel.setName("tunnelCountLabel"); // NOI18N
+ getContentPane().add(tunnelCountLabel);
+ tunnelCountLabel.setBounds(20, 340, 160, 17);
+
+ backupTunnelCountLabel.setText(resourceMap.getString("backupTunnelCountLabel.text")); // NOI18N
+ backupTunnelCountLabel.setName("backupTunnelCountLabel"); // NOI18N
+ getContentPane().add(backupTunnelCountLabel);
+ backupTunnelCountLabel.setBounds(20, 370, 170, 17);
+
+ jSeparator2.setName("jSeparator2"); // NOI18N
+ getContentPane().add(jSeparator2);
+ jSeparator2.setBounds(0, 260, 750, 10);
+
+ reduceIdle.setText(resourceMap.getString("reduceIdle.text")); // NOI18N
+ reduceIdle.setName("reduceIdle"); // NOI18N
+ getContentPane().add(reduceIdle);
+ reduceIdle.setBounds(20, 420, 300, 22);
+
+ closeIdle.setText(resourceMap.getString("closeIdle.text")); // NOI18N
+ closeIdle.setName("closeIdle"); // NOI18N
+ getContentPane().add(closeIdle);
+ closeIdle.setBounds(20, 450, 370, 22);
+
+ delayIdle.setText(resourceMap.getString("delayIdle.text")); // NOI18N
+ delayIdle.setName("delayIdle"); // NOI18N
+ getContentPane().add(delayIdle);
+ delayIdle.setBounds(20, 480, 400, 22);
+
+ jSeparator3.setName("jSeparator3"); // NOI18N
+ getContentPane().add(jSeparator3);
+ jSeparator3.setBounds(0, 400, 760, 10);
+
+ save.setText(resourceMap.getString("save.text")); // NOI18N
+ save.setName("save"); // NOI18N
+ save.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ saveActionPerformed(evt);
+ }
+ });
+ getContentPane().add(save);
+ save.setBounds(10, 520, 44, 29);
+
+ cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
+ cancel.setName("cancel"); // NOI18N
+ cancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ cancelActionPerformed(evt);
+ }
+ });
+ getContentPane().add(cancel);
+ cancel.setBounds(60, 520, 55, 29);
+
+ tunnelName.setText(resourceMap.getString("tunnelName.text")); // NOI18N
+ tunnelName.setName("tunnelName"); // NOI18N
+ getContentPane().add(tunnelName);
+ tunnelName.setBounds(200, 20, 340, 27);
+
+ tunnelType.setText(resourceMap.getString("tunnelType.text")); // NOI18N
+ tunnelType.setName("tunnelType"); // NOI18N
+ getContentPane().add(tunnelType);
+ tunnelType.setBounds(200, 50, 340, 20);
+
+ tunnelPort.setText(resourceMap.getString("tunnelPort.text")); // NOI18N
+ tunnelPort.setName("tunnelPort"); // NOI18N
+ getContentPane().add(tunnelPort);
+ tunnelPort.setBounds(200, 70, 340, 27);
+
+ tunnelDestination.setText(resourceMap.getString("tunnelDestination.text")); // NOI18N
+ tunnelDestination.setName("tunnelDestination"); // NOI18N
+ getContentPane().add(tunnelDestination);
+ tunnelDestination.setBounds(200, 100, 340, 27);
+
+ tunnelProfile.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Interactive connection (Instant messaging)", "Bulk connection (Downloads, websites...)" }));
+ tunnelProfile.setName("tunnelProfile"); // NOI18N
+ getContentPane().add(tunnelProfile);
+ tunnelProfile.setBounds(200, 130, 340, 27);
+
+ tunnelDepth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 hop tunnel (no anonymity, low latency)", "1 hop tunnel (low anonymity, low latency)", "2 hop tunnel (medium anonymity, medium latency)", "3 hop tunnel (high anonymity, high latency)" }));
+ tunnelDepth.setName("tunnelDepth"); // NOI18N
+ getContentPane().add(tunnelDepth);
+ tunnelDepth.setBounds(200, 280, 350, 27);
+
+ depthVariance.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 hop variance (no random, good performance)", "+ 0-1 hop variance (slightly random, lower performance)", "+ 0-2 hop variance (very random, lower performance)", "+/- 0-1 hop variance (slightly random, standard performance)", "+/- 0-2 hop variance (not recommended)" }));
+ depthVariance.setName("depthVariance"); // NOI18N
+ getContentPane().add(depthVariance);
+ depthVariance.setBounds(200, 310, 350, 27);
+
+ tunnelCount.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1 tunnel (low bandwidth usage, low reliability)", "2 tunnels (standard bandwidth usage, standard reliability)", "3 tunnels (high bandwidth usage, high reliability)" }));
+ tunnelCount.setName("tunnelCount"); // NOI18N
+ getContentPane().add(tunnelCount);
+ tunnelCount.setBounds(200, 340, 350, 27);
+
+ backupTunnelCount.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 backup tunnels (no redundancy, no resource usage)", "1 backup tunnel (low redundancy, low resource usage)", "2 backup tunnels (medium redundancy, medium resource usage)", "3 backup tunnels (high redundancy, high resource usage)" }));
+ backupTunnelCount.setName("backupTunnelCount"); // NOI18N
+ getContentPane().add(backupTunnelCount);
+ backupTunnelCount.setBounds(200, 370, 350, 27);
+
+ changeTunnelState.setText(resourceMap.getString("changeTunnelState.text")); // NOI18N
+ changeTunnelState.setName("changeTunnelState"); // NOI18N
+ getContentPane().add(changeTunnelState);
+ changeTunnelState.setBounds(160, 520, 150, 29);
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
+ EditBean bean = new EditBean();
+ if(!bean.isClient(tunnelNumber)) {
+ al.actionPerformed(evt);
+ this.dispose();
+ }
+ else {
+ bean.setTunnel("" + tunnelNumber);
+ bean.setName(tunnelName.getText());
+ bean.setPort(tunnelPort.getText());
+ bean.setTargetDestination(tunnelDestination.getText());
+ if(!bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
+ if(tunnelProfile.getSelectedIndex() == TUNNEL_INTERACTIVE) {
+ bean.setProfile("interactive");
+ }
+ else {
+ bean.setProfile("bulk");
+ }
+
+ if(delayConnect.isSelected()) {
+ bean.setConnectDelay("true");
+ }
+ else {
+ bean.setConnectDelay("false");
+ }
+
+ if(sharedClient.isSelected()) {
+ bean.setShared(true);
+ }
+ else {
+ bean.setShared(false);
+ }
+
+ if(autoStart.isSelected()) {
+ bean.setStartOnLoad("true");
+ }
+ else {
+ }
+ }
+ bean.setTunnelDepth("" + tunnelDepth.getSelectedIndex());
+
+ int variance = depthVariance.getSelectedIndex();
+ if(variance >= 0 && variance <= 2) {
+ bean.setTunnelVariance("" + variance);
+ }
+ else if(variance == 3) {
+ bean.setTunnelVariance("-1");
+ }
+ else if(variance == 4) {
+ bean.setTunnelVariance("-2");
+ }
+
+ bean.setTunnelQuantity("" + tunnelCount.getSelectedIndex() + 1);
+
+ bean.setTunnelBackupQuantity("" + backupTunnelCount.getSelectedIndex());
+
+ if(!bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
+ if(reduceIdle.isSelected()) {
+ bean.setReduce("true");
+ }
+ else {
+ }
+
+ if(closeIdle.isSelected()) {
+ bean.setClose("true");
+ }
+ else {
+ }
+
+ if(delayIdle.isSelected()) {
+ bean.setDelayOpen("true");
+ }
+ }
+
+ }
+
+ al.actionPerformed(evt);
+ this.dispose();
+}//GEN-LAST:event_saveActionPerformed
+
+ private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed
+ al.actionPerformed(evt);
+ this.dispose();
+ }//GEN-LAST:event_cancelActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox autoStart;
+ private javax.swing.JComboBox backupTunnelCount;
+ private javax.swing.JLabel backupTunnelCountLabel;
+ private javax.swing.JButton cancel;
+ private javax.swing.JButton changeTunnelState;
+ private javax.swing.JCheckBox closeIdle;
+ private javax.swing.JCheckBox delayConnect;
+ private javax.swing.JCheckBox delayIdle;
+ private javax.swing.JComboBox depthVariance;
+ private javax.swing.JLabel depthVarianceLabel;
+ private javax.swing.JSeparator jSeparator1;
+ private javax.swing.JSeparator jSeparator2;
+ private javax.swing.JSeparator jSeparator3;
+ private javax.swing.JCheckBox reduceIdle;
+ private javax.swing.JButton save;
+ private javax.swing.JCheckBox sharedClient;
+ private javax.swing.JComboBox tunnelCount;
+ private javax.swing.JLabel tunnelCountLabel;
+ private javax.swing.JComboBox tunnelDepth;
+ private javax.swing.JLabel tunnelDepthLabel;
+ private javax.swing.JTextField tunnelDestination;
+ private javax.swing.JLabel tunnelDestinationLabel;
+ private javax.swing.JTextField tunnelName;
+ private javax.swing.JLabel tunnelNameLabel;
+ private javax.swing.JTextField tunnelPort;
+ private javax.swing.JLabel tunnelPortLabel;
+ private javax.swing.JComboBox tunnelProfile;
+ private javax.swing.JLabel tunnelProfileLabel;
+ private javax.swing.JLabel tunnelType;
+ private javax.swing.JLabel tunnelTypeLabel;
+ // End of variables declaration//GEN-END:variables
+ private int tunnelNumber;
+ private ActionListener al;
+ private static final int TUNNEL_INTERACTIVE = 0;
+ private static final int TUNNEL_BULK = 1;
+ private static final String TYPE_STREAMR_CLIENT = "Streamr client";
+}
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.form b/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.form
index 4c7cb5afc..589f5cee2 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.form
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.form
@@ -322,14 +322,14 @@
-
-
-
-
+
+
+
+
-
+
@@ -439,11 +439,11 @@
-
+
-
-
+
+
@@ -463,9 +463,9 @@
-
-
-
+
+
+
@@ -477,6 +477,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -484,6 +529,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.java b/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.java
index 474e39473..3e4a17fd2 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/GeneralConfiguration.java
@@ -7,6 +7,7 @@
package net.i2p.desktopgui.gui;
import java.awt.Desktop;
+import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -23,6 +24,9 @@ import net.i2p.router.web.NewsFetcher;
import net.i2p.desktopgui.router.configuration.UpdateHandler;
import java.util.Date;
import javax.swing.SwingWorker;
+import net.i2p.i2ptunnel.web.IndexBean;
+import javax.swing.table.DefaultTableModel;
+import java.awt.event.ActionListener;
/**
*
@@ -43,6 +47,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
private void extraInitComponents() {
initSpeedTab();
initUpdateTab();
+ initTunnelTab();
}
private void initSpeedTab() {
@@ -87,6 +92,48 @@ public class GeneralConfiguration extends javax.swing.JFrame {
}
}
+ private void initTunnelTab() {
+ while(((DefaultTableModel) clientTable.getModel()).getRowCount() > 0) {
+ ((DefaultTableModel) clientTable.getModel()).removeRow(0);
+ }
+ while(((DefaultTableModel) serverTable.getModel()).getRowCount() > 0) {
+ ((DefaultTableModel) serverTable.getModel()).removeRow(0);
+ }
+ IndexBean bean = new IndexBean();
+ for(int i=0; i
+
+
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/ServerTunnelWindow.java b/apps/desktopgui/src/net/i2p/desktopgui/gui/ServerTunnelWindow.java
new file mode 100644
index 000000000..765210148
--- /dev/null
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/ServerTunnelWindow.java
@@ -0,0 +1,60 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/*
+ * ServerTunnelWindow.java
+ *
+ * Created on 11-jun-2009, 14:55:53
+ */
+
+package net.i2p.desktopgui.gui;
+
+import java.awt.event.ActionListener;
+
+/**
+ *
+ * @author mathias
+ */
+public class ServerTunnelWindow extends javax.swing.JFrame {
+
+ /** Creates new form ServerTunnelWindow */
+ public ServerTunnelWindow(int tunnelNumber, ActionListener al) {
+ initComponents();
+ this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+ this.setSize(600, 600);
+ this.setLocationRelativeTo(null);
+ this.requestFocus();
+ this.setVisible(true);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setName("Form"); // NOI18N
+ getContentPane().setLayout(null);
+
+ org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(ServerTunnelWindow.class);
+ jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
+ jLabel1.setName("jLabel1"); // NOI18N
+ getContentPane().add(jLabel1);
+ jLabel1.setBounds(10, 10, 43, 17);
+
+ pack();
+ }// //GEN-END:initComponents
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel jLabel1;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/ClientTunnelWindow.properties b/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/ClientTunnelWindow.properties
new file mode 100644
index 000000000..ca036e197
--- /dev/null
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/ClientTunnelWindow.properties
@@ -0,0 +1,26 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+Form.title=Client Tunnel Configuration
+tunnelNameLabel.text=Name:
+tunnelTypeLabel.text=Type:
+tunnelType.text=jLabel10
+tunnelName.text=jTextField1
+tunnelPortLabel.text=Port:
+tunnelPort.text=jTextField2
+tunnelDestination.text=jTextField3
+tunnelDestinationLabel.text=Destination:
+tunnelProfileLabel.text=Profile:
+delayConnect.text=Delay connect
+sharedClient.text=Shared client
+autoStart.text=Auto start
+tunnelDepthLabel.text=Tunnel depth:
+depthVarianceLabel.text=Depth variance:
+tunnelCountLabel.text=Tunnel count:
+backupTunnelCountLabel.text=Backup tunnel count:
+reduceIdle.text=Reduce tunnel count when idle
+closeIdle.text=Close tunnels when idle
+delayIdle.text=Delay opening of tunnels when idle
+save.text=Save
+cancel.text=Cancel
+changeTunnelState.text=Start Tunnel
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/GeneralConfiguration.properties b/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/GeneralConfiguration.properties
index c6af27a51..d53ac80d0 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/GeneralConfiguration.properties
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/GeneralConfiguration.properties
@@ -13,7 +13,7 @@ downloadspeed.text=jTextField2
uploadgb.text=jTextField3
downloadgb.text=jTextField4
updateMethod.text=What is your preferred automatic update setting?
-updateInform.text=Only inform about updates
+updateInform.text=Only inform about updates (not advised)
updateDownload.text=Download and verify update file, do not restart
updateDownloadRestart.text=Download, verify and restart
checkUpdates.text=Check for updates now
@@ -21,9 +21,17 @@ updateNow.text=Update available: update now
advancedUpdateConfig.text=Advanced update configuration
clientTunnelLabel.text=Client tunnels:
serverTunnelLabel.text=Server tunnels:
-tunnelsExplanation.text=Tunnel explanation
+tunnelsExplanation.text=Click on a tunnel to view and change its configuration. + Tunnel explanation
uploadUsageLabel.text=Monthly usage:
downloadUsageLabel.text=Monthly usage:
gbUploadLabel.text=GB
gbDownloadLabel.text=GB
uploadDownloadExplanation.text=Explanation ...
+clientTable.columnModel.title3=Status
+clientTable.columnModel.title2=Address
+clientTable.columnModel.title1=Type
+clientTable.columnModel.title0=Name
+serverTable.columnModel.title0=Name
+serverTable.columnModel.title3=Title 4
+serverTable.columnModel.title2=Status
+serverTable.columnModel.title1=Address
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/ServerTunnelWindow.properties b/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/ServerTunnelWindow.properties
new file mode 100644
index 000000000..683f3caa7
--- /dev/null
+++ b/apps/desktopgui/src/net/i2p/desktopgui/gui/resources/ServerTunnelWindow.properties
@@ -0,0 +1 @@
+jLabel1.text=Name:
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/router/configuration/UpdateHelper.java b/apps/desktopgui/src/net/i2p/desktopgui/router/configuration/UpdateHelper.java
index 86db6f708..6e28db108 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/router/configuration/UpdateHelper.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/router/configuration/UpdateHelper.java
@@ -9,7 +9,7 @@ import net.i2p.desktopgui.router.RouterHelper;
public class UpdateHelper {
public static final String PROP_NEWS_URL = "router.newsURL";
- public static final String DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
+ public static final String DEFAULT_NEWS_URL = "http://echelon.i2p/i2p/news.xml";
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
@@ -31,7 +31,6 @@ public class UpdateHelper {
public static final String DEFAULT_UPDATE_URL =
"http://echelon.i2p/i2p/i2pupdate.sud\r\n" +
"http://stats.i2p/i2p/i2pupdate.sud\r\n" +
- "http://complication.i2p/i2p/i2pupdate.sud\r\n" +
"http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" +
"http://update.postman.i2p/i2pupdate.sud" ;
diff --git a/apps/i2psnark/java/build.xml b/apps/i2psnark/java/build.xml
index d70233ac6..59f0421e7 100644
--- a/apps/i2psnark/java/build.xml
+++ b/apps/i2psnark/java/build.xml
@@ -37,16 +37,23 @@
-
+
+
-
+
@@ -56,31 +63,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -92,7 +81,6 @@
-
@@ -104,6 +92,7 @@
+
diff --git a/apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java b/apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java
index b7e623060..1a43514de 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java
@@ -73,7 +73,7 @@ public class I2PSnarkUtil {
// This is used for both announce replies and .torrent file downloads,
// so it must be available even if not connected to I2CP.
// so much for multiple instances
- _tmpDir = new File("tmp", "i2psnark");
+ _tmpDir = new File(ctx.getTempDir(), "i2psnark");
FileUtil.rmdir(_tmpDir, false);
_tmpDir.mkdirs();
}
diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
index a45bf5161..79ea62ebc 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java
@@ -31,7 +31,7 @@ public class SnarkManager implements Snark.CompleteListener {
/** map of (canonical) filename to Snark instance (unsynchronized) */
private Map _snarks;
private Object _addSnarkLock;
- private String _configFile = "i2psnark.config";
+ private File _configFile;
private Properties _config;
private I2PAppContext _context;
private Log _log;
@@ -51,6 +51,7 @@ public class SnarkManager implements Snark.CompleteListener {
public static final String PROP_META_PREFIX = "i2psnark.zmeta.";
public static final String PROP_META_BITFIELD_SUFFIX = ".bitfield";
+ private static final String CONFIG_FILE = "i2psnark.config";
public static final String PROP_AUTO_START = "i2snark.autoStart"; // oops
public static final String DEFAULT_AUTO_START = "false";
public static final String PROP_LINK_PREFIX = "i2psnark.linkPrefix";
@@ -66,6 +67,9 @@ public class SnarkManager implements Snark.CompleteListener {
_log = _context.logManager().getLog(SnarkManager.class);
_messages = new ArrayList(16);
_util = new I2PSnarkUtil(_context);
+ _configFile = new File(CONFIG_FILE);
+ if (!_configFile.isAbsolute())
+ _configFile = new File(_context.getConfigDir(), CONFIG_FILE);
loadConfig(null);
}
@@ -112,10 +116,11 @@ public class SnarkManager implements Snark.CompleteListener {
}
private int getStartupDelayMinutes() { return 3; }
public File getDataDir() {
- String dir = _config.getProperty(PROP_DIR);
- if ( (dir == null) || (dir.trim().length() <= 0) )
- dir = "i2psnark";
- return new File(dir);
+ String dir = _config.getProperty(PROP_DIR, "i2psnark");
+ File f = new File(dir);
+ if (!f.isAbsolute())
+ f = new File(_context.getAppDir(), dir);
+ return f;
}
/** null to set initial defaults */
@@ -123,8 +128,10 @@ public class SnarkManager implements Snark.CompleteListener {
if (_config == null)
_config = new Properties();
if (filename != null) {
- _configFile = filename;
File cfg = new File(filename);
+ if (!cfg.isAbsolute())
+ cfg = new File(_context.getConfigDir(), filename);
+ _configFile = cfg;
if (cfg.exists()) {
try {
DataHelper.loadProps(_config, cfg);
@@ -352,10 +359,10 @@ public class SnarkManager implements Snark.CompleteListener {
public void saveConfig() {
try {
synchronized (_configFile) {
- DataHelper.storeProps(_config, new File(_configFile));
+ DataHelper.storeProps(_config, _configFile);
}
} catch (IOException ioe) {
- addMessage("Unable to save the config to '" + _configFile + "'");
+ addMessage("Unable to save the config to '" + _configFile.getAbsolutePath() + "'");
}
}
diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index 3923484a8..3929fbe11 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -173,6 +173,7 @@ public class I2PSnarkServlet extends HttpServlet {
} else if ("Add torrent".equals(action)) {
String newFile = req.getParameter("newFile");
String newURL = req.getParameter("newURL");
+ // NOTE - newFile currently disabled in HTML form - see below
File f = null;
if ( (newFile != null) && (newFile.trim().length() > 0) )
f = new File(newFile.trim());
@@ -875,10 +876,9 @@ public class I2PSnarkServlet extends HttpServlet {
private static final String TABLE_FOOTER = "\n";
private static final String FOOTER = "