Compare commits

...

118 Commits

Author SHA1 Message Date
complication
87eafa30d0 * Update versions, package release 2009-05-16 19:48:12 +00:00
zzz
9bed2bde3c disable button disabling 2009-05-15 20:00:56 +00:00
zzz
9e003a9f93 bye nibble 2009-05-14 20:10:26 +00:00
mkvore-commit
a267fcc9cc merge of '476489c04057318947e2947393aa6a10aa382af8'
and 'd38ab82268c3643119e5c226a3f97c23fb794e93'
2009-05-12 22:32:49 +00:00
sponge
66a292a9c6 2009-05-12 sponge
* BOB clean up, change println's to _log.warn, bump BOB version
    * I2PSessionMuxedImpl.java changes as per zzz, and they test OK for me.
2009-05-12 21:10:42 +00:00
mkvore-commit
7cd0112211 SAM: fix: warnings when generating javadoc 2009-05-12 13:33:09 +00:00
mkvore-commit
9195e754cf propagate from branch 'i2p.i2p' (head 790894dc16c840512c99302fbb75136042cbeb65)
to branch 'i2p.i2p.sam3' (head 66136bbdb44136e3756944cb7d8147d2ab07ff23)
2009-05-12 13:27:17 +00:00
mkvore-commit
965b183d9e fix: warnings when generating javadoc 2009-05-12 10:46:34 +00:00
zzz
7372a18cec Give the clients friendlier names 2009-05-11 18:19:56 +00:00
zzz
c5ba5f3a5b -13 2009-05-11 16:46:38 +00:00
zzz
90251b8545 propagate from branch 'i2p.i2p.zzz.test' (head eaf123d687259d0dee558845508cfeec05f55915)
to branch 'i2p.i2p' (head 16158c16ac8422809a9bf3919831e5700ed74a51)
2009-05-11 16:43:02 +00:00
zzz
a8c97053c7 * logs.jsp: Put critical log at the top 2009-05-11 16:41:37 +00:00
zzz
117d3a5614 * NetDb: Don't accept stores of our own LeaseSets or RouterInfo 2009-05-11 16:35:30 +00:00
zzz
70a2e48a72 Dont instantiate unused AdminManager 2009-05-11 16:34:05 +00:00
mkvore-commit
a6f106ed6d update history.txt 2009-05-11 09:05:10 +00:00
mkvore-commit
47dd1b6168 * SAMv3 : correct a null pointer exception check before it gets caught and logged as an error 2009-05-10 20:31:14 +00:00
mkvore-commit
bc7a963f5c correct a null pointer exception check before it gets caught and logged as an error 2009-05-10 20:23:08 +00:00
zzz
3d7b9560cb Connect client: fix NPE when used with advanced i2ptunnel features 2009-05-09 21:44:48 +00:00
sponge
9bd3bea90a * merged branches 2009-05-09 18:26:03 +00:00
sponge
9541abc0a4 merge of '4ad028f436647b957e6531243fb3348156d5eb51'
and 'ef760639d59a6ab522ec50a95cc848e09bf11bd8'
2009-05-09 18:24:17 +00:00
sponge
0be28c1701 2009-05-09 sponge
* fixed OOM on lock (woops! my bad!)
2009-05-09 18:19:03 +00:00
mkvore-commit
8bb28ea825 propagate from branch 'i2p.i2p.sam3' (head fa9e8f7d5cacabb84eaae8cc6b569b334f2e0238)
to branch 'i2p.i2p' (head 9cdab8e186f77c375fd81913d3b3c20e5ca69ca2)
2009-05-08 14:37:48 +00:00
mkvore-commit
85382863d2 merge of '38d57079bc08f5efdaccfb785e39789a7e6f1969'
and 'a0a87038370fb791c619419d56a3133ee7ccec5f'
2009-05-08 14:33:23 +00:00
mkvore-commit
ef737415c5 SAMv3: bug corrected: sending datagrams through the datagram session socket works (like in v1 and v2) 2009-05-08 14:33:03 +00:00
mathiasdm
72e4dabd30 * desktopgui: moved files to stop polluting the namespace
(everything now in net.i2p.desktopgui)
    * desktopgui: some variable renaming in general configuration
2009-05-08 10:23:24 +00:00
mkvore-commit
6bcd547ca0 * SAM: version 3 added
* SAM: blocking case corrected on simultaneous client connection (v.1-3)
2009-05-07 19:31:27 +00:00
mkvore-commit
283f7a3f37 merge of '4238d44d0006a302c8a1fedf06a3789061b71672'
and '44b9f7b1bcd59acc89551681bfab2709ab5e9972'
2009-05-07 19:19:04 +00:00
zzz
d9a2e024ee add nibble 2009-05-07 17:27:50 +00:00
zzz
fe4e76a7f8 -9 2009-05-07 13:08:49 +00:00
zzz
9c4a7c02fd propagate from branch 'i2p.i2p.zzz.test' (head 29f20f786fbf565798b094a46ac9036dc39fb606)
to branch 'i2p.i2p' (head 622324a8f0f863b7b4eaaa26385228a65c71edf0)
2009-05-07 13:07:07 +00:00
mathiasdm
a516d6474e * Improvements to popup menu rightclick action
* Added general configuration options (still not available by default)
    * General fixes
    * Added ant build options (irc says eche|on would like that ;))
2009-05-06 16:17:58 +00:00
sponge
eba6ca5430 2009-05-06 sponge
* Hopefully the last fixes for BOB.
    * Fixes to prevent race in client-side I2CP and Notifier.
2009-05-06 05:34:33 +00:00
zzz
95a38779de * Console: Disable idle options for streamr client, it will never be
idle because it pings the server
2009-05-05 22:24:19 +00:00
zzz
e7913061e9 * Console: More IE button fixes, try harder to not 404 the iframe 2009-05-05 21:04:46 +00:00
zzz
7d91bdba1e * Throttle: Throttle at 90% so we throttle before we WRED 2009-05-05 21:03:36 +00:00
zzz
29fe221fe6 name the addressbook thread 2009-05-05 21:02:03 +00:00
mkvore-commit
30b73ffe6d changed samv3 because of reverted streaming and mstreaming libs 2009-05-05 12:39:14 +00:00
mkvore-commit
fceec5c129 reverted changes to mstreaming and streaming 2009-05-05 09:46:17 +00:00
mkvore-commit
e42f7ab8fc apps/sam/java/build.xml reflects dependancy upon streaming.jar 2009-05-05 09:28:10 +00:00
mkvore-commit
54b80d6724 merge of '40606168f4086dbe122e96b533df4f24b5e4d87d'
and '44a775450f24ec5d2e921ab01b94546968f81851'
2009-05-05 09:24:26 +00:00
sponge
7e3bda9d4d 2009-05-03 sponge
* More hopeful fixes for BOB.
    * Added new Robert ID to snark
2009-05-03 16:02:07 +00:00
zzz
40637e0f28 slow down the ff volunteers 2009-05-02 03:38:01 +00:00
zzz
6dc5d0f8d7 add postman2 2009-05-01 13:20:19 +00:00
zzz
7688df6fe5 -6 2009-05-01 13:03:59 +00:00
zzz
32b6c77156 propagate from branch 'i2p.i2p.zzz.test' (head eb755dae363d71808cb93ae1c6c976c1ec5df5d2)
to branch 'i2p.i2p' (head 25097fabfedcbe372d42dcddaf89b5279e9285e4)
2009-05-01 12:56:10 +00:00
zzz
a8a0e2a91c * I2PTunnel:
- Try to fix locking to prevent duplicate destinations when using
    the new option new-dest-on-resume. Still not right for shared clients
    but should be better for non-shared.
2009-05-01 12:43:19 +00:00
zzz
4c396e5b95 Console: fix ERR-UDP Disabled and Inbound TCP host/port not set 2009-05-01 12:31:38 +00:00
zzz
d3181e53cc prevent race NPE 2009-05-01 12:14:31 +00:00
zzz
4139b36eac fix race NPE 2009-05-01 11:58:14 +00:00
zzz
becc6dc0fc extend browser launch delay from 5s to 15s 2009-05-01 00:54:09 +00:00
zzz
5a6b65d20c * URL Launcher:
- Launcher on linux was stopping after trying opera, whether it succeeded or failed.
    Now it keeps going to try firefox, etc. as designed.
2009-04-30 18:06:51 +00:00
zzz
c3bafcab05 put jbigi info on logs.jsp 2009-04-30 14:56:25 +00:00
zzz
9ae4fce0db new consoleDocs target 2009-04-30 14:53:46 +00:00
zzz
a0c4e79c8a allow an extra part appended to the router version 2009-04-28 14:13:05 +00:00
zzz
34249e3dca merge of 'a41cc279bb8c70c8beb8b372e306affba56317a1'
and 'f59c86f21a1941949b9797e766708900eed053a6'
2009-04-28 13:45:03 +00:00
zzz
f5bd10207b log before a hang maybe (SWAG) 2009-04-28 13:43:48 +00:00
zzz
9cc1511863 fix up susidns build file so it will work with gcj 2009-04-27 17:37:29 +00:00
sponge
c1d7562331 2009-04-27 sponge
* more BOB fixes, complete with warnings when things go wrong, and
      success messages when things turn around and go right. Terminates
      early so that applications wait no more than 10 seconds or so.
    * Reversed a few earlier patches that caused some odd behavior.
    * Changed some core println()'s to debugging messages.
2009-04-27 17:09:47 +00:00
zzz
542e0f2ed3 -4 2009-04-27 15:02:05 +00:00
zzz
ab33b52f23 propagate from branch 'i2p.i2p.zzz.test' (head 28f0df7ddfdda1df49f30016359dcb77836b06df)
to branch 'i2p.i2p' (head 40618503ea9748aedee73aaf002482424adc1f72)
2009-04-27 14:59:15 +00:00
zzz
a223c7ac75 reduce bundled tags from 100 to 40 2009-04-27 14:58:43 +00:00
zzz
c32c9a2391 noob warning 2009-04-27 14:50:10 +00:00
zzz
798e1422c6 postman2 supports details link 2009-04-27 14:08:16 +00:00
zzz
e05b46002b add postman2 tracker 2009-04-27 13:49:45 +00:00
zzz
fa6aa44a86 quiet the ghost of jrandom 2009-04-27 13:33:22 +00:00
zzz
4f0013e8da Consolidate the details and config links to shrink the summary bar a little 2009-04-26 21:52:00 +00:00
zzz
b2e5e14bc6 extend the min expiration a little 2009-04-26 21:14:53 +00:00
zzz
e15b469833 * NTCP:
- Correct the meanings of the i2np.ntcp.autoip and i2np.ntcp.autoport
    advanced config. If you have one of these set but not the other, you
    will have to adjust your configuration on config.jsp.
2009-04-26 20:16:35 +00:00
zzz
c9b6d72c5a * Tunnel Pool:
- Clean up some tunnel removal code
  - Don't try to build a LeaseSet with more than 6 leases,
    no matter what the setting
2009-04-26 18:32:57 +00:00
zzz
a279f8d530 add some jetty help 2009-04-26 18:02:07 +00:00
zzz
89f0f09b86 new updaterWithJettyFixes target, build it for pkg 2009-04-26 16:27:44 +00:00
zzz
157b85b11b pass compiler args down from top build.xml 2009-04-26 15:54:51 +00:00
mkvore-commit
7b15cc8113 propagate from branch 'i2p.i2p' (head 982dc8adf7d5c10608e572f285c2eb196d25a64e)
to branch 'i2p.i2p.sam3' (head a455f4d173b9c8c18698ed182407e152848dc8de)
2009-04-26 10:38:28 +00:00
mkvore-commit
8d4c332987 merge of '40618503ea9748aedee73aaf002482424adc1f72'
and '81ec1b16687e7276a752db7f600a525a6e289458'
2009-04-26 10:36:41 +00:00
mkvore-commit
4ffa2450c2 * SAMv3 : doc/sam.3.0-protocol.txt updated
* SAMv3 : SAMv3StreamSession.java: thread naming for debugging purpose
2009-04-26 10:14:23 +00:00
zzz
d670d98e60 stats cleanup 2009-04-26 04:15:48 +00:00
zzz
33b2762003 more reachability help 2009-04-25 02:47:28 +00:00
zzz
507b6d45d5 longer iframe 2009-04-25 02:46:45 +00:00
sponge
f331dad72d 2009-04-25 sponge
* I2PSessionMuxedImpl atomic fixes
    * BOB fixes. This should be the final bug wack. Good Luck to everybody!
2009-04-25 00:02:38 +00:00
zzz
5b41827a7b allow spaces in dest and proxy lists 2009-04-24 16:38:44 +00:00
zzz
178b5996a5 * NetDb:
- Adjust RouterInfo expiration down to control memory usage
  - Display LeaseSets and RouterInfos on separate console pages
