Compare commits
266 Commits
Author | SHA1 | Date | |
---|---|---|---|
c0fd1dbcbc | |||
a08dd4aefa | |||
be52b5930c | |||
0382120363 | |||
7151590abc | |||
51faed2c4d | |||
c1a8c8a3fd | |||
4975d30714 | |||
45d9f9d07d | |||
9b0e553ece | |||
dcaa0594f1 | |||
1202a303b7 | |||
ed8fd0bde2 | |||
834bfde45c | |||
4c4b3b776c | |||
eee160503b | |||
bef55b25ea | |||
623f972e8b | |||
7e651d53a0 | |||
5d212d3cea | |||
3e31de1602 | |||
245b7168ab | |||
4a9b567ebd | |||
2f6ae99452 | |||
1538ba0cc3 | |||
06a3417124 | |||
8ff2724213 | |||
a9a2d2debb | |||
0070abc04c | |||
936a338e0e | |||
6c349d0ec4 | |||
7e1e3c3c32 | |||
ce23d76c72 | |||
cb488ebf7b | |||
7931451a49 | |||
59449cf513 | |||
39e5ff7eaa | |||
b430b02021 | |||
0bc67f5a89 | |||
56dc96de1e | |||
3ccbf37b41 | |||
7725b9e8a1 | |||
f511c9bc90 | |||
56b768fe19 | |||
f8901e94a9 | |||
ec5cc7e4d3 | |||
2413bcd99a | |||
1838ad4ae7 | |||
26c4f983d7 | |||
22609bbfdb | |||
0a8cbcbfb6 | |||
7f33051fe1 | |||
e65c2e279b | |||
b43338bd63 | |||
65ae9138ef | |||
665b691711 | |||
87953c4b93 | |||
be480d577c | |||
32566a43bd | |||
fd598dea5b | |||
8fef5d9a06 | |||
2f1d6e3f90 | |||
53f62bd8dd | |||
e6c87c54be | |||
ee3edc9661 | |||
32dddac75b | |||
906482823c | |||
91c389777a | |||
042a08b90e | |||
7f4c23a038 | |||
e7b0691116 | |||
235058eab1 | |||
85963a5c72 | |||
c639525c1d | |||
de18ebbb73 | |||
47e32c82fc | |||
71b708b0f2 | |||
ab9fee260f | |||
e86e42818a | |||
067e76c1b0 | |||
13b3bb4490 | |||
e82898c988 | |||
f4fdbceb3b | |||
c75ff538a3 | |||
7e71ead3e9 | |||
29489ad198 | |||
eac45256aa | |||
7feb97e415 | |||
695752629d | |||
c3c20ceca4 | |||
aa04820fd1 | |||
3208b7289e | |||
b4336fdec7 | |||
e0652a4607 | |||
4ab46b1de8 | |||
d7122cdad7 | |||
9c3eac58f1 | |||
79954cec68 | |||
d927f8bcb0 | |||
4426cc359c | |||
b1465b7dff | |||
438ea1b269 | |||
f10bfda115 | |||
b7e2d3a10b | |||
846c5fcfc3 | |||
31cd726b7b | |||
3ba43a77f4 | |||
cb5390b2fb | |||
fae7262d31 | |||
9b6abc1e19 | |||
631cd37f8b | |||
b59a38ffad | |||
9a6a993a81 | |||
9234a94da9 | |||
aa2f9e34c0 | |||
87eafa30d0 | |||
287eff50b7 | |||
8514e7962d | |||
9bed2bde3c | |||
9e003a9f93 | |||
86f02691a8 | |||
3ad3988937 | |||
757855a5c9 | |||
ccab73ff66 | |||
9df04724c4 | |||
94c2ba7fc5 | |||
a267fcc9cc | |||
66a292a9c6 | |||
7cd0112211 | |||
9195e754cf | |||
965b183d9e | |||
7372a18cec | |||
c5ba5f3a5b | |||
90251b8545 | |||
a8c97053c7 | |||
117d3a5614 | |||
70a2e48a72 | |||
a6f106ed6d | |||
47dd1b6168 | |||
bc7a963f5c | |||
47fc3b0d0b | |||
3d7b9560cb | |||
9bd3bea90a | |||
9541abc0a4 | |||
0be28c1701 | |||
8bb28ea825 | |||
85382863d2 | |||
ef737415c5 | |||
72e4dabd30 | |||
6bcd547ca0 | |||
283f7a3f37 | |||
d9a2e024ee | |||
fe4e76a7f8 | |||
9c4a7c02fd | |||
a516d6474e | |||
eba6ca5430 | |||
ee7e70b98a | |||
0b7fb21263 | |||
95a38779de | |||
e7913061e9 | |||
7d91bdba1e | |||
29fe221fe6 | |||
30b73ffe6d | |||
fceec5c129 | |||
e42f7ab8fc | |||
54b80d6724 | |||
e82f173f85 | |||
b45dfb85f0 | |||
3db244f5d2 | |||
65a41908ec | |||
7e3bda9d4d | |||
c6b2492e73 | |||
d41afc0c43 | |||
40637e0f28 | |||
0e4c846942 | |||
6dc5d0f8d7 | |||
7688df6fe5 | |||
32b6c77156 | |||
a8a0e2a91c | |||
4c396e5b95 | |||
d3181e53cc | |||
4139b36eac | |||
becc6dc0fc | |||
79a963fcab | |||
b21e011203 | |||
5a6b65d20c | |||
5b44bcb44f | |||
c3bafcab05 | |||
9ae4fce0db | |||
4929a7e635 | |||
b61861f840 | |||
35b5eb74f6 | |||
fc10031ff0 | |||
accf3dbf3f | |||
c2fedf8538 | |||
3b19afe7ed | |||
64ada538f4 | |||
a0c4e79c8a | |||
34249e3dca | |||
f5bd10207b | |||
9cc1511863 | |||
c1d7562331 | |||
542e0f2ed3 | |||
ab33b52f23 | |||
a223c7ac75 | |||
c32c9a2391 | |||
798e1422c6 | |||
e05b46002b | |||
fa6aa44a86 | |||
4f0013e8da | |||
b2e5e14bc6 | |||
e15b469833 | |||
c9b6d72c5a | |||
a279f8d530 | |||
89f0f09b86 | |||
157b85b11b | |||
7b15cc8113 | |||
8d4c332987 | |||
4ffa2450c2 | |||
d670d98e60 | |||
33b2762003 | |||
507b6d45d5 | |||
f331dad72d | |||
5b41827a7b | |||
178b5996a5 | |||
8054078b9e | |||
452adfa860 | |||
833ebd0714 | |||
b430abf172 | |||
939311d2de | |||
0c738e2c6f | |||
48e544c014 | |||
08b186aa24 | |||
2f46efe78d | |||
3ddd5f2a51 | |||
29a58cb030 | |||
0bcbe6ae05 | |||
3944688829 | |||
e126233fbc | |||
ae83b4202d | |||
7cdfe45acf | |||
eae4362181 | |||
f2e9e2cc23 | |||
311ec4eb54 | |||
f4254659ea | |||
b542f17194 | |||
ddf5cf80b2 | |||
0f1f33eaa4 | |||
18a475eff3 | |||
54255cab4a | |||
bc831d3c35 | |||
d54695e542 | |||
12625a46c2 | |||
ab84a5ce8e | |||
fcbfd7554f | |||
4d27f18710 | |||
1bc4cb382e | |||
6b825fbe25 | |||
2cf5221620 | |||
de6edc6a99 | |||
bc086a78eb | |||
e0dccb5970 | |||
a4d16af95d | |||
06aeff9a30 | |||
78075cb3aa | |||
312e6071d7 |
@ -1,8 +1,7 @@
|
||||
$Id: install-headless.txt,v 1.5 2005/09/29 14:19:23 jrandom Exp $
|
||||
Headless I2P installation instructions
|
||||
|
||||
1) tar xjf i2p.tar.bz2 (you've already done this)
|
||||
2) cd i2p ; vi install-headless.txt (you're doing this now)
|
||||
2) cd i2p ; vi INSTALL-headless.txt (you're doing this now)
|
||||
3) sh postinstall.sh (this launches the router)
|
||||
4) lynx http://localhost:7657/index.jsp (configure the router)
|
||||
|
56
LICENSE.txt
56
LICENSE.txt
@ -67,23 +67,63 @@ Public domain except as listed below:
|
||||
|
||||
|
||||
Router:
|
||||
Public domain
|
||||
Public domain except as listed below:
|
||||
UPnP.java:
|
||||
From freenet
|
||||
See licenses/LICENSE-GPLv2.txt
|
||||
|
||||
UPnP subsystem 1.7:
|
||||
Copyright (C) 2003-2006 Satoshi Konno
|
||||
See licenses/LICENSE-UPnP.txt
|
||||
|
||||
XMLPull library used by UPnP:
|
||||
See licenses/LICENSE-Apache2.0.txt
|
||||
|
||||
GeoIP data free to use, courtesy http://ip-to-country.webhosting.info/
|
||||
|
||||
|
||||
Installer:
|
||||
Launch4j:
|
||||
Launch4j 2.0.RC3:
|
||||
Copyright (C) 2005 Grzegorz Kowal
|
||||
See licenses/LICENSE-GPLv2.txt
|
||||
The following projects are used by Launch4j...
|
||||
MinGW binutils (http://www.mingw.org/)
|
||||
|
||||
Commons BeanUtils (http://jakarta.apache.org/commons/beanutils/)
|
||||
|
||||
Commons Logging (http://jakarta.apache.org/commons/logging/)
|
||||
See licenses/LICENSE-Apache1.1.txt
|
||||
See licenses/NOTICE-Commons-Logging.txt
|
||||
|
||||
XStream (http://xstream.codehaus.org/)
|
||||
Copyright (c) 2003-2004, Joe Walnes
|
||||
See licenses/LICENSE-XStream.txt
|
||||
|
||||
JGoodies Forms (http://www.jgoodies.com/freeware/forms/)
|
||||
Copyright (c) 2002-2004 JGoodies Karsten Lentzsch. All rights reserved.
|
||||
See licenses/LICENSE-JGoodies-Forms.txt
|
||||
|
||||
JGoodies Looks (http://www.jgoodies.com/freeware/looks/)
|
||||
Copyright (c) 2003 JGoodies Karsten Lentzsch. All rights reserved.
|
||||
See licenses/LICENSE-JGoodies-Looks.txt
|
||||
|
||||
Foxtrot (http://foxtrot.sourceforge.net/)
|
||||
Copyright (c) 2002, Simone Bordet & Marco Cravero. All rights reserved.
|
||||
See licenses/LICENSE-Foxtrot.txt
|
||||
|
||||
Nuvola Icon Theme (http://www.icon-king.com)
|
||||
See licenses/LICENSE-LGPLv2.1.txt
|
||||
|
||||
Forms were created using Abeille Forms Designer (https://abeille.dev.java.net/)
|
||||
|
||||
Izpack:
|
||||
See licenses/LICENSE-Apache1.1.txt
|
||||
|
||||
|
||||
|
||||
Wrapper:
|
||||
Copyright (c) 1999, 2004 Tanuki Software
|
||||
See licenses/LICENSE-Wrapper.txt
|
||||
Wrapper 3.1.1:
|
||||
Copyright (c) 1999, 2004 Tanuki Software
|
||||
See licenses/LICENSE-Wrapper.txt
|
||||
|
||||
|
||||
|
||||
@ -121,7 +161,6 @@ Applications:
|
||||
Copyright 2000-2004 Mort Bay Consulting Pty. Ltd.
|
||||
See licenses/LICENSE-Apache1.1.txt
|
||||
See licenses/LICENSE-Apache2.0.txt
|
||||
See licenses/NOTICE-Ant.txt
|
||||
See licenses/NOTICE-Commons-Logging.txt
|
||||
|
||||
JRobin 1.4.0:
|
||||
@ -137,6 +176,7 @@ Applications:
|
||||
|
||||
Router console:
|
||||
Public domain.
|
||||
Flag icons public domain, courtesy mjames@gmail.com http://www.famfamfam.com/
|
||||
|
||||
SAM:
|
||||
Public domain.
|
||||
@ -168,6 +208,10 @@ distributions. See the source package for the additional license information.
|
||||
Atalk:
|
||||
Public domain
|
||||
|
||||
Desktopgui
|
||||
Copyright (c) Mathias De Maré
|
||||
See apps/desktopgui/LICENSE
|
||||
|
||||
SAM C Library:
|
||||
Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>
|
||||
See apps/sam/c/doc/license.txt
|
||||
|
@ -27,10 +27,13 @@ import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import net.i2p.client.I2PClient;
|
||||
import net.i2p.client.streaming.RetransmissionTimer;
|
||||
import net.i2p.util.Log;
|
||||
@ -114,10 +117,15 @@ public class BOB {
|
||||
public final static String PROP_CONFIG_LOCATION = "BOB.config";
|
||||
public final static String PROP_BOB_PORT = "BOB.port";
|
||||
public final static String PROP_BOB_HOST = "BOB.host";
|
||||
private static int maxConnections = 0;
|
||||
private static NamedDB database;
|
||||
private static Properties props = new Properties();
|
||||
|
||||
private static AtomicBoolean spin = new AtomicBoolean(true);
|
||||
private static final String P_RUNNING = "RUNNING";
|
||||
private static final String P_STARTING = "STARTING";
|
||||
private static final String P_STOPPING = "STOPPING";
|
||||
private static AtomicBoolean lock = new AtomicBoolean(false);
|
||||
// no longer used.
|
||||
// private static int maxConnections = 0;
|
||||
|
||||
/**
|
||||
* Log a warning
|
||||
@ -149,6 +157,12 @@ public class BOB {
|
||||
_log.error(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop BOB gracefully
|
||||
*/
|
||||
public static void stop() {
|
||||
spin.set(false);
|
||||
}
|
||||
/**
|
||||
* Listen for incoming connections and handle them
|
||||
*
|
||||
@ -156,6 +170,7 @@ public class BOB {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
database = new NamedDB();
|
||||
ServerSocket listener = null;
|
||||
int i = 0;
|
||||
boolean save = false;
|
||||
// Set up all defaults to be passed forward to other threads.
|
||||
@ -168,77 +183,174 @@ public class BOB {
|
||||
i = Y.hashCode();
|
||||
i = Y1.hashCode();
|
||||
i = Y2.hashCode();
|
||||
|
||||
{
|
||||
try {
|
||||
FileInputStream fi = new FileInputStream(configLocation);
|
||||
props.load(fi);
|
||||
fi.close();
|
||||
} catch(FileNotFoundException fnfe) {
|
||||
warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
|
||||
warn(fnfe.toString());
|
||||
save = true;
|
||||
} catch(IOException ioe) {
|
||||
warn("IOException on BOB config file " + configLocation + ", using defaults.");
|
||||
warn(ioe.toString());
|
||||
}
|
||||
}
|
||||
// Global router and client API configurations that are missing are set to defaults here.
|
||||
if(!props.containsKey(I2PClient.PROP_TCP_HOST)) {
|
||||
props.setProperty(I2PClient.PROP_TCP_HOST, "localhost");
|
||||
}
|
||||
if(!props.containsKey(I2PClient.PROP_TCP_PORT)) {
|
||||
props.setProperty(I2PClient.PROP_TCP_PORT, "7654");
|
||||
}
|
||||
if(!props.containsKey(I2PClient.PROP_RELIABILITY)) {
|
||||
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_BEST_EFFORT);
|
||||
}
|
||||
if(!props.containsKey(PROP_BOB_PORT)) {
|
||||
props.setProperty(PROP_BOB_PORT, "2827"); // 0xB0B
|
||||
}
|
||||
if(!props.containsKey("inbound.length")) {
|
||||
props.setProperty("inbound.length", "1");
|
||||
}
|
||||
if(!props.containsKey("outbound.length")) {
|
||||
props.setProperty("outbound.length", "1");
|
||||
}
|
||||
if(!props.containsKey("inbound.lengthVariance")) {
|
||||
props.setProperty("inbound.lengthVariance", "0");
|
||||
}
|
||||
if(!props.containsKey("outbound.lengthVariance")) {
|
||||
props.setProperty("outbound.lengthVariance", "0");
|
||||
}
|
||||
if(!props.containsKey(PROP_BOB_HOST)) {
|
||||
props.setProperty(PROP_BOB_HOST, "localhost");
|
||||
}
|
||||
if(save) {
|
||||
try {
|
||||
warn("Writing new defaults file " + configLocation);
|
||||
FileOutputStream fo = new FileOutputStream(configLocation);
|
||||
props.store(fo, configLocation);
|
||||
fo.close();
|
||||
} catch(IOException ioe) {
|
||||
error("IOException on BOB config file " + configLocation + ", " + ioe);
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
try {
|
||||
info("BOB is now running.");
|
||||
ServerSocket listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
||||
Socket server;
|
||||
|
||||
while((i++ < maxConnections) || (maxConnections == 0)) {
|
||||
//DoCMDS connection;
|
||||
|
||||
server = listener.accept();
|
||||
DoCMDS conn_c = new DoCMDS(server, props, database, _log);
|
||||
Thread t = new Thread(conn_c);
|
||||
t.start();
|
||||
{
|
||||
try {
|
||||
FileInputStream fi = new FileInputStream(configLocation);
|
||||
props.load(fi);
|
||||
fi.close();
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
|
||||
warn(fnfe.toString());
|
||||
save = true;
|
||||
} catch (IOException ioe) {
|
||||
warn("IOException on BOB config file " + configLocation + ", using defaults.");
|
||||
warn(ioe.toString());
|
||||
}
|
||||
}
|
||||
} catch(IOException ioe) {
|
||||
error("IOException on socket listen: " + ioe);
|
||||
ioe.printStackTrace();
|
||||
// Global router and client API configurations that are missing are set to defaults here.
|
||||
if (!props.containsKey(I2PClient.PROP_TCP_HOST)) {
|
||||
props.setProperty(I2PClient.PROP_TCP_HOST, "localhost");
|
||||
}
|
||||
if (!props.containsKey(I2PClient.PROP_TCP_PORT)) {
|
||||
props.setProperty(I2PClient.PROP_TCP_PORT, "7654");
|
||||
}
|
||||
if (!props.containsKey(I2PClient.PROP_RELIABILITY)) {
|
||||
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_BEST_EFFORT);
|
||||
}
|
||||
if (!props.containsKey(PROP_BOB_PORT)) {
|
||||
props.setProperty(PROP_BOB_PORT, "2827"); // 0xB0B
|
||||
}
|
||||
if (!props.containsKey("inbound.length")) {
|
||||
props.setProperty("inbound.length", "1");
|
||||
}
|
||||
if (!props.containsKey("outbound.length")) {
|
||||
props.setProperty("outbound.length", "1");
|
||||
}
|
||||
if (!props.containsKey("inbound.lengthVariance")) {
|
||||
props.setProperty("inbound.lengthVariance", "0");
|
||||
}
|
||||
if (!props.containsKey("outbound.lengthVariance")) {
|
||||
props.setProperty("outbound.lengthVariance", "0");
|
||||
}
|
||||
if (!props.containsKey(PROP_BOB_HOST)) {
|
||||
props.setProperty(PROP_BOB_HOST, "localhost");
|
||||
}
|
||||
if (save) {
|
||||
try {
|
||||
warn("Writing new defaults file " + configLocation);
|
||||
FileOutputStream fo = new FileOutputStream(configLocation);
|
||||
props.store(fo, configLocation);
|
||||
fo.close();
|
||||
} catch (IOException ioe) {
|
||||
error("IOException on BOB config file " + configLocation + ", " + ioe);
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
boolean g = false;
|
||||
try {
|
||||
info("BOB is now running.");
|
||||
listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
||||
Socket server = null;
|
||||
listener.setSoTimeout(500); // .5 sec
|
||||
while (spin.get()) {
|
||||
//DoCMDS connection;
|
||||
|
||||
try {
|
||||
server = listener.accept();
|
||||
g = true;
|
||||
} catch (ConnectException ce) {
|
||||
g = false;
|
||||
} catch (SocketTimeoutException ste) {
|
||||
g = false;
|
||||
}
|
||||
|
||||
if (g) {
|
||||
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
|
||||
Thread t = new Thread(conn_c);
|
||||
t.setName("BOB.DoCMDS " + i);
|
||||
t.start();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
error("IOException on socket listen: " + ioe);
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
info("BOB is now shutting down...");
|
||||
// Clean up everything.
|
||||
try {
|
||||
listener.close();
|
||||
} catch (Exception ex) {
|
||||
// nop
|
||||
}
|
||||
// Find all our "BOB.DoCMDS" threads, wait for them to be finished.
|
||||
// We could order them to stop, but that could cause nasty issues in the locks.
|
||||
visitAllThreads();
|
||||
database.getReadLock();
|
||||
int all = database.getcount();
|
||||
database.releaseReadLock();
|
||||
NamedDB nickinfo;
|
||||
for (i = 0; i < all; i++) {
|
||||
database.getReadLock();
|
||||
nickinfo = (NamedDB) database.getnext(i);
|
||||
nickinfo.getReadLock();
|
||||
if (nickinfo.get(P_RUNNING).equals(Boolean.TRUE) && nickinfo.get(P_STOPPING).equals(Boolean.FALSE) && nickinfo.get(P_STARTING).equals(Boolean.FALSE)) {
|
||||
nickinfo.releaseReadLock();
|
||||
database.releaseReadLock();
|
||||
database.getWriteLock();
|
||||
nickinfo.getWriteLock();
|
||||
nickinfo.add(P_STOPPING, new Boolean(true));
|
||||
nickinfo.releaseWriteLock();
|
||||
database.releaseWriteLock();
|
||||
} else {
|
||||
nickinfo.releaseReadLock();
|
||||
database.releaseReadLock();
|
||||
}
|
||||
}
|
||||
info("BOB is now stopped.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the root thread group,
|
||||
* then find all theads with certain names and wait for them all to be dead.
|
||||
*
|
||||
*/
|
||||
private static void visitAllThreads() {
|
||||
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
|
||||
while (root.getParent() != null) {
|
||||
root = root.getParent();
|
||||
}
|
||||
|
||||
// Visit each thread group
|
||||
waitjoin(root, 0, root.getName());
|
||||
}
|
||||
|
||||
private static void waitjoin(ThreadGroup group, int level, String tn) {
|
||||
// Get threads in `group'
|
||||
int numThreads = group.activeCount();
|
||||
Thread[] threads = new Thread[numThreads * 2];
|
||||
numThreads = group.enumerate(threads, false);
|
||||
// Enumerate each thread in `group' and wait for it to stop if it is one of ours.
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
// Get thread
|
||||
Thread thread = threads[i];
|
||||
if (thread.getName().startsWith("BOB.DoCMDS ")) {
|
||||
try {
|
||||
if (thread.isAlive()) {
|
||||
try {
|
||||
thread.join();
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
} catch (SecurityException se) {
|
||||
//nop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get thread subgroups of `group'
|
||||
int numGroups = group.activeGroupCount();
|
||||
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
|
||||
numGroups = group.enumerate(groups, false);
|
||||
|
||||
// Recursively visit each subgroup
|
||||
for (int i = 0; i < numGroups; i++) {
|
||||
waitjoin(groups[i], level + 1, groups[i].getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import java.io.PrintStream;
|
||||
import java.net.Socket;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import net.i2p.I2PException;
|
||||
import net.i2p.client.I2PClientFactory;
|
||||
import net.i2p.data.Destination;
|
||||
@ -46,7 +47,7 @@ public class DoCMDS implements Runnable {
|
||||
|
||||
// FIX ME
|
||||
// I need a better way to do versioning, but this will do for now.
|
||||
public static final String BMAJ = "00", BMIN = "00", BREV = "05", BEXT = "";
|
||||
public static final String BMAJ = "00", BMIN = "00", BREV = "07", BEXT = "";
|
||||
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
|
||||
private Socket server;
|
||||
private Properties props;
|
||||
@ -57,6 +58,8 @@ public class DoCMDS implements Runnable {
|
||||
private boolean dk, ns, ip, op;
|
||||
private NamedDB nickinfo;
|
||||
private Log _log;
|
||||
private AtomicBoolean LIVE;
|
||||
private AtomicBoolean lock;
|
||||
/* database strings */
|
||||
private static final String P_DEST = "DESTINATION";
|
||||
private static final String P_INHOST = "INHOST";
|
||||
@ -94,6 +97,8 @@ public class DoCMDS implements Runnable {
|
||||
private static final String C_status = "status";
|
||||
private static final String C_stop = "stop";
|
||||
private static final String C_verify = "verify";
|
||||
private static final String C_visit = "visit";
|
||||
private static final String C_zap = "zap";
|
||||
|
||||
/* all the coomands available, plus description */
|
||||
private static final String C_ALL[][] = {
|
||||
@ -119,6 +124,8 @@ public class DoCMDS implements Runnable {
|
||||
{C_status, C_status + " nickname * Display status of a nicknamed tunnel."},
|
||||
{C_stop, C_stop + " * Stops the current nicknamed tunnel."},
|
||||
{C_verify, C_verify + " BASE64_key * Verifies BASE64 destination."},
|
||||
{C_visit, C_visit + " * Thread dump to wrapper.log."},
|
||||
{C_zap, C_zap + " * Shuts down BOB."},
|
||||
{"", "COMMANDS: " + // this is ugly, but...
|
||||
C_help + " " +
|
||||
C_clear + " " +
|
||||
@ -141,19 +148,23 @@ public class DoCMDS implements Runnable {
|
||||
C_start + " " +
|
||||
C_status + " " +
|
||||
C_stop + " " +
|
||||
C_verify
|
||||
C_verify + " " +
|
||||
C_visit + " " +
|
||||
C_zap
|
||||
},
|
||||
{" ", " "} // end of list
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param LIVE
|
||||
* @param server
|
||||
* @param props
|
||||
* @param database
|
||||
* @param _log
|
||||
*/
|
||||
DoCMDS(Socket server, Properties props, NamedDB database, Log _log) {
|
||||
DoCMDS(AtomicBoolean LIVE, AtomicBoolean lock, Socket server, Properties props, NamedDB database, Log _log) {
|
||||
this.lock = lock;
|
||||
this.LIVE = LIVE;
|
||||
this.server = server;
|
||||
this.props = new Properties();
|
||||
this.database = database;
|
||||
@ -429,6 +440,9 @@ public class DoCMDS implements Runnable {
|
||||
}
|
||||
|
||||
}
|
||||
} else if (Command.equals(C_visit)) {
|
||||
visitAllThreads();
|
||||
out.println("OK ");
|
||||
} else if (Command.equals(C_getdest)) {
|
||||
if (ns) {
|
||||
if (dk) {
|
||||
@ -509,6 +523,11 @@ public class DoCMDS implements Runnable {
|
||||
} else if (Command.equals(C_quit)) {
|
||||
// End the command session
|
||||
break quit;
|
||||
} else if (Command.equals(C_zap)) {
|
||||
// Kill BOB!! (let's hope this works!)
|
||||
LIVE.set(false);
|
||||
// End the command session
|
||||
break quit;
|
||||
} else if (Command.equals(C_newkeys)) {
|
||||
if (ns) {
|
||||
try {
|
||||
@ -1260,18 +1279,23 @@ public class DoCMDS implements Runnable {
|
||||
} else {
|
||||
MUXlisten tunnel;
|
||||
try {
|
||||
tunnel = new MUXlisten(database, nickinfo, _log);
|
||||
while (!lock.compareAndSet(false, true)) {
|
||||
// wait
|
||||
}
|
||||
tunnel = new MUXlisten(lock, database, nickinfo, _log);
|
||||
Thread t = new Thread(tunnel);
|
||||
t.start();
|
||||
try {
|
||||
Thread.sleep(1000 * 10); // Slow down the startup.
|
||||
} catch(InterruptedException ie) {
|
||||
// ignore it
|
||||
}
|
||||
// try {
|
||||
// Thread.sleep(1000 * 10); // Slow down the startup.
|
||||
// } catch(InterruptedException ie) {
|
||||
// // ignore it
|
||||
// }
|
||||
out.println("OK tunnel starting");
|
||||
} catch (I2PException e) {
|
||||
lock.set(false);
|
||||
out.println("ERROR starting tunnel: " + e);
|
||||
} catch (IOException e) {
|
||||
lock.set(false);
|
||||
out.println("ERROR starting tunnel: " + e);
|
||||
}
|
||||
}
|
||||
@ -1426,4 +1450,48 @@ public class DoCMDS implements Runnable {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
// Debugging... None of this is normally used.
|
||||
|
||||
/**
|
||||
* Find the root thread group and print them all.
|
||||
*
|
||||
*/
|
||||
private void visitAllThreads() {
|
||||
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
|
||||
while (root.getParent() != null) {
|
||||
root = root.getParent();
|
||||
}
|
||||
|
||||
// Visit each thread group
|
||||
visit(root, 0, root.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively visits all thread groups under `group' and dumps them.
|
||||
* @param group ThreadGroup to visit
|
||||
* @param level Current level
|
||||
*/
|
||||
private static void visit(ThreadGroup group, int level, String tn) {
|
||||
// Get threads in `group'
|
||||
int numThreads = group.activeCount();
|
||||
Thread[] threads = new Thread[numThreads * 2];
|
||||
numThreads = group.enumerate(threads, false);
|
||||
String indent = "------------------------------------".substring(0, level) + "-> ";
|
||||
// Enumerate each thread in `group' and print it.
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
// Get thread
|
||||
Thread thread = threads[i];
|
||||
System.out.println("BOB: " + indent + tn + ": " +thread.toString());
|
||||
}
|
||||
|
||||
// Get thread subgroups of `group'
|
||||
int numGroups = group.activeGroupCount();
|
||||
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
|
||||
numGroups = group.enumerate(groups, false);
|
||||
|
||||
// Recursively visit each subgroup
|
||||
for (int i = 0; i < numGroups; i++) {
|
||||
visit(groups[i], level + 1, groups[i].getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,91 +78,59 @@ public class I2Plistener implements Runnable {
|
||||
public void run() {
|
||||
boolean g = false;
|
||||
I2PSocket sessSocket = null;
|
||||
int conn = 0;
|
||||
try {
|
||||
die:
|
||||
{
|
||||
|
||||
die: {
|
||||
serverSocket.setSoTimeout(50);
|
||||
boolean spin = true;
|
||||
while (spin) {
|
||||
|
||||
serverSocket.setSoTimeout(50);
|
||||
// try {
|
||||
// if (info.exists("INPORT")) {
|
||||
// tgwatch = 2;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// try {
|
||||
// runlock();
|
||||
// } catch (Exception e2) {
|
||||
// break die;
|
||||
// }
|
||||
// break die;
|
||||
// }
|
||||
boolean spin = true;
|
||||
while (spin) {
|
||||
|
||||
try {
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e2) {
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
try {
|
||||
sessSocket = serverSocket.accept();
|
||||
g = true;
|
||||
} catch (ConnectException ce) {
|
||||
g = false;
|
||||
} catch (SocketTimeoutException ste) {
|
||||
g = false;
|
||||
}
|
||||
if (g) {
|
||||
g = false;
|
||||
// toss the connection to a new thread.
|
||||
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database);
|
||||
Thread t = new Thread(conn_c, "BOBI2PtoTCP");
|
||||
t.start();
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e2) {
|
||||
break die;
|
||||
}
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
try {
|
||||
sessSocket = serverSocket.accept();
|
||||
g = true;
|
||||
} catch (ConnectException ce) {
|
||||
g = false;
|
||||
} catch (SocketTimeoutException ste) {
|
||||
g = false;
|
||||
}
|
||||
if (g) {
|
||||
g = false;
|
||||
conn++;
|
||||
// toss the connection to a new thread.
|
||||
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database);
|
||||
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
|
||||
t.start();
|
||||
}
|
||||
|
||||
} catch (I2PException e) {
|
||||
// System.out.println("Exception " + e);
|
||||
} catch (Exception e) {
|
||||
// System.out.println("Exception " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
serverSocket.close();
|
||||
} catch (I2PException ex) {
|
||||
}
|
||||
// System.out.println("I2Plistener: Close");
|
||||
|
||||
|
||||
// Previous level does this cleanup now.
|
||||
//
|
||||
// try {
|
||||
// serverSocket.close();
|
||||
// } catch (I2PException e) {
|
||||
// nop
|
||||
//}
|
||||
// need to kill off the socket manager too.
|
||||
// I2PSession session = socketManager.getSession();
|
||||
// if (session != null) {
|
||||
// System.out.println("I2Plistener: destroySession");
|
||||
// try {
|
||||
// session.destroySession();
|
||||
// } catch (I2PSessionException ex) {
|
||||
// nop
|
||||
// }
|
||||
//}
|
||||
// System.out.println("I2Plistener: Waiting for children");
|
||||
// while (Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
|
||||
// try {
|
||||
// Thread.sleep(100); //sleep for 100 ms (One tenth second)
|
||||
// } catch (Exception e) {
|
||||
// nop
|
||||
// }
|
||||
//}
|
||||
|
||||
// System.out.println("I2Plistener: Done.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@
|
||||
*/
|
||||
package net.i2p.BOB;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
@ -53,12 +52,12 @@ public class I2PtoTCP implements Runnable {
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
private void rlock() throws Exception {
|
||||
private void rlock() {
|
||||
database.getReadLock();
|
||||
info.getReadLock();
|
||||
}
|
||||
|
||||
private void runlock() throws Exception {
|
||||
private void runlock() {
|
||||
database.releaseReadLock();
|
||||
info.releaseReadLock();
|
||||
}
|
||||
@ -71,90 +70,125 @@ public class I2PtoTCP implements Runnable {
|
||||
String host;
|
||||
int port;
|
||||
boolean tell;
|
||||
die: {
|
||||
try {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
InputStream Iin = null;
|
||||
OutputStream Iout = null;
|
||||
Thread t = null;
|
||||
Thread q = null;
|
||||
try {
|
||||
die:
|
||||
{
|
||||
try {
|
||||
rlock();
|
||||
} catch(Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
host = info.get("OUTHOST").toString();
|
||||
port = Integer.parseInt(info.get("OUTPORT").toString());
|
||||
tell = info.get("QUIET").equals(Boolean.FALSE);
|
||||
} catch(Exception e) {
|
||||
runlock();
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
runlock();
|
||||
} catch(Exception e) {
|
||||
break die;
|
||||
}
|
||||
sock = new Socket(host, port);
|
||||
// make readers/writers
|
||||
InputStream in = sock.getInputStream();
|
||||
OutputStream out = sock.getOutputStream();
|
||||
InputStream Iin = I2P.getInputStream();
|
||||
OutputStream Iout = I2P.getOutputStream();
|
||||
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
|
||||
|
||||
if(tell) {
|
||||
// tell who is connecting
|
||||
out.write(I2P.getPeerDestination().toBase64().getBytes());
|
||||
out.write(10); // nl
|
||||
out.flush(); // not really needed, but...
|
||||
}
|
||||
// setup to cross the streams
|
||||
TCPio conn_c = new TCPio(in, Iout /*, info, database */ ); // app -> I2P
|
||||
TCPio conn_a = new TCPio(Iin, out /* , info, database */); // I2P -> app
|
||||
Thread t = new Thread(conn_c, "TCPioA");
|
||||
Thread q = new Thread(conn_a, "TCPioB");
|
||||
// Fire!
|
||||
t.start();
|
||||
q.start();
|
||||
while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
|
||||
try {
|
||||
Thread.sleep(10); //sleep for 10 ms
|
||||
} catch(InterruptedException e) {
|
||||
try {
|
||||
in.close();
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
try {
|
||||
out.close();
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
try {
|
||||
Iin.close();
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
try {
|
||||
Iout.close();
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
host = info.get("OUTHOST").toString();
|
||||
port = Integer.parseInt(info.get("OUTPORT").toString());
|
||||
tell = info.get("QUIET").equals(Boolean.FALSE);
|
||||
} catch (Exception e) {
|
||||
runlock();
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
sock = new Socket(host, port);
|
||||
// make readers/writers
|
||||
in = sock.getInputStream();
|
||||
out = sock.getOutputStream();
|
||||
Iin = I2P.getInputStream();
|
||||
Iout = I2P.getOutputStream();
|
||||
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
|
||||
|
||||
if (tell) {
|
||||
// tell who is connecting
|
||||
out.write(I2P.getPeerDestination().toBase64().getBytes());
|
||||
out.write(10); // nl
|
||||
out.flush(); // not really needed, but...
|
||||
}
|
||||
// setup to cross the streams
|
||||
TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P
|
||||
TCPio conn_a = new TCPio(Iin, out /* , info, database */); // I2P -> app
|
||||
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
|
||||
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
|
||||
// Fire!
|
||||
t.start();
|
||||
q.start();
|
||||
boolean spin = true;
|
||||
while (t.isAlive() && q.isAlive() && spin) { // AND is used here to kill off the other thread
|
||||
try {
|
||||
Thread.sleep(10); //sleep for 10 ms
|
||||
} catch (InterruptedException e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e2) {
|
||||
break die;
|
||||
}
|
||||
break die;
|
||||
}
|
||||
}
|
||||
}
|
||||
// System.out.println("I2PtoTCP: Going away...");
|
||||
} catch(Exception e) {
|
||||
// System.out.println("I2PtoTCP: Owch! damn!");
|
||||
break die;
|
||||
} catch (Exception e) {
|
||||
// System.out.println("I2PtoTCP: Owch! damn!");
|
||||
break die;
|
||||
}
|
||||
} // die
|
||||
} finally {
|
||||
try {
|
||||
t.interrupt();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
q.interrupt();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
out.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
Iin.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
Iout.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
// System.out.println("I2PtoTCP: Close I2P");
|
||||
I2P.close();
|
||||
} catch (Exception e) {
|
||||
tell = false;
|
||||
}
|
||||
//System.out.println("I2PtoTCP: Closed I2P");
|
||||
try {
|
||||
// System.out.println("I2PtoTCP: Close sock");
|
||||
sock.close();
|
||||
} catch (Exception e) {
|
||||
tell = false;
|
||||
}
|
||||
} // die
|
||||
try {
|
||||
// System.out.println("I2PtoTCP: Close I2P");
|
||||
I2P.close();
|
||||
} catch(Exception e) {
|
||||
tell = false;
|
||||
}
|
||||
//System.out.println("I2PtoTCP: Closed I2P");
|
||||
try {
|
||||
// System.out.println("I2PtoTCP: Close sock");
|
||||
sock.close();
|
||||
} catch(Exception e) {
|
||||
tell = false;
|
||||
}
|
||||
// System.out.println("I2PtoTCP: Done");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,8 @@ import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import net.i2p.I2PException;
|
||||
import net.i2p.client.I2PSession;
|
||||
import net.i2p.client.I2PSessionException;
|
||||
import net.i2p.client.streaming.I2PServerSocket;
|
||||
import net.i2p.client.streaming.I2PSocketManager;
|
||||
import net.i2p.client.streaming.I2PSocketManagerFactory;
|
||||
@ -44,16 +43,17 @@ import net.i2p.util.Log;
|
||||
*/
|
||||
public class MUXlisten implements Runnable {
|
||||
|
||||
private NamedDB database, info;
|
||||
private NamedDB database, info;
|
||||
private Log _log;
|
||||
private I2PSocketManager socketManager;
|
||||
private ByteArrayInputStream prikey;
|
||||
private ThreadGroup tg;
|
||||
private String N;
|
||||
private ServerSocket listener;
|
||||
private ServerSocket listener = null;
|
||||
private int backlog = 50; // should this be more? less?
|
||||
boolean go_out;
|
||||
boolean come_in;
|
||||
private AtomicBoolean lock;
|
||||
|
||||
/**
|
||||
* Constructor Will fail if INPORT is occupied.
|
||||
@ -64,9 +64,10 @@ public class MUXlisten implements Runnable {
|
||||
* @throws net.i2p.I2PException
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
MUXlisten(NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
|
||||
MUXlisten(AtomicBoolean lock, NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
|
||||
int port = 0;
|
||||
InetAddress host = null;
|
||||
this.lock = lock;
|
||||
this.tg = null;
|
||||
this.database = database;
|
||||
this.info = info;
|
||||
@ -133,234 +134,187 @@ public class MUXlisten implements Runnable {
|
||||
*/
|
||||
public void run() {
|
||||
I2PServerSocket SS = null;
|
||||
int ticks = 1200; // Allow 120 seconds, no more.
|
||||
Thread t = null;
|
||||
Thread q = null;
|
||||
try {
|
||||
wlock();
|
||||
try {
|
||||
info.add("RUNNING", new Boolean(true));
|
||||
wlock();
|
||||
try {
|
||||
info.add("RUNNING", new Boolean(true));
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
// socketManager.addDisconnectListener(new DisconnectListener());
|
||||
|
||||
quit:
|
||||
{
|
||||
try {
|
||||
tg = new ThreadGroup(N);
|
||||
die:
|
||||
{
|
||||
// toss the connections to a new threads.
|
||||
// will wrap with TCP and UDP when UDP works
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
// socketManager.addDisconnectListener(new DisconnectListener());
|
||||
lock.set(false);
|
||||
quit:
|
||||
{
|
||||
try {
|
||||
tg = new ThreadGroup(N);
|
||||
{
|
||||
// toss the connections to a new threads.
|
||||
// will wrap with TCP and UDP when UDP works
|
||||
|
||||
if (go_out) {
|
||||
// I2P -> TCP
|
||||
SS = socketManager.getServerSocket();
|
||||
I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log);
|
||||
Thread t = new Thread(tg, conn, "BOBI2Plistener " + N);
|
||||
t.start();
|
||||
}
|
||||
|
||||
if (come_in) {
|
||||
// TCP -> I2P
|
||||
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log);
|
||||
Thread q = new Thread(tg, conn, "BOBTCPlistener" + N);
|
||||
q.start();
|
||||
}
|
||||
|
||||
try {
|
||||
wlock();
|
||||
try {
|
||||
info.add("STARTING", new Boolean(false));
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
break die;
|
||||
if (go_out) {
|
||||
// I2P -> TCP
|
||||
SS = socketManager.getServerSocket();
|
||||
I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log);
|
||||
t = new Thread(tg, conn, "BOBI2Plistener " + N);
|
||||
t.start();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
boolean spin = true;
|
||||
while (spin) {
|
||||
try {
|
||||
Thread.sleep(1000); //sleep for 1 second
|
||||
} catch (InterruptedException e) {
|
||||
break die;
|
||||
|
||||
if (come_in) {
|
||||
// TCP -> I2P
|
||||
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log);
|
||||
q = new Thread(tg, conn, "BOBTCPlistener " + N);
|
||||
q.start();
|
||||
}
|
||||
|
||||
try {
|
||||
rlock();
|
||||
wlock();
|
||||
try {
|
||||
spin = info.get("STOPPING").equals(Boolean.FALSE);
|
||||
info.add("STARTING", new Boolean(false));
|
||||
} catch (Exception e) {
|
||||
runlock();
|
||||
break die;
|
||||
wunlock();
|
||||
break quit;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
wlock();
|
||||
try {
|
||||
info.add("RUNNING", new Boolean(false));
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
break die;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
} // die
|
||||
|
||||
if (SS != null) {
|
||||
try {
|
||||
SS.close();
|
||||
} catch (I2PException ex) {
|
||||
//Logger.getLogger(MUXlisten.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
if (this.come_in) {
|
||||
try {
|
||||
listener.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
I2PSession session = socketManager.getSession();
|
||||
if (session != null) {
|
||||
// System.out.println("I2Plistener: destroySession");
|
||||
try {
|
||||
session.destroySession();
|
||||
} catch (I2PSessionException ex) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
try {
|
||||
socketManager.destroySocketManager();
|
||||
} catch (Exception e) {
|
||||
// nop
|
||||
}
|
||||
// Wait for child threads and thread groups to die
|
||||
// System.out.println("MUXlisten: waiting for children");
|
||||
if (tg.activeCount() + tg.activeGroupCount() != 0) {
|
||||
while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) {
|
||||
tg.interrupt(); // unwedge any blocking threads.
|
||||
ticks--;
|
||||
try {
|
||||
Thread.sleep(100); //sleep for 100 ms (One tenth second)
|
||||
} catch (InterruptedException ex) {
|
||||
break quit;
|
||||
}
|
||||
}
|
||||
if (tg.activeCount() + tg.activeGroupCount() != 0) {
|
||||
break quit; // Uh-oh.
|
||||
}
|
||||
}
|
||||
tg.destroy();
|
||||
// Zap reference to the ThreadGroup so the JVM can GC it.
|
||||
tg = null;
|
||||
} catch (Exception e) {
|
||||
// System.out.println("MUXlisten: Caught an exception" + e);
|
||||
break quit;
|
||||
}
|
||||
} // quit
|
||||
try {
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
break quit;
|
||||
}
|
||||
boolean spin = true;
|
||||
while (spin) {
|
||||
try {
|
||||
Thread.sleep(1000); //sleep for 1 second
|
||||
} catch (InterruptedException e) {
|
||||
break quit;
|
||||
}
|
||||
try {
|
||||
rlock();
|
||||
try {
|
||||
spin = info.get("STOPPING").equals(Boolean.FALSE);
|
||||
} catch (Exception e) {
|
||||
runlock();
|
||||
break quit;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
break quit;
|
||||
}
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e) {
|
||||
break quit;
|
||||
}
|
||||
}
|
||||
} // die
|
||||
|
||||
} catch (Exception e) {
|
||||
// System.out.println("MUXlisten: Caught an exception" + e);
|
||||
break quit;
|
||||
}
|
||||
} // quit
|
||||
} finally {
|
||||
// Start cleanup.
|
||||
while (!lock.compareAndSet(false, true)) {
|
||||
// wait
|
||||
}
|
||||
|
||||
// zero out everything.
|
||||
try {
|
||||
wlock();
|
||||
try {
|
||||
info.add("STARTING", new Boolean(false));
|
||||
info.add("STOPPING", new Boolean(false));
|
||||
info.add("RUNNING", new Boolean(false));
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
return;
|
||||
}
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// This is here to catch when something fucks up REALLY bad.
|
||||
if (tg != null) {
|
||||
if (SS != null) {
|
||||
try {
|
||||
SS.close();
|
||||
} catch (I2PException ex) {
|
||||
//Logger.getLogger(MUXlisten.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
if (this.come_in) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Some grace time.
|
||||
try {
|
||||
Thread.sleep(250);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
|
||||
lock.set(false); // Should we force waiting for all threads??
|
||||
// Wait around till all threads are collected.
|
||||
if (tg != null) {
|
||||
String boner = tg.getName();
|
||||
// System.out.println("BOB: MUXlisten: Starting thread collection for: " + boner);
|
||||
_log.warn("BOB: MUXlisten: Starting thread collection for: " + boner);
|
||||
// tg.interrupt(); // give my stuff a small smack again.
|
||||
if (tg.activeCount() + tg.activeGroupCount() != 0) {
|
||||
// visit(tg, 0, boner);
|
||||
int foo = tg.activeCount() + tg.activeGroupCount();
|
||||
// hopefully no longer needed!
|
||||
// int bar = foo;
|
||||
// System.out.println("BOB: MUXlisten: Waiting on threads for " + boner);
|
||||
// System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
|
||||
// visit(tg, 0, boner);
|
||||
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
|
||||
// Happily spin forever :-(
|
||||
while (foo != 0) {
|
||||
foo = tg.activeCount() + tg.activeGroupCount();
|
||||
// if (foo != bar && foo != 0) {
|
||||
// System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
|
||||
// visit(tg, 0, boner);
|
||||
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
|
||||
// }
|
||||
// bar = foo;
|
||||
try {
|
||||
Thread.sleep(100); //sleep for 100 ms (One tenth second)
|
||||
} catch (InterruptedException ex) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
}
|
||||
// System.out.println("BOB: MUXlisten: Threads went away. Success: " + boner);
|
||||
_log.warn("BOB: MUXlisten: Threads went away. Success: " + boner);
|
||||
tg.destroy();
|
||||
// Zap reference to the ThreadGroup so the JVM can GC it.
|
||||
tg = null;
|
||||
}
|
||||
try {
|
||||
socketManager.destroySocketManager();
|
||||
} catch (Exception e) {
|
||||
// nop
|
||||
}
|
||||
ticks = 600; // 60 seconds
|
||||
if (tg.activeCount() + tg.activeGroupCount() != 0) {
|
||||
while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) {
|
||||
tg.interrupt(); // unwedge any blocking threads.
|
||||
ticks--;
|
||||
try {
|
||||
Thread.sleep(100); //sleep for 100 ms (One tenth second)
|
||||
} catch (InterruptedException ex) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tg.activeCount() + tg.activeGroupCount() == 0) {
|
||||
tg.destroy();
|
||||
// Zap reference to the ThreadGroup so the JVM can GC it.
|
||||
tg = null;
|
||||
} else {
|
||||
System.out.println("BOB: MUXlisten: Can't kill threads. Please send the following dump to sponge@mail.i2p");
|
||||
System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN");
|
||||
visit(tg, 0);
|
||||
System.out.println("BOB: MUXlisten: ThreadGroup dump END\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
// This is here to catch when something fucks up REALLY bad.
|
||||
// if (tg != null) {
|
||||
// System.out.println("BOB: MUXlisten: Something fucked up REALLY bad!");
|
||||
// System.out.println("BOB: MUXlisten: Please email the following dump to sponge@mail.i2p");
|
||||
// WrapperManager.requestThreadDump();
|
||||
// System.out.println("BOB: MUXlisten: Something fucked up REALLY bad!");
|
||||
// System.out.println("BOB: MUXlisten: Please email the above dump to sponge@mail.i2p");
|
||||
// }
|
||||
// zero out everything.
|
||||
try {
|
||||
wlock();
|
||||
try {
|
||||
info.add("STARTING", new Boolean(false));
|
||||
info.add("STOPPING", new Boolean(false));
|
||||
info.add("RUNNING", new Boolean(false));
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
return;
|
||||
}
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Debugging...
|
||||
|
||||
/**
|
||||
// Debugging... None of this is normally used.
|
||||
/**
|
||||
* Find the root thread group and print them all.
|
||||
*
|
||||
*/
|
||||
@ -371,7 +325,7 @@ die:
|
||||
}
|
||||
|
||||
// Visit each thread group
|
||||
visit(root, 0);
|
||||
visit(root, 0, root.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -379,7 +333,7 @@ die:
|
||||
* @param group ThreadGroup to visit
|
||||
* @param level Current level
|
||||
*/
|
||||
private static void visit(ThreadGroup group, int level) {
|
||||
private static void visit(ThreadGroup group, int level, String tn) {
|
||||
// Get threads in `group'
|
||||
int numThreads = group.activeCount();
|
||||
Thread[] threads = new Thread[numThreads * 2];
|
||||
@ -389,7 +343,7 @@ die:
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
// Get thread
|
||||
Thread thread = threads[i];
|
||||
System.out.println("BOB: MUXlisten: " + indent + thread.toString());
|
||||
System.out.println("BOB: MUXlisten: " + tn + ": " + indent + thread.toString());
|
||||
}
|
||||
|
||||
// Get thread subgroups of `group'
|
||||
@ -399,7 +353,8 @@ die:
|
||||
|
||||
// Recursively visit each subgroup
|
||||
for (int i = 0; i < numGroups; i++) {
|
||||
visit(groups[i], level + 1);
|
||||
visit(groups[i], level + 1, groups[i].getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ public class TCPio implements Runnable {
|
||||
TCPio(InputStream Ain, OutputStream Aout /*, NamedDB info , NamedDB database */) {
|
||||
this.Ain = Ain;
|
||||
this.Aout = Aout;
|
||||
// this.info = info;
|
||||
// this.database = database;
|
||||
// this.info = info;
|
||||
// this.database = database;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,55 +86,46 @@ public class TCPio implements Runnable {
|
||||
byte a[] = new byte[1];
|
||||
boolean spin = true;
|
||||
try {
|
||||
while(spin) {
|
||||
// database.getReadLock();
|
||||
// info.getReadLock();
|
||||
// spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
// info.releaseReadLock();
|
||||
// database.releaseReadLock();
|
||||
b = Ain.read(a, 0, 1);
|
||||
// System.out.println(info.get("NICKNAME").toString() + " " + b);
|
||||
if(b > 0) {
|
||||
Aout.write(a, 0, b);
|
||||
} else if(b == 0) {
|
||||
Thread.yield(); // this should act like a mini sleep.
|
||||
if(Ain.available() == 0) {
|
||||
// try {
|
||||
// Thread.yield();
|
||||
try {
|
||||
while (spin) {
|
||||
b = Ain.read(a, 0, 1);
|
||||
if (b > 0) {
|
||||
Aout.write(a, 0, b);
|
||||
} else if (b == 0) {
|
||||
Thread.yield(); // this should act like a mini sleep.
|
||||
if (Ain.available() == 0) {
|
||||
Thread.sleep(10);
|
||||
// } catch(InterruptedException ex) {
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
/* according to the specs:
|
||||
*
|
||||
* The total number of bytes read into the buffer,
|
||||
* or -1 if there is no more data because the end of
|
||||
* the stream has been reached.
|
||||
*
|
||||
*/
|
||||
// System.out.println("TCPio: End Of Stream");
|
||||
// Ain.close();
|
||||
// Aout.close();
|
||||
//return;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* according to the specs:
|
||||
*
|
||||
* The total number of bytes read into the buffer,
|
||||
* or -1 if there is no more data because the end of
|
||||
* the stream has been reached.
|
||||
*
|
||||
*/
|
||||
// System.out.println("TCPio: End Of Stream");
|
||||
Ain.close();
|
||||
Aout.close();
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// System.out.println("TCPio: RUNNING = false");
|
||||
} catch(Exception e) {
|
||||
// System.out.println("TCPio: Leaving.");
|
||||
} finally {
|
||||
// Eject!!! Eject!!!
|
||||
//System.out.println("TCPio: Caught an exception " + e);
|
||||
try {
|
||||
Ain.close();
|
||||
} catch (IOException ex) {
|
||||
// Logger.getLogger(TCPio.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
try {
|
||||
Aout.close();
|
||||
} catch (IOException ex) {
|
||||
// Logger.getLogger(TCPio.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// System.out.println("TCPio: Leaving.");
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ public class TCPlistener implements Runnable {
|
||||
|
||||
private NamedDB info, database;
|
||||
private Log _log;
|
||||
private int tgwatch;
|
||||
public I2PSocketManager socketManager;
|
||||
public I2PServerSocket serverSocket;
|
||||
private ServerSocket listener;
|
||||
@ -60,7 +59,6 @@ public class TCPlistener implements Runnable {
|
||||
this._log = _log;
|
||||
this.socketManager = S;
|
||||
this.listener = listener;
|
||||
tgwatch = 1;
|
||||
}
|
||||
|
||||
private void rlock() throws Exception {
|
||||
@ -73,16 +71,6 @@ public class TCPlistener implements Runnable {
|
||||
info.releaseReadLock();
|
||||
}
|
||||
|
||||
private void wlock() throws Exception {
|
||||
database.getWriteLock();
|
||||
info.getWriteLock();
|
||||
}
|
||||
|
||||
private void wunlock() throws Exception {
|
||||
info.releaseWriteLock();
|
||||
database.releaseWriteLock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply listen on TCP port, and thread connections
|
||||
*
|
||||
@ -90,124 +78,53 @@ public class TCPlistener implements Runnable {
|
||||
public void run() {
|
||||
boolean g = false;
|
||||
boolean spin = true;
|
||||
|
||||
die: {
|
||||
try {
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
if (info.exists("OUTPORT")) {
|
||||
tgwatch = 2;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
int conn = 0;
|
||||
try {
|
||||
die:
|
||||
{
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e2) {
|
||||
break die;
|
||||
}
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
Socket server = new Socket();
|
||||
listener.setSoTimeout(50); // Half of the expected time from MUXlisten
|
||||
while (spin) {
|
||||
try {
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
} catch (Exception e) {
|
||||
Socket server = new Socket();
|
||||
listener.setSoTimeout(50); // We don't block, we cycle and check.
|
||||
while (spin) {
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e2) {
|
||||
break die;
|
||||
}
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
server = listener.accept();
|
||||
g = true;
|
||||
} catch (SocketTimeoutException ste) {
|
||||
g = false;
|
||||
}
|
||||
if (g) {
|
||||
// toss the connection to a new thread.
|
||||
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server /* , info, database */);
|
||||
Thread t = new Thread(conn_c, "BOBTCPtoI2P");
|
||||
t.start();
|
||||
g = false;
|
||||
}
|
||||
}
|
||||
//System.out.println("TCPlistener: destroySession");
|
||||
listener.close();
|
||||
} catch (IOException ioe) {
|
||||
try {
|
||||
listener.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
// Fatal failure, cause a stop event
|
||||
try {
|
||||
rlock();
|
||||
try {
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
} catch (Exception e) {
|
||||
runlock();
|
||||
break die;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
if (spin) {
|
||||
try {
|
||||
wlock();
|
||||
try {
|
||||
info.add("STOPPING", new Boolean(true));
|
||||
info.add("RUNNING", new Boolean(false));
|
||||
rlock();
|
||||
} catch (Exception e) {
|
||||
wunlock();
|
||||
break die;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
wunlock();
|
||||
} catch (Exception e) {
|
||||
break die;
|
||||
try {
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
runlock();
|
||||
} catch (Exception e2) {
|
||||
break die;
|
||||
}
|
||||
break die;
|
||||
}
|
||||
try {
|
||||
server = listener.accept();
|
||||
g = true;
|
||||
} catch (SocketTimeoutException ste) {
|
||||
g = false;
|
||||
}
|
||||
if (g) {
|
||||
conn++;
|
||||
// toss the connection to a new thread.
|
||||
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database);
|
||||
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
|
||||
t.start();
|
||||
g = false;
|
||||
}
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
listener.close();
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
//System.out.println("TCPlistener: " + Thread.currentThread().getName() + "Done.");
|
||||
}
|
||||
// Previous level does this cleanup now.
|
||||
//
|
||||
// need to kill off the socket manager too.
|
||||
// I2PSession session = socketManager.getSession();
|
||||
// if (session != null) {
|
||||
// try {
|
||||
// session.destroySession();
|
||||
// } catch (I2PSessionException ex) {
|
||||
// nop
|
||||
// }
|
||||
//}
|
||||
//System.out.println("TCPlistener: Waiting for children");
|
||||
//while (Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
|
||||
// try {
|
||||
// Thread.sleep(100); //sleep for 100 ms (One tenth second)
|
||||
// } catch (Exception e) {
|
||||
// // nop
|
||||
// }
|
||||
//}
|
||||
//System.out.println("TCPlistener: Done.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,6 +33,7 @@ import java.net.Socket;
|
||||
import net.i2p.I2PException;
|
||||
import net.i2p.client.streaming.I2PSocket;
|
||||
import net.i2p.client.streaming.I2PSocketManager;
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.i2ptunnel.I2PTunnel;
|
||||
|
||||
@ -45,41 +46,10 @@ import net.i2p.i2ptunnel.I2PTunnel;
|
||||
public class TCPtoI2P implements Runnable {
|
||||
|
||||
private I2PSocket I2P;
|
||||
// private NamedDB info, database;
|
||||
private NamedDB info, database;
|
||||
private Socket sock;
|
||||
private I2PSocketManager socketManager;
|
||||
|
||||
/**
|
||||
* This is a more forgiving readline,
|
||||
* it works on unbuffered streams
|
||||
*
|
||||
* @param in
|
||||
* @return line of text as a String
|
||||
* @throws Exception
|
||||
*/
|
||||
private static String lnRead(InputStream in) throws Exception {
|
||||
String S;
|
||||
int b;
|
||||
char c;
|
||||
|
||||
S = new String();
|
||||
|
||||
while(true) {
|
||||
b = in.read();
|
||||
if(b == 13) {
|
||||
//skip CR
|
||||
continue;
|
||||
}
|
||||
if(b < 20 || b > 126) {
|
||||
// exit on anything not legal
|
||||
break;
|
||||
}
|
||||
c = (char)(b & 0x7f); // We only really give a fuck about ASCII
|
||||
S = new String(S + c);
|
||||
}
|
||||
return S;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param i2p
|
||||
@ -87,13 +57,44 @@ public class TCPtoI2P implements Runnable {
|
||||
* param info
|
||||
* param database
|
||||
*/
|
||||
TCPtoI2P(I2PSocketManager i2p, Socket socket /*, NamedDB info, NamedDB database */) {
|
||||
TCPtoI2P(I2PSocketManager i2p, Socket socket , NamedDB info, NamedDB database) {
|
||||
this.sock = socket;
|
||||
// this.info = info;
|
||||
// this.database = database;
|
||||
this.info = info;
|
||||
this.database = database;
|
||||
this.socketManager = i2p;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a more forgiving readline,
|
||||
* it works on unbuffered streams
|
||||
*
|
||||
* @param in
|
||||
* @return line of text as a String
|
||||
* @throws IOException
|
||||
*/
|
||||
private static String lnRead(InputStream in) throws IOException {
|
||||
String S;
|
||||
int b;
|
||||
char c;
|
||||
|
||||
S = new String();
|
||||
|
||||
while (true) {
|
||||
b = in.read();
|
||||
if (b == 13) {
|
||||
//skip CR
|
||||
continue;
|
||||
}
|
||||
if (b < 20 || b > 126) {
|
||||
// exit on anything not legal
|
||||
break;
|
||||
}
|
||||
c = (char) (b & 0x7f); // We only really give a fuck about ASCII
|
||||
S = new String(S + c);
|
||||
}
|
||||
return S;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an error message to out
|
||||
*
|
||||
@ -103,11 +104,24 @@ public class TCPtoI2P implements Runnable {
|
||||
*/
|
||||
private void Emsg(String e, OutputStream out) throws IOException {
|
||||
// Debugging System.out.println("ERROR TCPtoI2P: " + e);
|
||||
out.write("ERROR".concat(e).getBytes());
|
||||
out.write(13); // cr
|
||||
out.write("ERROR ".concat(e).getBytes());
|
||||
out.write(13);
|
||||
out.write(10);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
// private void rlock() throws Exception {
|
||||
private void rlock() {
|
||||
database.getReadLock();
|
||||
info.getReadLock();
|
||||
}
|
||||
|
||||
// private void runlock() throws Exception {
|
||||
private void runlock() {
|
||||
info.releaseReadLock();
|
||||
database.releaseReadLock();
|
||||
}
|
||||
|
||||
/**
|
||||
* TCP stream to I2P stream thread starter
|
||||
*
|
||||
@ -118,17 +132,17 @@ public class TCPtoI2P implements Runnable {
|
||||
OutputStream Iout = null;
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
|
||||
Thread t = null;
|
||||
Thread q = null;
|
||||
try {
|
||||
|
||||
in = sock.getInputStream();
|
||||
out = sock.getOutputStream();
|
||||
try {
|
||||
|
||||
in = sock.getInputStream();
|
||||
out = sock.getOutputStream();
|
||||
line = lnRead(in);
|
||||
input = line.toLowerCase();
|
||||
Destination dest = null;
|
||||
|
||||
if(input.endsWith(".i2p")) {
|
||||
if (input.endsWith(".i2p")) {
|
||||
dest = I2PTunnel.destFromName(input);
|
||||
line = dest.toBase64();
|
||||
}
|
||||
@ -145,63 +159,81 @@ public class TCPtoI2P implements Runnable {
|
||||
// setup to cross the streams
|
||||
TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P
|
||||
TCPio conn_a = new TCPio(Iin, out /*, info, database */); // I2P -> app
|
||||
Thread t = new Thread(conn_c, "TCPioA");
|
||||
Thread q = new Thread(conn_a, "TCPioB");
|
||||
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
|
||||
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
|
||||
// Fire!
|
||||
t.start();
|
||||
q.start();
|
||||
while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
|
||||
// try {
|
||||
Thread.sleep(10); //sleep for 10 ms
|
||||
// } catch(InterruptedException e) {
|
||||
// nop
|
||||
// }
|
||||
boolean spin = true;
|
||||
while (t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
|
||||
Thread.sleep(10); //sleep for 10 ms
|
||||
rlock();
|
||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||
runlock();
|
||||
}
|
||||
// System.out.println("TCPtoI2P: Going away...");
|
||||
|
||||
} catch(I2PException e) {
|
||||
Emsg("ERROR " + e.toString(), out);
|
||||
} catch(ConnectException e) {
|
||||
Emsg("ERROR " + e.toString(), out);
|
||||
} catch(NoRouteToHostException e) {
|
||||
Emsg("ERROR " + e.toString(), out);
|
||||
} catch(InterruptedIOException e) {
|
||||
Emsg("ERROR " + e.toString(), out);
|
||||
} catch (I2PException e) {
|
||||
Emsg(e.toString(), out);
|
||||
} catch (ConnectException e) {
|
||||
Emsg(e.toString(), out);
|
||||
} catch (NoRouteToHostException e) {
|
||||
Emsg(e.toString(), out);
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
Emsg("ERROR " + e.toString(), out);
|
||||
} catch (InterruptedIOException e) {
|
||||
// We're breaking away.
|
||||
} catch (InterruptedException e) {
|
||||
// ditto
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
Emsg(e.toString(), out);
|
||||
} catch (IOException ex) {
|
||||
// ditto
|
||||
}
|
||||
} catch (DataFormatException e) {
|
||||
try {
|
||||
Emsg(e.toString(), out);
|
||||
} catch (IOException ex) {
|
||||
// ditto
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
// bail on anything else
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
try {
|
||||
out.close();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
try {
|
||||
Iin.close();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
try {
|
||||
Iout.close();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
try {
|
||||
// System.out.println("TCPtoI2P: Close I2P");
|
||||
I2P.close();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
// System.out.println("TCPtoI2P: Close sock");
|
||||
sock.close();
|
||||
} catch(Exception e) {
|
||||
} finally {
|
||||
try {
|
||||
t.interrupt();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
q.interrupt();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
Iin.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
Iout.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
// System.out.println("TCPtoI2P: Close I2P");
|
||||
I2P.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
// System.out.println("TCPtoI2P: Close sock");
|
||||
sock.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
// System.out.println("TCPtoI2P: Done.");
|
||||
// System.out.println("TCPtoI2P: Done.");
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
<property name="dist" location="dist"/>
|
||||
<property name="jar" value="addressbook.jar"/>
|
||||
<property name="war" value="addressbook.war"/>
|
||||
<property name="javac.compilerargs" value="" />
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${build}"/>
|
||||
@ -38,6 +39,7 @@
|
||||
<target name="compile" depends="init, depend">
|
||||
<javac debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
srcdir="${src}" destdir="${build}">
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
<classpath>
|
||||
<pathelement location="../../core/java/build/i2p.jar" />
|
||||
<pathelement location="../jetty/jettylib/javax.servlet.jar" />
|
||||
|
@ -54,9 +54,10 @@ public class Servlet extends GenericServlet {
|
||||
args[0] = config.getInitParameter("home");
|
||||
DaemonThread thread = new DaemonThread(args);
|
||||
thread.setDaemon(true);
|
||||
thread.setName("Addressbook");
|
||||
thread.start();
|
||||
System.out.println("INFO: Starting Addressbook " + Daemon.VERSION);
|
||||
System.out.println("INFO: config root under " + args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -76,10 +76,12 @@
|
||||
<property name="build_dist" location="dist"/>
|
||||
<property name="build_lib" location="lib"/>
|
||||
<property name="build_i2pref" location="../../build"/>
|
||||
<property name="build_routerconsole" location="../routerconsole/java/build/"/>
|
||||
|
||||
<path id="build_classpath">
|
||||
<fileset dir="${build_lib}" includes="**/*.jar"/>
|
||||
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
|
||||
<fileset dir="${build_routerconsole}" includes="**/*.jar"/>
|
||||
</path>
|
||||
<target name="build_init">
|
||||
<!-- Create the time stamp -->
|
||||
|
@ -152,7 +152,7 @@ is divided into following sections:
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="${javac.debug}" name="debug"/>
|
||||
<attribute default="" name="sourcepath"/>
|
||||
<attribute default="/does/not/exist" name="sourcepath"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
|
||||
@ -218,13 +218,13 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-nbjpda">
|
||||
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
|
||||
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="${main.class}" name="name"/>
|
||||
<attribute default="${debug.classpath}" name="classpath"/>
|
||||
<attribute default="" name="stopclassname"/>
|
||||
<sequential>
|
||||
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
|
||||
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
@ -255,6 +255,12 @@ is divided into following sections:
|
||||
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
|
||||
<istrue value="${have-jdk-older-than-1.4}"/>
|
||||
</condition>
|
||||
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
|
||||
<isset property="debug.transport"/>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-init-debug-args" name="-init-macrodef-debug">
|
||||
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
@ -264,7 +270,7 @@ is divided into following sections:
|
||||
<sequential>
|
||||
<java classname="@{classname}" dir="${work.dir}" fork="true">
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
@ -311,6 +317,13 @@ is divided into following sections:
|
||||
===================
|
||||
-->
|
||||
<target depends="init" name="deps-jar" unless="no.deps"/>
|
||||
<target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
|
||||
<target depends="init" name="-check-automatic-build">
|
||||
<available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
|
||||
</target>
|
||||
<target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
|
||||
<antcall target="clean"/>
|
||||
</target>
|
||||
<target depends="init,deps-jar" name="-pre-pre-compile">
|
||||
<mkdir dir="${build.classes.dir}"/>
|
||||
</target>
|
||||
@ -331,7 +344,7 @@ is divided into following sections:
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
|
||||
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
|
||||
<target name="-pre-compile-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
@ -345,7 +358,7 @@ is divided into following sections:
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
|
||||
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
|
||||
<!--
|
||||
====================
|
||||
JAR BUILDING SECTION
|
||||
|
@ -3,6 +3,6 @@ build.xml.script.CRC32=9785bb9a
|
||||
build.xml.stylesheet.CRC32=be360661
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=c4b345cd
|
||||
nbproject/build-impl.xml.script.CRC32=74d3fda2
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=487672f9
|
||||
nbproject/build-impl.xml.data.CRC32=f630f8db
|
||||
nbproject/build-impl.xml.script.CRC32=8c02c081
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=65b8de21
|
||||
|
@ -23,6 +23,7 @@ excludes=
|
||||
file.reference.appframework.jar=lib/appframework.jar
|
||||
file.reference.i2p.jar=../../core/java/build/i2p.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
|
||||
includes=**
|
||||
jar.compress=false
|
||||
@ -30,7 +31,8 @@ javac.classpath=\
|
||||
${file.reference.router.jar}:\
|
||||
${file.reference.appframework.jar}:\
|
||||
${file.reference.swing-worker.jar}:\
|
||||
${file.reference.i2p.jar}
|
||||
${file.reference.i2p.jar}:\
|
||||
${file.reference.routerconsole.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
@ -58,7 +60,7 @@ jnlp.codebase.url=file:/home/mathias/Documenten/Programmeren/i2p_monotone/repo/i
|
||||
jnlp.enabled=false
|
||||
jnlp.offline-allowed=false
|
||||
jnlp.signed=false
|
||||
main.class=desktopgui.Main
|
||||
main.class=net.i2p.desktopgui.desktopgui.Main
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
|
@ -13,7 +13,7 @@
|
||||
</test-roots>
|
||||
</data>
|
||||
<swingapp xmlns="http://www.netbeans.org/ns/form-swingapp/1">
|
||||
<application-class name="desktopgui.Main"/>
|
||||
<application-class name="net.i2p.desktopgui.desktopgui.Main"/>
|
||||
</swingapp>
|
||||
</configuration>
|
||||
</project>
|
||||
|
@ -1,376 +0,0 @@
|
||||
/*
|
||||
* GeneralConfiguration.java
|
||||
*
|
||||
* Created on 10 april 2009, 19:04
|
||||
*/
|
||||
|
||||
package gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mathias
|
||||
*/
|
||||
public class GeneralConfiguration extends javax.swing.JFrame {
|
||||
|
||||
/** Creates new form GeneralConfiguration */
|
||||
public GeneralConfiguration() {
|
||||
initComponents();
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
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")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
cancel = new javax.swing.JToggleButton();
|
||||
ok = new javax.swing.JToggleButton();
|
||||
jTabbedPane1 = new javax.swing.JTabbedPane();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
jTextField2 = new javax.swing.JTextField();
|
||||
jComboBox1 = new javax.swing.JComboBox();
|
||||
jComboBox2 = new javax.swing.JComboBox();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jTextField3 = new javax.swing.JTextField();
|
||||
jTextField4 = new javax.swing.JTextField();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
jRadioButton1 = new javax.swing.JRadioButton();
|
||||
jRadioButton2 = new javax.swing.JRadioButton();
|
||||
jRadioButton3 = new javax.swing.JRadioButton();
|
||||
jToggleButton1 = new javax.swing.JToggleButton();
|
||||
jToggleButton2 = new javax.swing.JToggleButton();
|
||||
jToggleButton3 = new javax.swing.JToggleButton();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jPanel6 = new javax.swing.JPanel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setName("Form"); // NOI18N
|
||||
|
||||
jPanel1.setName("jPanel1"); // NOI18N
|
||||
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(GeneralConfiguration.class);
|
||||
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
|
||||
cancel.setName("cancel"); // NOI18N
|
||||
|
||||
ok.setText(resourceMap.getString("ok.text")); // NOI18N
|
||||
ok.setName("ok"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap(475, Short.MAX_VALUE)
|
||||
.addComponent(ok)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancel)
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancel)
|
||||
.addComponent(ok))
|
||||
.addContainerGap(14, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.setName("jTabbedPane1"); // NOI18N
|
||||
|
||||
jPanel2.setName("jPanel2"); // NOI18N
|
||||
jPanel2.setLayout(null);
|
||||
|
||||
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
|
||||
jLabel1.setName("jLabel1"); // NOI18N
|
||||
jPanel2.add(jLabel1);
|
||||
jLabel1.setBounds(20, 20, 140, 30);
|
||||
|
||||
jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
|
||||
jLabel2.setName("jLabel2"); // NOI18N
|
||||
jPanel2.add(jLabel2);
|
||||
jLabel2.setBounds(20, 60, 140, 30);
|
||||
|
||||
jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N
|
||||
jTextField1.setName("jTextField1"); // NOI18N
|
||||
jPanel2.add(jTextField1);
|
||||
jTextField1.setBounds(160, 20, 77, 27);
|
||||
|
||||
jTextField2.setText(resourceMap.getString("jTextField2.text")); // NOI18N
|
||||
jTextField2.setName("jTextField2"); // NOI18N
|
||||
jPanel2.add(jTextField2);
|
||||
jTextField2.setBounds(160, 60, 77, 27);
|
||||
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
jComboBox1.setName("jComboBox1"); // NOI18N
|
||||
jPanel2.add(jComboBox1);
|
||||
jComboBox1.setBounds(240, 20, 78, 27);
|
||||
|
||||
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
jComboBox2.setName("jComboBox2"); // NOI18N
|
||||
jPanel2.add(jComboBox2);
|
||||
jComboBox2.setBounds(240, 60, 78, 27);
|
||||
|
||||
jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
|
||||
jLabel3.setName("jLabel3"); // NOI18N
|
||||
jPanel2.add(jLabel3);
|
||||
jLabel3.setBounds(330, 20, 97, 30);
|
||||
|
||||
jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
|
||||
jLabel4.setName("jLabel4"); // NOI18N
|
||||
jPanel2.add(jLabel4);
|
||||
jLabel4.setBounds(330, 60, 97, 30);
|
||||
|
||||
jTextField3.setText(resourceMap.getString("jTextField3.text")); // NOI18N
|
||||
jTextField3.setName("jTextField3"); // NOI18N
|
||||
jPanel2.add(jTextField3);
|
||||
jTextField3.setBounds(440, 20, 60, 27);
|
||||
|
||||
jTextField4.setText(resourceMap.getString("jTextField4.text")); // NOI18N
|
||||
jTextField4.setName("jTextField4"); // NOI18N
|
||||
jPanel2.add(jTextField4);
|
||||
jTextField4.setBounds(440, 60, 60, 27);
|
||||
|
||||
jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
|
||||
jLabel5.setName("jLabel5"); // NOI18N
|
||||
jPanel2.add(jLabel5);
|
||||
jLabel5.setBounds(510, 20, 19, 30);
|
||||
|
||||
jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
|
||||
jLabel6.setName("jLabel6"); // NOI18N
|
||||
jPanel2.add(jLabel6);
|
||||
jLabel6.setBounds(510, 60, 19, 30);
|
||||
|
||||
jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
|
||||
jLabel7.setName("jLabel7"); // NOI18N
|
||||
jPanel2.add(jLabel7);
|
||||
jLabel7.setBounds(20, 100, 520, 70);
|
||||
|
||||
jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N
|
||||
|
||||
jPanel3.setName("jPanel3"); // NOI18N
|
||||
|
||||
jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
|
||||
jLabel8.setName("jLabel8"); // NOI18N
|
||||
|
||||
jRadioButton1.setText(resourceMap.getString("jRadioButton1.text")); // NOI18N
|
||||
jRadioButton1.setName("jRadioButton1"); // NOI18N
|
||||
|
||||
jRadioButton2.setText(resourceMap.getString("jRadioButton2.text")); // NOI18N
|
||||
jRadioButton2.setName("jRadioButton2"); // NOI18N
|
||||
|
||||
jRadioButton3.setText(resourceMap.getString("jRadioButton3.text")); // NOI18N
|
||||
jRadioButton3.setName("jRadioButton3"); // NOI18N
|
||||
|
||||
jToggleButton1.setText(resourceMap.getString("jToggleButton1.text")); // NOI18N
|
||||
jToggleButton1.setName("jToggleButton1"); // NOI18N
|
||||
|
||||
jToggleButton2.setText(resourceMap.getString("jToggleButton2.text")); // NOI18N
|
||||
jToggleButton2.setName("jToggleButton2"); // NOI18N
|
||||
|
||||
jToggleButton3.setText(resourceMap.getString("jToggleButton3.text")); // NOI18N
|
||||
jToggleButton3.setName("jToggleButton3"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
|
||||
jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addGap(20, 20, 20)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel8)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addComponent(jToggleButton1)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jToggleButton2))))
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addGap(40, 40, 40)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jRadioButton2)
|
||||
.addComponent(jRadioButton1)
|
||||
.addComponent(jRadioButton3))))
|
||||
.addGap(9, 9, 9))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap(339, Short.MAX_VALUE)
|
||||
.addComponent(jToggleButton3)
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel8)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jRadioButton1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jRadioButton2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jRadioButton3)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jToggleButton1)
|
||||
.addComponent(jToggleButton2))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 181, Short.MAX_VALUE)
|
||||
.addComponent(jToggleButton3)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab(resourceMap.getString("jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N
|
||||
|
||||
jPanel4.setName("jPanel4"); // NOI18N
|
||||
|
||||
jScrollPane1.setName("jScrollPane1"); // NOI18N
|
||||
|
||||
jScrollPane2.setName("jScrollPane2"); // NOI18N
|
||||
|
||||
jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
|
||||
jLabel9.setName("jLabel9"); // NOI18N
|
||||
|
||||
jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
|
||||
jLabel10.setName("jLabel10"); // NOI18N
|
||||
|
||||
jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
|
||||
jLabel11.setName("jLabel11"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||
jPanel4.setLayout(jPanel4Layout);
|
||||
jPanel4Layout.setHorizontalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
|
||||
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
|
||||
.addComponent(jLabel10)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
|
||||
.addComponent(jLabel11))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel10)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel11)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N
|
||||
|
||||
jPanel5.setName("jPanel5"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
|
||||
jPanel5.setLayout(jPanel5Layout);
|
||||
jPanel5Layout.setHorizontalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 562, Short.MAX_VALUE)
|
||||
);
|
||||
jPanel5Layout.setVerticalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 388, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N
|
||||
|
||||
jPanel6.setName("jPanel6"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
|
||||
jPanel6.setLayout(jPanel6Layout);
|
||||
jPanel6Layout.setHorizontalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 562, Short.MAX_VALUE)
|
||||
);
|
||||
jPanel6Layout.setVerticalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 388, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab(resourceMap.getString("jPanel6.TabConstraints.tabTitle"), jPanel6); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(12, 12, 12)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jTabbedPane1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JToggleButton cancel;
|
||||
private javax.swing.JComboBox jComboBox1;
|
||||
private javax.swing.JComboBox jComboBox2;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JPanel jPanel5;
|
||||
private javax.swing.JPanel jPanel6;
|
||||
private javax.swing.JRadioButton jRadioButton1;
|
||||
private javax.swing.JRadioButton jRadioButton2;
|
||||
private javax.swing.JRadioButton jRadioButton3;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JTabbedPane jTabbedPane1;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
private javax.swing.JTextField jTextField2;
|
||||
private javax.swing.JTextField jTextField3;
|
||||
private javax.swing.JTextField jTextField4;
|
||||
private javax.swing.JToggleButton jToggleButton1;
|
||||
private javax.swing.JToggleButton jToggleButton2;
|
||||
private javax.swing.JToggleButton jToggleButton3;
|
||||
private javax.swing.JToggleButton ok;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
|
||||
jPanel2.TabConstraints.tabTitle=Speed
|
||||
jPanel3.TabConstraints.tabTitle=Updates
|
||||
jPanel4.TabConstraints.tabTitle=Tunnels/Services
|
||||
jPanel5.TabConstraints.tabTitle=Network
|
||||
jPanel6.TabConstraints.tabTitle=Advanced
|
||||
cancel.text=Cancel
|
||||
ok.text=OK
|
||||
jLabel1.text=Upload speed:
|
||||
jLabel2.text=Download speed:
|
||||
jTextField1.text=jTextField1
|
||||
jTextField2.text=jTextField2
|
||||
jLabel3.text=Monthly usage:
|
||||
jLabel4.text=Monthly usage:
|
||||
jTextField3.text=jTextField3
|
||||
jTextField4.text=jTextField4
|
||||
jLabel5.text=GB
|
||||
jLabel6.text=GB
|
||||
jLabel7.text=Explanation ...
|
||||
jLabel8.text=What is your preferred automatic update setting?
|
||||
jRadioButton1.text=Only inform about updates
|
||||
jRadioButton2.text=Download and verify update file, do not restart
|
||||
jRadioButton3.text=Download, verify and restart
|
||||
jToggleButton1.text=Check for updates now
|
||||
jToggleButton2.text=Update available: update now
|
||||
jToggleButton3.text=Advanced update configuration
|
||||
jLabel9.text=Tunnel explanation
|
||||
jLabel10.text=Client tunnels:
|
||||
jLabel11.text=Server tunnels:
|
@ -3,12 +3,12 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package desktopgui;
|
||||
package net.i2p.desktopgui.desktopgui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mathias
|
||||
*/
|
||||
public class GUIVersion {
|
||||
public static final String VERSION = "0.0.1.1";
|
||||
public static final String VERSION = "0.0.1.3";
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package desktopgui;
|
||||
package net.i2p.desktopgui.desktopgui;
|
||||
|
||||
/*
|
||||
* Main.java
|
||||
@ -6,8 +6,8 @@ package desktopgui;
|
||||
|
||||
|
||||
|
||||
import gui.Tray;
|
||||
import gui.SpeedSelector;
|
||||
import net.i2p.desktopgui.gui.Tray;
|
||||
import net.i2p.desktopgui.gui.SpeedSelector;
|
||||
import java.awt.SystemTray;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
@ -16,7 +16,7 @@ import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
import persistence.PropertyManager;
|
||||
import net.i2p.desktopgui.persistence.PropertyManager;
|
||||
|
||||
/**
|
||||
* The main class of the application.
|
@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.ButtonGroup" name="updateButtonGroup">
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
|
||||
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
@ -11,6 +16,7 @@
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
@ -22,27 +28,27 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="applyPanel" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="12" pref="12" max="12" attributes="0"/>
|
||||
<Component id="jTabbedPane1" pref="566" max="32767" attributes="0"/>
|
||||
<Component id="settingsPanel" pref="566" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jTabbedPane1" max="32767" attributes="0"/>
|
||||
<Component id="settingsPanel" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="applyPanel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Container class="javax.swing.JPanel" name="applyPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="applyPanel" noResource="true"/>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
@ -75,30 +81,36 @@
|
||||
<Property name="text" type="java.lang.String" resourceKey="cancel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="cancel" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="cancelMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="ok">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="ok.text"/>
|
||||
<Property name="name" type="java.lang.String" value="ok" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="okMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
|
||||
<Container class="javax.swing.JTabbedPane" name="settingsPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jTabbedPane1" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="settingsPanel" noResource="true"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Container class="javax.swing.JPanel" name="speedPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jPanel2" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="speedPanel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Speed">
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel2.TabConstraints.tabTitle"/>
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="speedPanel.TabConstraints.tabTitle"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
@ -107,10 +119,10 @@
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Component class="javax.swing.JLabel" name="uploadSpeedLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="uploadSpeedLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="uploadSpeedLabel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -118,10 +130,10 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Component class="javax.swing.JLabel" name="downloadSpeedLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="downloadSpeedLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="downloadSpeedLabel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -129,68 +141,76 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField1">
|
||||
<Component class="javax.swing.JTextField" name="uploadspeed">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jTextField1.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jTextField1" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="uploadspeed.text"/>
|
||||
<Property name="name" type="java.lang.String" value="uploadspeed" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyReleased"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="160" y="20" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField2">
|
||||
<Component class="javax.swing.JTextField" name="downloadspeed">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jTextField2.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jTextField2" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="downloadspeed.text"/>
|
||||
<Property name="name" type="java.lang.String" value="downloadspeed" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyReleased"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="160" y="60" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="jComboBox1">
|
||||
<Component class="javax.swing.JComboBox" name="uploadkbps">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringArray count="2">
|
||||
<StringItem index="0" value="kbps"/>
|
||||
<StringItem index="1" value="kBps"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="jComboBox1" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="uploadkbps" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="uploadkbpsActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="240" y="20" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="jComboBox2">
|
||||
<Component class="javax.swing.JComboBox" name="downloadkbps">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringArray count="2">
|
||||
<StringItem index="0" value="kbps"/>
|
||||
<StringItem index="1" value="kBps"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="jComboBox2" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="downloadkbps" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadkbpsActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="240" y="60" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Component class="javax.swing.JLabel" name="uploadUsageLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="uploadUsageLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="uploadUsageLabel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -198,10 +218,10 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Component class="javax.swing.JLabel" name="downloadUsageLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel4.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="downloadUsageLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="downloadUsageLabel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -209,32 +229,38 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField3">
|
||||
<Component class="javax.swing.JTextField" name="uploadgb">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jTextField3.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jTextField3" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="uploadgb.text"/>
|
||||
<Property name="name" type="java.lang.String" value="uploadgb" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="440" y="20" width="60" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField4">
|
||||
<Component class="javax.swing.JTextField" name="downloadgb">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jTextField4.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jTextField4" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="downloadgb.text"/>
|
||||
<Property name="name" type="java.lang.String" value="downloadgb" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="440" y="60" width="60" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Component class="javax.swing.JLabel" name="gbUploadLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel5.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel5" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="gbUploadLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="gbUploadLabel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -242,10 +268,10 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Component class="javax.swing.JLabel" name="gbDownloadLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel6.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel6" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="gbDownloadLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="gbDownloadLabel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -253,10 +279,10 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
<Component class="javax.swing.JLabel" name="uploadDownloadExplanation">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel7.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel7" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="uploadDownloadExplanation.text"/>
|
||||
<Property name="name" type="java.lang.String" value="uploadDownloadExplanation" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
@ -266,14 +292,14 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Container class="javax.swing.JPanel" name="updatesPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jPanel3" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="updatesPanel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Updates">
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel3.TabConstraints.tabTitle"/>
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="updatesPanel.TabConstraints.tabTitle"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
@ -286,20 +312,20 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateMethod" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jToggleButton1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkUpdates" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jToggleButton2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateNow" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="40" pref="40" max="40" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jRadioButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jRadioButton3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateDownload" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateInform" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateDownloadRestart" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -307,7 +333,7 @@
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="339" max="32767" attributes="0"/>
|
||||
<Component id="jToggleButton3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="advancedUpdateConfig" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -316,78 +342,96 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateMethod" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jRadioButton1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateInform" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jRadioButton2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateDownload" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jRadioButton3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateDownloadRestart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jToggleButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jToggleButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkUpdates" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="updateNow" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="181" max="32767" attributes="0"/>
|
||||
<Component id="jToggleButton3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="advancedUpdateConfig" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel8">
|
||||
<Component class="javax.swing.JLabel" name="updateMethod">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel8.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel8" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="updateMethod.text"/>
|
||||
<Property name="name" type="java.lang.String" value="updateMethod" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="jRadioButton1">
|
||||
<Component class="javax.swing.JRadioButton" name="updateInform">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jRadioButton1.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jRadioButton1" noResource="true"/>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="updateButtonGroup"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" resourceKey="updateInform.text"/>
|
||||
<Property name="name" type="java.lang.String" value="updateInform" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="jRadioButton2">
|
||||
<Component class="javax.swing.JRadioButton" name="updateDownload">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jRadioButton2.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jRadioButton2" noResource="true"/>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="updateButtonGroup"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" resourceKey="updateDownload.text"/>
|
||||
<Property name="name" type="java.lang.String" value="updateDownload" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="jRadioButton3">
|
||||
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jRadioButton3.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jRadioButton3" noResource="true"/>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="updateButtonGroup"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" resourceKey="updateDownloadRestart.text"/>
|
||||
<Property name="name" type="java.lang.String" value="updateDownloadRestart" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleButton1">
|
||||
<Component class="javax.swing.JToggleButton" name="checkUpdates">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jToggleButton1.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jToggleButton1" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="checkUpdates.text"/>
|
||||
<Property name="name" type="java.lang.String" value="checkUpdates" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkUpdatesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleButton2">
|
||||
<Component class="javax.swing.JToggleButton" name="updateNow">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jToggleButton2.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jToggleButton2" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="updateNow.text"/>
|
||||
<Property name="name" type="java.lang.String" value="updateNow" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="updateNowActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleButton3">
|
||||
<Component class="javax.swing.JToggleButton" name="advancedUpdateConfig">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jToggleButton3.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jToggleButton3" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="advancedUpdateConfig.text"/>
|
||||
<Property name="name" type="java.lang.String" value="advancedUpdateConfig" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="advancedUpdateConfigActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
<Container class="javax.swing.JPanel" name="tunnelPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jPanel4" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="tunnelPanel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Tunnels/Services">
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel4.TabConstraints.tabTitle"/>
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="tunnelPanel.TabConstraints.tabTitle"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
@ -398,11 +442,11 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane2" alignment="1" pref="538" max="32767" attributes="0"/>
|
||||
<Component id="jLabel9" alignment="0" pref="538" max="32767" attributes="0"/>
|
||||
<Component id="jLabel10" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="538" max="32767" attributes="0"/>
|
||||
<Component id="jLabel11" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="serverFrame" alignment="1" pref="538" max="32767" attributes="0"/>
|
||||
<Component id="tunnelsExplanation" alignment="0" pref="538" max="32767" attributes="0"/>
|
||||
<Component id="clientTunnelLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="clientFrame" alignment="0" pref="538" max="32767" attributes="0"/>
|
||||
<Component id="serverTunnelLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@ -412,63 +456,63 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="clientTunnelLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="119" max="32767" attributes="0"/>
|
||||
<Component id="clientFrame" pref="119" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="serverTunnelLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane2" pref="122" max="32767" attributes="0"/>
|
||||
<Component id="serverFrame" pref="122" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel9" min="-2" pref="65" max="-2" attributes="0"/>
|
||||
<Component id="tunnelsExplanation" min="-2" pref="65" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Container class="javax.swing.JScrollPane" name="clientFrame">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="clientFrame" noResource="true"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<Container class="javax.swing.JScrollPane" name="serverFrame">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jScrollPane2" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="serverFrame" noResource="true"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel9">
|
||||
<Component class="javax.swing.JLabel" name="tunnelsExplanation">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel9.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel9" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="tunnelsExplanation.text"/>
|
||||
<Property name="name" type="java.lang.String" value="tunnelsExplanation" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel10">
|
||||
<Component class="javax.swing.JLabel" name="clientTunnelLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel10.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel10" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="clientTunnelLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="clientTunnelLabel" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel11">
|
||||
<Component class="javax.swing.JLabel" name="serverTunnelLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" resourceKey="jLabel11.text"/>
|
||||
<Property name="name" type="java.lang.String" value="jLabel11" noResource="true"/>
|
||||
<Property name="text" type="java.lang.String" resourceKey="serverTunnelLabel.text"/>
|
||||
<Property name="name" type="java.lang.String" value="serverTunnelLabel" noResource="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<Container class="javax.swing.JPanel" name="networkPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jPanel5" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="networkPanel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Network">
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel5.TabConstraints.tabTitle"/>
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="networkPanel.TabConstraints.tabTitle"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
@ -486,14 +530,14 @@
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel6">
|
||||
<Container class="javax.swing.JPanel" name="advancedPanel">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="jPanel6" noResource="true"/>
|
||||
<Property name="name" type="java.lang.String" value="advancedPanel" noResource="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Advanced">
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel6.TabConstraints.tabTitle"/>
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="advancedPanel.TabConstraints.tabTitle"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
@ -0,0 +1,684 @@
|
||||
/*
|
||||
* GeneralConfiguration.java
|
||||
*
|
||||
* Created on 10 april 2009, 19:04
|
||||
*/
|
||||
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.i2p.desktopgui.router.configuration.SpeedHelper;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.ButtonModel;
|
||||
import javax.swing.JTextField;
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
import net.i2p.desktopgui.router.configuration.SpeedHandler;
|
||||
import net.i2p.desktopgui.router.configuration.UpdateHelper;
|
||||
import net.i2p.router.web.NewsFetcher;
|
||||
import net.i2p.desktopgui.router.configuration.UpdateHandler;
|
||||
import java.util.Date;
|
||||
import javax.swing.SwingWorker;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mathias
|
||||
*/
|
||||
public class GeneralConfiguration extends javax.swing.JFrame {
|
||||
|
||||
/** Creates new form GeneralConfiguration */
|
||||
public GeneralConfiguration() {
|
||||
initComponents();
|
||||
extraInitComponents();
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
this.setLocationRelativeTo(null);
|
||||
this.requestFocus();
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void extraInitComponents() {
|
||||
initSpeedTab();
|
||||
initUpdateTab();
|
||||
}
|
||||
|
||||
private void initSpeedTab() {
|
||||
try {
|
||||
String inbound = SpeedHelper.getInboundBandwidth();
|
||||
String outbound = SpeedHelper.getOutboundBandwidth();
|
||||
|
||||
initSpeeds("" + Integer.parseInt(inbound)*8, "" + Integer.parseInt(outbound)*8);
|
||||
initUsage("" + Integer.parseInt(inbound), "" + Integer.parseInt(outbound));
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Exception noticed, probably running desktopgui in a debugger instead of along with I2P!?");
|
||||
initSpeeds("100", "100");
|
||||
initUsage("12", "12");
|
||||
}
|
||||
}
|
||||
|
||||
private void initUpdateTab() {
|
||||
//Set update policy
|
||||
String updatePolicy = UpdateHelper.getUpdatePolicy();
|
||||
if(updatePolicy.equals(UpdateHelper.NOTIFY_UPDATE_POLICY)) {
|
||||
updateButtonGroup.setSelected(updateInform.getModel(), true);
|
||||
}
|
||||
else if(updatePolicy.equals(UpdateHelper.DOWNLOAD_UPDATE_POLICY)) {
|
||||
updateButtonGroup.setSelected(updateDownload.getModel(), true);
|
||||
}
|
||||
else if(updatePolicy.equals(UpdateHelper.INSTALL_UPDATE_POLICY)) {
|
||||
updateButtonGroup.setSelected(updateDownloadRestart.getModel(), true);
|
||||
}
|
||||
else {
|
||||
System.out.println("desktopgui: no updates for you!");
|
||||
}
|
||||
|
||||
//Check if an update is available
|
||||
//TODO: move this method out of the routerconsole so desktopgui doesn't depend on routerconsole!!!
|
||||
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
|
||||
updateNow.setVisible(true);
|
||||
}
|
||||
else {
|
||||
updateNow.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/** 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")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
updateButtonGroup = new javax.swing.ButtonGroup();
|
||||
applyPanel = new javax.swing.JPanel();
|
||||
cancel = new javax.swing.JToggleButton();
|
||||
ok = new javax.swing.JToggleButton();
|
||||
settingsPanel = new javax.swing.JTabbedPane();
|
||||
speedPanel = new javax.swing.JPanel();
|
||||
uploadSpeedLabel = new javax.swing.JLabel();
|
||||
downloadSpeedLabel = new javax.swing.JLabel();
|
||||
uploadspeed = new javax.swing.JTextField();
|
||||
downloadspeed = new javax.swing.JTextField();
|
||||
uploadkbps = new javax.swing.JComboBox();
|
||||
downloadkbps = new javax.swing.JComboBox();
|
||||
uploadUsageLabel = new javax.swing.JLabel();
|
||||
downloadUsageLabel = new javax.swing.JLabel();
|
||||
uploadgb = new javax.swing.JTextField();
|
||||
downloadgb = new javax.swing.JTextField();
|
||||
gbUploadLabel = new javax.swing.JLabel();
|
||||
gbDownloadLabel = new javax.swing.JLabel();
|
||||
uploadDownloadExplanation = new javax.swing.JLabel();
|
||||
updatesPanel = new javax.swing.JPanel();
|
||||
updateMethod = new javax.swing.JLabel();
|
||||
updateInform = new javax.swing.JRadioButton();
|
||||
updateDownload = new javax.swing.JRadioButton();
|
||||
updateDownloadRestart = new javax.swing.JRadioButton();
|
||||
checkUpdates = new javax.swing.JToggleButton();
|
||||
updateNow = new javax.swing.JToggleButton();
|
||||
advancedUpdateConfig = new javax.swing.JToggleButton();
|
||||
tunnelPanel = new javax.swing.JPanel();
|
||||
clientFrame = new javax.swing.JScrollPane();
|
||||
serverFrame = new javax.swing.JScrollPane();
|
||||
tunnelsExplanation = new javax.swing.JLabel();
|
||||
clientTunnelLabel = new javax.swing.JLabel();
|
||||
serverTunnelLabel = new javax.swing.JLabel();
|
||||
networkPanel = new javax.swing.JPanel();
|
||||
advancedPanel = new javax.swing.JPanel();
|
||||
|
||||
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(GeneralConfiguration.class);
|
||||
setTitle(resourceMap.getString("Form.title")); // NOI18N
|
||||
setName("Form"); // NOI18N
|
||||
|
||||
applyPanel.setName("applyPanel"); // NOI18N
|
||||
|
||||
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
|
||||
cancel.setName("cancel"); // NOI18N
|
||||
cancel.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
cancelMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
ok.setText(resourceMap.getString("ok.text")); // NOI18N
|
||||
ok.setName("ok"); // NOI18N
|
||||
ok.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
okMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout applyPanelLayout = new javax.swing.GroupLayout(applyPanel);
|
||||
applyPanel.setLayout(applyPanelLayout);
|
||||
applyPanelLayout.setHorizontalGroup(
|
||||
applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, applyPanelLayout.createSequentialGroup()
|
||||
.addContainerGap(475, Short.MAX_VALUE)
|
||||
.addComponent(ok)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancel)
|
||||
.addContainerGap())
|
||||
);
|
||||
applyPanelLayout.setVerticalGroup(
|
||||
applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(applyPanelLayout.createSequentialGroup()
|
||||
.addGroup(applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancel)
|
||||
.addComponent(ok))
|
||||
.addContainerGap(14, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
settingsPanel.setName("settingsPanel"); // NOI18N
|
||||
|
||||
speedPanel.setName("speedPanel"); // NOI18N
|
||||
speedPanel.setLayout(null);
|
||||
|
||||
uploadSpeedLabel.setText(resourceMap.getString("uploadSpeedLabel.text")); // NOI18N
|
||||
uploadSpeedLabel.setName("uploadSpeedLabel"); // NOI18N
|
||||
speedPanel.add(uploadSpeedLabel);
|
||||
uploadSpeedLabel.setBounds(20, 20, 140, 30);
|
||||
|
||||
downloadSpeedLabel.setText(resourceMap.getString("downloadSpeedLabel.text")); // NOI18N
|
||||
downloadSpeedLabel.setName("downloadSpeedLabel"); // NOI18N
|
||||
speedPanel.add(downloadSpeedLabel);
|
||||
downloadSpeedLabel.setBounds(20, 60, 140, 30);
|
||||
|
||||
uploadspeed.setText(resourceMap.getString("uploadspeed.text")); // NOI18N
|
||||
uploadspeed.setName("uploadspeed"); // NOI18N
|
||||
uploadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
speedKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
speedPanel.add(uploadspeed);
|
||||
uploadspeed.setBounds(160, 20, 77, 27);
|
||||
|
||||
downloadspeed.setText(resourceMap.getString("downloadspeed.text")); // NOI18N
|
||||
downloadspeed.setName("downloadspeed"); // NOI18N
|
||||
downloadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
speedKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
speedPanel.add(downloadspeed);
|
||||
downloadspeed.setBounds(160, 60, 77, 27);
|
||||
|
||||
uploadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
|
||||
uploadkbps.setName("uploadkbps"); // NOI18N
|
||||
uploadkbps.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
uploadkbpsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
speedPanel.add(uploadkbps);
|
||||
uploadkbps.setBounds(240, 20, 68, 27);
|
||||
|
||||
downloadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
|
||||
downloadkbps.setName("downloadkbps"); // NOI18N
|
||||
downloadkbps.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
downloadkbpsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
speedPanel.add(downloadkbps);
|
||||
downloadkbps.setBounds(240, 60, 68, 27);
|
||||
|
||||
uploadUsageLabel.setText(resourceMap.getString("uploadUsageLabel.text")); // NOI18N
|
||||
uploadUsageLabel.setName("uploadUsageLabel"); // NOI18N
|
||||
speedPanel.add(uploadUsageLabel);
|
||||
uploadUsageLabel.setBounds(330, 20, 97, 30);
|
||||
|
||||
downloadUsageLabel.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
|
||||
downloadUsageLabel.setName("downloadUsageLabel"); // NOI18N
|
||||
speedPanel.add(downloadUsageLabel);
|
||||
downloadUsageLabel.setBounds(330, 60, 97, 30);
|
||||
|
||||
uploadgb.setText(resourceMap.getString("uploadgb.text")); // NOI18N
|
||||
uploadgb.setName("uploadgb"); // NOI18N
|
||||
uploadgb.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
monthKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
speedPanel.add(uploadgb);
|
||||
uploadgb.setBounds(440, 20, 60, 27);
|
||||
|
||||
downloadgb.setText(resourceMap.getString("downloadgb.text")); // NOI18N
|
||||
downloadgb.setName("downloadgb"); // NOI18N
|
||||
downloadgb.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
monthKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
speedPanel.add(downloadgb);
|
||||
downloadgb.setBounds(440, 60, 60, 27);
|
||||
|
||||
gbUploadLabel.setText(resourceMap.getString("gbUploadLabel.text")); // NOI18N
|
||||
gbUploadLabel.setName("gbUploadLabel"); // NOI18N
|
||||
speedPanel.add(gbUploadLabel);
|
||||
gbUploadLabel.setBounds(510, 20, 19, 30);
|
||||
|
||||
gbDownloadLabel.setText(resourceMap.getString("gbDownloadLabel.text")); // NOI18N
|
||||
gbDownloadLabel.setName("gbDownloadLabel"); // NOI18N
|
||||
speedPanel.add(gbDownloadLabel);
|
||||
gbDownloadLabel.setBounds(510, 60, 19, 30);
|
||||
|
||||
uploadDownloadExplanation.setText(resourceMap.getString("uploadDownloadExplanation.text")); // NOI18N
|
||||
uploadDownloadExplanation.setName("uploadDownloadExplanation"); // NOI18N
|
||||
speedPanel.add(uploadDownloadExplanation);
|
||||
uploadDownloadExplanation.setBounds(20, 100, 520, 70);
|
||||
|
||||
settingsPanel.addTab(resourceMap.getString("speedPanel.TabConstraints.tabTitle"), speedPanel); // NOI18N
|
||||
|
||||
updatesPanel.setName("updatesPanel"); // NOI18N
|
||||
|
||||
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
|
||||
updateMethod.setName("updateMethod"); // NOI18N
|
||||
|
||||
updateButtonGroup.add(updateInform);
|
||||
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
|
||||
updateInform.setName("updateInform"); // NOI18N
|
||||
|
||||
updateButtonGroup.add(updateDownload);
|
||||
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
|
||||
updateDownload.setName("updateDownload"); // NOI18N
|
||||
|
||||
updateButtonGroup.add(updateDownloadRestart);
|
||||
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
|
||||
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
|
||||
|
||||
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
|
||||
checkUpdates.setName("checkUpdates"); // NOI18N
|
||||
checkUpdates.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
checkUpdatesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
|
||||
updateNow.setName("updateNow"); // NOI18N
|
||||
updateNow.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
updateNowActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
|
||||
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
|
||||
advancedUpdateConfig.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
advancedUpdateConfigActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
|
||||
updatesPanel.setLayout(updatesPanelLayout);
|
||||
updatesPanelLayout.setHorizontalGroup(
|
||||
updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(updatesPanelLayout.createSequentialGroup()
|
||||
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(updatesPanelLayout.createSequentialGroup()
|
||||
.addGap(20, 20, 20)
|
||||
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(updateMethod)
|
||||
.addGroup(updatesPanelLayout.createSequentialGroup()
|
||||
.addComponent(checkUpdates)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(updateNow))))
|
||||
.addGroup(updatesPanelLayout.createSequentialGroup()
|
||||
.addGap(40, 40, 40)
|
||||
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(updateDownload)
|
||||
.addComponent(updateInform)
|
||||
.addComponent(updateDownloadRestart))))
|
||||
.addGap(9, 9, 9))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, updatesPanelLayout.createSequentialGroup()
|
||||
.addContainerGap(339, Short.MAX_VALUE)
|
||||
.addComponent(advancedUpdateConfig)
|
||||
.addContainerGap())
|
||||
);
|
||||
updatesPanelLayout.setVerticalGroup(
|
||||
updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(updatesPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(updateMethod)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(updateInform)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(updateDownload)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(updateDownloadRestart)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(checkUpdates)
|
||||
.addComponent(updateNow))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 181, Short.MAX_VALUE)
|
||||
.addComponent(advancedUpdateConfig)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
settingsPanel.addTab(resourceMap.getString("updatesPanel.TabConstraints.tabTitle"), updatesPanel); // NOI18N
|
||||
|
||||
tunnelPanel.setName("tunnelPanel"); // NOI18N
|
||||
|
||||
clientFrame.setName("clientFrame"); // NOI18N
|
||||
|
||||
serverFrame.setName("serverFrame"); // NOI18N
|
||||
|
||||
tunnelsExplanation.setText(resourceMap.getString("tunnelsExplanation.text")); // NOI18N
|
||||
tunnelsExplanation.setName("tunnelsExplanation"); // NOI18N
|
||||
|
||||
clientTunnelLabel.setText(resourceMap.getString("clientTunnelLabel.text")); // NOI18N
|
||||
clientTunnelLabel.setName("clientTunnelLabel"); // NOI18N
|
||||
|
||||
serverTunnelLabel.setText(resourceMap.getString("serverTunnelLabel.text")); // NOI18N
|
||||
serverTunnelLabel.setName("serverTunnelLabel"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout tunnelPanelLayout = new javax.swing.GroupLayout(tunnelPanel);
|
||||
tunnelPanel.setLayout(tunnelPanelLayout);
|
||||
tunnelPanelLayout.setHorizontalGroup(
|
||||
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(tunnelPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(serverFrame, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
|
||||
.addComponent(tunnelsExplanation, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
|
||||
.addComponent(clientTunnelLabel)
|
||||
.addComponent(clientFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
|
||||
.addComponent(serverTunnelLabel))
|
||||
.addContainerGap())
|
||||
);
|
||||
tunnelPanelLayout.setVerticalGroup(
|
||||
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(tunnelPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(clientTunnelLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(clientFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(serverTunnelLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(serverFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(tunnelsExplanation, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
settingsPanel.addTab(resourceMap.getString("tunnelPanel.TabConstraints.tabTitle"), tunnelPanel); // NOI18N
|
||||
|
||||
networkPanel.setName("networkPanel"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout networkPanelLayout = new javax.swing.GroupLayout(networkPanel);
|
||||
networkPanel.setLayout(networkPanelLayout);
|
||||
networkPanelLayout.setHorizontalGroup(
|
||||
networkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 562, Short.MAX_VALUE)
|
||||
);
|
||||
networkPanelLayout.setVerticalGroup(
|
||||
networkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 388, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
settingsPanel.addTab(resourceMap.getString("networkPanel.TabConstraints.tabTitle"), networkPanel); // NOI18N
|
||||
|
||||
advancedPanel.setName("advancedPanel"); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout advancedPanelLayout = new javax.swing.GroupLayout(advancedPanel);
|
||||
advancedPanel.setLayout(advancedPanelLayout);
|
||||
advancedPanelLayout.setHorizontalGroup(
|
||||
advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 562, Short.MAX_VALUE)
|
||||
);
|
||||
advancedPanelLayout.setVerticalGroup(
|
||||
advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 388, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
settingsPanel.addTab(resourceMap.getString("advancedPanel.TabConstraints.tabTitle"), advancedPanel); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(applyPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(12, 12, 12)
|
||||
.addComponent(settingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(settingsPanel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(applyPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void speedKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyReleased
|
||||
try {
|
||||
String upload = "";
|
||||
if(uploadkbps.getSelectedIndex() == KILOBIT)
|
||||
upload = "" + Integer.parseInt(uploadspeed.getText())/8;
|
||||
else
|
||||
upload = uploadspeed.getText();
|
||||
String download = "";
|
||||
if(downloadkbps.getSelectedIndex() == KILOBIT)
|
||||
download = "" + Integer.parseInt(downloadspeed.getText())/8;
|
||||
else
|
||||
download = downloadspeed.getText();
|
||||
initUsage(upload, download);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}//GEN-LAST:event_speedKeyReleased
|
||||
|
||||
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
|
||||
kbpsSwitchPerformed(uploadkbps, uploadspeed);
|
||||
}//GEN-LAST:event_uploadkbpsActionPerformed
|
||||
|
||||
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
|
||||
kbpsSwitchPerformed(downloadkbps, downloadspeed);
|
||||
}//GEN-LAST:event_downloadkbpsActionPerformed
|
||||
|
||||
private void monthKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_monthKeyReleased
|
||||
try {
|
||||
int uploadMonthValue = Integer.parseInt(uploadgb.getText());
|
||||
int downloadMonthValue = Integer.parseInt(downloadgb.getText());
|
||||
|
||||
String upload = "";
|
||||
String burstUpload = "";
|
||||
String download = "";
|
||||
String burstDownload = "";
|
||||
|
||||
if(uploadkbps.getSelectedIndex() == KILOBIT)
|
||||
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue)*8; //kbit
|
||||
else
|
||||
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue); //kbyte
|
||||
|
||||
if(downloadkbps.getSelectedIndex() == KILOBIT)
|
||||
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue)*8; //kbit
|
||||
else
|
||||
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue); //kbyte
|
||||
|
||||
initSpeeds(upload, download);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}//GEN-LAST:event_monthKeyReleased
|
||||
|
||||
private void cancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelMouseClicked
|
||||
this.dispose();
|
||||
}//GEN-LAST:event_cancelMouseClicked
|
||||
|
||||
private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okMouseClicked
|
||||
saveSpeeds();
|
||||
saveUpdatePolicy();
|
||||
this.dispose();
|
||||
}//GEN-LAST:event_okMouseClicked
|
||||
|
||||
private void checkUpdatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkUpdatesActionPerformed
|
||||
long current = new Date().getTime();
|
||||
if(current < newsLastFetched + 5*60*1000) {
|
||||
return;
|
||||
}
|
||||
checkUpdates.setText("Checking for updates");
|
||||
checkUpdates.setEnabled(false);
|
||||
newsLastFetched = current;
|
||||
SwingWorker sw = new SwingWorker() {
|
||||
|
||||
@Override
|
||||
protected Object doInBackground() throws Exception {
|
||||
NewsFetcher.getInstance(RouterHelper.getContext()).fetchNews();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
checkUpdates.setText("Check for updates now");
|
||||
checkUpdates.setEnabled(true);
|
||||
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
|
||||
updateNow.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}//GEN-LAST:event_checkUpdatesActionPerformed
|
||||
|
||||
private void updateNowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateNowActionPerformed
|
||||
SwingWorker sw = new SwingWorker() {
|
||||
|
||||
@Override
|
||||
protected Object doInBackground() throws Exception {
|
||||
new net.i2p.router.web.UpdateHandler().update();
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
updateNow.setEnabled(false);
|
||||
updateNow.setText("Updating...");
|
||||
checkUpdates.setEnabled(false);
|
||||
|
||||
}//GEN-LAST:event_updateNowActionPerformed
|
||||
|
||||
private void advancedUpdateConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedUpdateConfigActionPerformed
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI("http://127.0.0.1:7657/configupdate.jsp"));
|
||||
} catch (URISyntaxException ex) {
|
||||
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}//GEN-LAST:event_advancedUpdateConfigActionPerformed
|
||||
|
||||
protected void initUsage(String upload, String download) {
|
||||
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
|
||||
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
|
||||
}
|
||||
|
||||
protected void initSpeeds(String upload, String download) {
|
||||
uploadspeed.setText(upload);
|
||||
downloadspeed.setText(download);
|
||||
}
|
||||
|
||||
private void kbpsSwitchPerformed(JComboBox kbps, JTextField speed) {
|
||||
int index = kbps.getSelectedIndex();
|
||||
int previous = Integer.parseInt(speed.getText());
|
||||
if(index == KILOBIT) {
|
||||
speed.setText("" + previous*8);
|
||||
}
|
||||
else {
|
||||
speed.setText("" + previous/8);
|
||||
}
|
||||
}
|
||||
|
||||
protected void saveSpeeds() {
|
||||
int maxDownload = Integer.parseInt(downloadspeed.getText());
|
||||
int maxUpload = Integer.parseInt(uploadspeed.getText());
|
||||
if(uploadkbps.getSelectedIndex() == KILOBIT) {
|
||||
SpeedHandler.setOutboundBandwidth(maxUpload/8);
|
||||
SpeedHandler.setOutboundBurstBandwidth(maxUpload/8);
|
||||
}
|
||||
else {
|
||||
SpeedHandler.setOutboundBandwidth(maxUpload);
|
||||
SpeedHandler.setOutboundBurstBandwidth(maxUpload);
|
||||
}
|
||||
if(downloadkbps.getSelectedIndex() == KILOBIT) {
|
||||
SpeedHandler.setInboundBandwidth(maxDownload/8);
|
||||
SpeedHandler.setInboundBurstBandwidth(maxDownload/8);
|
||||
}
|
||||
else {
|
||||
SpeedHandler.setInboundBandwidth(maxDownload);
|
||||
SpeedHandler.setInboundBurstBandwidth(maxDownload);
|
||||
}
|
||||
}
|
||||
|
||||
protected void saveUpdatePolicy() {
|
||||
ButtonModel policyButton = updateButtonGroup.getSelection();
|
||||
if(policyButton.equals(updateInform.getModel())) {
|
||||
UpdateHandler.setUpdatePolicy(UpdateHelper.NOTIFY_UPDATE_POLICY);
|
||||
}
|
||||
else if(policyButton.equals(updateDownload.getModel())) {
|
||||
UpdateHandler.setUpdatePolicy(UpdateHelper.DOWNLOAD_UPDATE_POLICY);
|
||||
}
|
||||
else if(policyButton.equals(updateDownloadRestart.getModel())) {
|
||||
UpdateHandler.setUpdatePolicy(UpdateHelper.INSTALL_UPDATE_POLICY);
|
||||
}
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel advancedPanel;
|
||||
private javax.swing.JToggleButton advancedUpdateConfig;
|
||||
private javax.swing.JPanel applyPanel;
|
||||
private javax.swing.JToggleButton cancel;
|
||||
private javax.swing.JToggleButton checkUpdates;
|
||||
private javax.swing.JScrollPane clientFrame;
|
||||
private javax.swing.JLabel clientTunnelLabel;
|
||||
private javax.swing.JLabel downloadSpeedLabel;
|
||||
private javax.swing.JLabel downloadUsageLabel;
|
||||
private javax.swing.JTextField downloadgb;
|
||||
private javax.swing.JComboBox downloadkbps;
|
||||
private javax.swing.JTextField downloadspeed;
|
||||
private javax.swing.JLabel gbDownloadLabel;
|
||||
private javax.swing.JLabel gbUploadLabel;
|
||||
private javax.swing.JPanel networkPanel;
|
||||
private javax.swing.JToggleButton ok;
|
||||
private javax.swing.JScrollPane serverFrame;
|
||||
private javax.swing.JLabel serverTunnelLabel;
|
||||
private javax.swing.JTabbedPane settingsPanel;
|
||||
private javax.swing.JPanel speedPanel;
|
||||
private javax.swing.JPanel tunnelPanel;
|
||||
private javax.swing.JLabel tunnelsExplanation;
|
||||
private javax.swing.ButtonGroup updateButtonGroup;
|
||||
private javax.swing.JRadioButton updateDownload;
|
||||
private javax.swing.JRadioButton updateDownloadRestart;
|
||||
private javax.swing.JRadioButton updateInform;
|
||||
private javax.swing.JLabel updateMethod;
|
||||
private javax.swing.JToggleButton updateNow;
|
||||
private javax.swing.JPanel updatesPanel;
|
||||
private javax.swing.JLabel uploadDownloadExplanation;
|
||||
private javax.swing.JLabel uploadSpeedLabel;
|
||||
private javax.swing.JLabel uploadUsageLabel;
|
||||
private javax.swing.JTextField uploadgb;
|
||||
private javax.swing.JComboBox uploadkbps;
|
||||
private javax.swing.JTextField uploadspeed;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
public static final int KILOBIT = 0;
|
||||
public static final int KILOBYTE = 1;
|
||||
|
||||
private long newsLastFetched = 0;
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
@ -37,13 +37,12 @@ import java.awt.Window;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JWindow;
|
||||
import javax.swing.RootPaneContainer;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
@ -63,6 +62,10 @@ public class JPopupTrayIcon extends TrayIcon {
|
||||
|
||||
private final static boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().contains("windows");
|
||||
|
||||
private static MouseEvent previous = null;
|
||||
private static Date previousTime = new Date();
|
||||
private static Date time = new Date();
|
||||
|
||||
public JPopupTrayIcon(Image image) {
|
||||
super(image);
|
||||
init();
|
||||
@ -92,12 +95,12 @@ public class JPopupTrayIcon extends TrayIcon {
|
||||
|
||||
@Override
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
||||
// System.out.println("popupMenuWillBecomeVisible");
|
||||
//System.out.println("popupMenuWillBecomeVisible");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
||||
// System.out.println("popupMenuWillBecomeInvisible");
|
||||
//System.out.println("popupMenuWillBecomeInvisible");
|
||||
if(window != null) {
|
||||
window.dispose();
|
||||
window = null;
|
||||
@ -117,21 +120,27 @@ public class JPopupTrayIcon extends TrayIcon {
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
// System.out.println(e.getPoint());
|
||||
showJPopupMenu(e);
|
||||
//System.out.println("Pressed " + e.getPoint());
|
||||
showJPopupMenu(e, previous);
|
||||
previous = e;
|
||||
previousTime = time;
|
||||
time = new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
// System.out.println(e.getPoint());
|
||||
showJPopupMenu(e);
|
||||
//System.out.println("Released " + e.getPoint());
|
||||
showJPopupMenu(e, previous);
|
||||
previous = e;
|
||||
previousTime = time;
|
||||
time = new Date();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private final void showJPopupMenu(MouseEvent e) {
|
||||
if(e.isPopupTrigger() && menu != null) {
|
||||
private final void showJPopupMenu(MouseEvent e, MouseEvent previous) {
|
||||
if((e.isPopupTrigger() || previous.isPopupTrigger()) && (time.getTime() - previousTime.getTime() < 1000) && menu != null) {
|
||||
if (window == null) {
|
||||
|
||||
if(IS_WINDOWS) {
|
@ -3,6 +3,7 @@
|
||||
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
|
||||
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
@ -11,6 +12,7 @@
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
@ -4,7 +4,7 @@
|
||||
* Created on 10 april 2009, 19:17
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@ -73,6 +73,8 @@ public class LogViewer extends javax.swing.JFrame {
|
||||
clearButton = 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(LogViewer.class);
|
||||
setTitle(resourceMap.getString("Form.title")); // NOI18N
|
||||
setName("Form"); // NOI18N
|
||||
|
||||
textScroll.setName("textScroll"); // NOI18N
|
||||
@ -82,7 +84,6 @@ public class LogViewer extends javax.swing.JFrame {
|
||||
logText.setName("logText"); // NOI18N
|
||||
textScroll.setViewportView(logText);
|
||||
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(LogViewer.class);
|
||||
explanationText.setText(resourceMap.getString("explanationText.text")); // NOI18N
|
||||
explanationText.setName("explanationText"); // NOI18N
|
||||
|
@ -16,6 +16,7 @@
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
@ -4,15 +4,14 @@
|
||||
* Created on 3 april 2009, 13:57
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Properties;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JTextField;
|
||||
import persistence.PropertyManager;
|
||||
import util.IntegerVerifier;
|
||||
import net.i2p.desktopgui.persistence.PropertyManager;
|
||||
import net.i2p.desktopgui.util.IntegerVerifier;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -60,7 +59,7 @@ public class SpeedSelector extends javax.swing.JFrame {
|
||||
downloadkbps = new javax.swing.JComboBox();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(SpeedSelector.class);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(SpeedSelector.class);
|
||||
setTitle(resourceMap.getString("Form.title")); // NOI18N
|
||||
setMinimumSize(new java.awt.Dimension(610, 330));
|
||||
setName("Form"); // NOI18N
|
@ -20,6 +20,7 @@
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
@ -4,14 +4,13 @@
|
||||
* Created on 3 april 2009, 14:36
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import javax.swing.AbstractButton;
|
||||
import persistence.PropertyManager;
|
||||
import net.i2p.desktopgui.persistence.PropertyManager;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -48,7 +47,7 @@ public class SpeedSelector2 extends javax.swing.JFrame {
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(SpeedSelector2.class);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(SpeedSelector2.class);
|
||||
setTitle(resourceMap.getString("Form.title")); // NOI18N
|
||||
setMinimumSize(new java.awt.Dimension(610, 330));
|
||||
setName("Form"); // NOI18N
|
@ -16,6 +16,7 @@
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
@ -318,7 +319,7 @@
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="580" y="150" width="-1" height="30"/>
|
||||
<AbsoluteConstraints x="580" y="150" width="40" height="30"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
@ -4,16 +4,16 @@
|
||||
* Created on 3 april 2009, 15:17
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Properties;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JTextField;
|
||||
import persistence.PropertyManager;
|
||||
import router.configuration.SpeedHandler;
|
||||
import router.configuration.SpeedHelper;
|
||||
import net.i2p.desktopgui.persistence.PropertyManager;
|
||||
import net.i2p.desktopgui.router.configuration.SpeedHandler;
|
||||
import net.i2p.desktopgui.router.configuration.SpeedHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -67,7 +67,7 @@ public class SpeedSelector3 extends javax.swing.JFrame {
|
||||
explanation = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(SpeedSelector3.class);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(SpeedSelector3.class);
|
||||
setTitle(resourceMap.getString("Form.title")); // NOI18N
|
||||
setMinimumSize(new java.awt.Dimension(670, 330));
|
||||
setName("Form"); // NOI18N
|
||||
@ -231,7 +231,7 @@ public class SpeedSelector3 extends javax.swing.JFrame {
|
||||
downloadGB.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
|
||||
downloadGB.setName("downloadUsageLabel"); // NOI18N
|
||||
getContentPane().add(downloadGB);
|
||||
downloadGB.setBounds(580, 150, 19, 30);
|
||||
downloadGB.setBounds(580, 150, 40, 30);
|
||||
|
||||
explanation.setText(resourceMap.getString("explanation.text")); // NOI18N
|
||||
explanation.setName("explanation"); // NOI18N
|
@ -1,4 +1,4 @@
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
/**
|
||||
*
|
@ -3,9 +3,9 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import desktopgui.*;
|
||||
import net.i2p.desktopgui.desktopgui.*;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Image;
|
||||
@ -23,9 +23,9 @@ import java.util.logging.Logger;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import router.RouterHandler;
|
||||
import router.RouterHelper;
|
||||
import router.configuration.PeerHelper;
|
||||
import net.i2p.desktopgui.router.RouterHandler;
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
import net.i2p.desktopgui.router.configuration.PeerHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -151,7 +151,7 @@ public class Tray {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
RouterHandler.setStatus(RouterHandler.SHUTDOWN_GRACEFULLY);
|
||||
long shutdownTime = RouterHelper.getGracefulShutdownTimeRemaining();
|
||||
System.out.println(shutdownTime);
|
||||
System.out.println("Shutdowntime remaining: " + shutdownTime);
|
||||
if(shutdownTime>0) {
|
||||
trayIcon.displayMessage("Shutting down...", "Shutdown time remaining: " + shutdownTime/1000 + " seconds."
|
||||
+ System.getProperty("line.separator") + "Shutdown will not happen immediately, because we are still participating in the network.", TrayIcon.MessageType.INFO);
|
||||
@ -170,7 +170,7 @@ public class Tray {
|
||||
popup.addSeparator();
|
||||
|
||||
config.add(speedConfig);
|
||||
//config.add(generalConfig);
|
||||
config.add(generalConfig);
|
||||
config.add(advancedConfig);
|
||||
popup.add(config);
|
||||
|
@ -3,6 +3,7 @@
|
||||
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
|
||||
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
@ -11,6 +12,7 @@
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
@ -22,24 +24,24 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="I2Plabel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="GUILabel" alignment="0" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="I2PVersion" pref="126" max="32767" attributes="0"/>
|
||||
<Component id="GUIVersion" pref="126" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="I2Plabel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="GUILabel" alignment="0" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="I2PVersion" pref="126" max="32767" attributes="0"/>
|
||||
<Component id="GUIVersion" pref="126" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="okButton" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="294" max="32767" attributes="0"/>
|
||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
@ -4,10 +4,10 @@
|
||||
* Created on 13 april 2009, 13:48
|
||||
*/
|
||||
|
||||
package gui;
|
||||
package net.i2p.desktopgui.gui;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import router.RouterHelper;
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -24,7 +24,7 @@ public class Version extends javax.swing.JDialog {
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
String i2pVersion = RouterHelper.getVersion();
|
||||
String guiVersion = desktopgui.GUIVersion.VERSION;
|
||||
String guiVersion = net.i2p.desktopgui.desktopgui.GUIVersion.VERSION;
|
||||
this.I2PVersion.setText("<html><h1>" + i2pVersion + "</h1></html>");
|
||||
this.GUIVersion.setText("<html><h1>" + guiVersion + "</h1></html>");
|
||||
this.setVisible(true);
|
||||
@ -46,9 +46,10 @@ public class Version extends javax.swing.JDialog {
|
||||
GUIVersion = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(Version.class);
|
||||
setTitle(resourceMap.getString("Form.title")); // NOI18N
|
||||
setName("Form"); // NOI18N
|
||||
|
||||
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(Version.class);
|
||||
okButton.setText(resourceMap.getString("okButton.text")); // NOI18N
|
||||
okButton.setName("okButton"); // NOI18N
|
||||
okButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@ -75,17 +76,16 @@ public class Version extends javax.swing.JDialog {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(I2Plabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(GUILabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(I2PVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
|
||||
.addComponent(GUIVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(294, Short.MAX_VALUE)
|
||||
.addComponent(okButton)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(I2Plabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(GUILabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(I2PVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
|
||||
.addComponent(GUIVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)))
|
||||
.addComponent(okButton, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
@ -0,0 +1,29 @@
|
||||
cancel.text=Cancel
|
||||
ok.text=OK
|
||||
Form.title=General Configuration
|
||||
speedPanel.TabConstraints.tabTitle=Speed
|
||||
updatesPanel.TabConstraints.tabTitle=Updates
|
||||
tunnelPanel.TabConstraints.tabTitle=Tunnels/Services
|
||||
networkPanel.TabConstraints.tabTitle=Network
|
||||
advancedPanel.TabConstraints.tabTitle=Advanced
|
||||
uploadSpeedLabel.text=Upload speed:
|
||||
downloadSpeedLabel.text=Download speed:
|
||||
uploadspeed.text=jTextField1
|
||||
downloadspeed.text=jTextField2
|
||||
uploadgb.text=jTextField3
|
||||
downloadgb.text=jTextField4
|
||||
updateMethod.text=What is your preferred automatic update setting?
|
||||
updateInform.text=Only inform about updates
|
||||
updateDownload.text=Download and verify update file, do not restart
|
||||
updateDownloadRestart.text=Download, verify and restart
|
||||
checkUpdates.text=Check for updates now
|
||||
updateNow.text=Update available: update now
|
||||
advancedUpdateConfig.text=Advanced update configuration
|
||||
clientTunnelLabel.text=Client tunnels:
|
||||
serverTunnelLabel.text=Server tunnels:
|
||||
tunnelsExplanation.text=Tunnel explanation
|
||||
uploadUsageLabel.text=Monthly usage:
|
||||
downloadUsageLabel.text=Monthly usage:
|
||||
gbUploadLabel.text=GB
|
||||
gbDownloadLabel.text=GB
|
||||
uploadDownloadExplanation.text=Explanation ...
|
@ -1,3 +1,4 @@
|
||||
refreshButton.text=Refresh
|
||||
clearButton.text=Clear
|
||||
explanationText.text=Explanation ...
|
||||
Form.title=View Logs
|
@ -5,8 +5,8 @@ uploadLabel.text=Upload Speed:
|
||||
uploadBurstLabel.text=Burst Upload Speed:
|
||||
downloadLabel.text=Download Speed:
|
||||
downloadBurstLabel.text=Burst Download Speed:
|
||||
uploadUsageLabel.text=Monthly usage:
|
||||
downloadUsageLabel.text=Monthly usage:
|
||||
uploadUsageLabel.text=GB
|
||||
downloadUsageLabel.text=GB
|
||||
uploadField.text=jTextField1
|
||||
uploadBurstField.text=jTextField2
|
||||
downloadField.text=jTextField4
|
@ -3,3 +3,4 @@ I2Plabel.text=<html><h1>I2P Version:</h1></html>
|
||||
GUILabel.text=<html><h1>GUI Version:</h1></html>
|
||||
I2PVersion.text=jLabel3
|
||||
GUIVersion.text=jLabel4
|
||||
Form.title=Version
|
@ -1,4 +1,4 @@
|
||||
package persistence;
|
||||
package net.i2p.desktopgui.persistence;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
@ -3,7 +3,7 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package router;
|
||||
package net.i2p.desktopgui.router;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -1,4 +1,4 @@
|
||||
package router;
|
||||
package net.i2p.desktopgui.router;
|
||||
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
@ -1,4 +1,4 @@
|
||||
package router.configuration;
|
||||
package net.i2p.desktopgui.router.configuration;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@ -11,7 +11,7 @@ import net.i2p.router.CommSystemFacade;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
import net.i2p.router.transport.ntcp.NTCPAddress;
|
||||
import router.RouterHelper;
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
|
||||
/**
|
||||
* Part of the code imported and adapted from the I2P Router Console (which is licensed as public domain)
|
||||
@ -49,7 +49,7 @@ public class PeerHelper {
|
||||
return "ERROR: The UDP port is already in use. Set i2np.udp.internalPort=xxxx to a different value in the advanced config and restart";
|
||||
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
|
||||
default:
|
||||
ra = context.router().getRouterInfo().getTargetAddress("UDP");
|
||||
ra = context.router().getRouterInfo().getTargetAddress("SSU");
|
||||
if (ra == null && context.router().getUptime() > 5*60*1000) {
|
||||
if (context.getProperty(PROP_I2NP_NTCP_HOSTNAME) == null ||
|
||||
context.getProperty(PROP_I2NP_NTCP_PORT) == null)
|
||||
@ -160,6 +160,6 @@ public class PeerHelper {
|
||||
public final static String PROP_I2NP_INTERNAL_UDP_PORT = "i2np.udp.internalPort";
|
||||
public final static String PROP_I2NP_NTCP_HOSTNAME = "i2np.ntcp.hostname";
|
||||
public final static String PROP_I2NP_NTCP_PORT = "i2np.ntcp.port";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoip";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoport";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoport";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoip";
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package router.configuration;
|
||||
package net.i2p.desktopgui.router.configuration;
|
||||
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.transport.FIFOBandwidthRefiller;
|
||||
import router.RouterHelper;
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
|
||||
/**
|
||||
*
|
@ -1,4 +1,7 @@
|
||||
package router.configuration;
|
||||
package net.i2p.desktopgui.router.configuration;
|
||||
|
||||
import net.i2p.router.transport.FIFOBandwidthRefiller;
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -29,4 +32,12 @@ public class SpeedHelper {
|
||||
public static int calculateSpeed(int gigabytes) {
|
||||
return (int) (((long)gigabytes)*1000000/31/24/3600);
|
||||
}
|
||||
|
||||
public static String getInboundBandwidth() {
|
||||
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH);
|
||||
}
|
||||
|
||||
public static String getOutboundBandwidth() {
|
||||
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package net.i2p.desktopgui.router.configuration;
|
||||
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mathias
|
||||
*/
|
||||
public class UpdateHandler {
|
||||
public static void setUpdatePolicy(String policy) {
|
||||
RouterHelper.getContext().router().setConfigSetting(UpdateHelper.PROP_UPDATE_POLICY, policy);
|
||||
RouterHelper.getContext().router().saveConfig();
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package net.i2p.desktopgui.router.configuration;
|
||||
|
||||
import net.i2p.desktopgui.router.RouterHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mathias
|
||||
*/
|
||||
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 PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
|
||||
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
|
||||
|
||||
public static final String PROP_UPDATE_POLICY = "router.updatePolicy";
|
||||
public static final String NOTIFY_UPDATE_POLICY = "notify";
|
||||
public static final String DOWNLOAD_UPDATE_POLICY = "download";
|
||||
public static final String INSTALL_UPDATE_POLICY = "install";
|
||||
public static final String DEFAULT_UPDATE_POLICY = DOWNLOAD_UPDATE_POLICY;
|
||||
|
||||
public static final String PROP_SHOULD_PROXY = "router.updateThroughProxy";
|
||||
public static final String DEFAULT_SHOULD_PROXY = Boolean.TRUE.toString();
|
||||
public static final String PROP_PROXY_HOST = "router.updateProxyHost";
|
||||
public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
|
||||
public static final String PROP_PROXY_PORT = "router.updateProxyPort";
|
||||
public static final String DEFAULT_PROXY_PORT = "4444";
|
||||
|
||||
public static final String PROP_UPDATE_URL = "router.updateURL";
|
||||
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" ;
|
||||
|
||||
public static final String PROP_TRUSTED_KEYS = "router.trustedUpdateKeys";
|
||||
|
||||
public static String getNewsURL() {
|
||||
String url = RouterHelper.getContext().getProperty(PROP_NEWS_URL);
|
||||
if(url == null) {
|
||||
return DEFAULT_NEWS_URL;
|
||||
}
|
||||
else {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUpdatePolicy() {
|
||||
String policy = null;
|
||||
try {
|
||||
policy = RouterHelper.getContext().getProperty(PROP_UPDATE_POLICY);
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Policy: " + policy);
|
||||
if(policy == null) {
|
||||
return DEFAULT_UPDATE_POLICY;
|
||||
}
|
||||
else {
|
||||
return policy;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package util;
|
||||
package net.i2p.desktopgui.util;
|
||||
|
||||
import javax.swing.InputVerifier;
|
||||
import javax.swing.JComponent;
|
@ -24,6 +24,7 @@
|
||||
</classpath>
|
||||
</depend>
|
||||
</target>
|
||||
<property name="javac.compilerargs" value="" />
|
||||
<target name="compile" depends="depend">
|
||||
<mkdir dir="./build" />
|
||||
<mkdir dir="./build/obj" />
|
||||
@ -31,7 +32,9 @@
|
||||
srcdir="./src"
|
||||
debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
destdir="./build/obj"
|
||||
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" />
|
||||
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" >
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
</javac>
|
||||
</target>
|
||||
<target name="jar" depends="builddep, compile">
|
||||
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/*Servlet.class">
|
||||
@ -55,6 +58,7 @@
|
||||
<target name="standalone_prep" depends="war">
|
||||
<javac debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
destdir="./build" srcdir="src/" includes="org/klomp/snark/web/RunStandalone.java" >
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
<classpath>
|
||||
<pathelement location="../../jetty/jettylib/commons-logging.jar" />
|
||||
<pathelement location="../../jetty/jettylib/commons-el.jar" />
|
||||
|
@ -23,6 +23,8 @@ package org.klomp.snark;
|
||||
import java.util.Iterator;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
|
||||
/**
|
||||
* TimerTask that monitors the peers and total up/download speeds.
|
||||
* Works together with the main Snark class to report periodical statistics.
|
||||
@ -83,21 +85,12 @@ class PeerMonitorTask extends TimerTask
|
||||
|
||||
// Print some statistics
|
||||
long downloaded = coordinator.getDownloaded();
|
||||
String totalDown;
|
||||
if (downloaded >= 10 * 1024 * 1024)
|
||||
totalDown = (downloaded / (1024 * 1024)) + "MB";
|
||||
else
|
||||
totalDown = (downloaded / 1024 )+ "KB";
|
||||
String totalDown = DataHelper.formatSize(downloaded) + "B";
|
||||
long uploaded = coordinator.getUploaded();
|
||||
String totalUp;
|
||||
if (uploaded >= 10 * 1024 * 1024)
|
||||
totalUp = (uploaded / (1024 * 1024)) + "MB";
|
||||
else
|
||||
totalUp = (uploaded / 1024) + "KB";
|
||||
String totalUp = DataHelper.formatSize(uploaded) + "B";
|
||||
|
||||
int needP = coordinator.storage.needed();
|
||||
long needMB
|
||||
= needP * coordinator.metainfo.getPieceLength(0) / (1024 * 1024);
|
||||
long needMB = needP * coordinator.metainfo.getPieceLength(0) / (1024 * 1024);
|
||||
int totalP = coordinator.metainfo.getPieces();
|
||||
long totalMB = coordinator.metainfo.getTotalLength() / (1024 * 1024);
|
||||
|
||||
|
@ -60,9 +60,9 @@ class PeerState
|
||||
// If we have te resend outstanding requests (true after we got choked).
|
||||
private boolean resend = false;
|
||||
|
||||
private final static int MAX_PIPELINE = 3; // this is for outbound requests
|
||||
private final static int MAX_PIPELINE = 5; // this is for outbound requests
|
||||
private final static int MAX_PIPELINE_BYTES = 128*1024; // this is for inbound requests
|
||||
public final static int PARTSIZE = 32*1024; // Snark was 16K, i2p-bt uses 64KB
|
||||
public final static int PARTSIZE = 16*1024; // outbound request
|
||||
private final static int MAX_PARTSIZE = 64*1024; // Don't let anybody request more than this
|
||||
|
||||
PeerState(Peer peer, PeerListener listener, MetaInfo metainfo,
|
||||
|
@ -362,7 +362,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
public Properties getConfig() { return _config; }
|
||||
|
||||
/** hardcoded for sanity. perhaps this should be customizable, for people who increase their ulimit, etc. */
|
||||
private static final int MAX_FILES_PER_TORRENT = 256;
|
||||
private static final int MAX_FILES_PER_TORRENT = 512;
|
||||
|
||||
/** set of filenames that we are dealing with */
|
||||
public Set listTorrentFiles() { synchronized (_snarks) { return new HashSet(_snarks.keySet()); } }
|
||||
@ -543,16 +543,18 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
return "Too many files in " + info.getName() + " (" + files.size() + "), deleting it";
|
||||
} else if (info.getPieces() <= 0) {
|
||||
return "No pieces in " + info.getName() + "? deleting it";
|
||||
} else if (info.getPieceLength(0) > 1*1024*1024) {
|
||||
return "Pieces are too large in " + info.getName() + " (" + info.getPieceLength(0)/1024 + "KB), deleting it";
|
||||
} else if (info.getTotalLength() > 10*1024*1024*1024l) {
|
||||
} else if (info.getPieceLength(0) > Storage.MAX_PIECE_SIZE) {
|
||||
return "Pieces are too large in " + info.getName() + " (" + DataHelper.formatSize(info.getPieceLength(0)) +
|
||||
"B), deleting it";
|
||||
} else if (info.getTotalLength() > Storage.MAX_TOTAL_SIZE) {
|
||||
System.out.println("torrent info: " + info.toString());
|
||||
List lengths = info.getLengths();
|
||||
if (lengths != null)
|
||||
for (int i = 0; i < lengths.size(); i++)
|
||||
System.out.println("File " + i + " is " + lengths.get(i) + " long");
|
||||
|
||||
return "Torrents larger than 10GB are not supported yet (because we're paranoid): " + info.getName() + ", deleting it";
|
||||
return "Torrents larger than " + DataHelper.formatSize(Storage.MAX_TOTAL_SIZE) +
|
||||
"B are not supported yet (because we're paranoid): " + info.getName() + ", deleting it";
|
||||
} else {
|
||||
// ok
|
||||
return null;
|
||||
@ -637,8 +639,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
public void torrentComplete(Snark snark) {
|
||||
File f = new File(snark.torrent);
|
||||
long len = snark.meta.getTotalLength();
|
||||
addMessage("Download complete of " + f.getName()
|
||||
+ (len < 5*1024*1024 ? " (size: " + (len/1024) + "KB)" : " (size: " + (len/(1024*1024l)) + "MB)"));
|
||||
addMessage("Download complete of " + f.getName() + " (size: " + DataHelper.formatSize(len) + "B)");
|
||||
updateStatus(snark);
|
||||
}
|
||||
|
||||
@ -694,6 +695,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
// , "mastertracker", "http://VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT8JD7i-C2xzYFa4jT5U2aqHzHI-Jre4HL3Ri5hFtZrLk2ax3ji7Qfb6qPnuYkuiF2E2UDmKUOppI8d9Ye7tjdhQVCy0izn55tBaB-U7UWdcvSK2i85sauyw3G0Gfads1Rvy5-CAe2paqyYATcDmGjpUNLoxbfv9KH1KmwRTNH6k1v4PyWYYnhbT39WfKMbBjSxVQRdi19cyJrULSWhjxaQfJHeWx5Z8Ev4bSPByBeQBFl2~4vqy0S5RypINsRSa3MZdbiAAyn5tr5slWR6QdoqY3qBQgBJFZppy-3iWkFqqKgSxCPundF8gdDLC5ddizl~KYcYKl42y9SGFHIukH-TZs8~em0~iahzsqWVRks3zRG~tlBcX2U3M2~OJs~C33-NKhyfZT7-XFBREvb8Szmd~p66jDxrwOnKaku-G6DyoQipJqIz4VHmY9-y5T8RrUcJcM-5lVoMpAAAA.i2p/announce.php=http://tracker.mastertracker.i2p/"
|
||||
// , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
|
||||
, "crstrack", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
|
||||
, "Postman2", "http://lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDaJ50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqleE16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD3XF8BWb6K3GOOoyjc1umYKpur3G~FxBuqtHAsDRICkEbKUqJ9mPYQlTSujhNxiRIW-oLwMtvayCFci99oX8MvazPS7~97x0Gsm-onEK1Td9nBdmq30OqDxpRtXBimbzkLbR1IKObbg9HvrKs3L-kSyGwTUmHG9rSQSoZEvFMA-S0EXO~o4g21q1oikmxPMhkeVwQ22VHB0-LZJfmLr4SAAAA.i2p/announce.php=http://tracker2.postman.i2p/"
|
||||
};
|
||||
|
||||
/** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */
|
||||
|
@ -56,10 +56,11 @@ public class Storage
|
||||
boolean changed;
|
||||
|
||||
/** The default piece size. */
|
||||
private static int MIN_PIECE_SIZE = 256*1024;
|
||||
private static int MAX_PIECE_SIZE = 1024*1024;
|
||||
private static final int MIN_PIECE_SIZE = 256*1024;
|
||||
public static final int MAX_PIECE_SIZE = 1024*1024;
|
||||
/** The maximum number of pieces in a torrent. */
|
||||
private static long MAX_PIECES = 100*1024/20;
|
||||
public static final int MAX_PIECES = 10*1024;
|
||||
public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES;
|
||||
|
||||
/**
|
||||
* Creates a new storage based on the supplied MetaInfo. This will
|
||||
|
@ -502,9 +502,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
||||
out.write(filename);
|
||||
if (remaining == 0)
|
||||
out.write("</a>");
|
||||
// temporarily hardcoded for postman and anonymity, requires bytemonsoon patch for lookup by info_hash
|
||||
// temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash
|
||||
String announce = snark.meta.getAnnounce();
|
||||
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr")) {
|
||||
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") ||
|
||||
announce.startsWith("http://lnQ6yoBT")) {
|
||||
Map trackers = _manager.getTrackers();
|
||||
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
@ -586,6 +587,8 @@ public class I2PSnarkServlet extends HttpServlet {
|
||||
client = "I2PSnarkXL";
|
||||
else if ("ZV".equals(ch.substring(2,4)))
|
||||
client = "Robert";
|
||||
else if ("VUZP".equals(ch))
|
||||
client = "Robert";
|
||||
else
|
||||
client = "Unknown (" + ch + ')';
|
||||
out.write("<font size=-1>" + client + "</font> <tt>" + peer.toString().substring(5, 9) + "</tt>");
|
||||
|
@ -22,6 +22,7 @@
|
||||
</classpath>
|
||||
</depend>
|
||||
</target>
|
||||
<property name="javac.compilerargs" value="" />
|
||||
<target name="compile" depends="depend">
|
||||
<mkdir dir="./build" />
|
||||
<mkdir dir="./build/obj" />
|
||||
@ -29,7 +30,9 @@
|
||||
srcdir="./src"
|
||||
debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
destdir="./build/obj"
|
||||
classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" />
|
||||
classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
</javac>
|
||||
</target>
|
||||
<target name="jar" depends="builddep, compile">
|
||||
<jar destfile="./build/i2ptunnel.jar" basedir="./build/obj" includes="**/*.class">
|
||||
@ -52,7 +55,7 @@
|
||||
<mkdir dir="../jsp/WEB-INF/" />
|
||||
<mkdir dir="../jsp/WEB-INF/classes" />
|
||||
<!-- there are various jspc ant tasks, but they all seem a bit flakey -->
|
||||
<java classname="org.apache.jasper.JspC" fork="true" >
|
||||
<java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
|
||||
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
|
||||
@ -73,6 +76,7 @@
|
||||
</java>
|
||||
<javac debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
<classpath>
|
||||
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
|
||||
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
|
||||
|
@ -75,7 +75,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
private static long __tunnelId = 0;
|
||||
private long _tunnelId;
|
||||
private Properties _clientOptions;
|
||||
private final List _sessions;
|
||||
private final List<I2PSession> _sessions;
|
||||
|
||||
public static final int PACKET_DELAY = 100;
|
||||
|
||||
@ -92,7 +92,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
private final List tasks = new ArrayList();
|
||||
private int next_task_id = 1;
|
||||
|
||||
private Set listeners = new HashSet();
|
||||
private final Set listeners = new HashSet();
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
new I2PTunnel(args);
|
||||
@ -179,7 +179,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
List getSessions() {
|
||||
List<I2PSession> getSessions() {
|
||||
synchronized (_sessions) {
|
||||
return new ArrayList(_sessions);
|
||||
}
|
||||
@ -668,9 +668,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
*/
|
||||
public void runConnectClient(String args[], Logging l) {
|
||||
if (args.length >= 1 && args.length <= 3) {
|
||||
int port = -1;
|
||||
int _port = -1;
|
||||
try {
|
||||
port = Integer.parseInt(args[0]);
|
||||
_port = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
|
||||
return;
|
||||
@ -702,10 +702,10 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
I2PTunnelTask task;
|
||||
ownDest = !isShared;
|
||||
try {
|
||||
task = new I2PTunnelConnectClient(port, l, ownDest, proxy, (EventDispatcher) this, this);
|
||||
task = new I2PTunnelConnectClient(_port, l, ownDest, proxy, (EventDispatcher) this, this);
|
||||
addtask(task);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
_log.error(getPrefix() + "Invalid I2PTunnel config to create an httpclient [" + host + ":"+ port + "]", iae);
|
||||
_log.error(getPrefix() + "Invalid I2PTunnel config to create an httpclient [" + host + ":"+ _port + "]", iae);
|
||||
}
|
||||
} else {
|
||||
l.log("connectclient <port> [<sharedClient>] [<proxy>]");
|
||||
@ -728,9 +728,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
*/
|
||||
public void runIrcClient(String args[], Logging l) {
|
||||
if (args.length >= 2) {
|
||||
int port = -1;
|
||||
int _port = -1;
|
||||
try {
|
||||
port = Integer.parseInt(args[0]);
|
||||
_port = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
l.log("invalid port");
|
||||
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
|
||||
@ -757,12 +757,12 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
String privateKeyFile = null;
|
||||
if (args.length >= 4)
|
||||
privateKeyFile = args[3];
|
||||
task = new I2PTunnelIRCClient(port, args[1], l, ownDest, (EventDispatcher) this, this, privateKeyFile);
|
||||
task = new I2PTunnelIRCClient(_port, args[1], l, ownDest, (EventDispatcher) this, this, privateKeyFile);
|
||||
addtask(task);
|
||||
notifyEvent("ircclientTaskId", Integer.valueOf(task.getId()));
|
||||
} catch (IllegalArgumentException iae) {
|
||||
_log.error(getPrefix() + "Invalid I2PTunnel config to create an ircclient [" + host + ":"+ port + "]", iae);
|
||||
l.log("Invalid I2PTunnel configuration [" + host + ":" + port + "]");
|
||||
_log.error(getPrefix() + "Invalid I2PTunnel config to create an ircclient [" + host + ":"+ _port + "]", iae);
|
||||
l.log("Invalid I2PTunnel configuration [" + host + ":" + _port + "]");
|
||||
notifyEvent("ircclientTaskId", Integer.valueOf(-1));
|
||||
}
|
||||
} else {
|
||||
@ -786,9 +786,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
*/
|
||||
public void runSOCKSTunnel(String args[], Logging l) {
|
||||
if (args.length >= 1 && args.length <= 2) {
|
||||
int port = -1;
|
||||
int _port = -1;
|
||||
try {
|
||||
port = Integer.parseInt(args[0]);
|
||||
_port = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
l.log("invalid port");
|
||||
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
|
||||
@ -802,7 +802,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
|
||||
ownDest = !isShared;
|
||||
I2PTunnelTask task;
|
||||
task = new I2PSOCKSTunnel(port, l, ownDest, (EventDispatcher) this, this);
|
||||
task = new I2PSOCKSTunnel(_port, l, ownDest, (EventDispatcher) this, this);
|
||||
addtask(task);
|
||||
notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId()));
|
||||
} else {
|
||||
@ -820,9 +820,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
*/
|
||||
public void runStreamrClient(String args[], Logging l) {
|
||||
if (args.length == 3) {
|
||||
InetAddress host;
|
||||
InetAddress _host;
|
||||
try {
|
||||
host = InetAddress.getByName(args[0]);
|
||||
_host = InetAddress.getByName(args[0]);
|
||||
} catch (UnknownHostException uhe) {
|
||||
l.log("unknown host");
|
||||
_log.error(getPrefix() + "Error resolving " + args[0], uhe);
|
||||
@ -830,9 +830,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
int port = -1;
|
||||
int _port = -1;
|
||||
try {
|
||||
port = Integer.parseInt(args[1]);
|
||||
_port = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
l.log("invalid port");
|
||||
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
|
||||
@ -840,7 +840,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
StreamrConsumer task = new StreamrConsumer(host, port, args[2], l, (EventDispatcher) this, this);
|
||||
StreamrConsumer task = new StreamrConsumer(_host, _port, args[2], l, (EventDispatcher) this, this);
|
||||
task.startRunning();
|
||||
addtask(task);
|
||||
notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId()));
|
||||
@ -859,9 +859,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
*/
|
||||
public void runStreamrServer(String args[], Logging l) {
|
||||
if (args.length == 2) {
|
||||
int port = -1;
|
||||
int _port = -1;
|
||||
try {
|
||||
port = Integer.parseInt(args[0]);
|
||||
_port = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
l.log("invalid port");
|
||||
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
|
||||
@ -877,7 +877,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
StreamrProducer task = new StreamrProducer(port, privKeyFile, args[1], l, (EventDispatcher) this, this);
|
||||
StreamrProducer task = new StreamrProducer(_port, privKeyFile, args[1], l, (EventDispatcher) this, this);
|
||||
task.startRunning();
|
||||
addtask(task);
|
||||
notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId()));
|
||||
|
@ -39,7 +39,7 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
|
||||
return;
|
||||
}
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(destinations, ",");
|
||||
StringTokenizer tok = new StringTokenizer(destinations, ", ");
|
||||
dests = new ArrayList(1);
|
||||
while (tok.hasMoreTokens()) {
|
||||
String destination = tok.nextToken();
|
||||
|
@ -44,6 +44,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
protected final Object sockLock = new Object(); // Guards sockMgr and mySockets
|
||||
protected I2PSocketManager sockMgr; // should be final and use a factory. LINT
|
||||
protected List mySockets = new ArrayList();
|
||||
protected boolean _ownDest;
|
||||
|
||||
protected Destination dest = null;
|
||||
private int localPort;
|
||||
@ -114,6 +115,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
this.l = l;
|
||||
this.handlerName = handlerName + _clientId;
|
||||
this.privKeyFile = pkf;
|
||||
_ownDest = ownDest; // == ! shared client
|
||||
|
||||
|
||||
_context = tunnel.getContext();
|
||||
@ -129,13 +131,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
boolean openNow = !Boolean.valueOf(tunnel.getClientOptions().getProperty("i2cp.delayOpen")).booleanValue();
|
||||
if (openNow) {
|
||||
while (sockMgr == null) {
|
||||
synchronized (sockLock) {
|
||||
if (ownDest) {
|
||||
sockMgr = buildSocketManager();
|
||||
} else {
|
||||
sockMgr = getSocketManager();
|
||||
}
|
||||
}
|
||||
verifySocketManager();
|
||||
if (sockMgr == null) {
|
||||
_log.log(Log.CRIT, "Unable to create socket manager (our own? " + ownDest + ")");
|
||||
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
||||
@ -209,27 +205,67 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the this.sockMgr field if it is null, or if we want a new one
|
||||
*
|
||||
* We need a socket manager before getDefaultOptions() and most other things
|
||||
*/
|
||||
protected void verifySocketManager() {
|
||||
synchronized(sockLock) {
|
||||
boolean newManager = false;
|
||||
if (this.sockMgr == null) {
|
||||
newManager = true;
|
||||
} else {
|
||||
I2PSession sess = sockMgr.getSession();
|
||||
if (sess == null) {
|
||||
newManager = true;
|
||||
} else if (sess.isClosed() &&
|
||||
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")).booleanValue() &&
|
||||
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
|
||||
// build a new socket manager and a new dest if the session is closed.
|
||||
getTunnel().removeSession(sess);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn(getTunnel().getClientOptions().getProperty("inbound.nickname") + ": Built a new destination on resume");
|
||||
newManager = true;
|
||||
} // else the old socket manager will reconnect the old session if necessary
|
||||
}
|
||||
if (newManager) {
|
||||
if (_ownDest)
|
||||
this.sockMgr = buildSocketManager();
|
||||
else
|
||||
this.sockMgr = getSocketManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** this is ONLY for shared clients */
|
||||
private static I2PSocketManager socketManager;
|
||||
|
||||
/** this is ONLY for shared clients */
|
||||
protected synchronized I2PSocketManager getSocketManager() {
|
||||
return getSocketManager(getTunnel(), this.privKeyFile);
|
||||
}
|
||||
/** this is ONLY for shared clients */
|
||||
protected static synchronized I2PSocketManager getSocketManager(I2PTunnel tunnel) {
|
||||
return getSocketManager(tunnel, null);
|
||||
}
|
||||
/** this is ONLY for shared clients */
|
||||
protected static synchronized I2PSocketManager getSocketManager(I2PTunnel tunnel, String pkf) {
|
||||
if (socketManager != null) {
|
||||
I2PSession s = socketManager.getSession();
|
||||
if ( (s == null) || (s.isClosed()) ) {
|
||||
_log.info("Building a new socket manager since the old one closed [s=" + s + "]");
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since the old one closed [s=" + s + "]");
|
||||
if (s != null)
|
||||
tunnel.removeSession(s);
|
||||
socketManager = buildSocketManager(tunnel, pkf);
|
||||
} else {
|
||||
_log.info("Not building a new socket manager since the old one is open [s=" + s + "]");
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Not building a new socket manager since the old one is open [s=" + s + "]");
|
||||
}
|
||||
} else {
|
||||
_log.info("Building a new socket manager since there is no other one");
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since there is no other one");
|
||||
socketManager = buildSocketManager(tunnel, pkf);
|
||||
}
|
||||
return socketManager;
|
||||
@ -278,6 +314,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
}
|
||||
}
|
||||
sockManager.setName("Client");
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Built a new socket manager [s=" + sockManager.getSession() + "]");
|
||||
tunnel.addSession(sockManager.getSession());
|
||||
return sockManager;
|
||||
}
|
||||
@ -343,10 +381,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
* @return a new I2PSocket
|
||||
*/
|
||||
public I2PSocket createI2PSocket(Destination dest) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException {
|
||||
if (sockMgr == null) {
|
||||
// we need this before getDefaultOptions()
|
||||
sockMgr = getSocketManager();
|
||||
}
|
||||
verifySocketManager();
|
||||
return createI2PSocket(dest, getDefaultOptions());
|
||||
}
|
||||
|
||||
@ -367,19 +402,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
public I2PSocket createI2PSocket(Destination dest, I2PSocketOptions opt) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException {
|
||||
I2PSocket i2ps;
|
||||
|
||||
if (sockMgr == null) {
|
||||
// delayed open - call get instead of build because the locking is up there
|
||||
sockMgr = getSocketManager();
|
||||
} else if (Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
|
||||
synchronized(sockMgr) {
|
||||
I2PSocketManager oldSockMgr = sockMgr;
|
||||
// This will build a new socket manager and a new dest if the session is closed.
|
||||
sockMgr = getSocketManager();
|
||||
if (oldSockMgr != sockMgr) {
|
||||
_log.warn("Built a new destination on resume");
|
||||
}
|
||||
}
|
||||
} // else the old socket manager will reconnect the old session if necessary
|
||||
verifySocketManager();
|
||||
i2ps = sockMgr.connect(dest, opt);
|
||||
synchronized (sockLock) {
|
||||
mySockets.add(i2ps);
|
||||
|
@ -122,7 +122,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
|
||||
}
|
||||
|
||||
if (wwwProxy != null) {
|
||||
StringTokenizer tok = new StringTokenizer(wwwProxy, ",");
|
||||
StringTokenizer tok = new StringTokenizer(wwwProxy, ", ");
|
||||
while (tok.hasMoreTokens())
|
||||
_proxyList.add(tok.nextToken().trim());
|
||||
}
|
||||
@ -156,6 +156,8 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
|
||||
defaultOpts.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, ""+DEFAULT_READ_TIMEOUT);
|
||||
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
|
||||
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
|
||||
// delayed start
|
||||
verifySocketManager();
|
||||
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
|
||||
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
|
||||
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
|
||||
|
@ -152,7 +152,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
||||
}
|
||||
|
||||
if (wwwProxy != null) {
|
||||
StringTokenizer tok = new StringTokenizer(wwwProxy, ",");
|
||||
StringTokenizer tok = new StringTokenizer(wwwProxy, ", ");
|
||||
while (tok.hasMoreTokens())
|
||||
proxyList.add(tok.nextToken().trim());
|
||||
}
|
||||
@ -211,8 +211,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
||||
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
|
||||
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
|
||||
// delayed start
|
||||
if (sockMgr == null)
|
||||
sockMgr = getSocketManager();
|
||||
verifySocketManager();
|
||||
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
|
||||
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
|
||||
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
|
||||
|
@ -46,7 +46,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
|
||||
notifyThis,
|
||||
"IRCHandler " + (++__clientId), tunnel, pkf);
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(destinations, ",");
|
||||
StringTokenizer tok = new StringTokenizer(destinations, ", ");
|
||||
dests = new ArrayList(1);
|
||||
while (tok.hasMoreTokens()) {
|
||||
String destination = tok.nextToken();
|
||||
|
@ -434,6 +434,16 @@ public class TunnelController implements Logging {
|
||||
|
||||
public boolean getIsRunning() { return _running; }
|
||||
public boolean getIsStarting() { return _starting; }
|
||||
/** if running but no open sessions, we are in standby */
|
||||
public boolean getIsStandby() {
|
||||
if (!_running)
|
||||
return false;
|
||||
for (I2PSession sess : _tunnel.getSessions()) {
|
||||
if (!sess.isClosed())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void getSummary(StringBuffer buf) {
|
||||
String type = getType();
|
||||
|
@ -153,7 +153,9 @@ public class EditBean extends IndexBean {
|
||||
}
|
||||
|
||||
public boolean getNewDest(int tunnel) {
|
||||
return getBooleanProperty(tunnel, "i2cp.newDestOnResume");
|
||||
return getBooleanProperty(tunnel, "i2cp.newDestOnResume") &&
|
||||
getBooleanProperty(tunnel, "i2cp.closeOnIdle") &&
|
||||
!getBooleanProperty(tunnel, "persistentClientKey");
|
||||
}
|
||||
|
||||
public boolean getPersistentClientKey(int tunnel) {
|
||||
|
@ -77,6 +77,7 @@ public class IndexBean {
|
||||
public static final int RUNNING = 1;
|
||||
public static final int STARTING = 2;
|
||||
public static final int NOT_RUNNING = 3;
|
||||
public static final int STANDBY = 4;
|
||||
|
||||
public static final String PROP_TUNNEL_PASSPHRASE = "i2ptunnel.passphrase";
|
||||
static final String PROP_NONCE = IndexBean.class.getName() + ".nonce";
|
||||
@ -145,7 +146,7 @@ public class IndexBean {
|
||||
if ( (_action == null) || (_action.trim().length() <= 0) || ("Cancel".equals(_action)))
|
||||
return "";
|
||||
if ( (_prevNonce != _curNonce) && (!validPassphrase(_passphrase)) )
|
||||
return "Invalid nonce, are you being spoofed?";
|
||||
return "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.";
|
||||
if ("Stop all".equals(_action))
|
||||
return stopAll();
|
||||
else if ("Start all".equals(_action))
|
||||
@ -412,8 +413,12 @@ public class IndexBean {
|
||||
public int getTunnelStatus(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun == null) return NOT_RUNNING;
|
||||
if (tun.getIsRunning()) return RUNNING;
|
||||
else if (tun.getIsStarting()) return STARTING;
|
||||
if (tun.getIsRunning()) {
|
||||
if (isClient(tunnel) && tun.getIsStandby())
|
||||
return STANDBY;
|
||||
else
|
||||
return RUNNING;
|
||||
} else if (tun.getIsStarting()) return STARTING;
|
||||
else return NOT_RUNNING;
|
||||
}
|
||||
|
||||
@ -778,12 +783,6 @@ public class IndexBean {
|
||||
config.setProperty("interface", _reachableByOther);
|
||||
else
|
||||
config.setProperty("interface", _reachableBy);
|
||||
config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
|
||||
config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
|
||||
if (_name != null && !_sharedClient) {
|
||||
config.setProperty("option.inbound.nickname", _name);
|
||||
config.setProperty("option.outbound.nickname", _name);
|
||||
}
|
||||
config.setProperty("sharedClient", _sharedClient + "");
|
||||
for (String p : _booleanClientOpts)
|
||||
config.setProperty("option." + p, "" + _booleanOptions.contains(p));
|
||||
@ -896,14 +895,12 @@ public class IndexBean {
|
||||
config.setProperty("option.i2p.streaming.connectDelay", "1000");
|
||||
else
|
||||
config.setProperty("option.i2p.streaming.connectDelay", "0");
|
||||
if (_name != null) {
|
||||
if ( (!isClient(_type)) || (!_sharedClient) ) {
|
||||
config.setProperty("option.inbound.nickname", _name);
|
||||
config.setProperty("option.outbound.nickname", _name);
|
||||
} else {
|
||||
config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
|
||||
config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
|
||||
}
|
||||
if (isClient(_type) && _sharedClient) {
|
||||
config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
|
||||
config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
|
||||
} else if (_name != null) {
|
||||
config.setProperty("option.inbound.nickname", _name);
|
||||
config.setProperty("option.outbound.nickname", _name);
|
||||
}
|
||||
if ("interactive".equals(_profile))
|
||||
// This was 1 which doesn't make much sense
|
||||
|
@ -284,6 +284,7 @@
|
||||
<input type="text" id="clientPort" name="clientport" size="20" title="I2CP Port Number" value="<%=editBean.getI2CPPort(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
|
||||
<% if (!"streamrclient".equals(tunnelType)) { // streamr client sends pings so it will never be idle %>
|
||||
<div class="subdivider">
|
||||
<hr />
|
||||
</div>
|
||||
@ -362,6 +363,7 @@
|
||||
</label>
|
||||
<input value="1" type="checkbox" id="startOnLoad" name="delayOpen" title="Delay Tunnel Open"<%=(editBean.getDelayOpen(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% } // !streamrclient %>
|
||||
|
||||
<div class="subdivider">
|
||||
<hr />
|
||||
|
@ -97,6 +97,11 @@
|
||||
case IndexBean.STARTING:
|
||||
%><div class="statusStarting text">Starting...</div>
|
||||
<a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&action=stop&tunnel=<%=curClient%>">Stop</a>
|
||||
<%
|
||||
break;
|
||||
case IndexBean.STANDBY:
|
||||
%><div class="statusStarting text">Standby</div>
|
||||
<a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&action=stop&tunnel=<%=curClient%>">Stop</a>
|
||||
<%
|
||||
break;
|
||||
case IndexBean.RUNNING:
|
||||
|
@ -6,6 +6,7 @@
|
||||
<property name="jetty.url" value="http://dist.codehaus.org/jetty/jetty-5.1.x/jetty-5.1.12.zip" />
|
||||
<property name="jetty.filename" value="jetty-5.1.12.zip" />
|
||||
<property name="verified.filename" value="verified.txt" />
|
||||
<property name="javac.compilerargs" value="" />
|
||||
|
||||
<target name="all" depends="build" />
|
||||
|
||||
@ -90,9 +91,11 @@
|
||||
<mkdir dir="./build/obj" />
|
||||
<javac
|
||||
srcdir="./java/src"
|
||||
debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
debug="true" source="1.5" target="1.5"
|
||||
destdir="./build/obj"
|
||||
classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" />
|
||||
classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" >
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
</javac>
|
||||
</target>
|
||||
<target name="jar" depends="compile">
|
||||
<jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
|
||||
|
2198
apps/jetty/java/src/org/mortbay/http/HttpContext.java
Normal file
2198
apps/jetty/java/src/org/mortbay/http/HttpContext.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -19,10 +19,13 @@
|
||||
</classpath>
|
||||
</depend>
|
||||
</target>
|
||||
<property name="javac.compilerargs" value="" />
|
||||
<target name="compile" depends="depend">
|
||||
<mkdir dir="./build" />
|
||||
<mkdir dir="./build/obj" />
|
||||
<javac srcdir="./src" debug="true" deprecation="on" source="1.5" target="1.5" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" />
|
||||
<javac srcdir="./src" debug="true" deprecation="on" source="1.5" target="1.5" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
</javac>
|
||||
</target>
|
||||
<target name="jar" depends="compile">
|
||||
<jar destfile="./build/mstreaming.jar" basedir="./build/obj" includes="**/*.class" />
|
||||
|
@ -20,7 +20,7 @@ class I2PServerSocketImpl implements I2PServerSocket {
|
||||
private final static Log _log = new Log(I2PServerSocketImpl.class);
|
||||
private I2PSocketManager mgr;
|
||||
/** list of sockets waiting for the client to accept them */
|
||||
private List pendingSockets = Collections.synchronizedList(new ArrayList(4));
|
||||
private List<I2PSocket> pendingSockets = Collections.synchronizedList(new ArrayList<I2PSocket>(4));
|
||||
|
||||
/** have we been closed */
|
||||
private volatile boolean closing = false;
|
||||
|
@ -43,12 +43,12 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
|
||||
private I2PSession _session;
|
||||
private I2PServerSocketImpl _serverSocket = null;
|
||||
private Object lock = new Object(); // for locking socket lists
|
||||
private HashMap _outSockets;
|
||||
private HashMap _inSockets;
|
||||
private HashMap<String,I2PSocket> _outSockets;
|
||||
private HashMap<String,I2PSocket> _inSockets;
|
||||
private I2PSocketOptions _defaultOptions;
|
||||
private long _acceptTimeout;
|
||||
private String _name;
|
||||
private List _listeners;
|
||||
private List<DisconnectListener> _listeners;
|
||||
private static int __managerId = 0;
|
||||
|
||||
public static final short ACK = 0x51;
|
||||
@ -76,10 +76,10 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
|
||||
_name = name;
|
||||
_context = context;
|
||||
_log = _context.logManager().getLog(I2PSocketManager.class);
|
||||
_inSockets = new HashMap(16);
|
||||
_outSockets = new HashMap(16);
|
||||
_inSockets = new HashMap<String,I2PSocket>(16);
|
||||
_outSockets = new HashMap<String,I2PSocket>(16);
|
||||
_acceptTimeout = ACCEPT_TIMEOUT_DEFAULT;
|
||||
_listeners = new ArrayList(1);
|
||||
_listeners = new ArrayList<DisconnectListener>(1);
|
||||
setSession(session);
|
||||
setDefaultOptions(buildOptions(opts));
|
||||
_context.statManager().createRateStat("streaming.lifetime", "How long before the socket is closed?", "streaming", new long[] { 10*60*1000, 60*60*1000, 24*60*60*1000 });
|
||||
@ -113,9 +113,9 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
|
||||
public void disconnected(I2PSession session) {
|
||||
_log.info(getName() + ": Disconnected from the session");
|
||||
destroySocketManager();
|
||||
List listeners = null;
|
||||
List<DisconnectListener> listeners = null;
|
||||
synchronized (_listeners) {
|
||||
listeners = new ArrayList(_listeners);
|
||||
listeners = new ArrayList<DisconnectListener>(_listeners);
|
||||
_listeners.clear();
|
||||
}
|
||||
for (int i = 0; i < listeners.size(); i++) {
|
||||
@ -660,7 +660,7 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
|
||||
*
|
||||
*/
|
||||
public Set listSockets() {
|
||||
Set sockets = new HashSet(8);
|
||||
Set<I2PSocket> sockets = new HashSet<I2PSocket>(8);
|
||||
synchronized (lock) {
|
||||
sockets.addAll(_inSockets.values());
|
||||
sockets.addAll(_outSockets.values());
|
||||
|
@ -40,6 +40,7 @@
|
||||
<targetfilelist dir="." files="build/obj/net/i2p/router/web/UpdateHandler.class" />
|
||||
</dependset>
|
||||
</target>
|
||||
<property name="javac.compilerargs" value="" />
|
||||
<target name="compile" depends="prepare, depend, dependVersion">
|
||||
<mkdir dir="./build" />
|
||||
<mkdir dir="./build/obj" />
|
||||
@ -47,6 +48,7 @@
|
||||
srcdir="./src"
|
||||
debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
destdir="./build/obj">
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
<classpath>
|
||||
<pathelement location="../../../core/java/build/i2p.jar" />
|
||||
<pathelement location="../../../router/java/build/router.jar" />
|
||||
@ -84,7 +86,7 @@
|
||||
<mkdir dir="../jsp/WEB-INF/" />
|
||||
<mkdir dir="../jsp/WEB-INF/classes" />
|
||||
<!-- there are various jspc ant tasks, but they all seem a bit flakey -->
|
||||
<java classname="org.apache.jasper.JspC" fork="true">
|
||||
<java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
|
||||
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
|
||||
@ -114,6 +116,7 @@
|
||||
<javac debug="true" deprecation="on" source="1.5" target="1.5"
|
||||
destdir="../jsp/WEB-INF/classes/"
|
||||
srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
|
||||
<compilerarg line="${javac.compilerargs}" />
|
||||
<classpath>
|
||||
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
|
||||
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
|
||||
@ -140,7 +143,7 @@
|
||||
</target>
|
||||
|
||||
<uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
|
||||
<srcfiles dir= "../jsp" includes="**/*.jsp, **/*.html, susimail/susimail, web.xml"/>
|
||||
<srcfiles dir= "../jsp" includes="**/*.jsp, **/*.html, *.css, susimail/susimail, web.xml"/>
|
||||
</uptodate>
|
||||
|
||||
<target name="javadoc">
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import net.i2p.data.RouterInfo;
|
||||
import net.i2p.router.LoadTestManager;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.transport.FIFOBandwidthRefiller;
|
||||
import net.i2p.router.transport.TransportManager;
|
||||
import net.i2p.router.transport.udp.UDPTransport;
|
||||
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
|
||||
import net.i2p.time.Timestamper;
|
||||
@ -25,9 +25,13 @@ public class ConfigNetHandler extends FormHandler {
|
||||
private String _ntcpHostname;
|
||||
private String _ntcpPort;
|
||||
private String _tcpPort;
|
||||
private String _udpHost1;
|
||||
private String _udpHost2;
|
||||
private String _udpPort;
|
||||
private boolean _ntcpAutoIP;
|
||||
private String _udpAutoIP;
|
||||
private String _ntcpAutoIP;
|
||||
private boolean _ntcpAutoPort;
|
||||
private boolean _upnp;
|
||||
private String _inboundRate;
|
||||
private String _inboundBurstRate;
|
||||
private String _inboundBurst;
|
||||
@ -37,7 +41,8 @@ public class ConfigNetHandler extends FormHandler {
|
||||
private String _reseedFrom;
|
||||
private boolean _enableLoadTesting;
|
||||
private String _sharePct;
|
||||
private boolean _ratesOnly;
|
||||
private static final boolean _ratesOnly = false; // always false - delete me
|
||||
private static final String PROP_HIDDEN = Router.PROP_HIDDEN_HIDDEN; // see Router for other choice
|
||||
|
||||
protected void processForm() {
|
||||
if (_saveRequested || ( (_action != null) && ("Save changes".equals(_action)) )) {
|
||||
@ -53,12 +58,19 @@ public class ConfigNetHandler extends FormHandler {
|
||||
public void setEnabletimesync(String moo) { _timeSyncEnabled = true; }
|
||||
public void setRecheckReachability(String moo) { _recheckReachabilityRequested = true; }
|
||||
public void setRequireIntroductions(String moo) { _requireIntroductions = true; }
|
||||
public void setHiddenMode(String moo) { _hiddenMode = true; }
|
||||
public void setDynamicKeys(String moo) { _dynamicKeys = true; }
|
||||
public void setUpdateratesonly(String moo) { _ratesOnly = true; }
|
||||
public void setEnableloadtesting(String moo) { _enableLoadTesting = true; }
|
||||
public void setNtcpAutoIP(String moo) { _ntcpAutoIP = true; }
|
||||
public void setNtcpAutoPort(String moo) { _ntcpAutoPort = true; }
|
||||
public void setUdpAutoIP(String mode) {
|
||||
_udpAutoIP = mode;
|
||||
_hiddenMode = "hidden".equals(mode);
|
||||
}
|
||||
public void setNtcpAutoIP(String mode) {
|
||||
_ntcpAutoIP = mode;
|
||||
}
|
||||
public void setNtcpAutoPort(String mode) {
|
||||
_ntcpAutoPort = mode.equals("2");
|
||||
}
|
||||
public void setUpnp(String moo) { _upnp = true; }
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
_hostname = (hostname != null ? hostname.trim() : null);
|
||||
@ -72,6 +84,12 @@ public class ConfigNetHandler extends FormHandler {
|
||||
public void setNtcpport(String port) {
|
||||
_ntcpPort = (port != null ? port.trim() : null);
|
||||
}
|
||||
public void setUdpHost1(String host) {
|
||||
_udpHost1 = (host != null ? host.trim() : null);
|
||||
}
|
||||
public void setUdpHost2(String host) {
|
||||
_udpHost2 = (host != null ? host.trim() : null);
|
||||
}
|
||||
public void setUdpPort(String port) {
|
||||
_udpPort = (port != null ? port.trim() : null);
|
||||
}
|
||||
@ -111,58 +129,75 @@ public class ConfigNetHandler extends FormHandler {
|
||||
boolean restartRequired = false;
|
||||
|
||||
if (!_ratesOnly) {
|
||||
// IP Settings
|
||||
String oldUdp = _context.getProperty(UDPTransport.PROP_SOURCES, UDPTransport.DEFAULT_SOURCES);
|
||||
String oldUHost = _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST, "");
|
||||
if (_udpAutoIP != null) {
|
||||
String uhost = "";
|
||||
if (_udpAutoIP.equals("fixed")) {
|
||||
if (_udpHost1 != null && _udpHost1.length() > 0)
|
||||
uhost = _udpHost1;
|
||||
else if (_udpHost2 != null && _udpHost2.length() > 0)
|
||||
uhost = _udpHost2;
|
||||
else
|
||||
_udpAutoIP = UDPTransport.DEFAULT_SOURCES;
|
||||
}
|
||||
_context.router().setConfigSetting(UDPTransport.PROP_SOURCES, _udpAutoIP);
|
||||
// Todo: Catch local IPs right here rather than complaining later
|
||||
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_HOST, uhost);
|
||||
if ((!oldUdp.equals(_udpAutoIP)) || (!oldUHost.equals(uhost))) {
|
||||
addFormNotice("Updating IP address");
|
||||
restartRequired = true;
|
||||
}
|
||||
}
|
||||
|
||||
// NTCP Settings
|
||||
// Normalize some things to make the following code a little easier...
|
||||
String oldNHost = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
|
||||
if (oldNHost == null) oldNHost = "";
|
||||
String oldNPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
|
||||
if (oldNPort == null) oldNPort = "";
|
||||
String sAutoHost = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP);
|
||||
String sAutoPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
|
||||
boolean oldAutoHost = "true".equalsIgnoreCase(sAutoHost);
|
||||
String oldNHost = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, "");
|
||||
String oldNPort = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT, "");
|
||||
String oldAutoHost = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, "true");
|
||||
String sAutoPort = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "true");
|
||||
boolean oldAutoPort = "true".equalsIgnoreCase(sAutoPort);
|
||||
if (_ntcpHostname == null) _ntcpHostname = "";
|
||||
if (_ntcpPort == null) _ntcpPort = "";
|
||||
if (_ntcpAutoIP == null) _ntcpAutoIP = "true";
|
||||
|
||||
if (oldAutoHost != _ntcpAutoIP || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
|
||||
if (_ntcpAutoIP) {
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, "true");
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
|
||||
addFormNotice("Updating inbound TCP address to auto");
|
||||
} else if (_ntcpHostname.length() > 0) {
|
||||
if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
|
||||
if ("disabled".equals(_ntcpAutoIP)) {
|
||||
addFormNotice("Disabling TCP completely");
|
||||
} else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
|
||||
// Todo: Catch local IPs right here rather than complaining later
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname);
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP);
|
||||
addFormNotice("Updating inbound TCP address to " + _ntcpHostname);
|
||||
} else {
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP);
|
||||
addFormNotice("Disabling inbound TCP");
|
||||
if ("false".equals(_ntcpAutoIP))
|
||||
addFormNotice("Disabling inbound TCP");
|
||||
else
|
||||
addFormNotice("Updating inbound TCP address to auto"); // true or always
|
||||
}
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
|
||||
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP));
|
||||
restartRequired = true;
|
||||
}
|
||||
if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) {
|
||||
if ( _ntcpAutoPort ) {
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "true");
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
|
||||
addFormNotice("Updating inbound TCP port to auto");
|
||||
} else if (_ntcpPort.length() > 0) {
|
||||
if (_ntcpPort.length() > 0 && !_ntcpAutoPort) {
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort);
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
|
||||
addFormNotice("Updating inbound TCP port to " + _ntcpPort);
|
||||
} else {
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
|
||||
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
|
||||
addFormNotice("Disabling inbound TCP");
|
||||
addFormNotice("Updating inbound TCP port to auto");
|
||||
}
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
|
||||
restartRequired = true;
|
||||
}
|
||||
|
||||
// UDP Settings
|
||||
if ( (_udpPort != null) && (_udpPort.length() > 0) ) {
|
||||
String oldPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_UDP_PORT);
|
||||
if ( (oldPort == null) && (_udpPort.equals("8887")) ) {
|
||||
// still on default.. noop
|
||||
} else if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_udpPort)) ) {
|
||||
// its not the default OR it has changed
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_UDP_PORT, _udpPort);
|
||||
String oldPort = "" + _context.getProperty(UDPTransport.PROP_INTERNAL_PORT, UDPTransport.DEFAULT_INTERNAL_PORT);
|
||||
if (!oldPort.equals(_udpPort)) {
|
||||
_context.router().setConfigSetting(UDPTransport.PROP_INTERNAL_PORT, _udpPort);
|
||||
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_PORT, _udpPort);
|
||||
addFormNotice("Updating UDP port from " + oldPort + " to " + _udpPort);
|
||||
restartRequired = true;
|
||||
}
|
||||
@ -172,36 +207,29 @@ public class ConfigNetHandler extends FormHandler {
|
||||
|
||||
updateRates();
|
||||
|
||||
boolean switchRequired = false;
|
||||
if (!_ratesOnly) {
|
||||
if (_sharePct != null) {
|
||||
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
|
||||
if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) {
|
||||
_context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
|
||||
addFormNotice("Updating bandwidth share percentage");
|
||||
}
|
||||
}
|
||||
|
||||
// If hidden mode value changes, restart is required
|
||||
if (_hiddenMode && "false".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false"))) {
|
||||
_context.router().setConfigSetting(Router.PROP_HIDDEN, "true");
|
||||
_context.router().addCapabilities(_context.router().getRouterInfo());
|
||||
addFormNotice("Gracefully restarting into Hidden Router Mode. Make sure you have no 0-1 length "
|
||||
+ "<a href=\"configtunnels.jsp\">tunnels!</a>");
|
||||
hiddenSwitch();
|
||||
switchRequired = _hiddenMode != _context.router().isHidden();
|
||||
if (switchRequired) {
|
||||
_context.router().setConfigSetting(PROP_HIDDEN, "" + _hiddenMode);
|
||||
if (_hiddenMode)
|
||||
addFormError("Gracefully restarting into Hidden Router Mode");
|
||||
else
|
||||
addFormError("Gracefully restarting to exit Hidden Router Mode");
|
||||
}
|
||||
|
||||
if (!_hiddenMode && "true".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false"))) {
|
||||
_context.router().removeConfigSetting(Router.PROP_HIDDEN);
|
||||
_context.router().getRouterInfo().delCapability(RouterInfo.CAPABILITY_HIDDEN);
|
||||
addFormNotice("Gracefully restarting to exit Hidden Router Mode");
|
||||
hiddenSwitch();
|
||||
}
|
||||
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
|
||||
|
||||
if (_dynamicKeys) {
|
||||
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "true");
|
||||
} else {
|
||||
_context.router().removeConfigSetting(Router.PROP_DYNAMIC_KEYS);
|
||||
if (Boolean.valueOf(_context.getProperty(TransportManager.PROP_ENABLE_UPNP)).booleanValue() !=
|
||||
_upnp) {
|
||||
// This is minor, don't set restartRequired
|
||||
if (_upnp)
|
||||
addFormNotice("Enabling UPnP, restart required to take effect");
|
||||
else
|
||||
addFormNotice("Disabling UPnP, restart required to take effect");
|
||||
}
|
||||
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
|
||||
|
||||
if (_requireIntroductions) {
|
||||
_context.router().setConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS, "true");
|
||||
@ -210,14 +238,12 @@ public class ConfigNetHandler extends FormHandler {
|
||||
_context.router().removeConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS);
|
||||
}
|
||||
|
||||
if (true || _timeSyncEnabled) {
|
||||
// Time sync enable, means NOT disabled
|
||||
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "false");
|
||||
} else {
|
||||
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "true");
|
||||
}
|
||||
// Time sync enable, means NOT disabled
|
||||
// Hmm router sets this at startup, not required here
|
||||
//_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "false");
|
||||
|
||||
LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
|
||||
// Hidden in the GUI
|
||||
//LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
|
||||
}
|
||||
|
||||
boolean saved = _context.router().saveConfig();
|
||||
@ -228,10 +254,27 @@ public class ConfigNetHandler extends FormHandler {
|
||||
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
|
||||
}
|
||||
|
||||
if (restartRequired) {
|
||||
addFormNotice("Performing a soft restart");
|
||||
_context.router().restart();
|
||||
addFormNotice("Soft restart complete");
|
||||
if (switchRequired) {
|
||||
hiddenSwitch();
|
||||
} else if (restartRequired) {
|
||||
// Wow this dumps all conns immediately and really isn't nice
|
||||
//addFormNotice("Performing a soft restart");
|
||||
//_context.router().restart();
|
||||
//addFormNotice("Soft restart complete");
|
||||
|
||||
// Most of the time we aren't changing addresses, just enabling or disabling
|
||||
// things, so let's try just a new routerInfo and see how that works.
|
||||
// Maybe we should restart if we change addresses though?
|
||||
// No, this doesn't work well, really need to call SSU Transport externalAddressReceived(),
|
||||
// but that's hard to get to, and doesn't handle port changes, etc.
|
||||
// So don't do this...
|
||||
//_context.router().rebuildRouterInfo();
|
||||
//addFormNotice("Router Info rebuilt");
|
||||
|
||||
// There's a few changes that don't really require restart (e.g. enabling inbound TCP)
|
||||
// But it would be hard to get right, so just do a restart.
|
||||
addFormError("Gracefully restarting I2P to change published router address");
|
||||
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,19 +286,36 @@ public class ConfigNetHandler extends FormHandler {
|
||||
|
||||
private void updateRates() {
|
||||
boolean updated = false;
|
||||
if ( (_inboundRate != null) && (_inboundRate.length() > 0) ) {
|
||||
|
||||
if (_sharePct != null) {
|
||||
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
|
||||
if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) {
|
||||
_context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
|
||||
addFormNotice("Updating bandwidth share percentage");
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (_inboundRate != null) && (_inboundRate.length() > 0) &&
|
||||
!_inboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_INBOUND_BANDWIDTH))) {
|
||||
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, _inboundRate);
|
||||
updated = true;
|
||||
}
|
||||
if ( (_outboundRate != null) && (_outboundRate.length() > 0) ) {
|
||||
if ( (_outboundRate != null) && (_outboundRate.length() > 0) &&
|
||||
!_outboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BANDWIDTH))) {
|
||||
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, _outboundRate);
|
||||
updated = true;
|
||||
}
|
||||
if ( (_inboundBurstRate != null) && (_inboundBurstRate.length() > 0) ) {
|
||||
|
||||
/******* These aren't in the GUI for now
|
||||
|
||||
if ( (_inboundBurstRate != null) && (_inboundBurstRate.length() > 0) &&
|
||||
!_inboundBurstRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_INBOUND_BURST_BANDWIDTH))) {
|
||||
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, _inboundBurstRate);
|
||||
updated = true;
|
||||
}
|
||||
if ( (_outboundBurstRate != null) && (_outboundBurstRate.length() > 0) ) {
|
||||
if ( (_outboundBurstRate != null) && (_outboundBurstRate.length() > 0) &&
|
||||
!_outboundBurstRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BURST_BANDWIDTH))) {
|
||||
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, _outboundBurstRate);
|
||||
updated = true;
|
||||
}
|
||||
@ -295,9 +355,13 @@ public class ConfigNetHandler extends FormHandler {
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
***********/
|
||||
|
||||
|
||||
if (updated && !_ratesOnly)
|
||||
if (updated && !_ratesOnly) {
|
||||
_context.bandwidthLimiter().reinitialize();
|
||||
addFormNotice("Updated bandwidth limits");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.RouterAddress;
|
||||
import net.i2p.router.CommSystemFacade;
|
||||
import net.i2p.router.LoadTestManager;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.transport.Addresses;
|
||||
import net.i2p.router.transport.TransportManager;
|
||||
import net.i2p.router.transport.udp.UDPAddress;
|
||||
import net.i2p.router.transport.udp.UDPTransport;
|
||||
@ -14,25 +15,23 @@ public class ConfigNetHelper extends HelperBase {
|
||||
public ConfigNetHelper() {}
|
||||
|
||||
/** copied from various private components */
|
||||
public final static String PROP_I2NP_UDP_PORT = "i2np.udp.port";
|
||||
public final static String PROP_I2NP_INTERNAL_UDP_PORT = "i2np.udp.internalPort";
|
||||
public final static String PROP_I2NP_NTCP_HOSTNAME = "i2np.ntcp.hostname";
|
||||
public final static String PROP_I2NP_NTCP_PORT = "i2np.ntcp.port";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoip";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoport";
|
||||
public String getNtcphostname() {
|
||||
if (!TransportManager.enableNTCP(_context))
|
||||
return "\" disabled=\"true";
|
||||
String hostname = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
|
||||
if (hostname == null) return "";
|
||||
return hostname;
|
||||
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoport";
|
||||
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoip";
|
||||
private final static String CHECKED = " checked=\"true\" ";
|
||||
private final static String DISABLED = " disabled=\"true\" ";
|
||||
|
||||
public String getUdphostname() {
|
||||
return _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST, "");
|
||||
}
|
||||
|
||||
public String getNtcphostname() {
|
||||
return _context.getProperty(PROP_I2NP_NTCP_HOSTNAME, "");
|
||||
}
|
||||
|
||||
public String getNtcpport() {
|
||||
if (!TransportManager.enableNTCP(_context))
|
||||
return "\" disabled=\"true";
|
||||
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
|
||||
if (port == null) return "";
|
||||
return port;
|
||||
return _context.getProperty(PROP_I2NP_NTCP_PORT, "");
|
||||
}
|
||||
|
||||
public String getUdpAddress() {
|
||||
@ -63,75 +62,109 @@ public class ConfigNetHelper extends HelperBase {
|
||||
return "" + ua.getPort();
|
||||
}
|
||||
|
||||
public String getConfiguredUdpPort() {
|
||||
return "" + _context.getProperty(UDPTransport.PROP_INTERNAL_PORT, UDPTransport.DEFAULT_INTERNAL_PORT);
|
||||
}
|
||||
|
||||
public String getEnableTimeSyncChecked() {
|
||||
String disabled = _context.getProperty(Timestamper.PROP_DISABLED, "false");
|
||||
if ( (disabled != null) && ("true".equalsIgnoreCase(disabled)) )
|
||||
return "";
|
||||
else
|
||||
return " checked ";
|
||||
return CHECKED;
|
||||
}
|
||||
|
||||
public String getHiddenModeChecked() {
|
||||
String enabled = _context.getProperty(Router.PROP_HIDDEN, "false");
|
||||
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
|
||||
return " checked ";
|
||||
else
|
||||
return "";
|
||||
/** @param prop must default to false */
|
||||
public String getChecked(String prop) {
|
||||
if (Boolean.valueOf(_context.getProperty(prop)).booleanValue())
|
||||
return CHECKED;
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getDynamicKeysChecked() {
|
||||
String enabled = _context.getProperty(Router.PROP_DYNAMIC_KEYS, "false");
|
||||
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
|
||||
return " checked ";
|
||||
else
|
||||
return "";
|
||||
return getChecked(Router.PROP_DYNAMIC_KEYS);
|
||||
}
|
||||
|
||||
public String getTcpAutoPortChecked() {
|
||||
if (!TransportManager.enableNTCP(_context))
|
||||
return " disabled=\"true\" ";
|
||||
String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_PORT, "false");
|
||||
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
|
||||
return " checked ";
|
||||
else
|
||||
return "";
|
||||
public String getTcpAutoPortChecked(int mode) {
|
||||
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
|
||||
boolean specified = port != null && port.length() > 0;
|
||||
if ((mode == 1 && specified) ||
|
||||
(mode == 2 && !specified))
|
||||
return CHECKED;
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getTcpAutoIPChecked() {
|
||||
if (!TransportManager.enableNTCP(_context))
|
||||
return " disabled=\"true\" ";
|
||||
String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "false");
|
||||
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
|
||||
return " checked ";
|
||||
else
|
||||
return "";
|
||||
public String getTcpAutoIPChecked(int mode) {
|
||||
boolean enabled = TransportManager.enableNTCP(_context);
|
||||
String hostname = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
|
||||
boolean specified = hostname != null && hostname.length() > 0;
|
||||
String auto = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "false");
|
||||
if ((mode == 0 && (!specified) && auto.equals("false") && enabled) ||
|
||||
(mode == 1 && specified && auto.equals("false") && enabled) ||
|
||||
(mode == 2 && auto.equals("true") && enabled) ||
|
||||
(mode == 3 && auto.equals("always") && enabled) ||
|
||||
(mode == 4 && !enabled))
|
||||
return CHECKED;
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getUdpAutoIPChecked(int mode) {
|
||||
String hostname = _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST);
|
||||
boolean specified = hostname != null && hostname.length() > 0;
|
||||
boolean hidden = _context.router().isHidden();
|
||||
String sources = _context.getProperty(UDPTransport.PROP_SOURCES, UDPTransport.DEFAULT_SOURCES);
|
||||
if ((mode == 0 && sources.equals("ssu") && !hidden) ||
|
||||
(mode == 1 && specified && !hidden) ||
|
||||
(mode == 2 && hidden) ||
|
||||
(mode == 3 && sources.equals("local,upnp,ssu") && !hidden) ||
|
||||
(mode == 4 && sources.equals("local,ssu") && !hidden) ||
|
||||
(mode == 5 && sources.equals("upnp,ssu") && !hidden))
|
||||
return CHECKED;
|
||||
return "";
|
||||
}
|
||||
|
||||
/** default true */
|
||||
public String getUpnpChecked() {
|
||||
if (Boolean.valueOf(_context.getProperty(TransportManager.PROP_ENABLE_UPNP, "true")).booleanValue())
|
||||
return CHECKED;
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getRequireIntroductionsChecked() {
|
||||
short status = _context.commSystem().getReachabilityStatus();
|
||||
switch (status) {
|
||||
case CommSystemFacade.STATUS_OK:
|
||||
if ("true".equalsIgnoreCase(_context.getProperty(UDPTransport.PROP_FORCE_INTRODUCERS, "false")))
|
||||
return "checked=\"true\"";
|
||||
return "";
|
||||
case CommSystemFacade.STATUS_UNKNOWN:
|
||||
return getChecked(UDPTransport.PROP_FORCE_INTRODUCERS);
|
||||
case CommSystemFacade.STATUS_DIFFERENT:
|
||||
case CommSystemFacade.STATUS_REJECT_UNSOLICITED:
|
||||
return "checked=\"true\"";
|
||||
case CommSystemFacade.STATUS_UNKNOWN:
|
||||
if ("true".equalsIgnoreCase(_context.getProperty(UDPTransport.PROP_FORCE_INTRODUCERS, "false")))
|
||||
return "checked=\"true\"";
|
||||
return "";
|
||||
default:
|
||||
return "checked=\"true\"";
|
||||
return CHECKED;
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getAddresses() {
|
||||
return Addresses.getAddresses();
|
||||
}
|
||||
|
||||
public String getInboundRate() {
|
||||
return "" + _context.bandwidthLimiter().getInboundKBytesPerSecond();
|
||||
}
|
||||
public String getOutboundRate() {
|
||||
return "" + _context.bandwidthLimiter().getOutboundKBytesPerSecond();
|
||||
}
|
||||
public String getInboundRateBits() {
|
||||
return kbytesToBits(_context.bandwidthLimiter().getInboundKBytesPerSecond());
|
||||
}
|
||||
public String getOutboundRateBits() {
|
||||
return kbytesToBits(_context.bandwidthLimiter().getOutboundKBytesPerSecond());
|
||||
}
|
||||
public String getShareRateBits() {
|
||||
return kbytesToBits(getShareBandwidth());
|
||||
}
|
||||
private String kbytesToBits(int kbytes) {
|
||||
return DataHelper.formatSize(kbytes * 8 * 1024) + " bits per second";
|
||||
}
|
||||
public String getInboundBurstRate() {
|
||||
return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond();
|
||||
}
|
||||
@ -180,17 +213,15 @@ public class ConfigNetHelper extends HelperBase {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** removed */
|
||||
public String getEnableLoadTesting() {
|
||||
if (LoadTestManager.isEnabled(_context))
|
||||
return " checked ";
|
||||
else
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getSharePercentageBox() {
|
||||
int pct = (int) (100 * _context.router().getSharePercentage());
|
||||
StringBuffer buf = new StringBuffer(256);
|
||||
buf.append("<select name=\"sharePercentage\">\n");
|
||||
buf.append("<select style=\"text-align: right;\" name=\"sharePercentage\">\n");
|
||||
boolean found = false;
|
||||
for (int i = 30; i <= 110; i += 10) {
|
||||
int val = i;
|
||||
@ -200,12 +231,12 @@ public class ConfigNetHelper extends HelperBase {
|
||||
else
|
||||
val = pct;
|
||||
}
|
||||
buf.append("<option value=\"").append(val).append("\" ");
|
||||
buf.append("<option style=\"text-align: right;\" value=\"").append(val).append("\" ");
|
||||
if (pct == val) {
|
||||
buf.append("selected=\"true\" ");
|
||||
found = true;
|
||||
}
|
||||
buf.append(">Up to ").append(val).append("%</option>\n");
|
||||
buf.append(">").append(val).append("%</option>\n");
|
||||
}
|
||||
buf.append("</select>\n");
|
||||
return buf.toString();
|
||||
|
@ -63,6 +63,11 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
out.getLength() <= 0 ||
|
||||
out.getLength() + out.getLengthVariance() <= 0)
|
||||
buf.append("<tr><td colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels</font></td></tr>");
|
||||
else if (in.getLength() <= 1 ||
|
||||
in.getLength() + in.getLengthVariance() <= 1 ||
|
||||
out.getLength() <= 1 ||
|
||||
out.getLength() + out.getLengthVariance() <= 1)
|
||||
buf.append("<tr><td colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels</font></td></tr>");
|
||||
if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
|
||||
out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
|
||||
buf.append("<tr><td colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels</font></td></tr>");
|
||||
|
@ -12,7 +12,7 @@ import net.i2p.util.Log;
|
||||
* <jsp:setProperty name="handler" property="*" />
|
||||
*
|
||||
* The form is "processed" after the properties are set and the first output
|
||||
* property is retrieved - either getNotices() or getErrors().
|
||||
* property is retrieved - either getAll(), getNotices() or getErrors().
|
||||
*
|
||||
*/
|
||||
public class FormHandler {
|
||||
@ -21,8 +21,8 @@ public class FormHandler {
|
||||
private String _nonce;
|
||||
protected String _action;
|
||||
protected String _passphrase;
|
||||
private List _errors;
|
||||
private List _notices;
|
||||
private List<String> _errors;
|
||||
private List<String> _notices;
|
||||
private boolean _processed;
|
||||
private boolean _valid;
|
||||
|
||||
@ -78,6 +78,31 @@ public class FormHandler {
|
||||
_notices.add(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display everything, wrap it in a div for consistent presentation
|
||||
*
|
||||
*/
|
||||
public String getAllMessages() {
|
||||
validate();
|
||||
process();
|
||||
if (_errors.size() <= 0 && _notices.size() <= 0)
|
||||
return "";
|
||||
StringBuffer buf = new StringBuffer(512);
|
||||
buf.append("<div class=\"messages\" id=\"messages\"><p>");
|
||||
if (_errors.size() > 0) {
|
||||
buf.append("<span class=\"error\">");
|
||||
buf.append(render(_errors));
|
||||
buf.append("</span>");
|
||||
}
|
||||
if (_notices.size() > 0) {
|
||||
buf.append("<span class=\"notice\">");
|
||||
buf.append(render(_notices));
|
||||
buf.append("</span>");
|
||||
}
|
||||
buf.append("</p></div>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display any error messages (processing the form if it hasn't
|
||||
* been yet)
|
||||
@ -85,6 +110,7 @@ public class FormHandler {
|
||||
*/
|
||||
public String getErrors() {
|
||||
validate();
|
||||
process();
|
||||
return render(_errors);
|
||||
}
|
||||
|
||||
@ -95,6 +121,7 @@ public class FormHandler {
|
||||
*/
|
||||
public String getNotices() {
|
||||
validate();
|
||||
process();
|
||||
return render(_notices);
|
||||
}
|
||||
|
||||
@ -133,28 +160,29 @@ public class FormHandler {
|
||||
if ( (expected != null) && (expected.trim().length() > 0) && (expected.equals(_passphrase)) ) {
|
||||
// ok
|
||||
} else {
|
||||
addFormError("Invalid nonce, are you being spoofed?");
|
||||
addFormError("Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.");
|
||||
_valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String render(List source) {
|
||||
private void process() {
|
||||
if (!_processed) {
|
||||
if (_valid)
|
||||
processForm();
|
||||
_processed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private String render(List<String> source) {
|
||||
if (source.size() <= 0) {
|
||||
return "";
|
||||
} else if (source.size() == 1) {
|
||||
return (String)source.get(0);
|
||||
} else {
|
||||
StringBuffer buf = new StringBuffer(512);
|
||||
buf.append("<ul>\n");
|
||||
for (int i = 0; i < source.size(); i++) {
|
||||
buf.append("<li>");
|
||||
buf.append((String)source.get(i));
|
||||
buf.append(source.get(i));
|
||||
buf.append("</li>\n");
|
||||
}
|
||||
buf.append("</ul>\n");
|
||||
|
@ -10,17 +10,21 @@ import net.i2p.router.RouterContext;
|
||||
public class NetDbHelper extends HelperBase {
|
||||
private String _routerPrefix;
|
||||
private boolean _full = false;
|
||||
private boolean _lease = false;
|
||||
|
||||
public NetDbHelper() {}
|
||||
|
||||
public void setRouter(String r) { _routerPrefix = r; }
|
||||
public void setFull(String f) { _full = "1".equals(f); };
|
||||
public void setFull(String f) { _full = "1".equals(f); }
|
||||
public void setLease(String l) { _lease = "1".equals(l); }
|
||||
|
||||
public String getNetDbSummary() {
|
||||
try {
|
||||
if (_out != null) {
|
||||
if (_routerPrefix != null)
|
||||
_context.netDb().renderRouterInfoHTML(_out, _routerPrefix);
|
||||
else if (_lease)
|
||||
_context.netDb().renderLeaseSetHTML(_out);
|
||||
else
|
||||
_context.netDb().renderStatusHTML(_out, _full);
|
||||
return "";
|
||||
@ -28,6 +32,8 @@ public class NetDbHelper extends HelperBase {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(32*1024);
|
||||
if (_routerPrefix != null)
|
||||
_context.netDb().renderRouterInfoHTML(new OutputStreamWriter(baos), _routerPrefix);
|
||||
else if (_lease)
|
||||
_context.netDb().renderLeaseSetHTML(new OutputStreamWriter(baos));
|
||||
else
|
||||
_context.netDb().renderStatusHTML(new OutputStreamWriter(baos), _full);
|
||||
return new String(baos.toByteArray());
|
||||
|
@ -91,8 +91,9 @@ public class ReseedHandler {
|
||||
public boolean isRunning() { return _isRunning; }
|
||||
public void run() {
|
||||
_isRunning = true;
|
||||
System.out.println("Reseed start");
|
||||
reseed(false);
|
||||
System.out.println("Reseeding complete");
|
||||
System.out.println("Reseed complete");
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false");
|
||||
_isRunning = false;
|
||||
}
|
||||
@ -133,7 +134,7 @@ public class ReseedHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a directory listing and then all the routerInfo files in the listing.
|
||||
* Fetch a directory listing and then up to 200 routerInfo files in the listing.
|
||||
* The listing must contain (exactly) strings that match:
|
||||
* href="routerInfo-{hash}.dat">
|
||||
* and then it fetches the files
|
||||
@ -147,6 +148,7 @@ public class ReseedHandler {
|
||||
try {
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage","");
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.statusMessage","Reseeding: fetching seed URL.");
|
||||
System.err.println("Reseed from " + seedURL);
|
||||
URL dir = new URL(seedURL);
|
||||
byte contentRaw[] = readURL(dir);
|
||||
if (contentRaw == null) {
|
||||
@ -160,7 +162,8 @@ public class ReseedHandler {
|
||||
String content = new String(contentRaw);
|
||||
Set urls = new HashSet();
|
||||
int cur = 0;
|
||||
while (true) {
|
||||
int total = 0;
|
||||
while (total++ < 1000) {
|
||||
int start = content.indexOf("href=\"routerInfo-", cur);
|
||||
if (start < 0)
|
||||
break;
|
||||
@ -170,7 +173,7 @@ public class ReseedHandler {
|
||||
urls.add(name);
|
||||
cur = end + 1;
|
||||
}
|
||||
if (urls.size() <= 0) {
|
||||
if (total <= 0) {
|
||||
_log.error("Read " + contentRaw.length + " bytes from seed " + seedURL + ", but found no routerInfo URLs.");
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
|
||||
"Last reseed failed fully (no routerInfo URLs at seed URL). " +
|
||||
@ -178,13 +181,16 @@ public class ReseedHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
List urlList = new ArrayList(urls);
|
||||
Collections.shuffle(urlList);
|
||||
int fetched = 0;
|
||||
int errors = 0;
|
||||
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
|
||||
// 200 max from one URL
|
||||
for (Iterator iter = urlList.iterator(); iter.hasNext() && fetched < 200; ) {
|
||||
try {
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.statusMessage",
|
||||
"Reseeding: fetching router info from seed URL (" +
|
||||
fetched + " successful, " + errors + " errors, " + urls.size() + " total).");
|
||||
fetched + " successful, " + errors + " errors, " + total + " total).");
|
||||
|
||||
fetchSeed(seedURL, (String)iter.next());
|
||||
fetched++;
|
||||
@ -197,24 +203,24 @@ public class ReseedHandler {
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
if (echoStatus) System.out.println();
|
||||
System.err.println("Reseed got " + fetched + " router infos from " + seedURL);
|
||||
|
||||
int failPercent = 100 * errors / urls.size();
|
||||
int failPercent = 100 * errors / total;
|
||||
|
||||
// Less than 10% of failures is considered success,
|
||||
// because some routerInfos will always fail.
|
||||
if ((failPercent >= 10) && (failPercent < 90)) {
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
|
||||
"Last reseed failed partly (" + failPercent + "% of " + urls.size() + "). " +
|
||||
"Last reseed failed partly (" + failPercent + "% of " + total + "). " +
|
||||
RESEED_TIPS);
|
||||
}
|
||||
if (failPercent >= 90) {
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
|
||||
"Last reseed failed (" + failPercent + "% of " + urls.size() + "). " +
|
||||
"Last reseed failed (" + failPercent + "% of " + total + "). " +
|
||||
RESEED_TIPS);
|
||||
}
|
||||
// Don't go on to the next URL if we have enough
|
||||
if (fetched > 25)
|
||||
if (fetched >= 100)
|
||||
_isRunning = false;
|
||||
} catch (Throwable t) {
|
||||
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
|
||||
|
@ -48,7 +48,7 @@ public class SummaryHelper extends HelperBase {
|
||||
*
|
||||
*/
|
||||
public String getVersion() {
|
||||
return RouterVersion.VERSION + "-" + RouterVersion.BUILD;
|
||||
return RouterVersion.FULL_VERSION;
|
||||
}
|
||||
/**
|
||||
* Retrieve a pretty printed uptime count (ala 4d or 7h or 39m)
|
||||
@ -78,24 +78,10 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
long ms = _context.clock().getOffset();
|
||||
|
||||
long diff = ms;
|
||||
if (diff < 0)
|
||||
diff = 0 - diff;
|
||||
if (diff == 0) {
|
||||
return now + " (no skew)";
|
||||
} else if (diff < 1000) {
|
||||
return now + " (" + ms + "ms skew)";
|
||||
} else if (diff < 5 * 1000) {
|
||||
return now + " (" + (ms / 1000) + "s skew)";
|
||||
} else if (diff < 60 * 1000) {
|
||||
return now + " <b>(" + (ms / 1000) + "s skew)</b>";
|
||||
} else if (diff < 60 * 60 * 1000) {
|
||||
return now + " <b>(" + (ms / (60 * 1000)) + "m skew)</b>";
|
||||
} else if (diff < 24 * 60 * 60 * 1000) {
|
||||
return now + " <b>(" + (ms / (60 * 60 * 1000)) + "h skew)</b>";
|
||||
} else {
|
||||
return now + " <b>(" + (ms / (24 * 60 * 60 * 1000)) + "d skew)</b>";
|
||||
}
|
||||
long diff = Math.abs(ms);
|
||||
if (diff < 100)
|
||||
return now;
|
||||
return now + " (" + DataHelper.formatDuration(diff) + " skew)";
|
||||
}
|
||||
|
||||
public boolean allowReseed() {
|
||||
@ -135,7 +121,7 @@ public class SummaryHelper extends HelperBase {
|
||||
return "ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart";
|
||||
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
|
||||
default:
|
||||
ra = _context.router().getRouterInfo().getTargetAddress("UDP");
|
||||
ra = _context.router().getRouterInfo().getTargetAddress("SSU");
|
||||
if (ra == null && _context.router().getUptime() > 5*60*1000) {
|
||||
if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null ||
|
||||
_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null)
|
||||
@ -364,7 +350,10 @@ public class SummaryHelper extends HelperBase {
|
||||
Destination client = (Destination)iter.next();
|
||||
String name = getName(client);
|
||||
|
||||
buf.append("<b>*</b> ").append(name).append("<br />\n");
|
||||
buf.append("<b>*</b> ");
|
||||
buf.append("<a href=\"tunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
|
||||
buf.append("\" target=\"_top\" title=\"Show tunnels\">");
|
||||
buf.append(name).append("</a><br />\n");
|
||||
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(client.calculateHash());
|
||||
if (ls != null) {
|
||||
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
|
||||
@ -375,10 +364,6 @@ public class SummaryHelper extends HelperBase {
|
||||
} else {
|
||||
buf.append("<i>No leases</i><br />\n");
|
||||
}
|
||||
buf.append("<a href=\"tunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
|
||||
buf.append("\" target=\"_top\">Details</a> ");
|
||||
buf.append("<a href=\"configtunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
|
||||
buf.append("\" target=\"_top\">Config</a><br />\n");
|
||||
}
|
||||
buf.append("<hr />\n");
|
||||
return buf.toString();
|
||||
|
@ -92,14 +92,27 @@ public class UpdateHandler {
|
||||
return _updateRunner.getStatus();
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return false;
|
||||
// this needs to be fixed and tested
|
||||
//if(this._updateRunner == null)
|
||||
// return true;
|
||||
//return this._updateRunner.isDone();
|
||||
}
|
||||
|
||||
public class UpdateRunner implements Runnable, EepGet.StatusListener {
|
||||
protected boolean _isRunning;
|
||||
protected boolean done;
|
||||
protected String _status;
|
||||
public UpdateRunner() {
|
||||
_isRunning = false;
|
||||
_isRunning = false;
|
||||
this.done = false;
|
||||
_status = "<b>Updating</b>";
|
||||
}
|
||||
public boolean isRunning() { return _isRunning; }
|
||||
public boolean isDone() {
|
||||
return this.done;
|
||||
}
|
||||
public String getStatus() { return _status; }
|
||||
public void run() {
|
||||
_isRunning = true;
|
||||
@ -159,13 +172,18 @@ public class UpdateHandler {
|
||||
f.delete();
|
||||
if (err == null) {
|
||||
String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY);
|
||||
this.done = true;
|
||||
if ("install".equals(policy)) {
|
||||
_log.log(Log.CRIT, "Update was VERIFIED, restarting to install it");
|
||||
_status = "<b>Update verified</b><br />Restarting";
|
||||
restart();
|
||||
} else {
|
||||
_log.log(Log.CRIT, "Update was VERIFIED, will be installed at next restart");
|
||||
_status = "<b>Update downloaded</b><br />Click Restart to Install";
|
||||
_status = "<b>Update downloaded</b><br />";
|
||||
if (System.getProperty("wrapper.version") != null)
|
||||
_status += "Click Restart to install";
|
||||
else
|
||||
_status += "Click Shutdown and restart to install";
|
||||
if (up.newVersion() != null)
|
||||
_status += " Version " + up.newVersion();
|
||||
}
|
||||
|
@ -18,8 +18,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigNetHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<form action="config.jsp" method="POST">
|
||||
<% String prev = System.getProperty("net.i2p.router.web.ConfigNetHandler.nonce");
|
||||
@ -28,21 +27,32 @@
|
||||
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigNetHandler.nonce")%>" />
|
||||
<input type="hidden" name="action" value="blah" />
|
||||
|
||||
<b>Bandwidth limiter</b><br />
|
||||
Inbound rate:
|
||||
<input name="inboundrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps
|
||||
<div class="configure" id="configure">
|
||||
<h3>Bandwidth limiter</h3>
|
||||
<p>
|
||||
<b>I2P will work best if you configure your rates to match the speed of your internet connection.</b>
|
||||
</p><p>
|
||||
<table>
|
||||
<tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps
|
||||
In <td>(<jsp:getProperty name="nethelper" property="inboundRateBits" />)<br />
|
||||
<!-- let's keep this simple...
|
||||
bursting up to
|
||||
<input name="inboundburstrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" /> KBps for
|
||||
<input name="inboundburstrate" type="text" size="5" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" /> KBps for
|
||||
<jsp:getProperty name="nethelper" property="inboundBurstFactorBox" /><br />
|
||||
Outbound rate:
|
||||
<input name="outboundrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps
|
||||
-->
|
||||
<tr><td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps
|
||||
Out <td>(<jsp:getProperty name="nethelper" property="outboundRateBits" />)<br />
|
||||
<!-- let's keep this simple...
|
||||
bursting up to
|
||||
<input name="outboundburstrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="outboundBurstRate" />" /> KBps for
|
||||
<jsp:getProperty name="nethelper" property="outboundBurstFactorBox" /><br />
|
||||
<i>KBps = kilobytes per second = 1024 bytes per second = 8192 bits per second.<br />
|
||||
A negative rate sets the default.</i><br />
|
||||
Bandwidth share percentage:
|
||||
<jsp:getProperty name="nethelper" property="sharePercentageBox" /><br />
|
||||
-->
|
||||
<tr><td><jsp:getProperty name="nethelper" property="sharePercentageBox" />
|
||||
Share <td>(<jsp:getProperty name="nethelper" property="shareRateBits" />)<br />
|
||||
</table>
|
||||
</p><p>
|
||||
<% int share = nethelper.getShareBandwidth();
|
||||
if (share < 12) {
|
||||
out.print("<b>NOTE</b>: You have configured I2P to share only " + share + "KBps. ");
|
||||
@ -54,8 +64,10 @@
|
||||
out.print("The higher the share bandwidth the more you improve your anonymity and help the network.<br />");
|
||||
}
|
||||
%>
|
||||
<p>
|
||||
</p><p>
|
||||
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
<!--
|
||||
<b>Enable load testing: </b>
|
||||
@ -67,49 +79,122 @@
|
||||
<a href="oldstats.jsp#test.rtt">test.rtt</a> and related stats.</p>
|
||||
<hr />
|
||||
-->
|
||||
<b>External UDP address:</b> <i><jsp:getProperty name="nethelper" property="udpAddress" /></i><br />
|
||||
<b>Require SSU introductions? </b>
|
||||
<input type="checkbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> /><br />
|
||||
<p>If you can, please poke a hole in your NAT or firewall to allow unsolicited UDP packets to reach
|
||||
you on your external UDP address. If you can't, I2P now includes supports UDP hole punching
|
||||
with "SSU introductions" - peers who will relay a request from someone you don't know to your
|
||||
router for your router so that you can make an outbound connection to them. I2P will use these
|
||||
introductions automatically if it detects that the port is not forwarded (as shown by
|
||||
the <i>Status: Firewalled</i> line), or you can manually require them here.
|
||||
Users behind symmetric NATs, such as OpenBSD's pf, are not currently supported.</p>
|
||||
<input type="submit" name="recheckReachability" value="Check network reachability..." />
|
||||
<hr />
|
||||
<b>Inbound TCP connection configuration:</b><br />
|
||||
Externally reachable hostname or IP address:
|
||||
<input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" />
|
||||
(dyndns and the like are fine)<br />
|
||||
OR use IP address detected by SSU
|
||||
(currently <jsp:getProperty name="nethelper" property="udpIP" />)?
|
||||
<input type="checkbox" name="ntcpAutoIP" value="true" <jsp:getProperty name="nethelper" property="tcpAutoIPChecked" /> /><br />
|
||||
<h3>IP and Transport Configuration</h3>
|
||||
<p>
|
||||
Externally reachable TCP port:
|
||||
<input name ="ntcpport" type="text" size="6" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
|
||||
OR use the same port configured for SSU
|
||||
(currently <jsp:getProperty name="nethelper" property="udpPort" />)?
|
||||
<input type="checkbox" name="ntcpAutoPort" value="true" <jsp:getProperty name="nethelper" property="tcpAutoPortChecked" /> /><br />
|
||||
<p>A hostname entered here will be published in the network database.
|
||||
It is <b>not private</b>.
|
||||
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.
|
||||
</p>
|
||||
<p>You do <i>not</i> need to allow inbound TCP connections - outbound connections work with no
|
||||
configuration. However, if you want to receive inbound TCP connections, you <b>must</b> poke a hole
|
||||
in your NAT or firewall for unsolicited TCP connections. If you specify the wrong IP address or
|
||||
hostname, or do not properly configure your NAT or firewall, your network performance will degrade
|
||||
substantially. When in doubt, leave the hostname and port number blank.</p>
|
||||
<p><b>Note: changing any of these settings will terminate all of your connections and effectively
|
||||
restart your router.</b>
|
||||
<b>The default settings will work for most people. There is <a href="#chelp">help below</a>.</b>
|
||||
</p><p>
|
||||
<b>UPnP Configuration:</b><br />
|
||||
<input type="checkbox" name="upnp" value="true" <jsp:getProperty name="nethelper" property="upnpChecked" /> />
|
||||
Enable UPnP to open firewall ports - <a href="peers.jsp#upnp">UPnP status</a>
|
||||
</p><p>
|
||||
<b>IP Configuration:</b><br />
|
||||
Externally reachable hostname or IP address:<br />
|
||||
<input type="radio" name="udpAutoIP" value="local,upnp,ssu" <%=nethelper.getUdpAutoIPChecked(3) %> />
|
||||
Use all auto-detect methods<br />
|
||||
<input type="radio" name="udpAutoIP" value="local,ssu" <%=nethelper.getUdpAutoIPChecked(4) %> />
|
||||
Disable UPnP IP address detection<br />
|
||||
<input type="radio" name="udpAutoIP" value="upnp,ssu" <%=nethelper.getUdpAutoIPChecked(5) %> />
|
||||
Ignore local interface IP address<br />
|
||||
<input type="radio" name="udpAutoIP" value="ssu" <%=nethelper.getUdpAutoIPChecked(0) %> />
|
||||
Use SSU IP address detection only<br />
|
||||
<input type="radio" name="udpAutoIP" value="fixed" <%=nethelper.getUdpAutoIPChecked(1) %> />
|
||||
Specify hostname or IP:
|
||||
<input name ="udpHost1" type="text" size="16" value="<jsp:getProperty name="nethelper" property="udphostname" />" />
|
||||
<% String[] ips = nethelper.getAddresses();
|
||||
if (ips.length > 0) {
|
||||
out.print(" or <select name=\"udpHost2\"><option value=\"\" selected=\"true\">Select Interface</option>\n");
|
||||
for (int i = 0; i < ips.length; i++) {
|
||||
out.print("<option value=\"");
|
||||
out.print(ips[i]);
|
||||
out.print("\">");
|
||||
out.print(ips[i]);
|
||||
out.print("</option>\n");
|
||||
}
|
||||
out.print("</select>\n");
|
||||
}
|
||||
%>
|
||||
<br />
|
||||
<input type="radio" name="udpAutoIP" value="hidden" <%=nethelper.getUdpAutoIPChecked(2) %> />
|
||||
Hidden mode - do not publish IP <i>(prevents participating traffic)</i><br />
|
||||
</p><p>
|
||||
<b>UDP Configuration:</b><br />
|
||||
UDP port:
|
||||
<input name ="udpPort" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="configuredUdpPort" />" /><br />
|
||||
<!-- let's keep this simple...
|
||||
<input type="checkbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> />
|
||||
Require SSU introductions
|
||||
<i>(Enable if you cannot open your firewall)</i>
|
||||
</p><p>
|
||||
Current External UDP address: <i><jsp:getProperty name="nethelper" property="udpAddress" /></i><br />
|
||||
-->
|
||||
</p><p>
|
||||
<b>TCP Configuration:</b><br />
|
||||
Externally reachable hostname or IP address:<br />
|
||||
<input type="radio" name="ntcpAutoIP" value="true" <%=nethelper.getTcpAutoIPChecked(2) %> />
|
||||
Use auto-detected IP address
|
||||
<i>(currently <jsp:getProperty name="nethelper" property="udpIP" />)</i>
|
||||
if we are not firewalled<br />
|
||||
<input type="radio" name="ntcpAutoIP" value="always" <%=nethelper.getTcpAutoIPChecked(3) %> />
|
||||
Always use auto-detected IP address (Not firewalled)<br />
|
||||
<input type="radio" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(1) %> />
|
||||
Specify hostname or IP:
|
||||
<input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" /><br />
|
||||
<input type="radio" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(0) %> />
|
||||
Disable inbound (Firewalled)<br />
|
||||
<input type="radio" name="ntcpAutoIP" value="disabled" <%=nethelper.getTcpAutoIPChecked(4) %> />
|
||||
Completely disable <i>(select only if behind a firewall that throttles or blocks outbound TCP)</i><br />
|
||||
</p><p>
|
||||
Externally reachable TCP port:<br />
|
||||
<input type="radio" name="ntcpAutoPort" value="2" <%=nethelper.getTcpAutoPortChecked(2) %> />
|
||||
Use the same port configured for UDP
|
||||
<i>(currently <jsp:getProperty name="nethelper" property="udpPort" />)</i><br />
|
||||
<input type="radio" name="ntcpAutoPort" value="1" <%=nethelper.getTcpAutoPortChecked(1) %> />
|
||||
Specify Port:
|
||||
<input name ="ntcpport" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
|
||||
</p><p><b>Note: Changing these settings will restart your router.</b>
|
||||
</p>
|
||||
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
|
||||
<hr />
|
||||
<b><a name="chelp">Configuration Help:</a></b>
|
||||
<p>
|
||||
While I2P will work fine behind most firewalls, your speeds and network integration will generally improve
|
||||
if the I2P port (generally 8887) is forwarded for both UDP and TCP.
|
||||
</p><p>
|
||||
If you can, please poke a hole in your firewall to allow unsolicited UDP and TCP packets to reach
|
||||
you. If you can't, I2P supports UPnP (Universal Plug and Play) and UDP hole punching
|
||||
with "SSU introductions" to relay traffic. Most of the options above are for special situations,
|
||||
for example where UPnP does not work correctly, or a firewall not under your control is doing
|
||||
harm. Certain firewalls such as symmetric NATs may not work well with I2P.
|
||||
</p>
|
||||
<!-- let's keep this simple...
|
||||
<input type="submit" name="recheckReachability" value="Check network reachability..." />
|
||||
-->
|
||||
</p><p>
|
||||
UPnP is used to communicate with Internet Gateway Devices (IGDs) to detect the external IP address
|
||||
and forward ports.
|
||||
UPnP support is beta, and may not work for any number of reasons:
|
||||
<ul>
|
||||
<li>No UPnP-compatible device present
|
||||
<li>UPnP disabled on the device
|
||||
<li>Software firewall interference with UPnP
|
||||
<li>Bugs in the device's UPnP implementation
|
||||
<li>Multiple firewall/routers in the internet connection path
|
||||
<li>UPnP device change, reset, or address change
|
||||
</ul>
|
||||
Reviewing the <a href="peers.jsp#upnp">UPnP status</a> may help.
|
||||
UPnP may be enabled or disabled above, but a change requires a router restart to take effect.
|
||||
</p><p>Hostnames entered above will be published in the network database.
|
||||
They are <b>not private</b>.
|
||||
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.
|
||||
If you specify the wrong IP address or
|
||||
hostname, or do not properly configure your NAT or firewall, your network performance will degrade
|
||||
substantially. When in doubt, leave the settings at the defaults.</p>
|
||||
</p>
|
||||
<hr />
|
||||
<b><a name="help">Reachability Help:</a></b>
|
||||
<p>
|
||||
While I2P will work adequately behind a firewall, your speeds and network integration will generally improve
|
||||
if you open up your port (generally 8887) to both UDP and TCP, and enable inbound TCP above.
|
||||
While I2P will work fine behind most firewalls, your speeds and network integration will generally improve
|
||||
if the I2P port (generally 8887) to both UDP and TCP.
|
||||
If you think you have opened up your firewall and I2P still thinks you are firewalled, remember
|
||||
that you may have multiple firewalls, for example both software packages and external hardware routers.
|
||||
If there is an error, the <a href="logs.jsp">logs</a> may also help diagnose the problem.
|
||||
@ -118,7 +203,13 @@
|
||||
<li><b>Firewalled</b> - Your UDP port appears to be firewalled.
|
||||
As the firewall detection methods are not 100% reliable, this may occasionally be displayed in error.
|
||||
However, if it appears consistently, you should check whether both your external and internal
|
||||
firewalls are open on port 8887.
|
||||
firewalls are open on port 8887. I2P will work fine when firewalled, there is no reason for concern.
|
||||
When firewalled, the router uses "introducers" to relay inbound connections.
|
||||
However, you will get more participating traffic and help the network more if you can open your
|
||||
firewall(s). If you think you have already done so, remember that you may have both a hardware
|
||||
and a software firewall, or be behind an additional, institutional firewall you cannot control.
|
||||
Also, some routers cannot correctly forward both TCP and UDP on a single port, or may have other
|
||||
limitations or bugs that prevent them from passing traffic through to I2P.
|
||||
<li><b>Testing</b> - The router is currently testing whether your UDP port is firewalled.
|
||||
<li><b>Hidden</b> - The router is not configured to publish its address,
|
||||
therefore it does not expect incoming connections.
|
||||
@ -142,7 +233,8 @@
|
||||
<li><b>ERR - Private TCP Address</b> - You must never advertise an unroutable IP address such as
|
||||
127.0.0.1 or 192.168.1.1 as your external address. Correct the address or disable inbound TCP above.
|
||||
<li><b>ERR - SymmetricNAT</b> - I2P detected that you are firewalled by a Symmetric NAT.
|
||||
I2P does not work behind this type of firewall.
|
||||
I2P does not work well behind this type of firewall. You will probably not be able to
|
||||
accept inbound connections, which will limit your participation in the network.
|
||||
<li><b>ERR - UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart</b> -
|
||||
I2P was unable to bind to port 8887 or other configured port.
|
||||
Check to see if another program is using port 8887. If so, stop that program or configure
|
||||
|
@ -19,8 +19,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigAdvancedHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<form action="configadvanced.jsp" method="POST">
|
||||
<% String prev = System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce");
|
||||
@ -29,14 +28,12 @@
|
||||
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce")%>" />
|
||||
<input type="hidden" name="action" value="blah" />
|
||||
<textarea rows="20" cols="100" name="config" wrap="off"><jsp:getProperty name="advancedhelper" property="settings" /></textarea><br />
|
||||
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" /><!-- <br />
|
||||
<b>Force restart:</b> <input type="checkbox" name="restart" value="force" /> <i>(specify this
|
||||
if the changes made above require the router to reset itself - e.g. you are updating TCP ports
|
||||
or hostnames, etc)</i>-->
|
||||
If you are changing any of the I2NP settings, you should go to the
|
||||
<a href="configservice.jsp">service config</a> page and do a graceful restart after saving.
|
||||
<p>
|
||||
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" />
|
||||
</p><p>
|
||||
NOTE: Some changes may require a restart to take effect.
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -26,8 +26,7 @@ button span.hide{
|
||||
<jsp:setProperty name="formhandler" property="action" value="<%=request.getParameter("action")%>" />
|
||||
<jsp:setProperty name="formhandler" property="nonce" value="<%=request.getParameter("nonce")%>" />
|
||||
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<form action="configclients.jsp" method="POST">
|
||||
<% String prev = System.getProperty("net.i2p.router.web.ConfigClientsHandler.nonce");
|
||||
|
@ -16,8 +16,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigKeyringHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
|
||||
|
||||
|
@ -18,8 +18,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigLoggingHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<form action="configlogging.jsp" method="POST">
|
||||
<% String prev = System.getProperty("net.i2p.router.web.ConfigLoggingHandler.nonce");
|
||||
@ -27,25 +26,27 @@
|
||||
System.setProperty("net.i2p.router.web.ConfigLoggingHandler.nonce", new java.util.Random().nextLong()+""); %>
|
||||
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigLoggingHandler.nonce")%>" />
|
||||
<input type="hidden" name="action" value="blah" />
|
||||
<b>Logging filename:</b>
|
||||
<input type="text" name="logfilename" size="40" value="<jsp:getProperty name="logginghelper" property="logFilePattern" />" /><br />
|
||||
<i>(the symbol '@' will be replaced during log rotation)</i><br />
|
||||
<b>Log record format:</b>
|
||||
<input type="text" name="logformat" size="20" value="<jsp:getProperty name="logginghelper" property="recordPattern" />" /><br />
|
||||
<i>(use 'd' = date, 'c' = class, 't' = thread, 'p' = priority, 'm' = message)</i><br />
|
||||
<b>Log date format:</b>
|
||||
<input type="text" name="logdateformat" size="20" value="<jsp:getProperty name="logginghelper" property="datePattern" />" /><br />
|
||||
<i>('MM' = month, 'dd' = day, 'HH' = hour, 'mm' = minute, 'ss' = second, 'SSS' = millisecond)</i><br />
|
||||
<b>Max log file size:</b>
|
||||
<input type="text" name="logfilesize" size="4" value="<jsp:getProperty name="logginghelper" property="maxFileSize" />" /><br />
|
||||
<hr />
|
||||
<b>Log levels:</b> <br />
|
||||
<b>Default log level:</b>
|
||||
<jsp:getProperty name="logginghelper" property="defaultLogLevelBox" /><br />
|
||||
<jsp:getProperty name="logginghelper" property="logLevelTable" />
|
||||
<hr />
|
||||
<table border="0" cellspacing="5">
|
||||
<tr><td valign="top"><b>Logging filename:</b>
|
||||
<td><input type="text" name="logfilename" size="40" value="<jsp:getProperty name="logginghelper" property="logFilePattern" />" /><br />
|
||||
<i>(the symbol '@' will be replaced during log rotation)</i>
|
||||
<tr><td valign="top"><b>Log record format:</b>
|
||||
<td><input type="text" name="logformat" size="20" value="<jsp:getProperty name="logginghelper" property="recordPattern" />" /><br />
|
||||
<i>(use 'd' = date, 'c' = class, 't' = thread, 'p' = priority, 'm' = message)</i>
|
||||
<tr><td valign="top"><b>Log date format:</b>
|
||||
<td><input type="text" name="logdateformat" size="20" value="<jsp:getProperty name="logginghelper" property="datePattern" />" /><br />
|
||||
<i>('MM' = month, 'dd' = day, 'HH' = hour, 'mm' = minute, 'ss' = second, 'SSS' = millisecond)</i>
|
||||
<tr><td valign="top"><b>Max log file size:</b>
|
||||
<td><input type="text" name="logfilesize" size="4" value="<jsp:getProperty name="logginghelper" property="maxFileSize" />" /><br />
|
||||
<tr><td valign="top"><b>Default log level:</b>
|
||||
<td><jsp:getProperty name="logginghelper" property="defaultLogLevelBox" />
|
||||
<br /><i>(DEBUG and INFO are not recommended defaults, as they will drastically slow down your router)</i>
|
||||
<tr><td valign="top"><b>Log level overrides:</b>
|
||||
<td><jsp:getProperty name="logginghelper" property="logLevelTable" />
|
||||
<tr><td><td>
|
||||
<input type="submit" name="shouldsave" value="Save changes" />
|
||||
<input type="reset" value="Cancel" />
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
@ -1,3 +1,27 @@
|
||||
<div class="confignav" id="confignav">
|
||||
<center>
|
||||
<b>
|
||||
<% if (request.getRequestURI().indexOf("config.jsp") != -1) {
|
||||
%>Network<% }
|
||||
else if (request.getRequestURI().indexOf("configservice.jsp") != -1) {
|
||||
%>Service<% }
|
||||
else if (request.getRequestURI().indexOf("configupdate.jsp") != -1) {
|
||||
%>Update<% }
|
||||
else if (request.getRequestURI().indexOf("configtunnels.jsp") != -1) {
|
||||
%>Tunnels<% }
|
||||
else if (request.getRequestURI().indexOf("configclients.jsp") != -1) {
|
||||
%>Clients<% }
|
||||
else if (request.getRequestURI().indexOf("configpeer.jsp") != -1) {
|
||||
%>Peers<% }
|
||||
else if (request.getRequestURI().indexOf("configkeyring.jsp") != -1) {
|
||||
%>Keyring<% }
|
||||
else if (request.getRequestURI().indexOf("configlogging.jsp") != -1) {
|
||||
%>Logging<% }
|
||||
else if (request.getRequestURI().indexOf("configstats.jsp") != -1) {
|
||||
%>Stats<% }
|
||||
else if (request.getRequestURI().indexOf("configadvanced.jsp") != -1) {
|
||||
%>Advanced<% }%>
|
||||
Configuration</b>
|
||||
<h4><% if (request.getRequestURI().indexOf("config.jsp") != -1) {
|
||||
%>Network | <% } else { %><a href="config.jsp">Network</a> | <% }
|
||||
if (request.getRequestURI().indexOf("configservice.jsp") != -1) {
|
||||
@ -18,3 +42,6 @@
|
||||
%>Stats | <% } else { %><a href="configstats.jsp">Stats</a> | <% }
|
||||
if (request.getRequestURI().indexOf("configadvanced.jsp") != -1) {
|
||||
%>Advanced<% } else { %><a href="configadvanced.jsp">Advanced</a><% } %></h4>
|
||||
</center>
|
||||
<hr />
|
||||
</div>
|
||||
|
@ -16,8 +16,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigPeerHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigServiceHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<form action="configservice.jsp" method="POST">
|
||||
<% String prev = System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce");
|
||||
@ -33,6 +32,7 @@
|
||||
<input type="submit" name="action" value="Shutdown immediately" />
|
||||
<input type="submit" name="action" value="Cancel graceful shutdown" />
|
||||
|
||||
<% if (System.getProperty("wrapper.version") != null) { %>
|
||||
<p>If you want the router to restart itself after shutting down, you can choose one of
|
||||
the following. This is useful in some situations - for example, if you changed
|
||||
some settings that client applications only read at startup, such as the routerconsole password
|
||||
@ -42,6 +42,7 @@
|
||||
|
||||
<input type="submit" name="action" value="Graceful restart" />
|
||||
<input type="submit" name="action" value="Hard restart" />
|
||||
<% } %>
|
||||
|
||||
<% if ( (System.getProperty("os.name") != null) && (System.getProperty("os.name").startsWith("Win")) ) { %>
|
||||
<h4>Systray integration</h4>
|
||||
@ -62,11 +63,14 @@
|
||||
down your router immediately. You may want to consider shutting down gracefully, as
|
||||
above, then running uninstall_i2p_service_winnt.bat.</p>
|
||||
<% } %>
|
||||
|
||||
<% if (System.getProperty("wrapper.version") != null) { %>
|
||||
<h4>Debugging</h4>
|
||||
<p>At times, it may be helpful to debug I2P by getting a thread dump. To do so,
|
||||
please select the following option and review the thread dumped to
|
||||
<a href="logs.jsp#servicelogs">wrapper.log</a>.</p>
|
||||
<input type="submit" name="action" value="Dump threads" />
|
||||
<% } %>
|
||||
|
||||
<h4>Launch browser on router startup?</h4>
|
||||
<p>I2P's main configuration interface is this web console, so for your convenience
|
||||
|
@ -61,8 +61,7 @@ function toggleAll(category)
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigStatsHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigStatsHelper" id="statshelper" scope="request" />
|
||||
<jsp:setProperty name="statshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
|
@ -22,8 +22,7 @@
|
||||
<jsp:setProperty name="formhandler" property="action" value="<%=request.getParameter("action")%>" />
|
||||
<jsp:setProperty name="formhandler" property="nonce" value="<%=request.getParameter("nonce")%>" />
|
||||
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<p><i>
|
||||
NOTE: The default settings work for most people.
|
||||
|
@ -16,8 +16,7 @@
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
|
||||
<i><jsp:getProperty name="formhandler" property="notices" /></i>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHelper" id="updatehelper" scope="request" />
|
||||
<jsp:setProperty name="updatehelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
|
@ -5,6 +5,7 @@ body {
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
color: black;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.hide {
|
||||
@ -15,6 +16,11 @@ img {
|
||||
border: none;
|
||||
}
|
||||
|
||||
pre {
|
||||
width: 100%;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
div.logo {
|
||||
float: left;
|
||||
width: 200px;
|
||||
@ -30,25 +36,27 @@ div.toolbar {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.routersummary {
|
||||
/* width: 8em; */
|
||||
/* height: 5em; */
|
||||
/* position: fixed; */
|
||||
div.routersummaryouter {
|
||||
float: left;
|
||||
width: 200px;
|
||||
/* left: 1em; */
|
||||
/* top: 1em; */
|
||||
margin: 0em;
|
||||
padding: .5em;
|
||||
text-align: left;
|
||||
border: medium solid #efefff;
|
||||
background-color: #fafaff;
|
||||
color: inherit;
|
||||
font-size: small;
|
||||
width: 215px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
clear: left; /* fixes a bug in Opera */
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.routersummary {
|
||||
background-color: #fafaff;
|
||||
width: 195px;
|
||||
color: inherit;
|
||||
margin: 0em;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
border: medium solid #efefff;
|
||||
font-size: 0.82em;
|
||||
}
|
||||
|
||||
div.warning {
|
||||
margin: 0em 1em 1em 224px;
|
||||
padding: .5em 1em;
|
||||
@ -67,6 +75,10 @@ div.main {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
div.main textarea {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
div.news {
|
||||
margin: 0em 1em 1em 224px;
|
||||
padding: .5em 1em;
|
||||
@ -75,3 +87,26 @@ div.news {
|
||||
text-align: left;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
div.confignav {
|
||||
padding: 1em;
|
||||
background-color: #efefff;
|
||||
}
|
||||
|
||||
div.configure {
|
||||
padding: 1em;
|
||||
background-color: #ffffc0;
|
||||
}
|
||||
|
||||
div.messages {
|
||||
padding: 1em;
|
||||
background-color: #fafaff;
|
||||
}
|
||||
|
||||
div.messages span.error {
|
||||
color: #d00000;
|
||||
}
|
||||
|
||||
div.messages span.notice {
|
||||
font-style: italic;
|
||||
}
|
||||
|
27
apps/routerconsole/jsp/flags.jsp
Normal file
27
apps/routerconsole/jsp/flags.jsp
Normal file
@ -0,0 +1,27 @@
|
||||
<%
|
||||
/*
|
||||
* USE CAUTION WHEN EDITING
|
||||
* Trailing whitespace OR NEWLINE on the last line will cause
|
||||
* IllegalStateExceptions !!!
|
||||
*/
|
||||
|
||||
/**
|
||||
* flags.jsp?c=de => icons/flags/de.png
|
||||
* with headers set so the browser caches.
|
||||
*/
|
||||
boolean rendered = false;
|
||||
String c = request.getParameter("c");
|
||||
if (c != null && c.length() > 0) {
|
||||
java.io.OutputStream cout = response.getOutputStream();
|
||||
response.setContentType("image/png");
|
||||
response.setHeader("Cache-Control", "max-age=86400"); // cache for a day
|
||||
try {
|
||||
net.i2p.util.FileUtil.readFile(c + ".png", "docs/icons/flags", cout);
|
||||
rendered = true;
|
||||
} catch (java.io.IOException ioe) {}
|
||||
if (rendered)
|
||||
cout.close();;
|
||||
}
|
||||
if (!rendered)
|
||||
response.sendError(404, "Not found");
|
||||
%>
|
@ -11,22 +11,26 @@
|
||||
<%@include file="summary.jsp" %>
|
||||
|
||||
<div class="main" id="main">
|
||||
<h4>Version:</h4><a name="version"> </a>
|
||||
Please include this information in bug reports.
|
||||
<p>
|
||||
I2P <jsp:getProperty name="helper" property="version" /><br />
|
||||
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br />
|
||||
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%><br />
|
||||
CPU <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)<br />
|
||||
jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%><br />
|
||||
</p>
|
||||
<hr />
|
||||
<jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />
|
||||
<jsp:setProperty name="logsHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<h4>Router logs:</h4>
|
||||
<jsp:getProperty name="logsHelper" property="logs" />
|
||||
<hr />
|
||||
<h4>Critical logs:</h4><a name="criticallogs"> </a>
|
||||
<jsp:getProperty name="logsHelper" property="criticalLogs" />
|
||||
<hr />
|
||||
<h4>Router logs (<a href="configlogging.jsp">configure</a>):</h4>
|
||||
<jsp:getProperty name="logsHelper" property="logs" />
|
||||
<hr />
|
||||
<h4>Service (Wrapper) logs:</h4><a name="servicelogs"> </a>
|
||||
<jsp:getProperty name="logsHelper" property="serviceLogs" />
|
||||
<hr />
|
||||
<h4>Java Version:</h4><a name="version"> </a>
|
||||
<pre>
|
||||
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%>
|
||||
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user