2009-04-23 22:34:25 +00:00
zzz
8054078b9e -2 2009-04-23 20:20:37 +00:00
zzz
452adfa860 logs.jsp: fix layout problem on IE, move version info to the top 2009-04-23 20:00:33 +00:00
zzz
833ebd0714 Jetty: Fix temp dir handling, which was causing susidns not to start on windows.
Jetty forms the temp directory name from, among other things, the bound
address. The patch in 0.7.2 to bind to IPV6 addresses led to ':' in the
directory name, which is not allowed on windows. Change these to '_'.
2009-04-23 18:29:46 +00:00
zzz
b430abf172 add i2p version for easy cut-n-paste 2009-04-23 18:22:55 +00:00
zzz
939311d2de css fixes from badger 2009-04-23 18:21:25 +00:00
mkvore-commit
0c738e2c6f SAMv3: stream session stop listening when the forwarding session closes. Doc has to be changed to reflect this. 2009-04-23 00:55:12 +00:00
zzz
48e544c014 RouterConsole: Make summary bar a refreshing iframe 2009-04-23 00:39:49 +00:00
zzz
08b186aa24 propagate from branch 'i2p.i2p' (head 28b73161ea8915467ac9a4a8eb910d8fef1d42cd)
to branch 'i2p.i2p.zzz.test' (head 4470e8eb34649523d9f0055e754d90226f0d7bcb)
2009-04-23 00:27:54 +00:00
zzz
2f46efe78d * Blocklist: cleanup
* PeerProfile:
     - Replace a hot lock with concurrent RW lock
     - Rewrite ugly IP Restriction code
     - Also use transport IP in restriction code
   * Transport: Start the previously unused CleanupUnreachable
2009-04-23 00:23:29 +00:00
zzz
3ddd5f2a51 * Fragmenter: don't re-throw the corrupt fragment IllegalStateException,
to limit the damage - root cause still not found
2009-04-22 19:21:21 +00:00
zzz
29a58cb030 * NTCP: Hopefully prevent this:
java.lang.IllegalStateException: Unable to serialize the message (net.i2p.data.i2np.DatabaseStoreMessage): Invalid key type
	at net.i2p.data.i2np.I2NPMessageImpl.toByteArray(I2NPMessageImpl.java:238)
	at net.i2p.router.transport.ntcp.NTCPConnection.bufferedPrepare(NTCPConnection.java:668)
	at net.i2p.router.transport.ntcp.NTCPConnection.send(NTCPConnection.java:295)
	at net.i2p.router.transport.ntcp.NTCPConnection.enqueueFloodfillMessage(NTCPConnection.java:412)
	at net.i2p.router.transport.ntcp.NTCPConnection.enqueueInfoMessage(NTCPConnection.java:373)
	at net.i2p.router.transport.ntcp.NTCPTransport.outboundMessageReady(NTCPTransport.java:179)
	at net.i2p.router.transport.TransportImpl.send(TransportImpl.java:339)
      ...
2009-04-22 18:53:57 +00:00
zzz
0bcbe6ae05 * i2psnark: (http://forum.i2p/viewtopic.php?t=3317)
- Change file limit to 512 (was 256)
      - Change size limit to 10GB (was 5GB)
      - Change request size to 16KB (was 32KB)
      - Change pipeline to 5 (was 3)
2009-04-22 13:54:59 +00:00
dev
3944688829 merge of '2fe56e848564fc4e006771a6cb807c8dec370bab'
and 'a2a447dc9fe4d0a9bdefccc5263eed665bedb84f'
2009-04-21 20:17:45 +00:00
dev
e126233fbc hope i have fixed that bug, where the "download $version" kept showing, while already having downloaded it 2009-04-21 20:17:07 +00:00
zzz
ae83b4202d recognize -h, --help, etc 2009-04-21 17:44:16 +00:00
mkvore-commit
7cdfe45acf propagate from branch 'i2p.i2p' (head 81ec1b16687e7276a752db7f600a525a6e289458)
to branch 'i2p.i2p.sam3' (head bf43c21d57d97df61e863a41783aaae968381d00)
2009-04-21 04:15:32 +00:00
mkvore-commit
eae4362181 SAMv3: NAMING ME request now work on stream sessions 2009-04-21 04:14:53 +00:00
sponge
f2e9e2cc23 2009-04-21 sponge
* Code janator work, basic corrections involving @Override, and
      appling final where it is important. Also fixed some equals methods
      and commented places that need fixing.
2009-04-21 03:32:38 +00:00
dev
311ec4eb54 merge of '401f2e769d7507a315783ec22c880a0e866194bd'
and 'eba7e55d7a69ed23fcce7f004a39fb2847ab66f5'
2009-04-19 11:16:21 +00:00
complication
f4254659ea * Fix typo in "news.xml", no build number increase. 2009-04-18 23:08:40 +00:00
dev
b542f17194 removed code unused since 75fadec23097a196f56cd8d7932dca0de5da5583 (0.5.0.5) 2009-04-18 15:08:48 +00:00
mkvore-commit
0f1f33eaa4 merge of '798b531efac76d62154df2a99a91a32ccd97ab47'
and '9b73a50d356f49e9aadaae4cf86681b718c0d56b'
2009-04-09 19:12:06 +00:00
mkvore-commit
18a475eff3 merge of '9666f5fdfc24a7fc2ca3a99a95ea5dfef5583b1b'
and 'e76b1962963aa7cadb74aacc32f90adf31db3761'
2009-04-08 06:41:53 +00:00
mkvore-commit
54255cab4a merge of '91bd86329a458a5e064af7aa5abf3662aec61dab'
and 'a09513bb83b827232b24950613986dcb6d5e713c'
2009-04-07 05:47:04 +00:00
mkvore-commit
bc831d3c35 Changelog: SAM : big bug in SAMv1Handler corrected 2009-04-06 09:53:01 +00:00
mkvore-commit
d54695e542 add dependency to streaming lib to apps/sam/java/build.xml 2009-04-06 08:16:19 +00:00
mkvore-commit
12625a46c2 comment added in net.i2p.client.streaming.ConnectionHanler 2009-04-06 07:54:19 +00:00
mkvore-commit
ab84a5ce8e propagate from branch 'i2p.i2p' (head ac3b23a1d65017e99af5231a8248590c278c136f)
to branch 'i2p.i2p.sam3' (head e257c0c2a8456c229d12a8de2c5339b2e981fd80)
2009-04-06 07:45:57 +00:00
mkvore-commit
fcbfd7554f SAMv3: alternate form of calling SAMBridge.main. Usage message updated. 2009-04-06 06:39:30 +00:00
mkvore-commit
4d27f18710 SAMv3: rawTests Demos scripts updated 2009-04-06 05:29:03 +00:00
mkvore-commit
1bc4cb382e SAMv3 : protocol better specified, and small changes in the code reflecting the new protocol 2009-04-05 21:35:56 +00:00
mkvore-commit
6b825fbe25 SAMv3 : protocol better specified, and small changes in the code reflecting the new protocol 2009-04-05 21:32:43 +00:00
mkvore-commit
2cf5221620 minimize differences with mainstream apps/streaming 2009-04-04 12:37:19 +00:00
mkvore-commit
de6edc6a99 2009-04-04 10:28:31 +00:00
mkvore-commit
bc086a78eb explicit merge of '7bae8d314209ec279a4da918dc3255e31bda7e45'
and '3b133e76d8124df27791cb78006e7c2b9a8b6430'
2009-04-02 08:57:46 +00:00
mkvore-commit
e0dccb5970 2009-04-02 08:54:28 +00:00
mkvore-commit
a4d16af95d SAM version 3 :
- Raw and Datagram sessions implemented
      - option "SILENT=true" added to the stream protocol
      - java 6 warnings removed
   ministreaming :
      - java 6 warnings removed
   ministreaming and streaming :
      -  added functions : 
      	I2PServerSocket.waitIncoming(long timeout)
      	I2PServerSocket.accept(boolean block)
2009-04-02 08:22:31 +00:00
289 changed files with 7710 additions and 2098 deletions

View File

@@ -46,7 +46,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 = "06", BEXT = "";
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
private Socket server;
private Properties props;
@@ -1263,11 +1263,11 @@ public class DoCMDS implements Runnable {
tunnel = new MUXlisten(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) {
out.println("ERROR starting tunnel: " + e);

View File

@@ -25,6 +25,8 @@ package net.i2p.BOB;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocket;
@@ -78,91 +80,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.");
}
}
}

View File

@@ -23,7 +23,6 @@
*/
package net.i2p.BOB;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
@@ -71,90 +70,99 @@ 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;
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) {
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
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
Thread 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 {
in.close();
} catch(Exception ex) {
}
try {
out.close();
} catch(Exception ex) {
}
try {
Iin.close();
} catch(Exception ex) {
}
try {
Iout.close();
} catch(Exception ex) {
Thread.sleep(10); //sleep for 10 ms
} catch (InterruptedException e) {
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 {
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");
}
}
}

View File

@@ -29,8 +29,6 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Properties;
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;
@@ -50,7 +48,7 @@ public class MUXlisten implements Runnable {
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;
@@ -133,234 +131,195 @@ 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) {
return;
}
try {
wunlock();
} 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
quit:
{
try {
tg = new ThreadGroup(N);
die:
{
// 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();
wunlock();
break die;
}
} 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();
} catch (Exception e) {
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;
boolean spin = true;
while (spin) {
try {
Thread.sleep(1000); //sleep for 1 second
} catch (InterruptedException e) {
break die;
}
try {
rlock();
try {
spin = info.get("STOPPING").equals(Boolean.FALSE);
} catch (Exception e) {
runlock();
break die;
}
} catch (Exception e) {
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
}
}
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
// This is here to catch when something fucks up REALLY bad.
if (tg != null) {
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
} catch (Exception e) {
// System.out.println("MUXlisten: Caught an exception" + e);
break quit;
}
} // quit
} finally {
// Start cleanup. Allow threads above this one to catch the stop signal.
try {
Thread.sleep(250);
} catch (InterruptedException ex) {
}
// 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) {
}
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) {
}
}
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
}
// Wait around till all threads are collected.
if (tg != null) {
String boner = tg.getName();
_log.warn("BOB: MUXlisten: Starting thread collection for: " + boner);
// tg.interrupt(); // give my stuff a small smack again.
if (tg.activeCount() + tg.activeGroupCount() != 0) {
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) {
// 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
}
}
}
}
if (tg.activeCount() + tg.activeGroupCount() == 0) {
_log.warn("BOB: MUXlisten: Threads went away. Success: " + boner);
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 +330,7 @@ die:
}
// Visit each thread group
visit(root, 0);
visit(root, 0, root.getName());
}
/**
@@ -379,7 +338,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 +348,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 +358,43 @@ 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());
}
}
private static void nuke(ThreadGroup group, int level) {
// 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 stop it.
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
try {
if (thread.isAlive()) {
thread.stop();
}
} 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++) {
nuke(groups[i], level + 1);
}
try {
group.destroy();
} catch (IllegalThreadStateException IE) {
//nop
} catch (SecurityException se) {
//nop
}
}
}

View File

@@ -87,23 +87,13 @@ public class TCPio implements Runnable {
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();
Thread.sleep(10);
// } catch(InterruptedException ex) {
// }
}
} else {
/* according to the specs:
@@ -119,19 +109,16 @@ public class TCPio implements Runnable {
return;
}
}
// System.out.println("TCPio: RUNNING = false");
} catch(Exception e) {
// 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;
}

View File

@@ -29,6 +29,8 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
// import net.i2p.client.I2PSession;
// import net.i2p.client.I2PSessionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.Log;
@@ -73,16 +75,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 +82,80 @@ 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) {
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) {
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
int conn = 0;
try {
die:
{
try {
rlock();
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
runlock();
break die;
}
} catch (Exception e) {
break die;
}
if (spin) {
try {
if (info.exists("OUTPORT")) {
tgwatch = 2;
}
} catch (Exception e) {
try {
wlock();
try {
info.add("STOPPING", new Boolean(true));
info.add("RUNNING", new Boolean(false));
} catch (Exception e) {
wunlock();
break die;
}
} catch (Exception e) {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
try {
Socket server = new Socket();
listener.setSoTimeout(50); // We don't block, we cycle and check.
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) {
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);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
}
listener.close();
} catch (IOException ioe) {
try {
wunlock();
} catch (Exception e) {
break die;
listener.close();
} catch (IOException e) {
}
}
}
} 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.");
}
}

View File

@@ -64,17 +64,17 @@ public class TCPtoI2P implements Runnable {
S = new String();
while(true) {
while (true) {
b = in.read();
if(b == 13) {
if (b == 13) {
//skip CR
continue;
}
if(b < 20 || b > 126) {
if (b < 20 || b > 126) {
// exit on anything not legal
break;
}
c = (char)(b & 0x7f); // We only really give a fuck about ASCII
c = (char) (b & 0x7f); // We only really give a fuck about ASCII
S = new String(S + c);
}
return S;
@@ -118,90 +118,87 @@ public class TCPtoI2P implements Runnable {
OutputStream Iout = null;
InputStream in = null;
OutputStream out = null;
try {
in = sock.getInputStream();
out = sock.getOutputStream();
try {
line = lnRead(in);
input = line.toLowerCase();
Destination dest = null;
if(input.endsWith(".i2p")) {
dest = I2PTunnel.destFromName(input);
line = dest.toBase64();
}
dest = new Destination();
dest.fromBase64(line);
in = sock.getInputStream();
out = sock.getOutputStream();
try {
// get a client socket
I2P = socketManager.connect(dest);
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
// make readers/writers
Iin = I2P.getInputStream();
Iout = I2P.getOutputStream();
// 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) {
// nop
// }
}
// System.out.println("TCPtoI2P: Going away...");
line = lnRead(in);
input = line.toLowerCase();
Destination dest = null;
} 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) {
if (input.endsWith(".i2p")) {
dest = I2PTunnel.destFromName(input);
line = dest.toBase64();
}
dest = new Destination();
dest.fromBase64(line);
try {
// get a client socket
I2P = socketManager.connect(dest);
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
// make readers/writers
Iin = I2P.getInputStream();
Iout = I2P.getOutputStream();
// 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, Thread.currentThread().getName() + " TCPioA");
Thread 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
Thread.sleep(10); //sleep for 10 ms
}
} 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) {
// We're breaking away.
}
} catch (Exception e) {
Emsg("ERROR " + e.toString(), out);
}
} catch(Exception e) {
Emsg("ERROR " + e.toString(), out);
} catch (Exception e) {
// bail on anything else
}
} finally {
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) {
}
} 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) {
try {
// System.out.println("TCPtoI2P: Close sock");
sock.close();
} catch (Exception e) {
}
}
// System.out.println("TCPtoI2P: Done.");
// System.out.println("TCPtoI2P: Done.");
}
}

View File

@@ -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" />

View File

@@ -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]);
}
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -58,7 +58,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

View File

@@ -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>

View File

@@ -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
}

View File

@@ -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:

View File

@@ -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.2";
}

View File

@@ -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.

View File

@@ -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="buttonGroup1">
</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>
@@ -84,21 +90,21 @@
</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 +113,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 +124,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,58 +135,66 @@
</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="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
</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="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
</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"/>
@@ -209,22 +223,28 @@
</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="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="uploadgbKeyTyped"/>
</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="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="downloadgbKeyTyped"/>
</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"/>
@@ -266,14 +286,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 +306,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 +327,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 +336,87 @@
<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="buttonGroup1"/>
</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="buttonGroup1"/>
</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="buttonGroup1"/>
</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>
</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>
</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>
</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 +427,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 +441,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 +515,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>

View File

@@ -0,0 +1,461 @@
/*
* GeneralConfiguration.java
*
* Created on 10 april 2009, 19:04
*/
package net.i2p.desktopgui.gui;
import net.i2p.desktopgui.router.configuration.SpeedHelper;
/**
*
* @author mathias
*/
public class GeneralConfiguration extends javax.swing.JFrame {
/** Creates new form GeneralConfiguration */
public GeneralConfiguration() {
initComponents();
extraInitComponents();
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setVisible(true);
}
private void extraInitComponents() {
downloadspeed.setText(SpeedHelper.getInboundBandwidth());
}
/** 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() {
buttonGroup1 = 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();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
uploadgb = new javax.swing.JTextField();
downloadgb = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = 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
ok.setText(resourceMap.getString("ok.text")); // NOI18N
ok.setName("ok"); // NOI18N
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 keyTyped(java.awt.event.KeyEvent evt) {
speedKeyTyped(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 keyTyped(java.awt.event.KeyEvent evt) {
speedKeyTyped(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);
jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
jLabel3.setName("jLabel3"); // NOI18N
speedPanel.add(jLabel3);
jLabel3.setBounds(330, 20, 97, 30);
jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
jLabel4.setName("jLabel4"); // NOI18N
speedPanel.add(jLabel4);
jLabel4.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 keyTyped(java.awt.event.KeyEvent evt) {
uploadgbKeyTyped(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 keyTyped(java.awt.event.KeyEvent evt) {
downloadgbKeyTyped(evt);
}
});
speedPanel.add(downloadgb);
downloadgb.setBounds(440, 60, 60, 27);
jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
jLabel5.setName("jLabel5"); // NOI18N
speedPanel.add(jLabel5);
jLabel5.setBounds(510, 20, 19, 30);
jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
jLabel6.setName("jLabel6"); // NOI18N
speedPanel.add(jLabel6);
jLabel6.setBounds(510, 60, 19, 30);
jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
jLabel7.setName("jLabel7"); // NOI18N
speedPanel.add(jLabel7);
jLabel7.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
buttonGroup1.add(updateInform);
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
updateInform.setName("updateInform"); // NOI18N
buttonGroup1.add(updateDownload);
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
updateDownload.setName("updateDownload"); // NOI18N
buttonGroup1.add(updateDownloadRestart);
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
checkUpdates.setName("checkUpdates"); // NOI18N
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
updateNow.setName("updateNow"); // NOI18N
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
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 speedKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyTyped
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_speedKeyTyped
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_uploadkbpsActionPerformed
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_downloadkbpsActionPerformed
private void uploadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_uploadgbKeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_uploadgbKeyTyped
private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_downloadgbKeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_downloadgbKeyTyped
protected void initUsage(String upload, String download) {
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
}
// 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.ButtonGroup buttonGroup1;
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.JTextField downloadgb;
private javax.swing.JComboBox downloadkbps;
private javax.swing.JTextField downloadspeed;
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.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.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 uploadSpeedLabel;
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;
}

View File

@@ -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) {

View File

@@ -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"/>

View File

@@ -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

View File

@@ -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"/>

View File

@@ -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

View File

@@ -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"/>

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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;
/**
*

View File

@@ -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">

View File

@@ -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(

View File

@@ -0,0 +1,29 @@
cancel.text=Cancel
ok.text=OK
jLabel3.text=Monthly usage:
jLabel4.text=Monthly usage:
jLabel5.text=GB
jLabel6.text=GB
jLabel7.text=Explanation ...
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

View File

@@ -1,3 +1,4 @@
refreshButton.text=Refresh
clearButton.text=Clear
explanationText.text=Explanation ...
Form.title=View Logs

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,4 @@
package persistence;
package net.i2p.desktopgui.persistence;
import java.io.File;
import java.io.FileInputStream;

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
package router;
package net.i2p.desktopgui.router;
import net.i2p.router.RouterContext;
import net.i2p.router.RouterVersion;

View File

@@ -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";
}

View File

@@ -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;
/**
*

View File

@@ -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,8 @@ 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);
}
}

View File

@@ -1,4 +1,4 @@
package util;
package net.i2p.desktopgui.util;
import javax.swing.InputVerifier;
import javax.swing.JComponent;

View File

@@ -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" />

View File

@@ -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);

View File

@@ -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,

View File

@@ -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 */

View File

@@ -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

View File

@@ -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>&nbsp;&nbsp;<tt>" + peer.toString().substring(5, 9) + "</tt>");

View File

@@ -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">
@@ -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" />

View File

@@ -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);
@@ -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()));

View File

@@ -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();

View File

@@ -345,7 +345,9 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
public I2PSocket createI2PSocket(Destination dest) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException {
if (sockMgr == null) {
// we need this before getDefaultOptions()
sockMgr = getSocketManager();
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
return createI2PSocket(dest, getDefaultOptions());
}
@@ -369,9 +371,12 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
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) {
synchronized(sockLock) {
sockMgr = getSocketManager();
}
} else if (Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")).booleanValue() &&
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
synchronized(sockLock) {
I2PSocketManager oldSockMgr = sockMgr;
// This will build a new socket manager and a new dest if the session is closed.
sockMgr = getSocketManager();

View File

@@ -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,12 @@ 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
if (sockMgr == null) {
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

View File

@@ -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,11 @@ 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();
if (sockMgr == null) {
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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 />

View File

@@ -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" >

File diff suppressed because it is too large Load Diff

View File

@@ -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" />

View File

@@ -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;

View File

@@ -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());

View File

@@ -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" />
@@ -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" />

View File

@@ -18,8 +18,8 @@ public class ConfigNetHelper extends HelperBase {
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";
public String getNtcphostname() {
if (!TransportManager.enableNTCP(_context))
return "\" disabled=\"true";

View File

@@ -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());

View File

@@ -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)
@@ -135,7 +135,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 +364,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 +378,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();

View File

@@ -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,6 +172,7 @@ 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";

View File

@@ -78,7 +78,7 @@
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 />
<p>
<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" />" />
@@ -118,7 +118,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 +148,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

View File

@@ -41,7 +41,9 @@
<hr />
<b>Log levels:</b> <br />
<b>Default log level:</b>
<jsp:getProperty name="logginghelper" property="defaultLogLevelBox" /><br />
<jsp:getProperty name="logginghelper" property="defaultLogLevelBox" />
<i>(DEBUG and INFO are not recommended defaults, as they will drastically slow down your router)</i>
<br />
<jsp:getProperty name="logginghelper" property="logLevelTable" />
<hr />
<input type="submit" name="shouldsave" value="Save changes" />

View File

@@ -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;

View File

@@ -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:</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>

View File

@@ -16,6 +16,7 @@
<jsp:setProperty name="netdbHelper" property="writer" value="<%=out%>" />
<jsp:setProperty name="netdbHelper" property="full" value="<%=request.getParameter("f")%>" />
<jsp:setProperty name="netdbHelper" property="router" value="<%=request.getParameter("r")%>" />
<jsp:setProperty name="netdbHelper" property="lease" value="<%=request.getParameter("l")%>" />
<jsp:getProperty name="netdbHelper" property="netDbSummary" />
</div>

View File

@@ -1,102 +1,30 @@
<%@page import="net.i2p.router.web.SummaryHelper" %>
<jsp:useBean class="net.i2p.router.web.SummaryHelper" id="helper" scope="request" />
<jsp:setProperty name="helper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:useBean class="net.i2p.router.web.ReseedHandler" id="reseed" scope="request" />
<jsp:setProperty name="reseed" property="*" />
<jsp:useBean class="net.i2p.router.web.UpdateHandler" id="update" scope="request" />
<jsp:setProperty name="update" property="*" />
<jsp:setProperty name="update" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHelper" id="uhelper" scope="request" />
<jsp:setProperty name="uhelper" property="*" />
<jsp:setProperty name="uhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<% // put width here too to prevent bad layout at startup %>
<div class="routersummaryouter" style="width: 215px;">
<%
// skip the iframe if refresh disabled
String d = request.getParameter("refresh");
String newDelay = "";
if (d == null || "".equals(d))
d = System.getProperty("routerconsole.summaryRefresh");
else
// pass the new delay parameter to the iframe
newDelay = "?refresh=" + d;
if (!"0".equals(d))
out.print("<iframe src=\"summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"100%\" scrolling=\"auto\" frameborder=\"0\" allowtransparency=\"true\">\n");
%>
<div class="routersummary">
<center><b><a href="config.jsp">Configuration</a>&nbsp;&nbsp;<a href="help.jsp">Help</a></b></center>
<hr />
<u><b>General</b></u><br />
<b>Ident:</b> (<a title="Your router identity is <jsp:getProperty name="helper" property="ident" />, never reveal it to anyone" href="netdb.jsp?r=.">view</a>)<br />
<b>Version:</b> <jsp:getProperty name="helper" property="version" /><br />
<b>Uptime:</b> <jsp:getProperty name="helper" property="uptime" /><br />
<b>Now:</b> <jsp:getProperty name="helper" property="time" /><br />
<b>Reachability:</b> <a href="config.jsp#help"><jsp:getProperty name="helper" property="reachability" /></a><%
if (helper.updateAvailable()) {
// display all the time so we display the final failure message
out.print("<br />" + update.getStatus());
if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) {
} else {
long nonce = new java.util.Random().nextLong();
String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.UpdateHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.UpdateHandler.nonce", nonce+"");
String uri = request.getRequestURI();
out.print("<p><form action=\"" + uri + "\" method=\"GET\">\n");
out.print("<input type=\"hidden\" name=\"updateNonce\" value=\"" + nonce + "\" >\n");
out.print("<input type=\"submit\" value=\"Download " + uhelper.getUpdateVersion() + " Update\" ></form></p>\n");
}
<%@include file="summarynoframe.jsp" %>
<%
// d defined above
if (!"0".equals(d)) {
out.print("</div></iframe>\n");
} else {
// since we don't have an iframe this will reload the base page, and
// the new delay will be passed to the iframe above
out.print("<hr /><p><form action=\"" + request.getRequestURI() + "\" method=\"GET\">\n");
out.print("<b>Refresh (s):</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\">Enable</button>\n");
out.print("</form></p></div>\n");
}
%>
<p>
<%=net.i2p.router.web.ConfigRestartBean.renderStatus(request.getRequestURI(), request.getParameter("action"), request.getParameter("consoleNonce"))%>
</p>
<hr />
<u><b><a href="peers.jsp">Peers</a></b></u><br />
<b>Active:</b> <jsp:getProperty name="helper" property="activePeers" />/<jsp:getProperty name="helper" property="activeProfiles" /><br />
<b>Fast:</b> <jsp:getProperty name="helper" property="fastPeers" /><br />
<b>High capacity:</b> <jsp:getProperty name="helper" property="highCapacityPeers" /><br />
<b>Well integrated:</b> <jsp:getProperty name="helper" property="wellIntegratedPeers" /><br />
<b>Known:</b> <jsp:getProperty name="helper" property="allPeers" /><br /><%
if (helper.getActivePeers() <= 0) {
%><b><a href="config.jsp">check your NAT/firewall</a></b><br /><%
}
// If showing the reseed link is allowed
if (helper.allowReseed()) {
if ("true".equals(System.getProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false"))) {
// While reseed occurring, show status message instead
out.print("<i>" + System.getProperty("net.i2p.router.web.ReseedHandler.statusMessage","") + "</i><br />");
} else {
// While no reseed occurring, show reseed link
long nonce = new java.util.Random().nextLong();
String prev = System.getProperty("net.i2p.router.web.ReseedHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+"");
String uri = request.getRequestURI();
out.print("<p><form action=\"" + uri + "\" method=\"GET\">\n");
out.print("<input type=\"hidden\" name=\"reseedNonce\" value=\"" + nonce + "\" >\n");
out.print("<button type=\"submit\" >Reseed</button></form></p>\n");
}
}
// If a new reseed ain't running, and the last reseed had errors, show error message
if ("false".equals(System.getProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false"))) {
String reseedErrorMessage = System.getProperty("net.i2p.router.web.ReseedHandler.errorMessage","");
if (reseedErrorMessage.length() > 0) {
out.print("<i>" + reseedErrorMessage + "</i><br />");
}
}
%><hr />
<u><b><a href="config.jsp" title="Configure the bandwidth limits">Bandwidth in/out</a></b></u><br />
<b>1s:</b> <jsp:getProperty name="helper" property="inboundSecondKBps" />/<jsp:getProperty name="helper" property="outboundSecondKBps" />KBps<br />
<b>5m:</b> <jsp:getProperty name="helper" property="inboundFiveMinuteKBps" />/<jsp:getProperty name="helper" property="outboundFiveMinuteKBps" />KBps<br />
<b>Total:</b> <jsp:getProperty name="helper" property="inboundLifetimeKBps" />/<jsp:getProperty name="helper" property="outboundLifetimeKBps" />KBps<br />
<b>Used:</b> <jsp:getProperty name="helper" property="inboundTransferred" />/<jsp:getProperty name="helper" property="outboundTransferred" /><br />
<hr />
<jsp:getProperty name="helper" property="destinations" />
<u><b>Tunnels in/out</b></u><br />
<b>Exploratory:</b> <jsp:getProperty name="helper" property="inboundTunnels" />/<jsp:getProperty name="helper" property="outboundTunnels" /><br />
<b>Client:</b> <jsp:getProperty name="helper" property="inboundClientTunnels" />/<jsp:getProperty name="helper" property="outboundClientTunnels" /><br />
<b>Participating:</b> <jsp:getProperty name="helper" property="participatingTunnels" /><br />
<hr />
<u><b>Congestion</b></u><br />
<b>Job lag:</b> <jsp:getProperty name="helper" property="jobLag" /><br />
<b>Message delay:</b> <jsp:getProperty name="helper" property="messageDelay" /><br />
<b>Tunnel lag:</b> <jsp:getProperty name="helper" property="tunnelLag" /><br />
<b>Handle backlog:</b> <jsp:getProperty name="helper" property="inboundBacklog" /><br />
<b><jsp:getProperty name="helper" property="tunnelStatus" /></b><br />
%>
</div>

View File

@@ -0,0 +1,78 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* All links in the summary bar must have target="_top"
* so they don't load in the iframe
*/
%>
<html><head>
<title>Summary Bar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%
// try hard to avoid an error page in the iframe after shutdown
String action = request.getParameter("action");
String d = request.getParameter("refresh");
// Normal browsers send value, IE sends button label
boolean shutdownSoon = "shutdownImmediate".equals(action) || "restartImmediate".equals(action) ||
"Shutdown immediately".equals(action) || "Restart immediately".equals(action);
if (!shutdownSoon) {
if (d == null || "".equals(d)) {
d = System.getProperty("routerconsole.summaryRefresh");
if (d == null || "".equals(d))
d = "60";
} else {
System.setProperty("routerconsole.summaryRefresh", d);
}
// we probably don't get here if d == "0" since caught in summary.jsp, but just
// to be sure...
if (!"0".equals(d)) {
// doesn't work for restart or shutdown with no expl. tunnels,
// since the call to ConfigRestartBean.renderStatus() hasn't happened yet...
// So we delay slightly
if ("restart".equalsIgnoreCase(action) || "shutdown".equalsIgnoreCase(action)) {
synchronized(this) {
try {
wait(1000);
} catch(InterruptedException ie) {}
}
}
long timeleft = net.i2p.router.web.ConfigRestartBean.getRestartTimeRemaining();
long delay = 60;
try { delay = Long.parseLong(d); } catch (NumberFormatException nfe) {}
if (delay*1000 < timeleft + 5000)
out.print("<meta http-equiv=\"refresh\" content=\"" + d + "\" />\n");
else
shutdownSoon = true;
}
}
%>
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body style="margin: 0;">
<div class="routersummary">
<%@include file="summarynoframe.jsp" %>
<%
// d and shutdownSoon defined above
if (!shutdownSoon) {
out.print("<hr /><p><form action=\"summaryframe.jsp\" method=\"GET\">\n");
if ("0".equals(d)) {
out.print("<b>Refresh (s):<b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\">Enable</button>\n");
} else {
// this will load in the iframe but subsequent pages will not have the iframe
out.print("<input type=\"hidden\" name=\"refresh\" value=\"0\" />\n");
out.print("<button type=\"submit\">Disable " + d + "s Refresh</button>\n");
}
out.print("</form></p>\n");
}
%>
</div>
</body>
</html>

View File

@@ -0,0 +1,100 @@
<%@page import="net.i2p.router.web.SummaryHelper" %>
<jsp:useBean class="net.i2p.router.web.SummaryHelper" id="helper" scope="request" />
<jsp:setProperty name="helper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:useBean class="net.i2p.router.web.ReseedHandler" id="reseed" scope="request" />
<jsp:setProperty name="reseed" property="*" />
<jsp:useBean class="net.i2p.router.web.UpdateHandler" id="update" scope="request" />
<jsp:setProperty name="update" property="*" />
<jsp:setProperty name="update" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHelper" id="uhelper" scope="request" />
<jsp:setProperty name="uhelper" property="*" />
<jsp:setProperty name="uhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<center><b><a href="config.jsp" target="_top">Configuration</a>&nbsp;&nbsp;<a href="help.jsp" target="_top">Help</a></b></center>
<hr />
<u><b>General</b></u><br />
<b>Ident:</b> (<a title="Your router identity is <jsp:getProperty name="helper" property="ident" />, never reveal it to anyone" href="netdb.jsp?r=." target="_top">view</a>)<br />
<b>Version:</b> <jsp:getProperty name="helper" property="version" /><br />
<b>Uptime:</b> <jsp:getProperty name="helper" property="uptime" /><br />
<b>Now:</b> <jsp:getProperty name="helper" property="time" /><br />
<b>Reachability:</b> <a href="config.jsp#help" target="_top"><jsp:getProperty name="helper" property="reachability" /></a><%
if (helper.updateAvailable()) {
// display all the time so we display the final failure message
out.print("<br />" + update.getStatus());
if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) {
} else if(!update.isDone()) {
long nonce = new java.util.Random().nextLong();
String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.UpdateHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.UpdateHandler.nonce", nonce+"");
String uri = request.getRequestURI();
out.print("<p><form action=\"" + uri + "\" method=\"GET\">\n");
out.print("<input type=\"hidden\" name=\"updateNonce\" value=\"" + nonce + "\" />\n");
out.print("<input type=\"submit\" value=\"Download " + uhelper.getUpdateVersion() + " Update\" /></form></p>\n");
}
}
%>
<p>
<%=net.i2p.router.web.ConfigRestartBean.renderStatus(request.getRequestURI(), request.getParameter("action"), request.getParameter("consoleNonce"))%>
</p>
<hr />
<u><b><a href="peers.jsp" target="_top">Peers</a></b></u><br />
<b>Active:</b> <jsp:getProperty name="helper" property="activePeers" />/<jsp:getProperty name="helper" property="activeProfiles" /><br />
<b>Fast:</b> <jsp:getProperty name="helper" property="fastPeers" /><br />
<b>High capacity:</b> <jsp:getProperty name="helper" property="highCapacityPeers" /><br />
<b>Well integrated:</b> <jsp:getProperty name="helper" property="wellIntegratedPeers" /><br />
<b>Known:</b> <jsp:getProperty name="helper" property="allPeers" /><br /><%
if (helper.getActivePeers() <= 0) {
%><b><a href="config.jsp" target="_top">check your NAT/firewall</a></b><br /><%
}
// If showing the reseed link is allowed
if (helper.allowReseed()) {
if ("true".equals(System.getProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false"))) {
// While reseed occurring, show status message instead
out.print("<i>" + System.getProperty("net.i2p.router.web.ReseedHandler.statusMessage","") + "</i><br />");
} else {
// While no reseed occurring, show reseed link
long nonce = new java.util.Random().nextLong();
String prev = System.getProperty("net.i2p.router.web.ReseedHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ReseedHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ReseedHandler.nonce", nonce+"");
String uri = request.getRequestURI();
out.print("<p><form action=\"" + uri + "\" method=\"GET\">\n");
out.print("<input type=\"hidden\" name=\"reseedNonce\" value=\"" + nonce + "\" />\n");
out.print("<button type=\"submit\" >Reseed</button></form></p>\n");
}
}
// If a new reseed ain't running, and the last reseed had errors, show error message
if ("false".equals(System.getProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false"))) {
String reseedErrorMessage = System.getProperty("net.i2p.router.web.ReseedHandler.errorMessage","");
if (reseedErrorMessage.length() > 0) {
out.print("<i>" + reseedErrorMessage + "</i><br />");
}
}
%><hr />
<u><b><a href="config.jsp" title="Configure the bandwidth limits" target="_top">Bandwidth in/out</a></b></u><br />
<b>1s:</b> <jsp:getProperty name="helper" property="inboundSecondKBps" />/<jsp:getProperty name="helper" property="outboundSecondKBps" />KBps<br />
<b>5m:</b> <jsp:getProperty name="helper" property="inboundFiveMinuteKBps" />/<jsp:getProperty name="helper" property="outboundFiveMinuteKBps" />KBps<br />
<b>Total:</b> <jsp:getProperty name="helper" property="inboundLifetimeKBps" />/<jsp:getProperty name="helper" property="outboundLifetimeKBps" />KBps<br />
<b>Used:</b> <jsp:getProperty name="helper" property="inboundTransferred" />/<jsp:getProperty name="helper" property="outboundTransferred" /><br />
<hr />
<jsp:getProperty name="helper" property="destinations" />
<u><b>Tunnels in/out</b></u><br />
<b>Exploratory:</b> <jsp:getProperty name="helper" property="inboundTunnels" />/<jsp:getProperty name="helper" property="outboundTunnels" /><br />
<b>Client:</b> <jsp:getProperty name="helper" property="inboundClientTunnels" />/<jsp:getProperty name="helper" property="outboundClientTunnels" /><br />
<b>Participating:</b> <jsp:getProperty name="helper" property="participatingTunnels" /><br />
<hr />
<u><b>Congestion</b></u><br />
<b>Job lag:</b> <jsp:getProperty name="helper" property="jobLag" /><br />
<b>Message delay:</b> <jsp:getProperty name="helper" property="messageDelay" /><br />
<b>Tunnel lag:</b> <jsp:getProperty name="helper" property="tunnelLag" /><br />
<b>Handle backlog:</b> <jsp:getProperty name="helper" property="inboundBacklog" /><br />
<b><jsp:getProperty name="helper" property="tunnelStatus" /></b><br />

View File

@@ -0,0 +1,15 @@
# test example
#in a first terminal, launch :
./samIn.py inTest
#in a second terminal, launch :
./samForward.py 25000 forward
#in a third terminal, launch :
l=0
while [ $l -lt 1000 ]
do
l=$((l+1))
./samOut.py forward this is message n. $l
done

View File

@@ -0,0 +1,35 @@
#!/usr/bin/python
import socket
import sys
# create a forward style SAM datagram session
# that forwards messages on specified port (default port : 25000)
# creates a standard datagram server that listens on this port forever
# usage : ./samForward.py [port [SAM session name]]
if len(sys.argv)>=2 :
port = eval(sys.argv[1])
else :
port = 25000
if len(sys.argv)==3 :
name = sys.argv[2]
else :
name = "datagramSamForward"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=DATAGRAM PORT="+str(port)+" ID="+name+" DESTINATION=EYUpJFeW9tiubXR0aOjvCJ~ndj3xN0Wn-ljuGdbpOEttPg7nj0VCTOQDJ~FAolzn9FIDdmR3VjM0OFFDT46Q5HN4vShXFE2VNC8e3~GjzxJfaJhijRC2R9oIOzsNlzKtInD2o9lh0PxPioNMCigwmgWuqlQHs4tjWeaYRAtooHxbrtuoCIhIdGfyVV-nAcPiyYbouKq3leETXE~4kBXm-LfWfyPtrv6OuDk3GBVVcthv19GYBmnl2YI8HpJjc-G-TvNkgYishjzIJyEW-Xrpy43R4ZBXlyQqnheGLlbOEY8NLDbyNHLRMMOGbcr~67SVE3Iw3RqQ3Dhrkq2FCaQwcDucfIUCCbOfCZgu0hlnCkS42xsUvegQeiwMxbdI~h9v7vcR3yFFOrHX6WQvIZSbFLKNGArGJcfmOJVLqw1wTC4AgYXjk3csVDPd-QWbMXOuodyBgrg27Ds2BBYTsVXWskoo6ASsMIQZ6jMfL7PkY9dPLCRParIyzb9aPmf~MntNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHNqwgkhJnBW4ymaRsdVmITAha-ff0UiALfKSlznqp5HcSewgMHbzQ0I01TQytFnW outbound.nickname="+name+" inbound.nickname="+name+" outbound.length=0\n")
sys.stdout.write(sess.recv(10000))
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("", port))
print "waiting on port:", port
while 1:
data, addr = s.recvfrom(40000)
print data, " received from ", addr, "length=", len(data)

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python
# create a SAM datagram session that writes incoming messages on its master session stream
# and a listen forever
# usage : ./samIn.py [session name]
import socket
import sys
if len(sys.argv)==2 :
name = sys.argv[1]
else :
name = "datagramSamIn"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=DATAGRAM ID="+name+" DESTINATION=tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABngJSS8xMyF4t82otZmCDhrKjbm-QLMtOLoumwR28ebDHEd4clF6O7aRa3d3yRH7p\n")
sys.stdout.write(sess.recv(1000))
while 1 :
chunk = sess.recv(10000)
sys.stdout.write(chunk+'\n')
if not chunk : break
print

View File

@@ -0,0 +1,31 @@
#!/usr/bin/python
# sends a message to datagram destinations opened by samForward.py and samIn.py, using specified sending session name
# at least samForward.py should be running for results to be seen
# usage : ./samOut.py [ sendingSessionName [ message ... ] ]
# sendingSessionName : default = datagramSamForward
# message : default = "this is nice message"
import socket
import sys
import time
if len(sys.argv)>=2 :
name = sys.argv[1]
else :
name = "datagramSamForward"
if len(sys.argv)>2 :
message = ''.join([s+' ' for s in sys.argv[2:]]).strip()
else :
message = "This is a nice message"
# client.py
port = 7655
host = "localhost"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("", 0))
s.sendto("3.0 "+name+" tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAA\n"+message, (host, port))
s.sendto("3.0 "+name+" EYUpJFeW9tiubXR0aOjvCJ~ndj3xN0Wn-ljuGdbpOEttPg7nj0VCTOQDJ~FAolzn9FIDdmR3VjM0OFFDT46Q5HN4vShXFE2VNC8e3~GjzxJfaJhijRC2R9oIOzsNlzKtInD2o9lh0PxPioNMCigwmgWuqlQHs4tjWeaYRAtooHxbrtuoCIhIdGfyVV-nAcPiyYbouKq3leETXE~4kBXm-LfWfyPtrv6OuDk3GBVVcthv19GYBmnl2YI8HpJjc-G-TvNkgYishjzIJyEW-Xrpy43R4ZBXlyQqnheGLlbOEY8NLDbyNHLRMMOGbcr~67SVE3Iw3RqQ3Dhrkq2FCaQwcDucfIUCCbOfCZgu0hlnCkS42xsUvegQeiwMxbdI~h9v7vcR3yFFOrHX6WQvIZSbFLKNGArGJcfmOJVLqw1wTC4AgYXjk3csVDPd-QWbMXOuodyBgrg27Ds2BBYTsVXWskoo6ASsMIQZ6jMfL7PkY9dPLCRParIyzb9aPmf~MntNAAAA\n"+message, (host, port))

View File

@@ -0,0 +1,15 @@
# test example
#in a first terminal, launch :
./samIn.py inTest
#in a second terminal, launch :
./samForward.py 25000 forward
#in a third terminal, launch :
l=0
while [ $l -lt 1000 ]
do
l=$((l+1))
./samOut.py forward this is message n. $l
done

View File

@@ -0,0 +1,36 @@
#!/usr/bin/python
import socket
import sys
# create a forward style SAM raw datagram session
# that forwards messages on specified port (default port : 25000)
# creates a standard datagram server that listens on this port forever
# usage : ./samForward.py [port [SAM session name]]
if len(sys.argv)>=2 :
port = eval(sys.argv[1])
else :
port = 25000
if len(sys.argv)==3 :
name = sys.argv[2]
else :
name = "rawSamForward"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=RAW PORT="+str(port)+" ID="+name+" DESTINATION=EYUpJFeW9tiubXR0aOjvCJ~ndj3xN0Wn-ljuGdbpOEttPg7nj0VCTOQDJ~FAolzn9FIDdmR3VjM0OFFDT46Q5HN4vShXFE2VNC8e3~GjzxJfaJhijRC2R9oIOzsNlzKtInD2o9lh0PxPioNMCigwmgWuqlQHs4tjWeaYRAtooHxbrtuoCIhIdGfyVV-nAcPiyYbouKq3leETXE~4kBXm-LfWfyPtrv6OuDk3GBVVcthv19GYBmnl2YI8HpJjc-G-TvNkgYishjzIJyEW-Xrpy43R4ZBXlyQqnheGLlbOEY8NLDbyNHLRMMOGbcr~67SVE3Iw3RqQ3Dhrkq2FCaQwcDucfIUCCbOfCZgu0hlnCkS42xsUvegQeiwMxbdI~h9v7vcR3yFFOrHX6WQvIZSbFLKNGArGJcfmOJVLqw1wTC4AgYXjk3csVDPd-QWbMXOuodyBgrg27Ds2BBYTsVXWskoo6ASsMIQZ6jMfL7PkY9dPLCRParIyzb9aPmf~MntNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHNqwgkhJnBW4ymaRsdVmITAha-ff0UiALfKSlznqp5HcSewgMHbzQ0I01TQytFnW\n")
sys.stdout.write(sess.recv(10000))
# listening server
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("", port))
print "waiting on port:", port
while 1:
data, addr = s.recvfrom(40000)
print data, " received from ", addr, "length=", len(data)

View File

@@ -0,0 +1,31 @@
#!/usr/bin/python
# create a SAM datagram session that writes incoming messages on its master session stream
# and a listen forever
# usage : ./samIn.py [session name]
import socket
import sys
if len(sys.argv)==2 :
name = sys.argv[1]
else :
name = "rawSamIn"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=RAW ID="+name+" DESTINATION=tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABngJSS8xMyF4t82otZmCDhrKjbm-QLMtOLoumwR28ebDHEd4clF6O7aRa3d3yRH7p\n")
sys.stdout.write(sess.recv(1000))
# listen incoming messages
while 1 :
chunk = sess.recv(10000)
sys.stdout.write(chunk+'\n')
if not chunk : break
print

View File

@@ -0,0 +1,31 @@
#!/usr/bin/python
# sends a message to datagram destinations opened by samForward.py and samIn.py, using specified sending session name
# at least samForward.py should be running for results to be seen
# usage : ./samOut.py [ sendingSessionName [ message ... ] ]
# sendingSessionName : default = datagramSamForward
# message : default = "this is nice message"
import socket
import sys
import time
if len(sys.argv)>=2 :
name = sys.argv[1]
else :
name = "rawSamForward"
if len(sys.argv)>2 :
message = ''.join([s+' ' for s in sys.argv[2:]]).strip()
else :
message = "This is a nice message"
# client.py
port = 7655
host = "localhost"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("", 0))
s.sendto("3.0 "+name+" tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAA\n"+message, (host, port))
s.sendto("3.0 "+name+" EYUpJFeW9tiubXR0aOjvCJ~ndj3xN0Wn-ljuGdbpOEttPg7nj0VCTOQDJ~FAolzn9FIDdmR3VjM0OFFDT46Q5HN4vShXFE2VNC8e3~GjzxJfaJhijRC2R9oIOzsNlzKtInD2o9lh0PxPioNMCigwmgWuqlQHs4tjWeaYRAtooHxbrtuoCIhIdGfyVV-nAcPiyYbouKq3leETXE~4kBXm-LfWfyPtrv6OuDk3GBVVcthv19GYBmnl2YI8HpJjc-G-TvNkgYishjzIJyEW-Xrpy43R4ZBXlyQqnheGLlbOEY8NLDbyNHLRMMOGbcr~67SVE3Iw3RqQ3Dhrkq2FCaQwcDucfIUCCbOfCZgu0hlnCkS42xsUvegQeiwMxbdI~h9v7vcR3yFFOrHX6WQvIZSbFLKNGArGJcfmOJVLqw1wTC4AgYXjk3csVDPd-QWbMXOuodyBgrg27Ds2BBYTsVXWskoo6ASsMIQZ6jMfL7PkY9dPLCRParIyzb9aPmf~MntNAAAA\n"+message, (host, port))

View File

@@ -0,0 +1,24 @@
# test example
#in a first terminal, launch :
./samIn.py inTest
#in a second terminal, launch :
./samOut.py
#and again
./samOut.py
##########
# test example n°2
#in a first terminal, launch :
./samForward.py inTest
#in a second terminal, launch :
./server.py
#in a third terminal, launch :
./samOut.py

View File

@@ -0,0 +1,64 @@
#!/usr/bin/python
import socket
import sys
# create a master SAM stream session that opens a destination in I2P world
# then open another session that tells SAM to forward incoming connections
# to the specified address
#
# usage :
# ./samForward.py [ silent [ port [ sessionName [ host ] ] ] ]
#
# silent : should the first line of incoming socket contain the peer destination (true or false)
# port : port to which connections are forwarded (default : 25000)
# sessionName : session id (default : "forward")
# host : host to which connections are forwarded (default : this host)
if len(sys.argv)>=2 :
silent = " SILENT="+sys.argv[1]
else : silent = " SILENT=false"
if len(sys.argv)>=3 :
port = " PORT="+sys.argv[2]
else : port = " PORT=25000"
if len(sys.argv)>=4 :
name = " ID="+sys.argv[3]
else : name = " ID=forward"
if len(sys.argv)>=5 :
host = " HOST="+sys.argv[4]
else : host = ""
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=STREAM"+name+" DESTINATION=tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABngJSS8xMyF4t82otZmCDhrKjbm-QLMtOLoumwR28ebDHEd4clF6O7aRa3d3yRH7p\n")
sys.stdout.write(sess.recv(1000))
sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1",7656));
sock.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sock.recv(1000))
sock.send("STREAM FORWARD" + name + host + port + silent + "\n")
sys.stdout.write(sock.recv(1000))
l=0
while 1 :
chunk = sock.recv(100)
sys.stdout.write(chunk)
if not chunk : break
print "Forward socket closed"
l=0
while 1 :
chunk = sess.recv(100)
sys.stdout.write(chunk)
if not chunk : break

View File

@@ -0,0 +1,91 @@
#!/usr/bin/python
# create an stream session
# then an "accept" stream connected to this session
# then another "accept" stream from the same session
# then listen from the first stream and then listen from the second
# usage : ./samIn.py [ silent [ name ] ]
# name : the session id ( defaults to InTest )
# silent : true or false : tells wether we want to receive the incoming stream destination
# as first line
import socket
import sys
import time
if len(sys.argv)>=2 :
silent = " SILENT="+sys.argv[1]
else : silent = " SILENT=false"
if len(sys.argv)>=3 :
name = sys.argv[2]
else : name = "inTest"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=STREAM ID="+name+" DESTINATION=tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABngJSS8xMyF4t82otZmCDhrKjbm-QLMtOLoumwR28ebDHEd4clF6O7aRa3d3yRH7p\n")
sys.stdout.write(sess.recv(1000))
def accept() :
sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1",7656));
sock.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sock.recv(1000))
sock.send("STREAM ACCEPT ID=" + name + silent+"\n")
print "STREAM ACCEPT ID="+name+silent
if (silent==" SILENT=false") :
sys.stdout.write( sock.recv(100) )
return sock
def echo( sock, lines ) :
l = 0
while lines==-1 or l<lines :
chunk = sock.recv(1000)
if lines!=-1 : l = l + 1
if not chunk : break
print chunk
sock.send(chunk)
print
sock1 = accept()
time.sleep(1)
sock2 = accept()
print "Second listening session"
try :
echo(sock2, -1)
except :
print sock2
if silent == " SILENT=false" :
sys.stdout.write(sock1.recv(1000))
else :
# we know sock1 is accepted if it receives a byte
sock1.recv(1)
sock3 = accept()
print "First listening session"
echo(sock1, 2)
sock1.close()
print "Third listening session"
echo(sock3, -1)

View File

@@ -0,0 +1,52 @@
#!/usr/bin/python
# open a I2P stream destination
# then open another stream that connects to the destination created by samForward.py or samIn.py
# then send bytes through the stream
# usage :
# ./samOut.py [ silent [ sessionName ] ]
#
# silent : should the first incoming after the connection request contain the connection status message (true or false)
# sessionName : session id (default : "forward")
import socket
import sys
import time
if len(sys.argv)>=2 :
silent = " SILENT="+sys.argv[1]
else : silent = " SILENT=false"
if len(sys.argv)>=3 :
name = " ID="+sys.argv[2]
else : name = " ID=testOutStream"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=STREAM"+name+" DESTINATION=EYUpJFeW9tiubXR0aOjvCJ~ndj3xN0Wn-ljuGdbpOEttPg7nj0VCTOQDJ~FAolzn9FIDdmR3VjM0OFFDT46Q5HN4vShXFE2VNC8e3~GjzxJfaJhijRC2R9oIOzsNlzKtInD2o9lh0PxPioNMCigwmgWuqlQHs4tjWeaYRAtooHxbrtuoCIhIdGfyVV-nAcPiyYbouKq3leETXE~4kBXm-LfWfyPtrv6OuDk3GBVVcthv19GYBmnl2YI8HpJjc-G-TvNkgYishjzIJyEW-Xrpy43R4ZBXlyQqnheGLlbOEY8NLDbyNHLRMMOGbcr~67SVE3Iw3RqQ3Dhrkq2FCaQwcDucfIUCCbOfCZgu0hlnCkS42xsUvegQeiwMxbdI~h9v7vcR3yFFOrHX6WQvIZSbFLKNGArGJcfmOJVLqw1wTC4AgYXjk3csVDPd-QWbMXOuodyBgrg27Ds2BBYTsVXWskoo6ASsMIQZ6jMfL7PkY9dPLCRParIyzb9aPmf~MntNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHNqwgkhJnBW4ymaRsdVmITAha-ff0UiALfKSlznqp5HcSewgMHbzQ0I01TQytFnW\n")
sys.stdout.write(sess.recv(1000))
sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1",7656));
sock.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sock.recv(1000))
sock.send("STREAM CONNECT"+name+" DESTINATION=tYhjbFlFL38WFuO5eCzTvE0UBr4RfaqWMKlekGeMoB-Ouz7nYaWfiS-9j3jMiZT7FH~pwdmoSREOs2ZbXK84sR59P~pPfeCMxnJrk57f3U9uKzXkesjkKWYco3YAGs-G8sw8Fu2FBx0Do57yBdA9~j8Zq6pMjmgPBXCLuXG3vo0Z8zUWCjApJyFY6OXYopHck9Fz9vKy7YhC6zXFHfEuNHVkAooduiLd~aCoGij0TW3lH2rTVU-lx-DUdi6edxQ5-RvDNkXfikvytoCpRkivbNVytjCJLk~7RNU4FpBD20wTZWNJmEG3OY3cjNjawJVFdNjtgczh9K7gZ7ad-NjVjZVhXEj1lU8mk~vAH-2QE5om8dstWUwWoNDwmVDlvIJNKzQmahG~VrpFexFHXO0n3fKIXcSgWGOHDExM8w9neCt7AxUjxPDtXXuYNW~bRwcfiL-C9~z4K9rmwiTPZX0lmsToSXTF28l7WAoj~TMT9kZAjQeFRRWU5oW5oxVuonVvAAAA"+silent+"\n")
# wait for acknowledgement before sending data, if we asked for it
if (silent==" SILENT=false") :
sys.stdout.write(sock.recv(1000))
for i in range(1,11) :
sock.send(str(i)+'\n')
buf=sock.recv(1000)
sys.stdout.write(str(i)+' '+buf)
if not buf : break
print

View File

@@ -0,0 +1,51 @@
#!/usr/bin/python
# open a I2P stream destination
# then open another stream that connects to the destination created by samForward.py or samIn.py
# then send bytes through the stream
# usage :
# ./samOut.py [ silent [ sessionName ] ]
#
# silent : should the first incoming after the connection request contain the connection status message (true or false)
# sessionName : session id (default : "forward")
import socket
import sys
import time
if len(sys.argv)>=2 :
silent = " SILENT="+sys.argv[1]
else : silent = " SILENT=false"
if len(sys.argv)>=3 :
name = " ID="+sys.argv[2]
else : name = " ID=testOutStream"
sess = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sess.connect(("127.0.0.1",7656));
sess.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sess.recv(1000))
sess.send("SESSION CREATE STYLE=STREAM"+name+" DESTINATION=EYUpJFeW9tiubXR0aOjvCJ~ndj3xN0Wn-ljuGdbpOEttPg7nj0VCTOQDJ~FAolzn9FIDdmR3VjM0OFFDT46Q5HN4vShXFE2VNC8e3~GjzxJfaJhijRC2R9oIOzsNlzKtInD2o9lh0PxPioNMCigwmgWuqlQHs4tjWeaYRAtooHxbrtuoCIhIdGfyVV-nAcPiyYbouKq3leETXE~4kBXm-LfWfyPtrv6OuDk3GBVVcthv19GYBmnl2YI8HpJjc-G-TvNkgYishjzIJyEW-Xrpy43R4ZBXlyQqnheGLlbOEY8NLDbyNHLRMMOGbcr~67SVE3Iw3RqQ3Dhrkq2FCaQwcDucfIUCCbOfCZgu0hlnCkS42xsUvegQeiwMxbdI~h9v7vcR3yFFOrHX6WQvIZSbFLKNGArGJcfmOJVLqw1wTC4AgYXjk3csVDPd-QWbMXOuodyBgrg27Ds2BBYTsVXWskoo6ASsMIQZ6jMfL7PkY9dPLCRParIyzb9aPmf~MntNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHNqwgkhJnBW4ymaRsdVmITAha-ff0UiALfKSlznqp5HcSewgMHbzQ0I01TQytFnW\n")
sys.stdout.write(sess.recv(1000))
sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1",7656));
sock.send("HELLO VERSION MIN=3.0 MAX=3.0\n")
sys.stdout.write(sock.recv(1000))
sock.send("STREAM CONNECT"+name+" DESTINATION=http://amiga.i2p"+silent+"\n")
# wait for acknowledgement before sending data, if we asked for it
if (silent==" SILENT=false") :
sys.stdout.write(sock.recv(1000))
while (1) :
buf=sock.recv(1000)
sys.stdout.write(buf)
if not buf : break
print

View File

@@ -0,0 +1,41 @@
#!/usr/bin/python
# echo server
# accepts a socket on specified port, writes on stdout and send back incoming data
import socket
import sys
if len(sys.argv)>=2 :
port = eval(sys.argv[1])
else : port = 25000
#create an INET, STREAMing socket
serversocket = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
#bind the socket to a public host,
# and a well-known port
serversocket.bind(("0.0.0.0", port))
#become a server socket
serversocket.listen(1)
#accept connections from outside
(clientsocket, address) = serversocket.accept()
#now do something with the clientsocket
#in this case, we'll pretend this is a threaded server
i = 0
while 1 :
chunk = clientsocket.recv(1024)
i = i + 1
sys.stdout.write(str(i)+' '+chunk)
if not chunk: break
clientsocket.send(str(i)+' '+chunk)
clientsocket.close()
print

View File

@@ -0,0 +1,487 @@
----------------------------------------------------------------------
Simple Anonymous Messaging (SAM version 3.0)
----------------------------------------------------------------------
Client application talks to SAM bridge, which deals with
all of the I2P functionality (using the ministreaming
lib for virtual streams, or I2CP directly for async messages).
All client<-->SAM bridge communication is unencrypted and
unauthenticated. Access to the SAM
bridge should be protected through firewalls or other means
(perhaps the bridge may have ACLs on what IPs it accepts
connections from).
All of these SAM messages are sent on a single line in plain ASCII,
terminated by the newline character (\n). The formatting shown
below is merely for readability, and while the first two words in
each message must stay in their specific order, the ordering of
the key=value pairs can change (e.g. "ONE TWO A=B C=D" or
"ONE TWO C=D A=B" are both perfectly valid constructions). In
addition, the protocol is case-sensitive.
In the following, message examples are preceded by "-> " for
messages sent by the client to the SAM bridge, and by "<- " for
messages sent by the SAM bridge to the client.
I2P communications can take three distinct forms:
* Virtual streams
* Repliable datagrams (messages with a FROM field)
* Anonymous datagrams (raw anonymous messages)
I2P communications are supported by I2P sessions, and each I2P
session is bound to an address (called destination). An I2P session
is associated with one of the three types above, and cannot carry
communications of another type.
----------------------------------------------------------------------
SAM connection handshake
----------------------------------------------------------------------
No SAM communication can occur until after the client and bridge have
agreed on a protocol version, which is done by the client sending
a HELLO and the bridge sending a HELLO REPLY:
-> HELLO VERSION MIN=$min MAX=$max
and
<- HELLO REPLY RESULT=OK VERSION=3.0
*** In order to force protocol version 3.0, the values of $min and $max
*** must be "3.0".
If the SAM bridge cannot find a suitable version, it replies with :
<- HELLO REPLY RESULT=NOVERSION
If some error occurred, such as a bad request format, it replies with :
<- HELLO REPLY RESULT=I2P_ERROR MESSAGE={$message}
----------------------------------------------------------------------
SAM sessions
----------------------------------------------------------------------
A SAM session is created by a client opening a socket to the SAM
bridge, operating a handshake, and sending a SESSION CREATE message,
and the session terminates when the socket is disconnected.
Each registered I2P Destination is uniquely associated with a session ID
(or nickname).
Each session is uniquely associated with :
* the socket from which the client creates the session
* its ID (or nickname)
The session creation message can only use one of these forms (messages
received through other forms are answered with an error message) :
-> SESSION CREATE
STYLE={STREAM,DATAGRAM,RAW}
ID={$nickname}
DESTINATION={$private_destination_key,TRANSIENT}
[option=value]*
DESTINATION specifies what destination should be used for
sending and receiving messages/streams. It has to be a suitable
private base64 destination key. If the destination is
specified as TRANSIENT, the SAM bridge creates a new destination.
{$nickname} is the choice of the client. No whitespace is allowed.
Additional options given are passed to the I2P session
configuration if not interpreted by the SAM bridge (e.g.
outbound.length=0). These options are documented below.
The SAM bridge itself should already be configured with what router
it should communicate over I2P through (though if need be there may
be a way to provide an override, e.g. i2cp.tcp.host=localhost and
i2cp.tcp.port=7654).
After receiving the session create message, the SAM bridge will reply
with a session status message, as follows:
If the creation was successful :
<- SESSION STATUS RESULT=OK DESTINATION={$private_destination_key}
If the nickname is already associated with a session :
<- SESSION STATUS RESULT=DUPLICATED_ID
If the destination is already in use :
<- SESSION STATUS RESULT=DUPLICATED_DEST
If the destination is not a valid private destination key :
<- SESSION STATUS RESULT=INVALID_KEY
If some other error has occurred :
<- SESSION STATUS RESULT=I2P_ERROR MESSAGE={$message}
If it's not OK, the MESSAGE should contain human-readable information
as to why the session could not be created.
SAM sessions live and die with the socket they are associated with.
When the socket is closed, the session dies, and all communications
using the session die at the same time. And the other way round, when
the session dies for any reason, the SAM bridge closes the socket.
----------------------------------------------------------------------
SAM virtual streams
----------------------------------------------------------------------
Virtual streams are guaranteed to be sent reliably and in order, with
failure and success notification as soon as it is available.
Streams are bidirectional communication sockets between two I2P
destinations, but their opening has to be requested by one of them.
Hereafter, CONNECT commands are used by the SAM client for such a
request. FORWARD / ACCEPT commands are used by the SAM client when
he wants to listen to requests coming from other I2P destinations.
-----------------------------
SAM virtual streams : CONNECT
-----------------------------
A client asks for a connection by :
* opening a new socket with the SAM bridge
* passing the same HELLO handshake as above
* sending the connection command :
-> STREAM CONNECT
ID={$nickname}
DESTINATION=$peer_public_base64_key
[SILENCE={true,false}]
This establishes a new virtual connection from the local session
whose ID is {$nickname} to the specified peer.
If SILENCE=true is passed, the SAM bridge won't issue any other message
on the socket : if the connection fails, the socket will be closed.
If the connection succeeds, all remaining data passing through the
current socket is forwarded from and to the connected I2P destination
peer.
If SILENCE=false, which is the default value, the SAM bridge sends a
last message to its client before forwarding or shutting down the
socket :
<- STREAM STATUS
RESULT=$result
[MESSAGE=...]
The RESULT value may be one of:
OK
CANT_REACH_PEER
I2P_ERROR
INVALID_KEY
INVALID_ID
TIMEOUT
If the RESULT is OK, all remaining data passing through the
current socket is forwarded from and to the connected I2P destination
peer. If the connection was not possible (timeout, etc),
RESULT will contain the appropriate error value (accompanied by an
optional human-readable MESSAGE), and the SAM bridge closes the
socket.
----------------------------
SAM virtual streams : ACCEPT
----------------------------
A client waits for an incoming connection request by :
* opening a new socket with the SAM bridge
* passing the same HELLO handshake as above
* sending the accept command :
-> STREAM ACCEPT
ID={$nickname}
[SILENCE={true,false}]
This makes the session ${nickname} listen for one incoming
connection request from the I2P network.
The SAM bridge answers with :
<- STREAM STATUS
RESULT=$result
[MESSAGE=...]
The RESULT value may be one of:
OK
I2P_ERROR
INVALID_ID
If the result is not OK, the socket is closed immediately by the SAM
bridge. If the result is OK, the SAM bridge starts waiting for an
incoming connection request from another I2P peer. When a request
arrives, the SAM bridge accepts it and :
* If SILENCE=true was passed, the SAM bridge won't issue any other message
on the client socket : all remaining data passing through the
current socket is forwarded from and to the connected I2P destination
peer.
* If SILENCE=false was passed, which is the default value, the SAM bridge
sends the client an ASCII line containing the base64 public destination key
of the requesting peer. After this '\n' terminated line, all remaining data
passing through the current socket is forwarded from and to the connected
I2P destination peer, until one of the peer closes the socket.
-----------------------------
SAM virtual streams : FORWARD
-----------------------------
A client can use a regular socket server and wait for connection requests
coming from I2P. For that, the client has to :
* open a new socket with the SAM bridge
* pass the same HELLO handshake as above
* send the forward command :
-> STREAM FORWARD
ID={$nickname}
PORT={$port}
[HOST={$host}]
[SILENCE={true,false}]
This makes the session ${nickname} listen for incoming
connection requests from the I2P network.
The SAM bridge answers with :
<- STREAM STATUS
RESULT=$result
[MESSAGE=...]
The RESULT value may be one of:
OK
I2P_ERROR
INVALID_ID
* {$host} is the hostname or IP address of the socket server to which
SAM will forward connection requests. If not given, SAM takes the IP
of the socket that issued the forward command.
* {$port} is the port number of the socket server to which SAM will
forward connection requests. It is mandatory.
When a connexion request arrives from I2P, the SAM bridge requests a
socket connexion from {$host}:{$port}. If it is accepted after no more
than 3 seconds, SAM will accept the connexion from I2P, and then :
* If SILENCE=true was passed, all data passing through the obtained
current socket is forwarded from and to the connected I2P destination
peer.
* If SILENCE=false was passed, which is the default value, the SAM bridge
sends on the obtained socket an ASCII line containing the base64 public
destination key of the requesting peer. After this '\n' terminated line,
all remaining data passing through the socket is forwarded from and to
the connected I2P destination peer, until one of the sides closes the
socket.
The I2P router will stop listening to incoming connection requests as
soon as the "forwarding" socket is closed.
----------------------------------------------------------------------
SAM repliable datagrams : sending a datagram
----------------------------------------------------------------------
While I2P doesn't inherently contain a FROM address, for ease of use
an additional layer is provided as repliable datagrams - unordered
and unreliable messages of up to 31KB in size that include a FROM
address (leaving up to 1KB for header material). This FROM address
is authenticated internally by SAM (making use of the destination's
signing key to verify the source) and includes replay prevention.
** First method :
After establishing a SAM session with STYLE=DATAGRAM, the client can
send datagrams through SAM's UDP port (7655).
The first line of a datagram sent through this port has to be in the
following format :
3.0 {$nickname} {$base64_public_destination_key}
* 3.0 is the version of SAM
* {$nickname} is the id of the DGRAM session that will be used
* {$base64_public_destination_key} is the destination of the
datagram
* this line is '\n' terminated.
The first line will be discarded by SAM before sending the remaining
of the message to the specified destination.
** Second method :
Datagrams can also be sent through the socket from which the datagram
session was opened. See the "DATAGRAM SEND" command of SAM versions 1
and 2.
----------------------------------------------------------------------
SAM repliable datagrams : receiving a datagram
----------------------------------------------------------------------
Received datagrams are written by SAM on the socket from which the
datagram session was opened, unless specified otherwise by the CREATE
command.
When a datagram arrives, the bridge delivers it to the client via the
message :
<- DATAGRAM RECEIVED
DESTINATION=$base64key
SIZE=$numBytes\n[$numBytes of data]
The SAM bridge never exposes to the client the authentication headers
or other fields, merely the data that the sender provided. This
continues until the session is closed (by the client dropping the
connection).
----------------------------------------------------------------------
SAM repliable datagrams : forwarding datagrams
----------------------------------------------------------------------
When creating a datagram session, the client can ask SAM to forward
incoming messages to a specified ip:port. It does so by issuing the
CREATE command with PORT and HOST options :
-> SESSION CREATE
STYLE=DATAGRAM
ID={$nickname}
DESTINATION={$private_destination_key,TRANSIENT}
PORT={$port}
[HOST={$host}]
[option=value]*
* {$host} is the hostname or IP address of the datagram server to
which SAM will forward datagrams. If not given, SAM takes the
IP of the socket that issued the forward command.
* {$port} is the port number of the datagram server to which SAM
will forward datagrams.
When a datagram arrives, the bridge sends to the specified host:port
a message containing the following data :
${sender_base64_destination_key}\n{$datagram_payload}
----------------------------------------------------------------------
SAM anonymous datagrams
----------------------------------------------------------------------
Squeezing the most out of I2P's bandwidth, SAM allows clients to send
and receive anonymous datagrams, leaving authentication and reply
information up to the client themselves. These datagrams are
unreliable and unordered, and may be up to 32KB in size.
After establishing a SAM session with STYLE=RAW, the client can
send anonymous datagrams throug the SAM bridge exactly the same way
he sends non anonymous datagrams.
Both ways of receiving datagrams are also available for anonymous
datagrams.
When anonymous datagrams are to be written to the socket that created
the session,the bridge delivers it to the client via:
<- RAW RECEIVED
SIZE=$numBytes\n[$numBytes of data]
When anonymous datagrams are to be forwarded to some host:port,
the bridge sends to the specified host:port a message containing
the following data :
{$datagram_payload}
----------------------------------------------------------------------
SAM utility functionality
----------------------------------------------------------------------
The following message can be used by the client to query the SAM
bridge for name resolution:
NAMING LOOKUP
NAME=$name
which is answered by
NAMING REPLY
RESULT=$result
NAME=$name
[VALUE=$base64key]
[MESSAGE=$message]
The RESULT value may be one of:
OK
INVALID_KEY
KEY_NOT_FOUND
If NAME=ME, then the reply will contain the base64key used by the
current session (useful if you're using a TRANSIENT one). If $result
is not OK, MESSAGE may convey a descriptive message, such as "bad
format", etc.
Public and private base64 keys can be generated using the following
message:
DEST GENERATE
which is answered by
DEST REPLY
PUB=$pubkey
PRIV=$privkey
----------------------------------------------------------------------
RESULT values
----------------------------------------------------------------------
These are the values that can be carried by the RESULT field, with
their meaning:
OK Operation completed succesfully
CANT_REACH_PEER The peer exists, but cannot be reached
DUPLICATED_DEST The specified Destination is already in use
I2P_ERROR A generic I2P error (e.g. I2CP disconnection, etc.)
INVALID_KEY The specified key is not valid (bad format, etc.)
KEY_NOT_FOUND The naming system can't resolve the given name
PEER_NOT_FOUND The peer cannot be found on the network
TIMEOUT Timeout while waiting for an event (e.g. peer answer)
----------------------------------------------------------------------
Tunnel Pool Options
----------------------------------------------------------------------
These options can be passed in as name=value pairs at the end of a
SAM SESSION CREATE line.
inbound.nickname - Name shows up in I2P router console.
inbound.quantity - Number of tunnels, default 2.
inbound.backupQuantity - Number of backup tunnels, default 0.
inbound.rebuildPeriod - Obsolete - ignored - the router controls rebuilding
inbound.duration - Tunnels last X ms, default 10*60*1000.
(change not recommended, will break anonymmity
if it works at all)
inbound.length - Depth of tunnels, default 2.
inbound.lengthVariance - If negative, randomly skews from
(length - variance) to
(length + variance). If positive, from
length to (length + var), inclusive.
Default -1.
inbound.allowZeroHop - Zero hop allowed? Default "true".
outbound.* - Same properties as inbound.
i2p.streaming.connectDelay - If 0, connect ASAP. If positive, wait
until X ms have passed or output stream
is flushed or buffer fills. Default 0.
i2p.streaming.maxWindowSize - Max window size, default 64.
----------------------------------------------------------------------
Client library implementations:
----------------------------------------------------------------------
C/C++: libSAM: http://www.innographx.com/mpc/libsam/ or i2p/sam/c/
Python: Python/I2P: http://dev.i2p.net/contrib/apps/sam/python/index.html
Others: See apps/sam/ in I2P CVS.

View File

@@ -4,6 +4,7 @@
<target name="build" depends="builddep, jar" />
<target name="builddep">
<ant dir="../../ministreaming/java/" target="build" />
<ant dir="../../streaming/java/" target="build" />
<!-- ministreaming will build core -->
</target>
<condition property="depend.available">
@@ -18,9 +19,11 @@
<classpath>
<pathelement location="../../../core/java/build/obj" />
<pathelement location="../../ministreaming/java/build/obj" />
<pathelement location="../../streaming/java/build/obj" />
</classpath>
</depend>
</target>
<property name="javac.compilerargs" value="" />
<target name="compile" depends="depend">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
@@ -28,20 +31,24 @@
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:../../streaming/java/build/streaming.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
<target name="compileTest" depends="compile">
<javac
srcdir="./test"
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:../../streaming/java/build/streaming.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
<target name="jar" depends="compile">
<jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.sam.SAMBridge" />
<attribute name="Class-Path" value="i2p.jar mstreaming.jar" />
<attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
</manifest>
</jar>
</target>
@@ -52,7 +59,7 @@
<mkdir dir="./build" />
<mkdir dir="./build/javadoc" />
<javadoc
sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc"
sourcepath="./src:../../../core/java/src:../../ministreaming/java/src:../../streaming/java/src" destdir="./build/javadoc"
packagenames="*"
use="true"
splitindex="true"
@@ -64,9 +71,11 @@
<target name="cleandep" depends="clean">
<!-- ministreaming will clean core -->
<ant dir="../../ministreaming/java/" target="distclean" />
<ant dir="../../streaming/java/" target="distclean" />
</target>
<target name="distclean" depends="clean">
<!-- ministreaming will clean core -->
<ant dir="../../ministreaming/java/" target="distclean" />
<ant dir="../../streaming/java/" target="distclean" />
</target>
</project>

View File

@@ -14,9 +14,10 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -34,7 +35,7 @@ import net.i2p.util.Log;
*/
public class SAMBridge implements Runnable {
private final static Log _log = new Log(SAMBridge.class);
private ServerSocket serverSocket;
private ServerSocketChannel serverSocket;
private Properties i2cpProps;
/**
* filename in which the name to private key mapping should
@@ -45,12 +46,23 @@ public class SAMBridge implements Runnable {
* app designated destination name to the base64 of the I2P formatted
* destination keys (Destination+PrivateKey+SigningPrivateKey)
*/
private Map nameToPrivKeys;
private Map<String,String> nameToPrivKeys;
private boolean acceptConnections = true;
private static final int SAM_LISTENPORT = 7656;
public static final String DEFAULT_SAM_KEYFILE = "sam.keys";
public static final String PROP_TCP_HOST = "sam.tcp.host";
public static final String PROP_TCP_PORT = "sam.tcp.port";
protected static final String DEFAULT_TCP_HOST = "0.0.0.0";
protected static final String DEFAULT_TCP_PORT = "7656";
public static final String PROP_DATAGRAM_HOST = "sam.udp.host";
public static final String PROP_DATAGRAM_PORT = "sam.udp.port";
protected static final String DEFAULT_DATAGRAM_HOST = "0.0.0.0";
protected static final String DEFAULT_DATAGRAM_PORT = "7655";
private SAMBridge() {}
@@ -64,16 +76,18 @@ public class SAMBridge implements Runnable {
*/
public SAMBridge(String listenHost, int listenPort, Properties i2cpProps, String persistFile) {
persistFilename = persistFile;
nameToPrivKeys = new HashMap(8);
nameToPrivKeys = new HashMap<String,String>(8);
loadKeys();
try {
if ( (listenHost != null) && !("0.0.0.0".equals(listenHost)) ) {
serverSocket = new ServerSocket(listenPort, 0, InetAddress.getByName(listenHost));
serverSocket = ServerSocketChannel.open();
serverSocket.socket().bind(new InetSocketAddress(listenHost, listenPort));
if (_log.shouldLog(Log.DEBUG))
_log.debug("SAM bridge listening on "
+ listenHost + ":" + listenPort);
} else {
serverSocket = new ServerSocket(listenPort);
serverSocket = ServerSocketChannel.open();
serverSocket.socket().bind(new InetSocketAddress(listenPort));
if (_log.shouldLog(Log.DEBUG))
_log.debug("SAM bridge listening on 0.0.0.0:" + listenPort);
}
@@ -191,36 +205,50 @@ public class SAMBridge implements Runnable {
}
}
static class HelpRequested extends Exception {static final long serialVersionUID=0x1;}
/**
* Usage:
* <pre>SAMBridge [[listenHost ]listenPort[ name=val]*]</pre>
*
* <pre>SAMBridge [ keyfile [listenHost ] listenPort [ name=val ]* ]</pre>
* or:
* <pre>SAMBridge [ name=val ]* </pre>
*
* name=val options are passed to the I2CP code to build a session,
* allowing the bridge to specify an alternate I2CP host and port, tunnel
* depth, etc.
* @param args [[listenHost ]listenPort[ name=val]*]
* @param args [ keyfile [ listenHost ] listenPort [ name=val ]* ]
*/
public static void main(String args[]) {
String keyfile = DEFAULT_SAM_KEYFILE;
int port = SAM_LISTENPORT;
String host = "0.0.0.0";
String host = DEFAULT_TCP_HOST;
Properties opts = null;
if (args.length > 0) {
keyfile = args[0];
int portIndex = 1;
try {
port = Integer.parseInt(args[portIndex]);
} catch (NumberFormatException nfe) {
host = args[1];
portIndex++;
try {
port = Integer.parseInt(args[portIndex]);
} catch (NumberFormatException nfe1) {
usage();
return;
}
}
opts = parseOptions(args, portIndex+1);
try {
opts = parseOptions(args, 0);
keyfile = args[0];
int portIndex = 1;
try {
if (args.length>portIndex) port = Integer.parseInt(args[portIndex]);
} catch (NumberFormatException nfe) {
host = args[portIndex];
portIndex++;
try {
if (args.length>portIndex) port = Integer.parseInt(args[portIndex]);
} catch (NumberFormatException nfe1) {
try {
port = Integer.parseInt(opts.getProperty(SAMBridge.PROP_TCP_PORT, SAMBridge.DEFAULT_TCP_PORT));
host = opts.getProperty(SAMBridge.PROP_TCP_HOST, SAMBridge.DEFAULT_TCP_HOST);
} catch (NumberFormatException e) {
usage();
return;
}
}
}
} catch (HelpRequested e) {
usage();
return;
}
}
SAMBridge bridge = new SAMBridge(host, port, opts, keyfile);
I2PAppThread t = new I2PAppThread(bridge, "SAMListener");
@@ -236,10 +264,11 @@ public class SAMBridge implements Runnable {
t.start();
}
private static Properties parseOptions(String args[], int startArgs) {
private static Properties parseOptions(String args[], int startArgs) throws HelpRequested {
Properties props = new Properties();
// skip over first few options
for (int i = startArgs; i < args.length; i++) {
if (args[i].equals("-h")) throw new HelpRequested();
int eq = args[i].indexOf('=');
if (eq <= 0) continue;
if (eq >= args[i].length()-1) continue;
@@ -255,50 +284,76 @@ public class SAMBridge implements Runnable {
private static void usage() {
System.err.println("Usage: SAMBridge [keyfile [listenHost] listenPortNum[ name=val]*]");
System.err.println("or:");
System.err.println(" SAMBridge [ name=val ]*");
System.err.println(" keyfile: location to persist private keys (default sam.keys)");
System.err.println(" listenHost: interface to listen on (0.0.0.0 for all interfaces)");
System.err.println(" listenPort: port to listen for SAM connections on (default 7656)");
System.err.println(" name=val: options to pass when connecting via I2CP, such as ");
System.err.println(" i2cp.host=localhost and i2cp.port=7654");
System.err.println("");
System.err.println("Host and ports of the SAM bridge can be specified with the alternate");
System.err.println("form by specifying options "+SAMBridge.PROP_TCP_HOST+" and/or "+
SAMBridge.PROP_TCP_PORT);
System.err.println("");
System.err.println("Options "+SAMBridge.PROP_DATAGRAM_HOST+" and "+SAMBridge.PROP_DATAGRAM_PORT+
" specify the listening ip");
System.err.println("range and the port of SAM datagram server. This server is");
System.err.println("only launched after a client creates the first SAM datagram");
System.err.println("or raw session, after a handshake with SAM version >= 3.0.");
System.err.println("");
System.err.println("The option loglevel=[DEBUG|WARN|ERROR|CRIT] can be used");
System.err.println("for tuning the log verbosity.\n");
}
public void run() {
if (serverSocket == null) return;
try {
while (acceptConnections) {
Socket s = serverSocket.accept();
SocketChannel s = serverSocket.accept();
if (_log.shouldLog(Log.DEBUG))
_log.debug("New connection from "
+ s.getInetAddress().toString() + ":"
+ s.getPort());
+ s.socket().getInetAddress().toString() + ":"
+ s.socket().getPort());
try {
SAMHandler handler = SAMHandlerFactory.createSAMHandler(s, i2cpProps);
if (handler == null) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("SAM handler has not been instantiated");
class HelloHandler implements Runnable {
SocketChannel s ;
SAMBridge parent ;
HelloHandler(SocketChannel s, SAMBridge parent) {
this.s = s ;
this.parent = parent ;
}
public void run() {
try {
s.close();
} catch (IOException e) {}
continue;
}
handler.setBridge(this);
handler.startHandling();
} catch (SAMException e) {
if (_log.shouldLog(Log.ERROR))
_log.error("SAM error: " + e.getMessage(), e);
try {
String reply = "HELLO REPLY RESULT=I2P_ERROR MESSAGE=\"" + e.getMessage() + "\"\n";
s.getOutputStream().write(reply.getBytes("ISO-8859-1"));
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR))
_log.error("SAM Error sending error reply", ioe);
}
try { s.close(); } catch (IOException ioe) {}
} catch (Exception ee) {
try { s.close(); } catch (IOException ioe) {}
_log.log(Log.CRIT, "Unexpected error handling SAM connection", ee);
}
SAMHandler handler = SAMHandlerFactory.createSAMHandler(s, i2cpProps);
if (handler == null) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("SAM handler has not been instantiated");
try {
s.close();
} catch (IOException e) {}
return;
}
handler.setBridge(parent);
handler.startHandling();
} catch (SAMException e) {
if (_log.shouldLog(Log.ERROR))
_log.error("SAM error: " + e.getMessage(), e);
try {
String reply = "HELLO REPLY RESULT=I2P_ERROR MESSAGE=\"" + e.getMessage() + "\"\n";
s.write(ByteBuffer.wrap(reply.getBytes("ISO-8859-1")));
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR))
_log.error("SAM Error sending error reply", ioe);
}
try { s.close(); } catch (IOException ioe) {}
} catch (Exception ee) {
try { s.close(); } catch (IOException ioe) {}
_log.log(Log.CRIT, "Unexpected error handling SAM connection", ee);
}
}
}
new I2PAppThread(new HelloHandler(s,this), "HelloHandler").start();
}
} catch (Exception e) {
if (_log.shouldLog(Log.ERROR))

View File

@@ -30,7 +30,7 @@ public class SAMDatagramSession extends SAMMessageSession {
private final static Log _log = new Log(SAMDatagramSession.class);
public static int DGRAM_SIZE_MAX = 31*1024;
private SAMDatagramReceiver recv = null;
protected SAMDatagramReceiver recv = null;
private I2PDatagramMaker dgramMaker;
private I2PDatagramDissector dgramDissector = new I2PDatagramDissector();
@@ -84,9 +84,10 @@ public class SAMDatagramSession extends SAMMessageSession {
public boolean sendBytes(String dest, byte[] data) throws DataFormatException {
if (data.length > DGRAM_SIZE_MAX)
throw new DataFormatException("Datagram size exceeded (" + data.length + ")");
byte[] dgram = dgramMaker.makeI2PDatagram(data);
byte[] dgram ;
synchronized (dgramMaker) {
dgram = dgramMaker.makeI2PDatagram(data);
}
return sendBytesThroughMessageSession(dest, dgram);
}

View File

@@ -15,11 +15,13 @@ package net.i2p.sam;
*/
public class SAMException extends Exception {
static final long serialVersionUID = 1 ;
public SAMException() {
super();
super();
}
public SAMException(String s) {
super(s);
super(s);
}
}

View File

@@ -9,9 +9,8 @@ package net.i2p.sam;
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.channels.SocketChannel;
import java.nio.ByteBuffer;
import java.util.Properties;
import net.i2p.util.I2PAppThread;
@@ -32,8 +31,7 @@ public abstract class SAMHandler implements Runnable {
protected SAMBridge bridge = null;
private Object socketWLock = new Object(); // Guards writings on socket
private Socket socket = null;
private OutputStream socketOS = null; // Stream associated to socket
protected SocketChannel socket = null;
protected int verMajor = 0;
protected int verMinor = 0;
@@ -53,10 +51,9 @@ public abstract class SAMHandler implements Runnable {
* @param i2cpProps properties to configure the I2CP connection (host, port, etc)
* @throws IOException
*/
protected SAMHandler(Socket s,
protected SAMHandler(SocketChannel s,
int verMajor, int verMinor, Properties i2cpProps) throws IOException {
socket = s;
socketOS = socket.getOutputStream();
this.verMajor = verMajor;
this.verMinor = verMinor;
@@ -86,8 +83,8 @@ public abstract class SAMHandler implements Runnable {
* @return input stream
* @throws IOException
*/
protected final InputStream getClientSocketInputStream() throws IOException {
return socket.getInputStream();
protected final SocketChannel getClientSocket() {
return socket ;
}
/**
@@ -98,13 +95,17 @@ public abstract class SAMHandler implements Runnable {
* @param data A byte array to be written
* @throws IOException
*/
protected final void writeBytes(byte[] data) throws IOException {
protected final void writeBytes(ByteBuffer data) throws IOException {
synchronized (socketWLock) {
socketOS.write(data);
socketOS.flush();
writeBytes(data, socket);
}
}
static public void writeBytes(ByteBuffer data, SocketChannel out) throws IOException {
while (data.hasRemaining()) out.write(data);
out.socket().getOutputStream().flush();
}
/**
* If you're crazy enough to write to the raw socket, grab the write lock
* with getWriteLock(), synchronize against it, and write to the getOut()
@@ -112,7 +113,6 @@ public abstract class SAMHandler implements Runnable {
* @return socket Write lock object
*/
protected Object getWriteLock() { return socketWLock; }
protected OutputStream getOut() { return socketOS; }
/**
* Write a string to the handler's socket. This method must
@@ -121,21 +121,25 @@ public abstract class SAMHandler implements Runnable {
*
* @param str A byte array to be written
*
* @return True is the string was successfully written, false otherwise
* @return True if the string was successfully written, false otherwise
*/
protected final boolean writeString(String str) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Sending the client: [" + str + "]");
try {
writeBytes(str.getBytes("ISO-8859-1"));
return writeString(str, socket);
}
public static boolean writeString(String str, SocketChannel out)
{
try {
writeBytes(ByteBuffer.wrap(str.getBytes("ISO-8859-1")), out);
} catch (IOException e) {
_log.debug("Caught IOException", e);
return false;
}
return true;
return true ;
}
/**
* Close the socket connected to the SAM client.
*
@@ -178,8 +182,8 @@ public abstract class SAMHandler implements Runnable {
return ("SAM handler (class: " + this.getClass().getName()
+ "; SAM version: " + verMajor + "." + verMinor
+ "; client: "
+ this.socket.getInetAddress().toString() + ":"
+ this.socket.getPort() + ")");
+ this.socket.socket().getInetAddress().toString() + ":"
+ this.socket.socket().getPort() + ")");
}
public final void run() {

Some files were not shown because too many files have changed in this diff Show More