Compare commits

...

266 Commits

Author SHA1 Message Date
c0fd1dbcbc * Update versions, package release 2009-06-12 06:52:09 +00:00
zzz
a08dd4aefa * NTCP: Fix startup race NPE 2009-06-09 03:06:18 +00:00
be52b5930c 2009-06-08 sponge
* Last commit for this cycle. All debugging except for WARN removed.
      I can use the visit command to debug now anyway.
2009-06-08 14:42:44 +00:00
0382120363 2009-06-08 sponge
* Removed BOB debugging as-per zzz
2009-06-08 12:24:20 +00:00
7151590abc 2009-06-08 sponge
* Fixed NPE and some other goofups in BOB.
    * BOB bump version
2009-06-08 08:34:54 +00:00
zzz
51faed2c4d -15 2009-06-07 17:40:18 +00:00
zzz
c1a8c8a3fd propagate from branch 'i2p.i2p.zzz.test' (head ff346bd41de699648bb66488ec9c0f1f4b5300b1)
to branch 'i2p.i2p' (head 2914d3356f892de25a745f061129704f8b943fc5)
2009-06-07 17:35:02 +00:00
zzz
4975d30714 * ExploratoryPeerSelector: Limit to connected peers when near connection limit 2009-06-07 17:34:27 +00:00
zzz
45d9f9d07d -14 2009-06-07 14:47:04 +00:00
zzz
9b0e553ece propagate from branch 'i2p.i2p.zzz.test' (head f92f40cceea44a063e48db07d10fd8cf7df3e348)
to branch 'i2p.i2p' (head c497aec52c49d2e03430b88d8d73148ee73e59a5)
2009-06-07 14:45:33 +00:00
zzz
dcaa0594f1 Add updaterWithJettyFixesAndGeoIP, use it for pkg for one release 2009-06-07 14:13:01 +00:00
zzz
1202a303b7 Fix UPnP deprecation 2009-06-06 18:40:49 +00:00
ed8fd0bde2 Fixed bug causing congestion-avoidance code to not get executed. 2009-06-06 17:42:33 +00:00
zzz
834bfde45c * Timestamper: Use locale country if geoip unavailable 2009-06-06 16:34:32 +00:00
zzz
4c4b3b776c Try to alleviate connection-limit network collapse:
* Transport:
      - Lower min NTCP idle time to 3m (was 5m)
      - Increase SSU conn limit by 33%
    * Watchdog:
      - Defang him again
2009-06-06 15:14:05 +00:00
eee160503b 2009-06-06 sponge
* Added BOB's liscense to liscenses
    * Janitorial javadoc fixes *sigh*
    * bump to -13
2009-06-06 06:27:29 +00:00
bef55b25ea Javadocs cleanup *sigh* 2009-06-06 06:18:50 +00:00
623f972e8b Branching 2009-06-06 05:54:55 +00:00
zzz
7e651d53a0 netdb.jsp cleanup 2009-06-05 23:43:10 +00:00
zzz
5d212d3cea propagate from branch 'i2p.i2p' (head 06964a7526a814c5adc7baf4d273f57fe832afc2)
to branch 'i2p.i2p.zzz.test' (head 177659fa31e4f1807874564c921152601bbf420f)
2009-06-05 23:17:48 +00:00
zzz
3e31de1602 tunnels.jsp cleanup 2009-06-05 23:17:15 +00:00
245b7168ab 2009-06-05 sponge
* Merge and bump to -12
2009-06-05 20:32:49 +00:00
4a9b567ebd merge of 'ba538963b768e5137d3807a155360420640806bd'
and 'e10df19521ce47ba4fa825a910fdd0aef26892e2'
2009-06-05 19:59:07 +00:00
2f6ae99452 2009-06-05 sponge
* BOB now cleans up tunnels, although they can take up to 5 minutes to
      disapear. This is due to the fact that the streaming lib doesn't
      actually remove the connections properly and kill them off when the
      manager is destroyed. I'm not certain if this is a bug, or a feature,
      but it sure is annoying, and you have to wait for the connections to
      time out. What should happen is the streaming lib should cause an IO
      error to the pending read or write.
2009-06-05 19:46:26 +00:00
zzz
1538ba0cc3 16x11 transparent flags for ch and np, thanks anonim! 2009-06-05 15:46:02 +00:00
zzz
06a3417124 Add some licenses for launch4j includes, clean up build.xml some more 2009-06-05 00:59:44 +00:00
zzz
8ff2724213 Update geoip files from the June 3 release 2009-06-04 17:40:25 +00:00
zzz
a9a2d2debb -11 2009-06-04 16:37:29 +00:00
zzz
0070abc04c propagate from branch 'i2p.i2p.zzz.test' (head be1a2452acf68a8a0137f98f5aeb797055321d6e)
to branch 'i2p.i2p' (head bd6b02d1ae8a99afcea7fdffedf699a6e5c85fbf)
2009-06-04 16:28:32 +00:00
zzz
936a338e0e watchdog logging tweaks, allow disable by property 2009-06-04 16:23:51 +00:00
zzz
6c349d0ec4 Add standby indication to i2ptunnel page 2009-06-04 16:06:39 +00:00
zzz
7e1e3c3c32 * I2PTunnel:
- Fix bug where delayed-open and close-on-idle tunnels would
        use a different tunnel pool instead of building their own
2009-06-04 15:14:41 +00:00
zzz
ce23d76c72 If we dont know any good floodfills, try to connect to one 2009-06-04 14:42:27 +00:00
zzz
cb488ebf7b merge of 'cb50ec528ada3d7afd3bf8353d474599872fe931'
and 'd64f30fdfc808f4fa609db468a497e8fc005f116'
2009-06-03 19:07:36 +00:00
zzz
7931451a49 * Reseed: Limit to 200 per URL, shuffle selection, add some logging 2009-06-03 19:05:55 +00:00
zzz
59449cf513 change startup no-ff errror to warn 2009-06-03 15:32:08 +00:00
zzz
39e5ff7eaa add checklist step to look for untrusted revs 2009-06-02 21:33:15 +00:00
zzz
b430b02021 make default bw 96/40 2009-06-01 23:36:11 +00:00
zzz
0bc67f5a89 Rename install*txt files 2009-06-01 20:03:00 +00:00
zzz
56dc96de1e Report average tx and rx rates, effective in next release 2009-06-01 19:55:36 +00:00
zzz
3ccbf37b41 hide some things if no wrapper 2009-06-01 19:52:55 +00:00
zzz
7725b9e8a1 -10 2009-05-30 16:34:58 +00:00
zzz
f511c9bc90 propagate from branch 'i2p.i2p.zzz.test' (head 177f3f7dbb937e60486cb90da7bbcdf9987ffced)
to branch 'i2p.i2p' (head d2424406b9f3877644a1334df71313b6cba018e4)
2009-05-30 16:28:51 +00:00
zzz
56b768fe19 cleanup 2009-05-30 16:15:17 +00:00
zzz
f8901e94a9 cleanup 2009-05-30 15:51:55 +00:00
zzz
ec5cc7e4d3 cleanup 2009-05-30 15:48:56 +00:00
zzz
2413bcd99a configadvanced cleanup, clarification 2009-05-30 15:48:16 +00:00
zzz
1838ad4ae7 * UPnP:
- Retry port forward if it fails
      - Make peers.jsp display faster
      - Lengthen POST timeout
      - More comments
2009-05-30 15:47:20 +00:00
26c4f983d7 * added big fat start/stop lock into BOB
* added zap command to shut down BOB... now we need a way to start it
      after it stops. :-)
2009-05-29 21:14:08 +00:00
zzz
22609bbfdb * SessionKeyManager:
- More stubs for per-destination managers.
        No functional changes yet.
2009-05-29 13:57:50 +00:00
zzz
0a8cbcbfb6 * LoadTestManager: Delete, unused
* SendGarlicMessageJob: Delete, unused
    * config.jsp: Comment out unused burst config code
2009-05-29 12:08:36 +00:00
zzz
7f33051fe1 Add Serbia 2009-05-29 12:06:53 +00:00
zzz
e65c2e279b * Session Keys:
- Don't instantiate unused SessionKeyPersistenceHelper
      - Use TransientSessionKeyManager instead of PersistentSessionKeyManager
      - Add generics to TransientSessionKeyManager to help understand it
      - Change initial session map size to 64 (was 1024)
      - Prepare for per-destination SessionKeyManagers in ElGamalAESEngine
2009-05-29 10:00:06 +00:00
zzz
b43338bd63 * Transports:
- Adjust bids when near conn capacity
      - peers.jsp HTML fixes
2009-05-28 16:19:55 +00:00
zzz
65ae9138ef * Console:
- config.jsp now cause graceful restart
    * UPnP:
      - Tweak to help startup problems
   * UDP:
      - Only save IP when it changes
2009-05-28 13:49:57 +00:00
zzz
665b691711 UPnP: Prevent NPE after ParserException 2009-05-28 03:35:54 +00:00
zzz
87953c4b93 * Peer Selector: Make strict order opaque to hash value 2009-05-27 16:59:38 +00:00
zzz
be480d577c more peers.jsp and profiles.jsp cleanup 2009-05-27 16:27:57 +00:00
zzz
32566a43bd remove some unused UDP stats and test code 2009-05-27 15:47:49 +00:00
fd598dea5b * Increase sendProcessingTime some more, add a property to configure.
Configure with 'router.defaultProcessingTimeThrottle'.
2009-05-27 13:26:51 +00:00
8fef5d9a06 * Increased sendProcessingTime limits and added testSuccessTime
to avoid unwanted throttling
2009-05-27 09:01:14 +00:00
zzz
2f1d6e3f90 * Console:
- Use CSS for form messages
      - Goodbye nonce spoof message
      - tunnels.jsp improvements
2009-05-26 20:04:20 +00:00
53f62bd8dd * Throttling extension by looking at sendProcessingTime 2009-05-26 17:24:31 +00:00
zzz
e6c87c54be -7 2009-05-26 15:05:39 +00:00
zzz
ee3edc9661 propagate from branch 'i2p.i2p.zzz.test' (head dc817d70812b80e35a7c37eaa881e4b866435838)
to branch 'i2p.i2p' (head 5551e9b0487e14e901cd1081ce3e1ffd33c4a354)
2009-05-26 15:02:52 +00:00
zzz
32dddac75b * Streaming:
- Fix infinite loop through the SYN queue caused by race,
        resulting in high CPU, OOMs, etc.
2009-05-26 14:50:16 +00:00
zzz
906482823c Flags fixup 2009-05-26 14:48:58 +00:00
zzz
91c389777a clean up configlogging.jsp 2009-05-26 01:04:34 +00:00
zzz
042a08b90e * NetDb:
- Don't send our own hash in the don't-include list when exploring
      - Remove any pending write when removing a RouterInfo
      - Cleanup to use routerHash()
2009-05-25 16:34:26 +00:00
zzz
7f4c23a038 -6 2009-05-25 03:49:36 +00:00
zzz
e7b0691116 propagate from branch 'i2p.i2p.zzz.test' (head ea09c1bd1791674541854e77592153db6678aabb)
to branch 'i2p.i2p' (head 7ea5131c7a02f28ac2d3e23a8bf22558effb30ee)
2009-05-25 03:45:09 +00:00
zzz
235058eab1 * NTCP:
- Increasse routerinfo send frequency to every 90m (was 9h)
      - Don't send 3 floodfill infos at startup or with routerinfo
2009-05-25 03:34:58 +00:00
zzz
85963a5c72 more fast peers when more local dests 2009-05-25 03:22:01 +00:00
zzz
c639525c1d * Timestamper:
- Use GeoIP to query a closer ntp source if available
      - Lengthen query time if well-synced
      - Cleanup
2009-05-24 20:50:38 +00:00
zzz
de18ebbb73 save our own geoip location in the config 2009-05-24 18:30:47 +00:00
zzz
47e32c82fc fix geoip scan of all routerinfos at startup 2009-05-24 17:03:50 +00:00
71b708b0f2 -1
-5
merge of '8dc3dbded4d489ddca319052bf3cdb0c4d5a13cc'
     and 'afcd808741bf31d75eee2639e19d5e8946b62756'
2009-05-24 16:20:28 +00:00
ab9fee260f -5
SAMv1 and SAMv3 : logging some exception at INFO level
2009-05-24 16:12:39 +00:00
e86e42818a SAMv1 and SAMv3 : logging some exception at INFO level 2009-05-24 16:04:57 +00:00
zzz
067e76c1b0 -4 2009-05-24 14:40:27 +00:00
zzz
13b3bb4490 propagate from branch 'i2p.i2p.zzz.test' (head 4f0b8b8bb59f1a8e2181123c16c4099ea223e527)
to branch 'i2p.i2p' (head b977f0e1e1ca57e78d599943dcbf492e474c631a)
2009-05-24 14:37:27 +00:00
zzz
e82898c988 * Console - add readme_zh.html:
- Submitter (walking) reports encoding as GB2312, and tested on windows
        with ff, IE6, chrome and opera. UTF-8 doesn't work. Still don't know why.
2009-05-24 14:30:55 +00:00
zzz
f4fdbceb3b * SSU: Don't offer to introduce when near connection limit 2009-05-24 00:29:18 +00:00
zzz
c75ff538a3 a little peers.jsp cleanup 2009-05-23 20:23:28 +00:00
zzz
7e71ead3e9 * Connection limits / throttle:
- Better limits when no inbound TCP
        (limit inbound and outbound separately)
    * GeoIP:
      - Check netDb SSU IP too
      - Check whole netDb at startup
2009-05-23 19:43:02 +00:00
29489ad198 Error in the geoip html. 2009-05-23 17:24:44 +00:00
eac45256aa * Router netDB:
- Added flags to the netDB page
2009-05-23 16:40:18 +00:00
zzz
7feb97e415 more info than just nuh uh 2009-05-23 14:37:25 +00:00
zzz
695752629d Move upnp logging from wrapper log to router log 2009-05-23 14:09:37 +00:00
zzz
c3c20ceca4 fix comments 2009-05-22 15:17:47 +00:00
zzz
aa04820fd1 move icons/ to docs/ 2009-05-22 13:23:52 +00:00
3208b7289e * desktopgui:
- Updating works in general config
      - Switched to Swingworker threads for improved responsiveness
      - version increase to 0.1.3
2009-05-21 22:32:34 +00:00
zzz
b4336fdec7 -3 w/ watchdog changes 2009-05-21 15:44:05 +00:00
zzz
e0652a4607 propagate from branch 'i2p.i2p.zzz.test' (head 326752c8c7ce00bc6787fe25e315448ce7124aff)
to branch 'i2p.i2p' (head b73ed9af5ee4f058a2b84f96de92f7cdc7ee0196)
2009-05-21 15:40:50 +00:00
zzz
4ab46b1de8 * Watchdog:
- Log memory stats
      - Dump threads on linux
      - Restart after 20 minutes (give the dog his teeth back)
2009-05-21 15:40:33 +00:00
zzz
d7122cdad7 -2 2009-05-21 13:43:23 +00:00
zzz
9c3eac58f1 propagate from branch 'i2p.i2p.zzz.test' (head 97efbce521018c26030e229181a53adce5774ab6)
to branch 'i2p.i2p' (head e9c81b8ce06374554965eacae3ae64df995b26df)
2009-05-21 13:25:04 +00:00
zzz
79954cec68 increase eepsite hops to 3+0 for new installs 2009-05-21 13:19:34 +00:00
zzz
d927f8bcb0 message tweaks if no wrapperr 2009-05-21 13:12:47 +00:00
zzz
4426cc359c * ExpireRoutersJob:
- Rewrite, not enabled yet
    * TunnelManager:
      - Remove now-unused isInUse()
2009-05-21 00:34:10 +00:00
zzz
b1465b7dff * Console:
- Add a little color to confignav
      - Remove 'no skew' indication
2009-05-20 22:50:14 +00:00
zzz
438ea1b269 fix db writes to disk broken in last checkin 2009-05-20 22:35:56 +00:00
f10bfda115 * General configuration enabled by default
* General configuration speed tab works completely
2009-05-20 19:58:55 +00:00
zzz
b7e2d3a10b add some comments 2009-05-20 18:12:17 +00:00
zzz
846c5fcfc3 * Console:
- Use flags for shitlist and peers.jsp too
      - Tweak tunnels.jsp to show class letters
      - Hide in-progress details on tunnels.jsp
2009-05-20 15:49:39 +00:00
zzz
31cd726b7b * UPnP:
- Fix up port handling, add some logging on bind fails
      - Force IPv4 only for binds
2009-05-20 15:01:43 +00:00
zzz
3ba43a77f4 Add geoip support and flag icons 2009-05-19 18:07:19 +00:00
zzz
cb5390b2fb propagate from branch 'i2p.i2p' (head 31ab45aaed880aa1d8295541b813adb312582f17)
to branch 'i2p.i2p.zzz.test' (head 8f1820175b7df8fc1f880c4fe1104f1b0e633483)
2009-05-18 18:22:24 +00:00
zzz
fae7262d31 * DataStore:
- Adjust interface to have persistent and non-persistent methods,
        to prepare for partial storage in RAM
    * PersistentDataStore:
      - Cleanup, simplify, and concurrentify
      - Tweak stats
      - Remove write limit
      - Flush to disk on shutdown
      - Don't write out what we just read in
2009-05-18 18:21:56 +00:00
zzz
9b6abc1e19 add all the languages izpack has to the installer 2009-05-17 15:45:14 +00:00
zzz
631cd37f8b -1 2009-05-17 12:35:45 +00:00
zzz
b59a38ffad propagate from branch 'i2p.i2p.zzz.upnp' (head 348acc252da725bc621791ef811a43943e889833)
to branch 'i2p.i2p' (head 264d0119a37e276dce2996f360f9c8e065b30008)
2009-05-17 12:28:27 +00:00
zzz
9a6a993a81 history for prop 2009-05-17 12:23:51 +00:00
zzz
9234a94da9 propagate from branch 'i2p.i2p.zzz.test' (head f402c08d0b2796653b559711cb1ea8c3c0204372)
to branch 'i2p.i2p' (head 4d0babb75e3c5237b10ff49f57599c53c581bb83)
2009-05-17 12:20:34 +00:00
zzz
aa2f9e34c0 - Rework UDP peers.jsp table a little
- Don't let UDP bid on messages that are too long
- Clean up the max fragments code in UDP
2009-05-17 11:52:49 +00:00
87eafa30d0 * Update versions, package release 2009-05-16 19:48:12 +00:00
zzz
287eff50b7 dont bundle unneeded ant.jar (900KB) 2009-05-16 04:06:01 +00:00
zzz
8514e7962d stop build on jsp compile errors 2009-05-16 00:52:21 +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
zzz
86f02691a8 propagate from branch 'i2p.i2p' (head 9044c668fe6fdfcca38a20b557b870c993852c52)
to branch 'i2p.i2p.zzz.test' (head 88a5133b796e83cd8d5864a0a16bcd75e8e34ab5)
2009-05-13 20:53:27 +00:00
zzz
3ad3988937 Add warning for 1-hop tunnels 2009-05-13 19:20:49 +00:00
zzz
757855a5c9 logs.jsp: Add link to config 2009-05-13 18:06:31 +00:00
zzz
ccab73ff66 * FloodfillVerifyJob: Don't consider an older search resulthi* as verified 2009-05-13 17:42:24 +00:00
zzz
9df04724c4 Reduce routerinfo expiration again 2009-05-13 17:38:30 +00:00
zzz
94c2ba7fc5 * SusiDNS:
- Reduce displayed entries from 300 to 100
      - Add ability to go forward or back
      - Make textareas bigger
      - Clean up file names
      - Clarify messages about filter and search
2009-05-13 17:21:34 +00:00
a267fcc9cc merge of '476489c04057318947e2947393aa6a10aa382af8'
and 'd38ab82268c3643119e5c226a3f97c23fb794e93'
2009-05-12 22:32:49 +00:00
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
7cd0112211 SAM: fix: warnings when generating javadoc 2009-05-12 13:33:09 +00:00
9195e754cf propagate from branch 'i2p.i2p' (head 790894dc16c840512c99302fbb75136042cbeb65)
to branch 'i2p.i2p.sam3' (head 66136bbdb44136e3756944cb7d8147d2ab07ff23)
2009-05-12 13:27:17 +00:00
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
a6f106ed6d update history.txt 2009-05-11 09:05:10 +00:00
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
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
47fc3b0d0b - Don't start UPnP if we have a public interface address
- Fix setting IP to a local interface address
- Work on the configuration help some more
2009-05-10 15:40:50 +00:00
zzz
3d7b9560cb Connect client: fix NPE when used with advanced i2ptunnel features 2009-05-09 21:44:48 +00:00
9bd3bea90a * merged branches 2009-05-09 18:26:03 +00:00
9541abc0a4 merge of '4ad028f436647b957e6531243fb3348156d5eb51'
and 'ef760639d59a6ab522ec50a95cc848e09bf11bd8'
2009-05-09 18:24:17 +00:00
0be28c1701 2009-05-09 sponge
* fixed OOM on lock (woops! my bad!)
2009-05-09 18:19:03 +00:00
8bb28ea825 propagate from branch 'i2p.i2p.sam3' (head fa9e8f7d5cacabb84eaae8cc6b569b334f2e0238)
to branch 'i2p.i2p' (head 9cdab8e186f77c375fd81913d3b3c20e5ca69ca2)
2009-05-08 14:37:48 +00:00
85382863d2 merge of '38d57079bc08f5efdaccfb785e39789a7e6f1969'
and 'a0a87038370fb791c619419d56a3133ee7ccec5f'
2009-05-08 14:33:23 +00:00
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
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
6bcd547ca0 * SAM: version 3 added
* SAM: blocking case corrected on simultaneous client connection (v.1-3)
2009-05-07 19:31:27 +00:00
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
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
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
ee7e70b98a more config ui tweaks 2009-05-06 03:47:38 +00:00
zzz
0b7fb21263 - Simplify config.jsp some more
- No longer use i2np.udp.forceIntroducers
- Tweak UDP port qualification
- Fix allowing low ports again
- Add option to completely disable NTCP, for those behind nasty firewalls
- Use SSU reachability rather than global reachability for determining NTCP reachability,
  since we are now reporting NTCP reachability too
2009-05-06 00:54:24 +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
30b73ffe6d changed samv3 because of reverted streaming and mstreaming libs 2009-05-05 12:39:14 +00:00
fceec5c129 reverted changes to mstreaming and streaming 2009-05-05 09:46:17 +00:00
e42f7ab8fc apps/sam/java/build.xml reflects dependancy upon streaming.jar 2009-05-05 09:28:10 +00:00
54b80d6724 merge of '40606168f4086dbe122e96b533df4f24b5e4d87d'
and '44a775450f24ec5d2e921ab01b94546968f81851'
2009-05-05 09:24:26 +00:00
zzz
e82f173f85 - Don't notify for non-changed options on config.jsp 2009-05-04 19:54:33 +00:00
zzz
b45dfb85f0 - Change UPnP listener port defaults, allow configuration option 2009-05-04 16:24:31 +00:00
zzz
3db244f5d2 - Detect UPnP start failure
- Sort local addresses
- Store last IP for future laptop mode
- Subscribe to device service, doesn't seem to do anything though,
  need to test it more
2009-05-04 13:57:56 +00:00
zzz
65a41908ec - Make short timeouts for the XML parser so we don't hang when
the UPnP device goes away - same as for HTTP POST
- Stuff the port mapping requester into a thread so it doesn't
  delay everything for several seconds
- Handle UPnP devices that return IP = 0.0.0.0
- Better HTML output when no IP found
- Tweak logging
- Set Disposer thread name
- Keep the control point running after we find an IGD,
  so that we get notifications of it leaving or
  coming back or replaced.
2009-05-03 18:35:27 +00:00
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
c6b2492e73 - Make short timeouts for UPnP HTTP POST so we don't hang when
the UPnP device goes away
- Fix a bug in UPnP HTTP Server, but we don't use it anyway
2009-05-03 02:27:41 +00:00
zzz
d41afc0c43 - UPnP defaults to on - I didn't do all this for nothing
- Set Status to OK for local public addresses or UPnP port open
- Allow UDP address changes after we transition to firewalled
- Have NTCP start reporting reachability status, this will
  get OK on the console more often and mask UDP problems,
  which might be good or bad...
- Fix UDP port configuration
- Reword and rearrange configuration options again
- Rearrange configuration help
- More right-alignment on config
- Prevent Concurrent modification exception in UPnP
- UPnP HTML output tweaks - remove "plugin" references
- Move UDP message failed log from WARN to INFO
- Short-circuit message history call in UDP
2009-05-02 18:23:41 +00:00
zzz
40637e0f28 slow down the ff volunteers 2009-05-02 03:38:01 +00:00
zzz
0e4c846942 - Simplify bw form
- Add config link to UPnP status
2009-05-01 15:26:49 +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
79a963fcab - Implement config save of new IP address options
- Implement local address and UPnP configuration of UDP address
- Limit received port to 1024 minimum
2009-05-01 00:42:31 +00:00
zzz
b21e011203 - i2np.ntcp.autoip=true redefined to enable inbound only if
SSU reachability is OK. i2np.ntcp.autoip=always for the old behavior.
  autoip default is now "true".
  i2np.ntcp.hostname=xxx now trumps i2np.tcp.autoip.
- SSU always tells NTCP when status changes.
2009-04-30 21:03:00 +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
5b44bcb44f - NTCP Port must now be either auto or configured;
now defaults to auto; and configured now trumps auto.
  Port configuration now does not affect whether inbound
  NTCP is enabled - the host configuration alone can do that.
2009-04-30 16:50:47 +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
4929a7e635 - Add getRequestedPort() to transports 2009-04-29 20:42:42 +00:00
zzz
b61861f840 - Tweak UPnP warning messages
- Remove unused verifyupdate.jsp
- Start of callbacks from UPnP to transports
- Tell UDP local addresses at startup
2009-04-29 18:23:15 +00:00
zzz
35b5eb74f6 start of new address configuration 2009-04-29 03:12:19 +00:00
zzz
fc10031ff0 - Start to rework inbound configuration 2009-04-28 22:45:26 +00:00
zzz
accf3dbf3f - Implement UPnP enable/disable 2009-04-28 19:49:09 +00:00
zzz
c2fedf8538 - Add UDP Port configuration to config.jsp
- Don't restart router when configs change on config.jsp;
  simply rebuild router info.
- Clean up some port config code in UDP
2009-04-28 19:01:52 +00:00
zzz
3b19afe7ed propagate from branch 'i2p.i2p' (head 25097fabfedcbe372d42dcddaf89b5279e9285e4)
to branch 'i2p.i2p.zzz.upnp' (head d994c7d73b83aa689c3538efd7ebb6981ea33ba5)
2009-04-28 18:45:50 +00:00
zzz
64ada538f4 propagate from branch 'i2p.i2p' (head 5401181de2088780f15a018566a65ee35a25c92e)
to branch 'i2p.i2p.zzz.upnp' (head 223e91cc8e45fd22a53e30e839059e0ec4060e02)
2009-04-28 15:34:55 +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
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
7b15cc8113 propagate from branch 'i2p.i2p' (head 982dc8adf7d5c10608e572f285c2eb196d25a64e)
to branch 'i2p.i2p.sam3' (head a455f4d173b9c8c18698ed182407e152848dc8de)
2009-04-26 10:38:28 +00:00
8d4c332987 merge of '40618503ea9748aedee73aaf002482424adc1f72'
and '81ec1b16687e7276a752db7f600a525a6e289458'
2009-04-26 10:36:41 +00:00
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
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
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
7cdfe45acf propagate from branch 'i2p.i2p' (head 81ec1b16687e7276a752db7f600a525a6e289458)
to branch 'i2p.i2p.sam3' (head bf43c21d57d97df61e863a41783aaae968381d00)
2009-04-21 04:15:32 +00:00
eae4362181 SAMv3: NAMING ME request now work on stream sessions 2009-04-21 04:14:53 +00:00
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
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
dev
ddf5cf80b2 propagate from branch 'i2p.i2p' (head e26fa9cbcc023c4c1d8bdc4eb8dbd4a964bb6148)
to branch 'i2p.i2p.zzz.upnp' (head b712f92f4dce03ce1f7d1b2ffc95b559b9b66140)
2009-04-18 14:58:10 +00:00
0f1f33eaa4 merge of '798b531efac76d62154df2a99a91a32ccd97ab47'
and '9b73a50d356f49e9aadaae4cf86681b718c0d56b'
2009-04-09 19:12:06 +00:00
18a475eff3 merge of '9666f5fdfc24a7fc2ca3a99a95ea5dfef5583b1b'
and 'e76b1962963aa7cadb74aacc32f90adf31db3761'
2009-04-08 06:41:53 +00:00
54255cab4a merge of '91bd86329a458a5e064af7aa5abf3662aec61dab'
and 'a09513bb83b827232b24950613986dcb6d5e713c'
2009-04-07 05:47:04 +00:00
bc831d3c35 Changelog: SAM : big bug in SAMv1Handler corrected 2009-04-06 09:53:01 +00:00
d54695e542 add dependency to streaming lib to apps/sam/java/build.xml 2009-04-06 08:16:19 +00:00
12625a46c2 comment added in net.i2p.client.streaming.ConnectionHanler 2009-04-06 07:54:19 +00:00
ab84a5ce8e propagate from branch 'i2p.i2p' (head ac3b23a1d65017e99af5231a8248590c278c136f)
to branch 'i2p.i2p.sam3' (head e257c0c2a8456c229d12a8de2c5339b2e981fd80)
2009-04-06 07:45:57 +00:00
fcbfd7554f SAMv3: alternate form of calling SAMBridge.main. Usage message updated. 2009-04-06 06:39:30 +00:00
4d27f18710 SAMv3: rawTests Demos scripts updated 2009-04-06 05:29:03 +00:00
1bc4cb382e SAMv3 : protocol better specified, and small changes in the code reflecting the new protocol 2009-04-05 21:35:56 +00:00
6b825fbe25 SAMv3 : protocol better specified, and small changes in the code reflecting the new protocol 2009-04-05 21:32:43 +00:00
2cf5221620 minimize differences with mainstream apps/streaming 2009-04-04 12:37:19 +00:00
de6edc6a99 2009-04-04 10:28:31 +00:00
bc086a78eb explicit merge of '7bae8d314209ec279a4da918dc3255e31bda7e45'
and '3b133e76d8124df27791cb78006e7c2b9a8b6430'
2009-04-02 08:57:46 +00:00
e0dccb5970 2009-04-02 08:54:28 +00:00
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
zzz
06aeff9a30 drop file accidentally checked in 2009-02-20 19:00:01 +00:00
zzz
78075cb3aa Add upnp html output, fix up logging 2009-02-20 18:51:39 +00:00
zzz
312e6071d7 upnp first cut 2009-02-19 21:42:59 +00:00
727 changed files with 123027 additions and 4429 deletions

View File

@ -1,8 +1,7 @@
$Id: install-headless.txt,v 1.5 2005/09/29 14:19:23 jrandom Exp $
Headless I2P installation instructions
1) tar xjf i2p.tar.bz2 (you've already done this)
2) cd i2p ; vi install-headless.txt (you're doing this now)
2) cd i2p ; vi INSTALL-headless.txt (you're doing this now)
3) sh postinstall.sh (this launches the router)
4) lynx http://localhost:7657/index.jsp (configure the router)

View File

@ -67,23 +67,63 @@ Public domain except as listed below:
Router:
Public domain
Public domain except as listed below:
UPnP.java:
From freenet
See licenses/LICENSE-GPLv2.txt
UPnP subsystem 1.7:
Copyright (C) 2003-2006 Satoshi Konno
See licenses/LICENSE-UPnP.txt
XMLPull library used by UPnP:
See licenses/LICENSE-Apache2.0.txt
GeoIP data free to use, courtesy http://ip-to-country.webhosting.info/
Installer:
Launch4j:
Launch4j 2.0.RC3:
Copyright (C) 2005 Grzegorz Kowal
See licenses/LICENSE-GPLv2.txt
The following projects are used by Launch4j...
MinGW binutils (http://www.mingw.org/)
Commons BeanUtils (http://jakarta.apache.org/commons/beanutils/)
Commons Logging (http://jakarta.apache.org/commons/logging/)
See licenses/LICENSE-Apache1.1.txt
See licenses/NOTICE-Commons-Logging.txt
XStream (http://xstream.codehaus.org/)
Copyright (c) 2003-2004, Joe Walnes
See licenses/LICENSE-XStream.txt
JGoodies Forms (http://www.jgoodies.com/freeware/forms/)
Copyright (c) 2002-2004 JGoodies Karsten Lentzsch. All rights reserved.
See licenses/LICENSE-JGoodies-Forms.txt
JGoodies Looks (http://www.jgoodies.com/freeware/looks/)
Copyright (c) 2003 JGoodies Karsten Lentzsch. All rights reserved.
See licenses/LICENSE-JGoodies-Looks.txt
Foxtrot (http://foxtrot.sourceforge.net/)
Copyright (c) 2002, Simone Bordet & Marco Cravero. All rights reserved.
See licenses/LICENSE-Foxtrot.txt
Nuvola Icon Theme (http://www.icon-king.com)
See licenses/LICENSE-LGPLv2.1.txt
Forms were created using Abeille Forms Designer (https://abeille.dev.java.net/)
Izpack:
See licenses/LICENSE-Apache1.1.txt
Wrapper:
Copyright (c) 1999, 2004 Tanuki Software
See licenses/LICENSE-Wrapper.txt
Wrapper 3.1.1:
Copyright (c) 1999, 2004 Tanuki Software
See licenses/LICENSE-Wrapper.txt
@ -121,7 +161,6 @@ Applications:
Copyright 2000-2004 Mort Bay Consulting Pty. Ltd.
See licenses/LICENSE-Apache1.1.txt
See licenses/LICENSE-Apache2.0.txt
See licenses/NOTICE-Ant.txt
See licenses/NOTICE-Commons-Logging.txt
JRobin 1.4.0:
@ -137,6 +176,7 @@ Applications:
Router console:
Public domain.
Flag icons public domain, courtesy mjames@gmail.com http://www.famfamfam.com/
SAM:
Public domain.
@ -168,6 +208,10 @@ distributions. See the source package for the additional license information.
Atalk:
Public domain
Desktopgui
Copyright (c) Mathias De Maré
See apps/desktopgui/LICENSE
SAM C Library:
Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>
See apps/sam/c/doc/license.txt

View File

@ -27,10 +27,13 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.client.I2PClient;
import net.i2p.client.streaming.RetransmissionTimer;
import net.i2p.util.Log;
@ -114,10 +117,15 @@ public class BOB {
public final static String PROP_CONFIG_LOCATION = "BOB.config";
public final static String PROP_BOB_PORT = "BOB.port";
public final static String PROP_BOB_HOST = "BOB.host";
private static int maxConnections = 0;
private static NamedDB database;
private static Properties props = new Properties();
private static AtomicBoolean spin = new AtomicBoolean(true);
private static final String P_RUNNING = "RUNNING";
private static final String P_STARTING = "STARTING";
private static final String P_STOPPING = "STOPPING";
private static AtomicBoolean lock = new AtomicBoolean(false);
// no longer used.
// private static int maxConnections = 0;
/**
* Log a warning
@ -149,6 +157,12 @@ public class BOB {
_log.error(arg);
}
/**
* Stop BOB gracefully
*/
public static void stop() {
spin.set(false);
}
/**
* Listen for incoming connections and handle them
*
@ -156,6 +170,7 @@ public class BOB {
*/
public static void main(String[] args) {
database = new NamedDB();
ServerSocket listener = null;
int i = 0;
boolean save = false;
// Set up all defaults to be passed forward to other threads.
@ -168,77 +183,174 @@ public class BOB {
i = Y.hashCode();
i = Y1.hashCode();
i = Y2.hashCode();
{
try {
FileInputStream fi = new FileInputStream(configLocation);
props.load(fi);
fi.close();
} catch(FileNotFoundException fnfe) {
warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
warn(fnfe.toString());
save = true;
} catch(IOException ioe) {
warn("IOException on BOB config file " + configLocation + ", using defaults.");
warn(ioe.toString());
}
}
// Global router and client API configurations that are missing are set to defaults here.
if(!props.containsKey(I2PClient.PROP_TCP_HOST)) {
props.setProperty(I2PClient.PROP_TCP_HOST, "localhost");
}
if(!props.containsKey(I2PClient.PROP_TCP_PORT)) {
props.setProperty(I2PClient.PROP_TCP_PORT, "7654");
}
if(!props.containsKey(I2PClient.PROP_RELIABILITY)) {
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_BEST_EFFORT);
}
if(!props.containsKey(PROP_BOB_PORT)) {
props.setProperty(PROP_BOB_PORT, "2827"); // 0xB0B
}
if(!props.containsKey("inbound.length")) {
props.setProperty("inbound.length", "1");
}
if(!props.containsKey("outbound.length")) {
props.setProperty("outbound.length", "1");
}
if(!props.containsKey("inbound.lengthVariance")) {
props.setProperty("inbound.lengthVariance", "0");
}
if(!props.containsKey("outbound.lengthVariance")) {
props.setProperty("outbound.lengthVariance", "0");
}
if(!props.containsKey(PROP_BOB_HOST)) {
props.setProperty(PROP_BOB_HOST, "localhost");
}
if(save) {
try {
warn("Writing new defaults file " + configLocation);
FileOutputStream fo = new FileOutputStream(configLocation);
props.store(fo, configLocation);
fo.close();
} catch(IOException ioe) {
error("IOException on BOB config file " + configLocation + ", " + ioe);
}
}
i = 0;
try {
info("BOB is now running.");
ServerSocket listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
Socket server;
while((i++ < maxConnections) || (maxConnections == 0)) {
//DoCMDS connection;
server = listener.accept();
DoCMDS conn_c = new DoCMDS(server, props, database, _log);
Thread t = new Thread(conn_c);
t.start();
{
try {
FileInputStream fi = new FileInputStream(configLocation);
props.load(fi);
fi.close();
} catch (FileNotFoundException fnfe) {
warn("Unable to load up the BOB config file " + configLocation + ", Using defaults.");
warn(fnfe.toString());
save = true;
} catch (IOException ioe) {
warn("IOException on BOB config file " + configLocation + ", using defaults.");
warn(ioe.toString());
}
}
} catch(IOException ioe) {
error("IOException on socket listen: " + ioe);
ioe.printStackTrace();
// Global router and client API configurations that are missing are set to defaults here.
if (!props.containsKey(I2PClient.PROP_TCP_HOST)) {
props.setProperty(I2PClient.PROP_TCP_HOST, "localhost");
}
if (!props.containsKey(I2PClient.PROP_TCP_PORT)) {
props.setProperty(I2PClient.PROP_TCP_PORT, "7654");
}
if (!props.containsKey(I2PClient.PROP_RELIABILITY)) {
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_BEST_EFFORT);
}
if (!props.containsKey(PROP_BOB_PORT)) {
props.setProperty(PROP_BOB_PORT, "2827"); // 0xB0B
}
if (!props.containsKey("inbound.length")) {
props.setProperty("inbound.length", "1");
}
if (!props.containsKey("outbound.length")) {
props.setProperty("outbound.length", "1");
}
if (!props.containsKey("inbound.lengthVariance")) {
props.setProperty("inbound.lengthVariance", "0");
}
if (!props.containsKey("outbound.lengthVariance")) {
props.setProperty("outbound.lengthVariance", "0");
}
if (!props.containsKey(PROP_BOB_HOST)) {
props.setProperty(PROP_BOB_HOST, "localhost");
}
if (save) {
try {
warn("Writing new defaults file " + configLocation);
FileOutputStream fo = new FileOutputStream(configLocation);
props.store(fo, configLocation);
fo.close();
} catch (IOException ioe) {
error("IOException on BOB config file " + configLocation + ", " + ioe);
}
}
i = 0;
boolean g = false;
try {
info("BOB is now running.");
listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
Socket server = null;
listener.setSoTimeout(500); // .5 sec
while (spin.get()) {
//DoCMDS connection;
try {
server = listener.accept();
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
Thread t = new Thread(conn_c);
t.setName("BOB.DoCMDS " + i);
t.start();
i++;
}
}
} catch (IOException ioe) {
error("IOException on socket listen: " + ioe);
ioe.printStackTrace();
}
} finally {
info("BOB is now shutting down...");
// Clean up everything.
try {
listener.close();
} catch (Exception ex) {
// nop
}
// Find all our "BOB.DoCMDS" threads, wait for them to be finished.
// We could order them to stop, but that could cause nasty issues in the locks.
visitAllThreads();
database.getReadLock();
int all = database.getcount();
database.releaseReadLock();
NamedDB nickinfo;
for (i = 0; i < all; i++) {
database.getReadLock();
nickinfo = (NamedDB) database.getnext(i);
nickinfo.getReadLock();
if (nickinfo.get(P_RUNNING).equals(Boolean.TRUE) && nickinfo.get(P_STOPPING).equals(Boolean.FALSE) && nickinfo.get(P_STARTING).equals(Boolean.FALSE)) {
nickinfo.releaseReadLock();
database.releaseReadLock();
database.getWriteLock();
nickinfo.getWriteLock();
nickinfo.add(P_STOPPING, new Boolean(true));
nickinfo.releaseWriteLock();
database.releaseWriteLock();
} else {
nickinfo.releaseReadLock();
database.releaseReadLock();
}
}
info("BOB is now stopped.");
}
}
/**
* Find the root thread group,
* then find all theads with certain names and wait for them all to be dead.
*
*/
private static void visitAllThreads() {
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
while (root.getParent() != null) {
root = root.getParent();
}
// Visit each thread group
waitjoin(root, 0, root.getName());
}
private static void waitjoin(ThreadGroup group, int level, String tn) {
// Get threads in `group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
// Enumerate each thread in `group' and wait for it to stop if it is one of ours.
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
if (thread.getName().startsWith("BOB.DoCMDS ")) {
try {
if (thread.isAlive()) {
try {
thread.join();
} catch (InterruptedException ex) {
}
}
} catch (SecurityException se) {
//nop
}
}
}
// Get thread subgroups of `group'
int numGroups = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
numGroups = group.enumerate(groups, false);
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
waitjoin(groups[i], level + 1, groups[i].getName());
}
}
}

View File

@ -31,6 +31,7 @@ import java.io.PrintStream;
import java.net.Socket;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PException;
import net.i2p.client.I2PClientFactory;
import net.i2p.data.Destination;
@ -46,7 +47,7 @@ public class DoCMDS implements Runnable {
// FIX ME
// I need a better way to do versioning, but this will do for now.
public static final String BMAJ = "00", BMIN = "00", BREV = "05", BEXT = "";
public static final String BMAJ = "00", BMIN = "00", BREV = "07", BEXT = "";
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
private Socket server;
private Properties props;
@ -57,6 +58,8 @@ public class DoCMDS implements Runnable {
private boolean dk, ns, ip, op;
private NamedDB nickinfo;
private Log _log;
private AtomicBoolean LIVE;
private AtomicBoolean lock;
/* database strings */
private static final String P_DEST = "DESTINATION";
private static final String P_INHOST = "INHOST";
@ -94,6 +97,8 @@ public class DoCMDS implements Runnable {
private static final String C_status = "status";
private static final String C_stop = "stop";
private static final String C_verify = "verify";
private static final String C_visit = "visit";
private static final String C_zap = "zap";
/* all the coomands available, plus description */
private static final String C_ALL[][] = {
@ -119,6 +124,8 @@ public class DoCMDS implements Runnable {
{C_status, C_status + " nickname * Display status of a nicknamed tunnel."},
{C_stop, C_stop + " * Stops the current nicknamed tunnel."},
{C_verify, C_verify + " BASE64_key * Verifies BASE64 destination."},
{C_visit, C_visit + " * Thread dump to wrapper.log."},
{C_zap, C_zap + " * Shuts down BOB."},
{"", "COMMANDS: " + // this is ugly, but...
C_help + " " +
C_clear + " " +
@ -141,19 +148,23 @@ public class DoCMDS implements Runnable {
C_start + " " +
C_status + " " +
C_stop + " " +
C_verify
C_verify + " " +
C_visit + " " +
C_zap
},
{" ", " "} // end of list
};
/**
*
* @param LIVE
* @param server
* @param props
* @param database
* @param _log
*/
DoCMDS(Socket server, Properties props, NamedDB database, Log _log) {
DoCMDS(AtomicBoolean LIVE, AtomicBoolean lock, Socket server, Properties props, NamedDB database, Log _log) {
this.lock = lock;
this.LIVE = LIVE;
this.server = server;
this.props = new Properties();
this.database = database;
@ -429,6 +440,9 @@ public class DoCMDS implements Runnable {
}
}
} else if (Command.equals(C_visit)) {
visitAllThreads();
out.println("OK ");
} else if (Command.equals(C_getdest)) {
if (ns) {
if (dk) {
@ -509,6 +523,11 @@ public class DoCMDS implements Runnable {
} else if (Command.equals(C_quit)) {
// End the command session
break quit;
} else if (Command.equals(C_zap)) {
// Kill BOB!! (let's hope this works!)
LIVE.set(false);
// End the command session
break quit;
} else if (Command.equals(C_newkeys)) {
if (ns) {
try {
@ -1260,18 +1279,23 @@ public class DoCMDS implements Runnable {
} else {
MUXlisten tunnel;
try {
tunnel = new MUXlisten(database, nickinfo, _log);
while (!lock.compareAndSet(false, true)) {
// wait
}
tunnel = new MUXlisten(lock, database, nickinfo, _log);
Thread t = new Thread(tunnel);
t.start();
try {
Thread.sleep(1000 * 10); // Slow down the startup.
} catch(InterruptedException ie) {
// ignore it
}
// try {
// Thread.sleep(1000 * 10); // Slow down the startup.
// } catch(InterruptedException ie) {
// // ignore it
// }
out.println("OK tunnel starting");
} catch (I2PException e) {
lock.set(false);
out.println("ERROR starting tunnel: " + e);
} catch (IOException e) {
lock.set(false);
out.println("ERROR starting tunnel: " + e);
}
}
@ -1426,4 +1450,48 @@ public class DoCMDS implements Runnable {
ioe.printStackTrace();
}
}
// Debugging... None of this is normally used.
/**
* Find the root thread group and print them all.
*
*/
private void visitAllThreads() {
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
while (root.getParent() != null) {
root = root.getParent();
}
// Visit each thread group
visit(root, 0, root.getName());
}
/**
* Recursively visits all thread groups under `group' and dumps them.
* @param group ThreadGroup to visit
* @param level Current level
*/
private static void visit(ThreadGroup group, int level, String tn) {
// Get threads in `group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
String indent = "------------------------------------".substring(0, level) + "-> ";
// Enumerate each thread in `group' and print it.
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
System.out.println("BOB: " + indent + tn + ": " +thread.toString());
}
// Get thread subgroups of `group'
int numGroups = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
numGroups = group.enumerate(groups, false);
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
visit(groups[i], level + 1, groups[i].getName());
}
}
}

View File

@ -78,91 +78,59 @@ public class I2Plistener implements Runnable {
public void run() {
boolean g = false;
I2PSocket sessSocket = null;
int conn = 0;
try {
die:
{
die: {
serverSocket.setSoTimeout(50);
boolean spin = true;
while (spin) {
serverSocket.setSoTimeout(50);
// try {
// if (info.exists("INPORT")) {
// tgwatch = 2;
// }
// } catch (Exception e) {
// try {
// runlock();
// } catch (Exception e2) {
// break die;
// }
// break die;
// }
boolean spin = true;
while (spin) {
try {
rlock();
} catch (Exception e) {
break die;
}
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
try {
runlock();
} catch (Exception e2) {
rlock();
} catch (Exception e) {
break die;
}
break die;
}
try {
try {
sessSocket = serverSocket.accept();
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
g = false;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database);
Thread t = new Thread(conn_c, "BOBI2PtoTCP");
t.start();
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
try {
sessSocket = serverSocket.accept();
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
g = false;
conn++;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
t.start();
}
} catch (I2PException e) {
// System.out.println("Exception " + e);
} catch (Exception e) {
// System.out.println("Exception " + e);
}
}
}
}
} finally {
try {
serverSocket.close();
} catch (I2PException ex) {
}
// System.out.println("I2Plistener: Close");
// Previous level does this cleanup now.
//
// try {
// serverSocket.close();
// } catch (I2PException e) {
// nop
//}
// need to kill off the socket manager too.
// I2PSession session = socketManager.getSession();
// if (session != null) {
// System.out.println("I2Plistener: destroySession");
// try {
// session.destroySession();
// } catch (I2PSessionException ex) {
// nop
// }
//}
// System.out.println("I2Plistener: Waiting for children");
// while (Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
// try {
// Thread.sleep(100); //sleep for 100 ms (One tenth second)
// } catch (Exception e) {
// nop
// }
//}
// System.out.println("I2Plistener: Done.");
}
}
}

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;
@ -53,12 +52,12 @@ public class I2PtoTCP implements Runnable {
this.database = database;
}
private void rlock() throws Exception {
private void rlock() {
database.getReadLock();
info.getReadLock();
}
private void runlock() throws Exception {
private void runlock() {
database.releaseReadLock();
info.releaseReadLock();
}
@ -71,90 +70,125 @@ public class I2PtoTCP implements Runnable {
String host;
int port;
boolean tell;
die: {
try {
InputStream in = null;
OutputStream out = null;
InputStream Iin = null;
OutputStream Iout = null;
Thread t = null;
Thread q = null;
try {
die:
{
try {
rlock();
} catch(Exception e) {
break die;
}
try {
host = info.get("OUTHOST").toString();
port = Integer.parseInt(info.get("OUTPORT").toString());
tell = info.get("QUIET").equals(Boolean.FALSE);
} catch(Exception e) {
runlock();
break die;
}
try {
runlock();
} catch(Exception e) {
break die;
}
sock = new Socket(host, port);
// make readers/writers
InputStream in = sock.getInputStream();
OutputStream out = sock.getOutputStream();
InputStream Iin = I2P.getInputStream();
OutputStream Iout = I2P.getOutputStream();
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
if(tell) {
// tell who is connecting
out.write(I2P.getPeerDestination().toBase64().getBytes());
out.write(10); // nl
out.flush(); // not really needed, but...
}
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout /*, info, database */ ); // app -> I2P
TCPio conn_a = new TCPio(Iin, out /* , info, database */); // I2P -> app
Thread t = new Thread(conn_c, "TCPioA");
Thread q = new Thread(conn_a, "TCPioB");
// Fire!
t.start();
q.start();
while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
try {
Thread.sleep(10); //sleep for 10 ms
} catch(InterruptedException e) {
try {
in.close();
} catch(Exception ex) {
}
try {
out.close();
} catch(Exception ex) {
}
try {
Iin.close();
} catch(Exception ex) {
}
try {
Iout.close();
} catch(Exception ex) {
}
rlock();
} catch (Exception e) {
break die;
}
try {
host = info.get("OUTHOST").toString();
port = Integer.parseInt(info.get("OUTPORT").toString());
tell = info.get("QUIET").equals(Boolean.FALSE);
} catch (Exception e) {
runlock();
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
sock = new Socket(host, port);
// make readers/writers
in = sock.getInputStream();
out = sock.getOutputStream();
Iin = I2P.getInputStream();
Iout = I2P.getOutputStream();
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
if (tell) {
// tell who is connecting
out.write(I2P.getPeerDestination().toBase64().getBytes());
out.write(10); // nl
out.flush(); // not really needed, but...
}
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P
TCPio conn_a = new TCPio(Iin, out /* , info, database */); // I2P -> app
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();
boolean spin = true;
while (t.isAlive() && q.isAlive() && spin) { // AND is used here to kill off the other thread
try {
Thread.sleep(10); //sleep for 10 ms
} catch (InterruptedException e) {
break die;
}
try {
rlock();
} catch (Exception e) {
break die;
}
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
}
}
// System.out.println("I2PtoTCP: Going away...");
} catch(Exception e) {
// System.out.println("I2PtoTCP: Owch! damn!");
break die;
} catch (Exception e) {
// System.out.println("I2PtoTCP: Owch! damn!");
break die;
}
} // die
} finally {
try {
t.interrupt();
} catch (Exception e) {
}
try {
q.interrupt();
} catch (Exception e) {
}
try {
in.close();
} catch (Exception ex) {
}
try {
out.close();
} catch (Exception ex) {
}
try {
Iin.close();
} catch (Exception ex) {
}
try {
Iout.close();
} catch (Exception ex) {
}
try {
// System.out.println("I2PtoTCP: Close I2P");
I2P.close();
} catch (Exception e) {
tell = false;
}
//System.out.println("I2PtoTCP: Closed I2P");
try {
// System.out.println("I2PtoTCP: Close sock");
sock.close();
} catch (Exception e) {
tell = false;
}
} // die
try {
// System.out.println("I2PtoTCP: Close I2P");
I2P.close();
} catch(Exception e) {
tell = false;
}
//System.out.println("I2PtoTCP: Closed I2P");
try {
// System.out.println("I2PtoTCP: Close sock");
sock.close();
} catch(Exception e) {
tell = false;
}
// System.out.println("I2PtoTCP: Done");
}
}
}

View File

@ -28,9 +28,8 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PException;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
@ -44,16 +43,17 @@ import net.i2p.util.Log;
*/
public class MUXlisten implements Runnable {
private NamedDB database, info;
private NamedDB database, info;
private Log _log;
private I2PSocketManager socketManager;
private ByteArrayInputStream prikey;
private ThreadGroup tg;
private String N;
private ServerSocket listener;
private ServerSocket listener = null;
private int backlog = 50; // should this be more? less?
boolean go_out;
boolean come_in;
private AtomicBoolean lock;
/**
* Constructor Will fail if INPORT is occupied.
@ -64,9 +64,10 @@ public class MUXlisten implements Runnable {
* @throws net.i2p.I2PException
* @throws java.io.IOException
*/
MUXlisten(NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
MUXlisten(AtomicBoolean lock, NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
int port = 0;
InetAddress host = null;
this.lock = lock;
this.tg = null;
this.database = database;
this.info = info;
@ -133,234 +134,187 @@ public class MUXlisten implements Runnable {
*/
public void run() {
I2PServerSocket SS = null;
int ticks = 1200; // Allow 120 seconds, no more.
Thread t = null;
Thread q = null;
try {
wlock();
try {
info.add("RUNNING", new Boolean(true));
wlock();
try {
info.add("RUNNING", new Boolean(true));
} catch (Exception e) {
wunlock();
return;
}
} catch (Exception e) {
wunlock();
return;
}
} catch (Exception e) {
return;
}
try {
wunlock();
} catch (Exception e) {
return;
}
// socketManager.addDisconnectListener(new DisconnectListener());
quit:
{
try {
tg = new ThreadGroup(N);
die:
{
// toss the connections to a new threads.
// will wrap with TCP and UDP when UDP works
wunlock();
} catch (Exception e) {
return;
}
// socketManager.addDisconnectListener(new DisconnectListener());
lock.set(false);
quit:
{
try {
tg = new ThreadGroup(N);
{
// toss the connections to a new threads.
// will wrap with TCP and UDP when UDP works
if (go_out) {
// I2P -> TCP
SS = socketManager.getServerSocket();
I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log);
Thread t = new Thread(tg, conn, "BOBI2Plistener " + N);
t.start();
}
if (come_in) {
// TCP -> I2P
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log);
Thread q = new Thread(tg, conn, "BOBTCPlistener" + N);
q.start();
}
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
} catch (Exception e) {
wunlock();
break die;
if (go_out) {
// I2P -> TCP
SS = socketManager.getServerSocket();
I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log);
t = new Thread(tg, conn, "BOBI2Plistener " + N);
t.start();
}
} catch (Exception e) {
break die;
}
try {
wunlock();
} catch (Exception e) {
break die;
}
boolean spin = true;
while (spin) {
try {
Thread.sleep(1000); //sleep for 1 second
} catch (InterruptedException e) {
break die;
if (come_in) {
// TCP -> I2P
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log);
q = new Thread(tg, conn, "BOBTCPlistener " + N);
q.start();
}
try {
rlock();
wlock();
try {
spin = info.get("STOPPING").equals(Boolean.FALSE);
info.add("STARTING", new Boolean(false));
} catch (Exception e) {
runlock();
break die;
wunlock();
break quit;
}
} catch (Exception e) {
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
}
try {
wlock();
try {
info.add("RUNNING", new Boolean(false));
} catch (Exception e) {
wunlock();
break die;
}
} catch (Exception e) {
break die;
}
try {
wunlock();
} catch (Exception e) {
break die;
}
} // die
if (SS != null) {
try {
SS.close();
} catch (I2PException ex) {
//Logger.getLogger(MUXlisten.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (this.come_in) {
try {
listener.close();
} catch (IOException e) {
}
}
I2PSession session = socketManager.getSession();
if (session != null) {
// System.out.println("I2Plistener: destroySession");
try {
session.destroySession();
} catch (I2PSessionException ex) {
// nop
}
}
try {
socketManager.destroySocketManager();
} catch (Exception e) {
// nop
}
// Wait for child threads and thread groups to die
// System.out.println("MUXlisten: waiting for children");
if (tg.activeCount() + tg.activeGroupCount() != 0) {
while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) {
tg.interrupt(); // unwedge any blocking threads.
ticks--;
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) {
break quit;
}
}
if (tg.activeCount() + tg.activeGroupCount() != 0) {
break quit; // Uh-oh.
}
}
tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it.
tg = null;
} catch (Exception e) {
// System.out.println("MUXlisten: Caught an exception" + e);
break quit;
}
} // quit
try {
wunlock();
} catch (Exception e) {
break quit;
}
boolean spin = true;
while (spin) {
try {
Thread.sleep(1000); //sleep for 1 second
} catch (InterruptedException e) {
break quit;
}
try {
rlock();
try {
spin = info.get("STOPPING").equals(Boolean.FALSE);
} catch (Exception e) {
runlock();
break quit;
}
} catch (Exception e) {
break quit;
}
try {
runlock();
} catch (Exception e) {
break quit;
}
}
} // die
} catch (Exception e) {
// System.out.println("MUXlisten: Caught an exception" + e);
break quit;
}
} // quit
} finally {
// Start cleanup.
while (!lock.compareAndSet(false, true)) {
// wait
}
// zero out everything.
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STOPPING", new Boolean(false));
info.add("RUNNING", new Boolean(false));
} catch (Exception e) {
wunlock();
return;
}
wunlock();
} catch (Exception e) {
}
// This is here to catch when something fucks up REALLY bad.
if (tg != null) {
if (SS != null) {
try {
SS.close();
} catch (I2PException ex) {
//Logger.getLogger(MUXlisten.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (this.come_in) {
if (listener != null) {
try {
listener.close();
} catch (IOException e) {
}
}
// Some grace time.
try {
Thread.sleep(250);
} catch (InterruptedException ex) {
}
lock.set(false); // Should we force waiting for all threads??
// Wait around till all threads are collected.
if (tg != null) {
String boner = tg.getName();
// System.out.println("BOB: MUXlisten: Starting thread collection for: " + boner);
_log.warn("BOB: MUXlisten: Starting thread collection for: " + boner);
// tg.interrupt(); // give my stuff a small smack again.
if (tg.activeCount() + tg.activeGroupCount() != 0) {
// visit(tg, 0, boner);
int foo = tg.activeCount() + tg.activeGroupCount();
// hopefully no longer needed!
// int bar = foo;
// System.out.println("BOB: MUXlisten: Waiting on threads for " + boner);
// System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
// visit(tg, 0, boner);
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
// Happily spin forever :-(
while (foo != 0) {
foo = tg.activeCount() + tg.activeGroupCount();
// if (foo != bar && foo != 0) {
// System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
// visit(tg, 0, boner);
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
// }
// bar = foo;
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) {
// nop
}
}
}
// System.out.println("BOB: MUXlisten: Threads went away. Success: " + boner);
_log.warn("BOB: MUXlisten: Threads went away. Success: " + boner);
tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it.
tg = null;
}
try {
socketManager.destroySocketManager();
} catch (Exception e) {
// nop
}
ticks = 600; // 60 seconds
if (tg.activeCount() + tg.activeGroupCount() != 0) {
while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) {
tg.interrupt(); // unwedge any blocking threads.
ticks--;
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) {
// nop
}
}
}
if (tg.activeCount() + tg.activeGroupCount() == 0) {
tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it.
tg = null;
} else {
System.out.println("BOB: MUXlisten: Can't kill threads. Please send the following dump to sponge@mail.i2p");
System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN");
visit(tg, 0);
System.out.println("BOB: MUXlisten: ThreadGroup dump END\n\n");
}
}
// This is here to catch when something fucks up REALLY bad.
// if (tg != null) {
// System.out.println("BOB: MUXlisten: Something fucked up REALLY bad!");
// System.out.println("BOB: MUXlisten: Please email the following dump to sponge@mail.i2p");
// WrapperManager.requestThreadDump();
// System.out.println("BOB: MUXlisten: Something fucked up REALLY bad!");
// System.out.println("BOB: MUXlisten: Please email the above dump to sponge@mail.i2p");
// }
// zero out everything.
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STOPPING", new Boolean(false));
info.add("RUNNING", new Boolean(false));
} catch (Exception e) {
wunlock();
return;
}
wunlock();
} catch (Exception e) {
}
}
// Debugging...
/**
// Debugging... None of this is normally used.
/**
* Find the root thread group and print them all.
*
*/
@ -371,7 +325,7 @@ die:
}
// Visit each thread group
visit(root, 0);
visit(root, 0, root.getName());
}
/**
@ -379,7 +333,7 @@ die:
* @param group ThreadGroup to visit
* @param level Current level
*/
private static void visit(ThreadGroup group, int level) {
private static void visit(ThreadGroup group, int level, String tn) {
// Get threads in `group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
@ -389,7 +343,7 @@ die:
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
System.out.println("BOB: MUXlisten: " + indent + thread.toString());
System.out.println("BOB: MUXlisten: " + tn + ": " + indent + thread.toString());
}
// Get thread subgroups of `group'
@ -399,7 +353,8 @@ die:
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
visit(groups[i], level + 1);
visit(groups[i], level + 1, groups[i].getName());
}
}
}

View File

@ -49,8 +49,8 @@ public class TCPio implements Runnable {
TCPio(InputStream Ain, OutputStream Aout /*, NamedDB info , NamedDB database */) {
this.Ain = Ain;
this.Aout = Aout;
// this.info = info;
// this.database = database;
// this.info = info;
// this.database = database;
}
/**
@ -86,55 +86,46 @@ public class TCPio implements Runnable {
byte a[] = new byte[1];
boolean spin = true;
try {
while(spin) {
// database.getReadLock();
// info.getReadLock();
// spin = info.get("RUNNING").equals(Boolean.TRUE);
// info.releaseReadLock();
// database.releaseReadLock();
b = Ain.read(a, 0, 1);
// System.out.println(info.get("NICKNAME").toString() + " " + b);
if(b > 0) {
Aout.write(a, 0, b);
} else if(b == 0) {
Thread.yield(); // this should act like a mini sleep.
if(Ain.available() == 0) {
// try {
// Thread.yield();
try {
while (spin) {
b = Ain.read(a, 0, 1);
if (b > 0) {
Aout.write(a, 0, b);
} else if (b == 0) {
Thread.yield(); // this should act like a mini sleep.
if (Ain.available() == 0) {
Thread.sleep(10);
// } catch(InterruptedException ex) {
// }
}
} else {
/* according to the specs:
*
* The total number of bytes read into the buffer,
* or -1 if there is no more data because the end of
* the stream has been reached.
*
*/
// System.out.println("TCPio: End Of Stream");
// Ain.close();
// Aout.close();
//return;
break;
}
} else {
/* according to the specs:
*
* The total number of bytes read into the buffer,
* or -1 if there is no more data because the end of
* the stream has been reached.
*
*/
// System.out.println("TCPio: End Of Stream");
Ain.close();
Aout.close();
return;
}
} catch (Exception e) {
}
// System.out.println("TCPio: RUNNING = false");
} catch(Exception e) {
// System.out.println("TCPio: Leaving.");
} finally {
// Eject!!! Eject!!!
//System.out.println("TCPio: Caught an exception " + e);
try {
Ain.close();
} catch (IOException ex) {
// Logger.getLogger(TCPio.class.getName()).log(Level.SEVERE, null, ex);
}
try {
Aout.close();
} catch (IOException ex) {
// Logger.getLogger(TCPio.class.getName()).log(Level.SEVERE, null, ex);
}
return;
}
// System.out.println("TCPio: Leaving.");
}
}

View File

@ -42,7 +42,6 @@ public class TCPlistener implements Runnable {
private NamedDB info, database;
private Log _log;
private int tgwatch;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private ServerSocket listener;
@ -60,7 +59,6 @@ public class TCPlistener implements Runnable {
this._log = _log;
this.socketManager = S;
this.listener = listener;
tgwatch = 1;
}
private void rlock() throws Exception {
@ -73,16 +71,6 @@ public class TCPlistener implements Runnable {
info.releaseReadLock();
}
private void wlock() throws Exception {
database.getWriteLock();
info.getWriteLock();
}
private void wunlock() throws Exception {
info.releaseWriteLock();
database.releaseWriteLock();
}
/**
* Simply listen on TCP port, and thread connections
*
@ -90,124 +78,53 @@ public class TCPlistener implements Runnable {
public void run() {
boolean g = false;
boolean spin = true;
die: {
try {
rlock();
} catch (Exception e) {
break die;
}
try {
if (info.exists("OUTPORT")) {
tgwatch = 2;
}
} catch (Exception e) {
int conn = 0;
try {
die:
{
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
try {
Socket server = new Socket();
listener.setSoTimeout(50); // Half of the expected time from MUXlisten
while (spin) {
try {
rlock();
} catch (Exception e) {
break die;
}
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
Socket server = new Socket();
listener.setSoTimeout(50); // We don't block, we cycle and check.
while (spin) {
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
server = listener.accept();
g = true;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server /* , info, database */);
Thread t = new Thread(conn_c, "BOBTCPtoI2P");
t.start();
g = false;
}
}
//System.out.println("TCPlistener: destroySession");
listener.close();
} catch (IOException ioe) {
try {
listener.close();
} catch (IOException e) {
}
// Fatal failure, cause a stop event
try {
rlock();
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
runlock();
break die;
}
} catch (Exception e) {
break die;
}
if (spin) {
try {
wlock();
try {
info.add("STOPPING", new Boolean(true));
info.add("RUNNING", new Boolean(false));
rlock();
} catch (Exception e) {
wunlock();
break die;
}
} catch (Exception e) {
break die;
}
try {
wunlock();
} catch (Exception e) {
break die;
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
server = listener.accept();
g = true;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
conn++;
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
}
} catch (IOException ioe) {
}
}
} finally {
try {
listener.close();
} catch (IOException ex) {
}
//System.out.println("TCPlistener: " + Thread.currentThread().getName() + "Done.");
}
// Previous level does this cleanup now.
//
// need to kill off the socket manager too.
// I2PSession session = socketManager.getSession();
// if (session != null) {
// try {
// session.destroySession();
// } catch (I2PSessionException ex) {
// nop
// }
//}
//System.out.println("TCPlistener: Waiting for children");
//while (Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
// try {
// Thread.sleep(100); //sleep for 100 ms (One tenth second)
// } catch (Exception e) {
// // nop
// }
//}
//System.out.println("TCPlistener: Done.");
}
}

View File

@ -33,6 +33,7 @@ import java.net.Socket;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.I2PTunnel;
@ -45,41 +46,10 @@ import net.i2p.i2ptunnel.I2PTunnel;
public class TCPtoI2P implements Runnable {
private I2PSocket I2P;
// private NamedDB info, database;
private NamedDB info, database;
private Socket sock;
private I2PSocketManager socketManager;
/**
* This is a more forgiving readline,
* it works on unbuffered streams
*
* @param in
* @return line of text as a String
* @throws Exception
*/
private static String lnRead(InputStream in) throws Exception {
String S;
int b;
char c;
S = new String();
while(true) {
b = in.read();
if(b == 13) {
//skip CR
continue;
}
if(b < 20 || b > 126) {
// exit on anything not legal
break;
}
c = (char)(b & 0x7f); // We only really give a fuck about ASCII
S = new String(S + c);
}
return S;
}
/**
* Constructor
* @param i2p
@ -87,13 +57,44 @@ public class TCPtoI2P implements Runnable {
* param info
* param database
*/
TCPtoI2P(I2PSocketManager i2p, Socket socket /*, NamedDB info, NamedDB database */) {
TCPtoI2P(I2PSocketManager i2p, Socket socket , NamedDB info, NamedDB database) {
this.sock = socket;
// this.info = info;
// this.database = database;
this.info = info;
this.database = database;
this.socketManager = i2p;
}
/**
* This is a more forgiving readline,
* it works on unbuffered streams
*
* @param in
* @return line of text as a String
* @throws IOException
*/
private static String lnRead(InputStream in) throws IOException {
String S;
int b;
char c;
S = new String();
while (true) {
b = in.read();
if (b == 13) {
//skip CR
continue;
}
if (b < 20 || b > 126) {
// exit on anything not legal
break;
}
c = (char) (b & 0x7f); // We only really give a fuck about ASCII
S = new String(S + c);
}
return S;
}
/**
* Print an error message to out
*
@ -103,11 +104,24 @@ public class TCPtoI2P implements Runnable {
*/
private void Emsg(String e, OutputStream out) throws IOException {
// Debugging System.out.println("ERROR TCPtoI2P: " + e);
out.write("ERROR".concat(e).getBytes());
out.write(13); // cr
out.write("ERROR ".concat(e).getBytes());
out.write(13);
out.write(10);
out.flush();
}
// private void rlock() throws Exception {
private void rlock() {
database.getReadLock();
info.getReadLock();
}
// private void runlock() throws Exception {
private void runlock() {
info.releaseReadLock();
database.releaseReadLock();
}
/**
* TCP stream to I2P stream thread starter
*
@ -118,17 +132,17 @@ public class TCPtoI2P implements Runnable {
OutputStream Iout = null;
InputStream in = null;
OutputStream out = null;
Thread t = null;
Thread q = null;
try {
in = sock.getInputStream();
out = sock.getOutputStream();
try {
in = sock.getInputStream();
out = sock.getOutputStream();
line = lnRead(in);
input = line.toLowerCase();
Destination dest = null;
if(input.endsWith(".i2p")) {
if (input.endsWith(".i2p")) {
dest = I2PTunnel.destFromName(input);
line = dest.toBase64();
}
@ -145,63 +159,81 @@ public class TCPtoI2P implements Runnable {
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P
TCPio conn_a = new TCPio(Iin, out /*, info, database */); // I2P -> app
Thread t = new Thread(conn_c, "TCPioA");
Thread q = new Thread(conn_a, "TCPioB");
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();
while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
// try {
Thread.sleep(10); //sleep for 10 ms
// } catch(InterruptedException e) {
// nop
// }
boolean spin = true;
while (t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
Thread.sleep(10); //sleep for 10 ms
rlock();
spin = info.get("RUNNING").equals(Boolean.TRUE);
runlock();
}
// System.out.println("TCPtoI2P: Going away...");
} catch(I2PException e) {
Emsg("ERROR " + e.toString(), out);
} catch(ConnectException e) {
Emsg("ERROR " + e.toString(), out);
} catch(NoRouteToHostException e) {
Emsg("ERROR " + e.toString(), out);
} catch(InterruptedIOException e) {
Emsg("ERROR " + e.toString(), out);
} catch (I2PException e) {
Emsg(e.toString(), out);
} catch (ConnectException e) {
Emsg(e.toString(), out);
} catch (NoRouteToHostException e) {
Emsg(e.toString(), out);
}
} catch(Exception e) {
Emsg("ERROR " + e.toString(), out);
} catch (InterruptedIOException e) {
// We're breaking away.
} catch (InterruptedException e) {
// ditto
} catch (IOException e) {
try {
Emsg(e.toString(), out);
} catch (IOException ex) {
// ditto
}
} catch (DataFormatException e) {
try {
Emsg(e.toString(), out);
} catch (IOException ex) {
// ditto
}
}
} catch(Exception e) {
// bail on anything else
}
try {
in.close();
} catch(Exception e) {
}
try {
out.close();
} catch(Exception e) {
}
try {
Iin.close();
} catch(Exception e) {
}
try {
Iout.close();
} catch(Exception e) {
}
try {
// System.out.println("TCPtoI2P: Close I2P");
I2P.close();
} catch(Exception e) {
}
try {
// System.out.println("TCPtoI2P: Close sock");
sock.close();
} catch(Exception e) {
} finally {
try {
t.interrupt();
} catch (Exception e) {
}
try {
q.interrupt();
} catch (Exception e) {
}
try {
in.close();
} catch (Exception e) {
}
try {
out.close();
} catch (Exception e) {
}
try {
Iin.close();
} catch (Exception e) {
}
try {
Iout.close();
} catch (Exception e) {
}
try {
// System.out.println("TCPtoI2P: Close I2P");
I2P.close();
} catch (Exception e) {
}
try {
// System.out.println("TCPtoI2P: Close sock");
sock.close();
} catch (Exception e) {
}
}
// System.out.println("TCPtoI2P: Done.");
// System.out.println("TCPtoI2P: Done.");
}
}

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

@ -76,10 +76,12 @@
<property name="build_dist" location="dist"/>
<property name="build_lib" location="lib"/>
<property name="build_i2pref" location="../../build"/>
<property name="build_routerconsole" location="../routerconsole/java/build/"/>
<path id="build_classpath">
<fileset dir="${build_lib}" includes="**/*.jar"/>
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
<fileset dir="${build_routerconsole}" includes="**/*.jar"/>
</path>
<target name="build_init">
<!-- Create the time stamp -->

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

@ -23,6 +23,7 @@ excludes=
file.reference.appframework.jar=lib/appframework.jar
file.reference.i2p.jar=../../core/java/build/i2p.jar
file.reference.router.jar=../../router/java/build/router.jar
file.reference.routerconsole.jar=../routerconsole/java/build/routerconsole.jar
file.reference.swing-worker.jar=lib/swing-worker.jar
includes=**
jar.compress=false
@ -30,7 +31,8 @@ javac.classpath=\
${file.reference.router.jar}:\
${file.reference.appframework.jar}:\
${file.reference.swing-worker.jar}:\
${file.reference.i2p.jar}
${file.reference.i2p.jar}:\
${file.reference.routerconsole.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
@ -58,7 +60,7 @@ jnlp.codebase.url=file:/home/mathias/Documenten/Programmeren/i2p_monotone/repo/i
jnlp.enabled=false
jnlp.offline-allowed=false
jnlp.signed=false
main.class=desktopgui.Main
main.class=net.i2p.desktopgui.desktopgui.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform

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

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="updateButtonGroup">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
@ -11,6 +16,7 @@
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
@ -22,27 +28,27 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="applyPanel" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="12" pref="12" max="12" attributes="0"/>
<Component id="jTabbedPane1" pref="566" max="32767" attributes="0"/>
<Component id="settingsPanel" pref="566" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jTabbedPane1" max="32767" attributes="0"/>
<Component id="settingsPanel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<Component id="applyPanel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Container class="javax.swing.JPanel" name="applyPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/>
<Property name="name" type="java.lang.String" value="applyPanel" noResource="true"/>
</Properties>
<Layout>
@ -75,30 +81,36 @@
<Property name="text" type="java.lang.String" resourceKey="cancel.text"/>
<Property name="name" type="java.lang.String" value="cancel" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="cancelMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="ok">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="ok.text"/>
<Property name="name" type="java.lang.String" value="ok" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="okMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
<Container class="javax.swing.JTabbedPane" name="settingsPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jTabbedPane1" noResource="true"/>
<Property name="name" type="java.lang.String" value="settingsPanel" noResource="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Container class="javax.swing.JPanel" name="speedPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel2" noResource="true"/>
<Property name="name" type="java.lang.String" value="speedPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Speed">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel2.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="speedPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -107,10 +119,10 @@
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Component class="javax.swing.JLabel" name="uploadSpeedLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadSpeedLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadSpeedLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -118,10 +130,10 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Component class="javax.swing.JLabel" name="downloadSpeedLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/>
<Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadSpeedLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadSpeedLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -129,68 +141,76 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
<Component class="javax.swing.JTextField" name="uploadspeed">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField1.text"/>
<Property name="name" type="java.lang.String" value="jTextField1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadspeed.text"/>
<Property name="name" type="java.lang.String" value="uploadspeed" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="20" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField2">
<Component class="javax.swing.JTextField" name="downloadspeed">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField2.text"/>
<Property name="name" type="java.lang.String" value="jTextField2" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadspeed.text"/>
<Property name="name" type="java.lang.String" value="downloadspeed" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="60" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox1">
<Component class="javax.swing.JComboBox" name="uploadkbps">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="jComboBox1" noResource="true"/>
<Property name="name" type="java.lang.String" value="uploadkbps" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="uploadkbpsActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="20" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox2">
<Component class="javax.swing.JComboBox" name="downloadkbps">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="jComboBox2" noResource="true"/>
<Property name="name" type="java.lang.String" value="downloadkbps" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadkbpsActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="60" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Component class="javax.swing.JLabel" name="uploadUsageLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/>
<Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadUsageLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadUsageLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -198,10 +218,10 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Component class="javax.swing.JLabel" name="downloadUsageLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel4.text"/>
<Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadUsageLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadUsageLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -209,32 +229,38 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField3">
<Component class="javax.swing.JTextField" name="uploadgb">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField3.text"/>
<Property name="name" type="java.lang.String" value="jTextField3" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadgb.text"/>
<Property name="name" type="java.lang.String" value="uploadgb" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="20" width="60" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField4">
<Component class="javax.swing.JTextField" name="downloadgb">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField4.text"/>
<Property name="name" type="java.lang.String" value="jTextField4" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadgb.text"/>
<Property name="name" type="java.lang.String" value="downloadgb" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="60" width="60" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Component class="javax.swing.JLabel" name="gbUploadLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel5.text"/>
<Property name="name" type="java.lang.String" value="jLabel5" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="gbUploadLabel.text"/>
<Property name="name" type="java.lang.String" value="gbUploadLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -242,10 +268,10 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Component class="javax.swing.JLabel" name="gbDownloadLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel6.text"/>
<Property name="name" type="java.lang.String" value="jLabel6" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="gbDownloadLabel.text"/>
<Property name="name" type="java.lang.String" value="gbDownloadLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -253,10 +279,10 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Component class="javax.swing.JLabel" name="uploadDownloadExplanation">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel7.text"/>
<Property name="name" type="java.lang.String" value="jLabel7" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadDownloadExplanation.text"/>
<Property name="name" type="java.lang.String" value="uploadDownloadExplanation" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -266,14 +292,14 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Container class="javax.swing.JPanel" name="updatesPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel3" noResource="true"/>
<Property name="name" type="java.lang.String" value="updatesPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Updates">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel3.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="updatesPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -286,20 +312,20 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="updateMethod" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jToggleButton1" min="-2" max="-2" attributes="0"/>
<Component id="checkUpdates" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jToggleButton2" min="-2" max="-2" attributes="0"/>
<Component id="updateNow" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="40" pref="40" max="40" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton3" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="updateDownload" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="updateInform" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="updateDownloadRestart" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@ -307,7 +333,7 @@
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="339" max="32767" attributes="0"/>
<Component id="jToggleButton3" min="-2" max="-2" attributes="0"/>
<Component id="advancedUpdateConfig" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -316,78 +342,96 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<Component id="updateMethod" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jRadioButton1" min="-2" max="-2" attributes="0"/>
<Component id="updateInform" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jRadioButton2" min="-2" max="-2" attributes="0"/>
<Component id="updateDownload" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jRadioButton3" min="-2" max="-2" attributes="0"/>
<Component id="updateDownloadRestart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jToggleButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jToggleButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="checkUpdates" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="updateNow" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="181" max="32767" attributes="0"/>
<Component id="jToggleButton3" min="-2" max="-2" attributes="0"/>
<Component id="advancedUpdateConfig" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Component class="javax.swing.JLabel" name="updateMethod">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel8.text"/>
<Property name="name" type="java.lang.String" value="jLabel8" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="updateMethod.text"/>
<Property name="name" type="java.lang.String" value="updateMethod" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton1">
<Component class="javax.swing.JRadioButton" name="updateInform">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jRadioButton1.text"/>
<Property name="name" type="java.lang.String" value="jRadioButton1" noResource="true"/>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="updateButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="updateInform.text"/>
<Property name="name" type="java.lang.String" value="updateInform" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton2">
<Component class="javax.swing.JRadioButton" name="updateDownload">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jRadioButton2.text"/>
<Property name="name" type="java.lang.String" value="jRadioButton2" noResource="true"/>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="updateButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="updateDownload.text"/>
<Property name="name" type="java.lang.String" value="updateDownload" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton3">
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jRadioButton3.text"/>
<Property name="name" type="java.lang.String" value="jRadioButton3" noResource="true"/>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="updateButtonGroup"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="updateDownloadRestart.text"/>
<Property name="name" type="java.lang.String" value="updateDownloadRestart" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="jToggleButton1">
<Component class="javax.swing.JToggleButton" name="checkUpdates">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jToggleButton1.text"/>
<Property name="name" type="java.lang.String" value="jToggleButton1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="checkUpdates.text"/>
<Property name="name" type="java.lang.String" value="checkUpdates" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkUpdatesActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="jToggleButton2">
<Component class="javax.swing.JToggleButton" name="updateNow">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jToggleButton2.text"/>
<Property name="name" type="java.lang.String" value="jToggleButton2" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="updateNow.text"/>
<Property name="name" type="java.lang.String" value="updateNow" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="updateNowActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="jToggleButton3">
<Component class="javax.swing.JToggleButton" name="advancedUpdateConfig">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jToggleButton3.text"/>
<Property name="name" type="java.lang.String" value="jToggleButton3" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="advancedUpdateConfig.text"/>
<Property name="name" type="java.lang.String" value="advancedUpdateConfig" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="advancedUpdateConfigActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Container class="javax.swing.JPanel" name="tunnelPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel4" noResource="true"/>
<Property name="name" type="java.lang.String" value="tunnelPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Tunnels/Services">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel4.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="tunnelPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -398,11 +442,11 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane2" alignment="1" pref="538" max="32767" attributes="0"/>
<Component id="jLabel9" alignment="0" pref="538" max="32767" attributes="0"/>
<Component id="jLabel10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="538" max="32767" attributes="0"/>
<Component id="jLabel11" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="serverFrame" alignment="1" pref="538" max="32767" attributes="0"/>
<Component id="tunnelsExplanation" alignment="0" pref="538" max="32767" attributes="0"/>
<Component id="clientTunnelLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="clientFrame" alignment="0" pref="538" max="32767" attributes="0"/>
<Component id="serverTunnelLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -412,63 +456,63 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<Component id="clientTunnelLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="119" max="32767" attributes="0"/>
<Component id="clientFrame" pref="119" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<Component id="serverTunnelLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="122" max="32767" attributes="0"/>
<Component id="serverFrame" pref="122" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" min="-2" pref="65" max="-2" attributes="0"/>
<Component id="tunnelsExplanation" min="-2" pref="65" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Container class="javax.swing.JScrollPane" name="clientFrame">
<Properties>
<Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/>
<Property name="name" type="java.lang.String" value="clientFrame" noResource="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<Container class="javax.swing.JScrollPane" name="serverFrame">
<Properties>
<Property name="name" type="java.lang.String" value="jScrollPane2" noResource="true"/>
<Property name="name" type="java.lang.String" value="serverFrame" noResource="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
</Container>
<Component class="javax.swing.JLabel" name="jLabel9">
<Component class="javax.swing.JLabel" name="tunnelsExplanation">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel9.text"/>
<Property name="name" type="java.lang.String" value="jLabel9" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="tunnelsExplanation.text"/>
<Property name="name" type="java.lang.String" value="tunnelsExplanation" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Component class="javax.swing.JLabel" name="clientTunnelLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel10.text"/>
<Property name="name" type="java.lang.String" value="jLabel10" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="clientTunnelLabel.text"/>
<Property name="name" type="java.lang.String" value="clientTunnelLabel" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Component class="javax.swing.JLabel" name="serverTunnelLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel11.text"/>
<Property name="name" type="java.lang.String" value="jLabel11" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="serverTunnelLabel.text"/>
<Property name="name" type="java.lang.String" value="serverTunnelLabel" noResource="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel5">
<Container class="javax.swing.JPanel" name="networkPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel5" noResource="true"/>
<Property name="name" type="java.lang.String" value="networkPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Network">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel5.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="networkPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -486,14 +530,14 @@
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Container class="javax.swing.JPanel" name="advancedPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel6" noResource="true"/>
<Property name="name" type="java.lang.String" value="advancedPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Advanced">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel6.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="advancedPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>

View File

@ -0,0 +1,684 @@
/*
* GeneralConfiguration.java
*
* Created on 10 april 2009, 19:04
*/
package net.i2p.desktopgui.gui;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.i2p.desktopgui.router.configuration.SpeedHelper;
import javax.swing.JComboBox;
import javax.swing.ButtonModel;
import javax.swing.JTextField;
import net.i2p.desktopgui.router.RouterHelper;
import net.i2p.desktopgui.router.configuration.SpeedHandler;
import net.i2p.desktopgui.router.configuration.UpdateHelper;
import net.i2p.router.web.NewsFetcher;
import net.i2p.desktopgui.router.configuration.UpdateHandler;
import java.util.Date;
import javax.swing.SwingWorker;
/**
*
* @author mathias
*/
public class GeneralConfiguration extends javax.swing.JFrame {
/** Creates new form GeneralConfiguration */
public GeneralConfiguration() {
initComponents();
extraInitComponents();
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
this.requestFocus();
this.setVisible(true);
}
private void extraInitComponents() {
initSpeedTab();
initUpdateTab();
}
private void initSpeedTab() {
try {
String inbound = SpeedHelper.getInboundBandwidth();
String outbound = SpeedHelper.getOutboundBandwidth();
initSpeeds("" + Integer.parseInt(inbound)*8, "" + Integer.parseInt(outbound)*8);
initUsage("" + Integer.parseInt(inbound), "" + Integer.parseInt(outbound));
}
catch(Exception e) {
e.printStackTrace();
System.out.println("Exception noticed, probably running desktopgui in a debugger instead of along with I2P!?");
initSpeeds("100", "100");
initUsage("12", "12");
}
}
private void initUpdateTab() {
//Set update policy
String updatePolicy = UpdateHelper.getUpdatePolicy();
if(updatePolicy.equals(UpdateHelper.NOTIFY_UPDATE_POLICY)) {
updateButtonGroup.setSelected(updateInform.getModel(), true);
}
else if(updatePolicy.equals(UpdateHelper.DOWNLOAD_UPDATE_POLICY)) {
updateButtonGroup.setSelected(updateDownload.getModel(), true);
}
else if(updatePolicy.equals(UpdateHelper.INSTALL_UPDATE_POLICY)) {
updateButtonGroup.setSelected(updateDownloadRestart.getModel(), true);
}
else {
System.out.println("desktopgui: no updates for you!");
}
//Check if an update is available
//TODO: move this method out of the routerconsole so desktopgui doesn't depend on routerconsole!!!
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
updateNow.setVisible(true);
}
else {
updateNow.setVisible(false);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
updateButtonGroup = new javax.swing.ButtonGroup();
applyPanel = new javax.swing.JPanel();
cancel = new javax.swing.JToggleButton();
ok = new javax.swing.JToggleButton();
settingsPanel = new javax.swing.JTabbedPane();
speedPanel = new javax.swing.JPanel();
uploadSpeedLabel = new javax.swing.JLabel();
downloadSpeedLabel = new javax.swing.JLabel();
uploadspeed = new javax.swing.JTextField();
downloadspeed = new javax.swing.JTextField();
uploadkbps = new javax.swing.JComboBox();
downloadkbps = new javax.swing.JComboBox();
uploadUsageLabel = new javax.swing.JLabel();
downloadUsageLabel = new javax.swing.JLabel();
uploadgb = new javax.swing.JTextField();
downloadgb = new javax.swing.JTextField();
gbUploadLabel = new javax.swing.JLabel();
gbDownloadLabel = new javax.swing.JLabel();
uploadDownloadExplanation = new javax.swing.JLabel();
updatesPanel = new javax.swing.JPanel();
updateMethod = new javax.swing.JLabel();
updateInform = new javax.swing.JRadioButton();
updateDownload = new javax.swing.JRadioButton();
updateDownloadRestart = new javax.swing.JRadioButton();
checkUpdates = new javax.swing.JToggleButton();
updateNow = new javax.swing.JToggleButton();
advancedUpdateConfig = new javax.swing.JToggleButton();
tunnelPanel = new javax.swing.JPanel();
clientFrame = new javax.swing.JScrollPane();
serverFrame = new javax.swing.JScrollPane();
tunnelsExplanation = new javax.swing.JLabel();
clientTunnelLabel = new javax.swing.JLabel();
serverTunnelLabel = new javax.swing.JLabel();
networkPanel = new javax.swing.JPanel();
advancedPanel = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(GeneralConfiguration.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setName("Form"); // NOI18N
applyPanel.setName("applyPanel"); // NOI18N
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
cancel.setName("cancel"); // NOI18N
cancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
cancelMouseClicked(evt);
}
});
ok.setText(resourceMap.getString("ok.text")); // NOI18N
ok.setName("ok"); // NOI18N
ok.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
okMouseClicked(evt);
}
});
javax.swing.GroupLayout applyPanelLayout = new javax.swing.GroupLayout(applyPanel);
applyPanel.setLayout(applyPanelLayout);
applyPanelLayout.setHorizontalGroup(
applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, applyPanelLayout.createSequentialGroup()
.addContainerGap(475, Short.MAX_VALUE)
.addComponent(ok)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancel)
.addContainerGap())
);
applyPanelLayout.setVerticalGroup(
applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(applyPanelLayout.createSequentialGroup()
.addGroup(applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancel)
.addComponent(ok))
.addContainerGap(14, Short.MAX_VALUE))
);
settingsPanel.setName("settingsPanel"); // NOI18N
speedPanel.setName("speedPanel"); // NOI18N
speedPanel.setLayout(null);
uploadSpeedLabel.setText(resourceMap.getString("uploadSpeedLabel.text")); // NOI18N
uploadSpeedLabel.setName("uploadSpeedLabel"); // NOI18N
speedPanel.add(uploadSpeedLabel);
uploadSpeedLabel.setBounds(20, 20, 140, 30);
downloadSpeedLabel.setText(resourceMap.getString("downloadSpeedLabel.text")); // NOI18N
downloadSpeedLabel.setName("downloadSpeedLabel"); // NOI18N
speedPanel.add(downloadSpeedLabel);
downloadSpeedLabel.setBounds(20, 60, 140, 30);
uploadspeed.setText(resourceMap.getString("uploadspeed.text")); // NOI18N
uploadspeed.setName("uploadspeed"); // NOI18N
uploadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
speedKeyReleased(evt);
}
});
speedPanel.add(uploadspeed);
uploadspeed.setBounds(160, 20, 77, 27);
downloadspeed.setText(resourceMap.getString("downloadspeed.text")); // NOI18N
downloadspeed.setName("downloadspeed"); // NOI18N
downloadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
speedKeyReleased(evt);
}
});
speedPanel.add(downloadspeed);
downloadspeed.setBounds(160, 60, 77, 27);
uploadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
uploadkbps.setName("uploadkbps"); // NOI18N
uploadkbps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
uploadkbpsActionPerformed(evt);
}
});
speedPanel.add(uploadkbps);
uploadkbps.setBounds(240, 20, 68, 27);
downloadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
downloadkbps.setName("downloadkbps"); // NOI18N
downloadkbps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
downloadkbpsActionPerformed(evt);
}
});
speedPanel.add(downloadkbps);
downloadkbps.setBounds(240, 60, 68, 27);
uploadUsageLabel.setText(resourceMap.getString("uploadUsageLabel.text")); // NOI18N
uploadUsageLabel.setName("uploadUsageLabel"); // NOI18N
speedPanel.add(uploadUsageLabel);
uploadUsageLabel.setBounds(330, 20, 97, 30);
downloadUsageLabel.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
downloadUsageLabel.setName("downloadUsageLabel"); // NOI18N
speedPanel.add(downloadUsageLabel);
downloadUsageLabel.setBounds(330, 60, 97, 30);
uploadgb.setText(resourceMap.getString("uploadgb.text")); // NOI18N
uploadgb.setName("uploadgb"); // NOI18N
uploadgb.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
monthKeyReleased(evt);
}
});
speedPanel.add(uploadgb);
uploadgb.setBounds(440, 20, 60, 27);
downloadgb.setText(resourceMap.getString("downloadgb.text")); // NOI18N
downloadgb.setName("downloadgb"); // NOI18N
downloadgb.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
monthKeyReleased(evt);
}
});
speedPanel.add(downloadgb);
downloadgb.setBounds(440, 60, 60, 27);
gbUploadLabel.setText(resourceMap.getString("gbUploadLabel.text")); // NOI18N
gbUploadLabel.setName("gbUploadLabel"); // NOI18N
speedPanel.add(gbUploadLabel);
gbUploadLabel.setBounds(510, 20, 19, 30);
gbDownloadLabel.setText(resourceMap.getString("gbDownloadLabel.text")); // NOI18N
gbDownloadLabel.setName("gbDownloadLabel"); // NOI18N
speedPanel.add(gbDownloadLabel);
gbDownloadLabel.setBounds(510, 60, 19, 30);
uploadDownloadExplanation.setText(resourceMap.getString("uploadDownloadExplanation.text")); // NOI18N
uploadDownloadExplanation.setName("uploadDownloadExplanation"); // NOI18N
speedPanel.add(uploadDownloadExplanation);
uploadDownloadExplanation.setBounds(20, 100, 520, 70);
settingsPanel.addTab(resourceMap.getString("speedPanel.TabConstraints.tabTitle"), speedPanel); // NOI18N
updatesPanel.setName("updatesPanel"); // NOI18N
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
updateMethod.setName("updateMethod"); // NOI18N
updateButtonGroup.add(updateInform);
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
updateInform.setName("updateInform"); // NOI18N
updateButtonGroup.add(updateDownload);
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
updateDownload.setName("updateDownload"); // NOI18N
updateButtonGroup.add(updateDownloadRestart);
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
checkUpdates.setName("checkUpdates"); // NOI18N
checkUpdates.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkUpdatesActionPerformed(evt);
}
});
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
updateNow.setName("updateNow"); // NOI18N
updateNow.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
updateNowActionPerformed(evt);
}
});
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
advancedUpdateConfig.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
advancedUpdateConfigActionPerformed(evt);
}
});
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
updatesPanel.setLayout(updatesPanelLayout);
updatesPanelLayout.setHorizontalGroup(
updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(updateMethod)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addComponent(checkUpdates)
.addGap(18, 18, 18)
.addComponent(updateNow))))
.addGroup(updatesPanelLayout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(updateDownload)
.addComponent(updateInform)
.addComponent(updateDownloadRestart))))
.addGap(9, 9, 9))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, updatesPanelLayout.createSequentialGroup()
.addContainerGap(339, Short.MAX_VALUE)
.addComponent(advancedUpdateConfig)
.addContainerGap())
);
updatesPanelLayout.setVerticalGroup(
updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(updateMethod)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(updateInform)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(updateDownload)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(updateDownloadRestart)
.addGap(18, 18, 18)
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(checkUpdates)
.addComponent(updateNow))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 181, Short.MAX_VALUE)
.addComponent(advancedUpdateConfig)
.addContainerGap())
);
settingsPanel.addTab(resourceMap.getString("updatesPanel.TabConstraints.tabTitle"), updatesPanel); // NOI18N
tunnelPanel.setName("tunnelPanel"); // NOI18N
clientFrame.setName("clientFrame"); // NOI18N
serverFrame.setName("serverFrame"); // NOI18N
tunnelsExplanation.setText(resourceMap.getString("tunnelsExplanation.text")); // NOI18N
tunnelsExplanation.setName("tunnelsExplanation"); // NOI18N
clientTunnelLabel.setText(resourceMap.getString("clientTunnelLabel.text")); // NOI18N
clientTunnelLabel.setName("clientTunnelLabel"); // NOI18N
serverTunnelLabel.setText(resourceMap.getString("serverTunnelLabel.text")); // NOI18N
serverTunnelLabel.setName("serverTunnelLabel"); // NOI18N
javax.swing.GroupLayout tunnelPanelLayout = new javax.swing.GroupLayout(tunnelPanel);
tunnelPanel.setLayout(tunnelPanelLayout);
tunnelPanelLayout.setHorizontalGroup(
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tunnelPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(serverFrame, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(tunnelsExplanation, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(clientTunnelLabel)
.addComponent(clientFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(serverTunnelLabel))
.addContainerGap())
);
tunnelPanelLayout.setVerticalGroup(
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tunnelPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(clientTunnelLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(clientFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(serverTunnelLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(serverFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tunnelsExplanation, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
settingsPanel.addTab(resourceMap.getString("tunnelPanel.TabConstraints.tabTitle"), tunnelPanel); // NOI18N
networkPanel.setName("networkPanel"); // NOI18N
javax.swing.GroupLayout networkPanelLayout = new javax.swing.GroupLayout(networkPanel);
networkPanel.setLayout(networkPanelLayout);
networkPanelLayout.setHorizontalGroup(
networkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 562, Short.MAX_VALUE)
);
networkPanelLayout.setVerticalGroup(
networkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 388, Short.MAX_VALUE)
);
settingsPanel.addTab(resourceMap.getString("networkPanel.TabConstraints.tabTitle"), networkPanel); // NOI18N
advancedPanel.setName("advancedPanel"); // NOI18N
javax.swing.GroupLayout advancedPanelLayout = new javax.swing.GroupLayout(advancedPanel);
advancedPanel.setLayout(advancedPanelLayout);
advancedPanelLayout.setHorizontalGroup(
advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 562, Short.MAX_VALUE)
);
advancedPanelLayout.setVerticalGroup(
advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 388, Short.MAX_VALUE)
);
settingsPanel.addTab(resourceMap.getString("advancedPanel.TabConstraints.tabTitle"), advancedPanel); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(applyPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(settingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(settingsPanel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(applyPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void speedKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyReleased
try {
String upload = "";
if(uploadkbps.getSelectedIndex() == KILOBIT)
upload = "" + Integer.parseInt(uploadspeed.getText())/8;
else
upload = uploadspeed.getText();
String download = "";
if(downloadkbps.getSelectedIndex() == KILOBIT)
download = "" + Integer.parseInt(downloadspeed.getText())/8;
else
download = downloadspeed.getText();
initUsage(upload, download);
}
catch(NumberFormatException e) {
e.printStackTrace();
return;
}
}//GEN-LAST:event_speedKeyReleased
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
kbpsSwitchPerformed(uploadkbps, uploadspeed);
}//GEN-LAST:event_uploadkbpsActionPerformed
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
kbpsSwitchPerformed(downloadkbps, downloadspeed);
}//GEN-LAST:event_downloadkbpsActionPerformed
private void monthKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_monthKeyReleased
try {
int uploadMonthValue = Integer.parseInt(uploadgb.getText());
int downloadMonthValue = Integer.parseInt(downloadgb.getText());
String upload = "";
String burstUpload = "";
String download = "";
String burstDownload = "";
if(uploadkbps.getSelectedIndex() == KILOBIT)
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue)*8; //kbit
else
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue); //kbyte
if(downloadkbps.getSelectedIndex() == KILOBIT)
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue)*8; //kbit
else
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue); //kbyte
initSpeeds(upload, download);
}
catch(NumberFormatException e) {
e.printStackTrace();
return;
}
}//GEN-LAST:event_monthKeyReleased
private void cancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelMouseClicked
this.dispose();
}//GEN-LAST:event_cancelMouseClicked
private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okMouseClicked
saveSpeeds();
saveUpdatePolicy();
this.dispose();
}//GEN-LAST:event_okMouseClicked
private void checkUpdatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkUpdatesActionPerformed
long current = new Date().getTime();
if(current < newsLastFetched + 5*60*1000) {
return;
}
checkUpdates.setText("Checking for updates");
checkUpdates.setEnabled(false);
newsLastFetched = current;
SwingWorker sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
NewsFetcher.getInstance(RouterHelper.getContext()).fetchNews();
return null;
}
@Override
protected void done() {
checkUpdates.setText("Check for updates now");
checkUpdates.setEnabled(true);
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
updateNow.setVisible(true);
}
}
};
}//GEN-LAST:event_checkUpdatesActionPerformed
private void updateNowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateNowActionPerformed
SwingWorker sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
new net.i2p.router.web.UpdateHandler().update();
return null;
}
};
updateNow.setEnabled(false);
updateNow.setText("Updating...");
checkUpdates.setEnabled(false);
}//GEN-LAST:event_updateNowActionPerformed
private void advancedUpdateConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedUpdateConfigActionPerformed
try {
Desktop.getDesktop().browse(new URI("http://127.0.0.1:7657/configupdate.jsp"));
} catch (URISyntaxException ex) {
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
}
catch (IOException ex) {
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_advancedUpdateConfigActionPerformed
protected void initUsage(String upload, String download) {
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
}
protected void initSpeeds(String upload, String download) {
uploadspeed.setText(upload);
downloadspeed.setText(download);
}
private void kbpsSwitchPerformed(JComboBox kbps, JTextField speed) {
int index = kbps.getSelectedIndex();
int previous = Integer.parseInt(speed.getText());
if(index == KILOBIT) {
speed.setText("" + previous*8);
}
else {
speed.setText("" + previous/8);
}
}
protected void saveSpeeds() {
int maxDownload = Integer.parseInt(downloadspeed.getText());
int maxUpload = Integer.parseInt(uploadspeed.getText());
if(uploadkbps.getSelectedIndex() == KILOBIT) {
SpeedHandler.setOutboundBandwidth(maxUpload/8);
SpeedHandler.setOutboundBurstBandwidth(maxUpload/8);
}
else {
SpeedHandler.setOutboundBandwidth(maxUpload);
SpeedHandler.setOutboundBurstBandwidth(maxUpload);
}
if(downloadkbps.getSelectedIndex() == KILOBIT) {
SpeedHandler.setInboundBandwidth(maxDownload/8);
SpeedHandler.setInboundBurstBandwidth(maxDownload/8);
}
else {
SpeedHandler.setInboundBandwidth(maxDownload);
SpeedHandler.setInboundBurstBandwidth(maxDownload);
}
}
protected void saveUpdatePolicy() {
ButtonModel policyButton = updateButtonGroup.getSelection();
if(policyButton.equals(updateInform.getModel())) {
UpdateHandler.setUpdatePolicy(UpdateHelper.NOTIFY_UPDATE_POLICY);
}
else if(policyButton.equals(updateDownload.getModel())) {
UpdateHandler.setUpdatePolicy(UpdateHelper.DOWNLOAD_UPDATE_POLICY);
}
else if(policyButton.equals(updateDownloadRestart.getModel())) {
UpdateHandler.setUpdatePolicy(UpdateHelper.INSTALL_UPDATE_POLICY);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel advancedPanel;
private javax.swing.JToggleButton advancedUpdateConfig;
private javax.swing.JPanel applyPanel;
private javax.swing.JToggleButton cancel;
private javax.swing.JToggleButton checkUpdates;
private javax.swing.JScrollPane clientFrame;
private javax.swing.JLabel clientTunnelLabel;
private javax.swing.JLabel downloadSpeedLabel;
private javax.swing.JLabel downloadUsageLabel;
private javax.swing.JTextField downloadgb;
private javax.swing.JComboBox downloadkbps;
private javax.swing.JTextField downloadspeed;
private javax.swing.JLabel gbDownloadLabel;
private javax.swing.JLabel gbUploadLabel;
private javax.swing.JPanel networkPanel;
private javax.swing.JToggleButton ok;
private javax.swing.JScrollPane serverFrame;
private javax.swing.JLabel serverTunnelLabel;
private javax.swing.JTabbedPane settingsPanel;
private javax.swing.JPanel speedPanel;
private javax.swing.JPanel tunnelPanel;
private javax.swing.JLabel tunnelsExplanation;
private javax.swing.ButtonGroup updateButtonGroup;
private javax.swing.JRadioButton updateDownload;
private javax.swing.JRadioButton updateDownloadRestart;
private javax.swing.JRadioButton updateInform;
private javax.swing.JLabel updateMethod;
private javax.swing.JToggleButton updateNow;
private javax.swing.JPanel updatesPanel;
private javax.swing.JLabel uploadDownloadExplanation;
private javax.swing.JLabel uploadSpeedLabel;
private javax.swing.JLabel uploadUsageLabel;
private javax.swing.JTextField uploadgb;
private javax.swing.JComboBox uploadkbps;
private javax.swing.JTextField uploadspeed;
// End of variables declaration//GEN-END:variables
public static final int KILOBIT = 0;
public static final int KILOBYTE = 1;
private long newsLastFetched = 0;
}

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;
/**
*
@ -151,7 +151,7 @@ public class Tray {
public void actionPerformed(ActionEvent arg0) {
RouterHandler.setStatus(RouterHandler.SHUTDOWN_GRACEFULLY);
long shutdownTime = RouterHelper.getGracefulShutdownTimeRemaining();
System.out.println(shutdownTime);
System.out.println("Shutdowntime remaining: " + shutdownTime);
if(shutdownTime>0) {
trayIcon.displayMessage("Shutting down...", "Shutdown time remaining: " + shutdownTime/1000 + " seconds."
+ System.getProperty("line.separator") + "Shutdown will not happen immediately, because we are still participating in the network.", TrayIcon.MessageType.INFO);
@ -170,7 +170,7 @@ public class Tray {
popup.addSeparator();
config.add(speedConfig);
//config.add(generalConfig);
config.add(generalConfig);
config.add(advancedConfig);
popup.add(config);

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
Form.title=General Configuration
speedPanel.TabConstraints.tabTitle=Speed
updatesPanel.TabConstraints.tabTitle=Updates
tunnelPanel.TabConstraints.tabTitle=Tunnels/Services
networkPanel.TabConstraints.tabTitle=Network
advancedPanel.TabConstraints.tabTitle=Advanced
uploadSpeedLabel.text=Upload speed:
downloadSpeedLabel.text=Download speed:
uploadspeed.text=jTextField1
downloadspeed.text=jTextField2
uploadgb.text=jTextField3
downloadgb.text=jTextField4
updateMethod.text=What is your preferred automatic update setting?
updateInform.text=Only inform about updates
updateDownload.text=Download and verify update file, do not restart
updateDownloadRestart.text=Download, verify and restart
checkUpdates.text=Check for updates now
updateNow.text=Update available: update now
advancedUpdateConfig.text=Advanced update configuration
clientTunnelLabel.text=Client tunnels:
serverTunnelLabel.text=Server tunnels:
tunnelsExplanation.text=Tunnel explanation
uploadUsageLabel.text=Monthly usage:
downloadUsageLabel.text=Monthly usage:
gbUploadLabel.text=GB
gbDownloadLabel.text=GB
uploadDownloadExplanation.text=Explanation ...

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,12 @@ public class SpeedHelper {
public static int calculateSpeed(int gigabytes) {
return (int) (((long)gigabytes)*1000000/31/24/3600);
}
public static String getInboundBandwidth() {
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH);
}
public static String getOutboundBandwidth() {
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH);
}
}

View File

@ -0,0 +1,19 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package net.i2p.desktopgui.router.configuration;
import net.i2p.desktopgui.router.RouterHelper;
/**
*
* @author mathias
*/
public class UpdateHandler {
public static void setUpdatePolicy(String policy) {
RouterHelper.getContext().router().setConfigSetting(UpdateHelper.PROP_UPDATE_POLICY, policy);
RouterHelper.getContext().router().saveConfig();
}
}

View File

@ -0,0 +1,66 @@
package net.i2p.desktopgui.router.configuration;
import net.i2p.desktopgui.router.RouterHelper;
/**
*
* @author mathias
*/
public class UpdateHelper {
public static final String PROP_NEWS_URL = "router.newsURL";
public static final String DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
public static final String PROP_UPDATE_POLICY = "router.updatePolicy";
public static final String NOTIFY_UPDATE_POLICY = "notify";
public static final String DOWNLOAD_UPDATE_POLICY = "download";
public static final String INSTALL_UPDATE_POLICY = "install";
public static final String DEFAULT_UPDATE_POLICY = DOWNLOAD_UPDATE_POLICY;
public static final String PROP_SHOULD_PROXY = "router.updateThroughProxy";
public static final String DEFAULT_SHOULD_PROXY = Boolean.TRUE.toString();
public static final String PROP_PROXY_HOST = "router.updateProxyHost";
public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
public static final String PROP_PROXY_PORT = "router.updateProxyPort";
public static final String DEFAULT_PROXY_PORT = "4444";
public static final String PROP_UPDATE_URL = "router.updateURL";
public static final String DEFAULT_UPDATE_URL =
"http://echelon.i2p/i2p/i2pupdate.sud\r\n" +
"http://stats.i2p/i2p/i2pupdate.sud\r\n" +
"http://complication.i2p/i2p/i2pupdate.sud\r\n" +
"http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" +
"http://update.postman.i2p/i2pupdate.sud" ;
public static final String PROP_TRUSTED_KEYS = "router.trustedUpdateKeys";
public static String getNewsURL() {
String url = RouterHelper.getContext().getProperty(PROP_NEWS_URL);
if(url == null) {
return DEFAULT_NEWS_URL;
}
else {
return url;
}
}
public static String getUpdatePolicy() {
String policy = null;
try {
policy = RouterHelper.getContext().getProperty(PROP_UPDATE_POLICY);
}
catch(Exception e) {
e.printStackTrace();
}
System.out.println("Policy: " + policy);
if(policy == null) {
return DEFAULT_UPDATE_POLICY;
}
else {
return policy;
}
}
}

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">
@ -52,7 +55,7 @@
<mkdir dir="../jsp/WEB-INF/" />
<mkdir dir="../jsp/WEB-INF/classes" />
<!-- there are various jspc ant tasks, but they all seem a bit flakey -->
<java classname="org.apache.jasper.JspC" fork="true" >
<java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
<classpath>
<pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
@ -73,6 +76,7 @@
</java>
<javac debug="true" deprecation="on" source="1.5" target="1.5"
destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />

View File

@ -75,7 +75,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
private static long __tunnelId = 0;
private long _tunnelId;
private Properties _clientOptions;
private final List _sessions;
private final List<I2PSession> _sessions;
public static final int PACKET_DELAY = 100;
@ -92,7 +92,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
private final List tasks = new ArrayList();
private int next_task_id = 1;
private Set listeners = new HashSet();
private final Set listeners = new HashSet();
public static void main(String[] args) throws IOException {
new I2PTunnel(args);
@ -179,7 +179,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
}
}
List getSessions() {
List<I2PSession> getSessions() {
synchronized (_sessions) {
return new ArrayList(_sessions);
}
@ -668,9 +668,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
*/
public void runConnectClient(String args[], Logging l) {
if (args.length >= 1 && args.length <= 3) {
int port = -1;
int _port = -1;
try {
port = Integer.parseInt(args[0]);
_port = Integer.parseInt(args[0]);
} catch (NumberFormatException nfe) {
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
return;
@ -702,10 +702,10 @@ public class I2PTunnel implements Logging, EventDispatcher {
I2PTunnelTask task;
ownDest = !isShared;
try {
task = new I2PTunnelConnectClient(port, l, ownDest, proxy, (EventDispatcher) this, this);
task = new I2PTunnelConnectClient(_port, l, ownDest, proxy, (EventDispatcher) this, this);
addtask(task);
} catch (IllegalArgumentException iae) {
_log.error(getPrefix() + "Invalid I2PTunnel config to create an httpclient [" + host + ":"+ port + "]", iae);
_log.error(getPrefix() + "Invalid I2PTunnel config to create an httpclient [" + host + ":"+ _port + "]", iae);
}
} else {
l.log("connectclient <port> [<sharedClient>] [<proxy>]");
@ -728,9 +728,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
*/
public void runIrcClient(String args[], Logging l) {
if (args.length >= 2) {
int port = -1;
int _port = -1;
try {
port = Integer.parseInt(args[0]);
_port = Integer.parseInt(args[0]);
} catch (NumberFormatException nfe) {
l.log("invalid port");
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
@ -757,12 +757,12 @@ public class I2PTunnel implements Logging, EventDispatcher {
String privateKeyFile = null;
if (args.length >= 4)
privateKeyFile = args[3];
task = new I2PTunnelIRCClient(port, args[1], l, ownDest, (EventDispatcher) this, this, privateKeyFile);
task = new I2PTunnelIRCClient(_port, args[1], l, ownDest, (EventDispatcher) this, this, privateKeyFile);
addtask(task);
notifyEvent("ircclientTaskId", Integer.valueOf(task.getId()));
} catch (IllegalArgumentException iae) {
_log.error(getPrefix() + "Invalid I2PTunnel config to create an ircclient [" + host + ":"+ port + "]", iae);
l.log("Invalid I2PTunnel configuration [" + host + ":" + port + "]");
_log.error(getPrefix() + "Invalid I2PTunnel config to create an ircclient [" + host + ":"+ _port + "]", iae);
l.log("Invalid I2PTunnel configuration [" + host + ":" + _port + "]");
notifyEvent("ircclientTaskId", Integer.valueOf(-1));
}
} else {
@ -786,9 +786,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
*/
public void runSOCKSTunnel(String args[], Logging l) {
if (args.length >= 1 && args.length <= 2) {
int port = -1;
int _port = -1;
try {
port = Integer.parseInt(args[0]);
_port = Integer.parseInt(args[0]);
} catch (NumberFormatException nfe) {
l.log("invalid port");
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
@ -802,7 +802,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
ownDest = !isShared;
I2PTunnelTask task;
task = new I2PSOCKSTunnel(port, l, ownDest, (EventDispatcher) this, this);
task = new I2PSOCKSTunnel(_port, l, ownDest, (EventDispatcher) this, this);
addtask(task);
notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId()));
} else {
@ -820,9 +820,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
*/
public void runStreamrClient(String args[], Logging l) {
if (args.length == 3) {
InetAddress host;
InetAddress _host;
try {
host = InetAddress.getByName(args[0]);
_host = InetAddress.getByName(args[0]);
} catch (UnknownHostException uhe) {
l.log("unknown host");
_log.error(getPrefix() + "Error resolving " + args[0], uhe);
@ -830,9 +830,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
return;
}
int port = -1;
int _port = -1;
try {
port = Integer.parseInt(args[1]);
_port = Integer.parseInt(args[1]);
} catch (NumberFormatException nfe) {
l.log("invalid port");
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
@ -840,7 +840,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
return;
}
StreamrConsumer task = new StreamrConsumer(host, port, args[2], l, (EventDispatcher) this, this);
StreamrConsumer task = new StreamrConsumer(_host, _port, args[2], l, (EventDispatcher) this, this);
task.startRunning();
addtask(task);
notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId()));
@ -859,9 +859,9 @@ public class I2PTunnel implements Logging, EventDispatcher {
*/
public void runStreamrServer(String args[], Logging l) {
if (args.length == 2) {
int port = -1;
int _port = -1;
try {
port = Integer.parseInt(args[0]);
_port = Integer.parseInt(args[0]);
} catch (NumberFormatException nfe) {
l.log("invalid port");
_log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe);
@ -877,7 +877,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
return;
}
StreamrProducer task = new StreamrProducer(port, privKeyFile, args[1], l, (EventDispatcher) this, this);
StreamrProducer task = new StreamrProducer(_port, privKeyFile, args[1], l, (EventDispatcher) this, this);
task.startRunning();
addtask(task);
notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId()));

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

@ -44,6 +44,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
protected final Object sockLock = new Object(); // Guards sockMgr and mySockets
protected I2PSocketManager sockMgr; // should be final and use a factory. LINT
protected List mySockets = new ArrayList();
protected boolean _ownDest;
protected Destination dest = null;
private int localPort;
@ -114,6 +115,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
this.l = l;
this.handlerName = handlerName + _clientId;
this.privKeyFile = pkf;
_ownDest = ownDest; // == ! shared client
_context = tunnel.getContext();
@ -129,13 +131,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
boolean openNow = !Boolean.valueOf(tunnel.getClientOptions().getProperty("i2cp.delayOpen")).booleanValue();
if (openNow) {
while (sockMgr == null) {
synchronized (sockLock) {
if (ownDest) {
sockMgr = buildSocketManager();
} else {
sockMgr = getSocketManager();
}
}
verifySocketManager();
if (sockMgr == null) {
_log.log(Log.CRIT, "Unable to create socket manager (our own? " + ownDest + ")");
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
@ -209,27 +205,67 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
}
}
/**
* Sets the this.sockMgr field if it is null, or if we want a new one
*
* We need a socket manager before getDefaultOptions() and most other things
*/
protected void verifySocketManager() {
synchronized(sockLock) {
boolean newManager = false;
if (this.sockMgr == null) {
newManager = true;
} else {
I2PSession sess = sockMgr.getSession();
if (sess == null) {
newManager = true;
} else if (sess.isClosed() &&
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")).booleanValue() &&
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
// build a new socket manager and a new dest if the session is closed.
getTunnel().removeSession(sess);
if (_log.shouldLog(Log.WARN))
_log.warn(getTunnel().getClientOptions().getProperty("inbound.nickname") + ": Built a new destination on resume");
newManager = true;
} // else the old socket manager will reconnect the old session if necessary
}
if (newManager) {
if (_ownDest)
this.sockMgr = buildSocketManager();
else
this.sockMgr = getSocketManager();
}
}
}
/** this is ONLY for shared clients */
private static I2PSocketManager socketManager;
/** this is ONLY for shared clients */
protected synchronized I2PSocketManager getSocketManager() {
return getSocketManager(getTunnel(), this.privKeyFile);
}
/** this is ONLY for shared clients */
protected static synchronized I2PSocketManager getSocketManager(I2PTunnel tunnel) {
return getSocketManager(tunnel, null);
}
/** this is ONLY for shared clients */
protected static synchronized I2PSocketManager getSocketManager(I2PTunnel tunnel, String pkf) {
if (socketManager != null) {
I2PSession s = socketManager.getSession();
if ( (s == null) || (s.isClosed()) ) {
_log.info("Building a new socket manager since the old one closed [s=" + s + "]");
if (_log.shouldLog(Log.INFO))
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since the old one closed [s=" + s + "]");
if (s != null)
tunnel.removeSession(s);
socketManager = buildSocketManager(tunnel, pkf);
} else {
_log.info("Not building a new socket manager since the old one is open [s=" + s + "]");
if (_log.shouldLog(Log.INFO))
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Not building a new socket manager since the old one is open [s=" + s + "]");
}
} else {
_log.info("Building a new socket manager since there is no other one");
if (_log.shouldLog(Log.INFO))
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since there is no other one");
socketManager = buildSocketManager(tunnel, pkf);
}
return socketManager;
@ -278,6 +314,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
}
}
sockManager.setName("Client");
if (_log.shouldLog(Log.INFO))
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Built a new socket manager [s=" + sockManager.getSession() + "]");
tunnel.addSession(sockManager.getSession());
return sockManager;
}
@ -343,10 +381,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
* @return a new I2PSocket
*/
public I2PSocket createI2PSocket(Destination dest) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException {
if (sockMgr == null) {
// we need this before getDefaultOptions()
sockMgr = getSocketManager();
}
verifySocketManager();
return createI2PSocket(dest, getDefaultOptions());
}
@ -367,19 +402,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
public I2PSocket createI2PSocket(Destination dest, I2PSocketOptions opt) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException {
I2PSocket i2ps;
if (sockMgr == null) {
// delayed open - call get instead of build because the locking is up there
sockMgr = getSocketManager();
} else if (Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
synchronized(sockMgr) {
I2PSocketManager oldSockMgr = sockMgr;
// This will build a new socket manager and a new dest if the session is closed.
sockMgr = getSocketManager();
if (oldSockMgr != sockMgr) {
_log.warn("Built a new destination on resume");
}
}
} // else the old socket manager will reconnect the old session if necessary
verifySocketManager();
i2ps = sockMgr.connect(dest, opt);
synchronized (sockLock) {
mySockets.add(i2ps);

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,8 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
defaultOpts.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, ""+DEFAULT_READ_TIMEOUT);
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
// delayed start
verifySocketManager();
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

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,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
// delayed start
if (sockMgr == null)
sockMgr = getSocketManager();
verifySocketManager();
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

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

@ -434,6 +434,16 @@ public class TunnelController implements Logging {
public boolean getIsRunning() { return _running; }
public boolean getIsStarting() { return _starting; }
/** if running but no open sessions, we are in standby */
public boolean getIsStandby() {
if (!_running)
return false;
for (I2PSession sess : _tunnel.getSessions()) {
if (!sess.isClosed())
return false;
}
return true;
}
public void getSummary(StringBuffer buf) {
String type = getType();

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

@ -77,6 +77,7 @@ public class IndexBean {
public static final int RUNNING = 1;
public static final int STARTING = 2;
public static final int NOT_RUNNING = 3;
public static final int STANDBY = 4;
public static final String PROP_TUNNEL_PASSPHRASE = "i2ptunnel.passphrase";
static final String PROP_NONCE = IndexBean.class.getName() + ".nonce";
@ -145,7 +146,7 @@ public class IndexBean {
if ( (_action == null) || (_action.trim().length() <= 0) || ("Cancel".equals(_action)))
return "";
if ( (_prevNonce != _curNonce) && (!validPassphrase(_passphrase)) )
return "Invalid nonce, are you being spoofed?";
return "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.";
if ("Stop all".equals(_action))
return stopAll();
else if ("Start all".equals(_action))
@ -412,8 +413,12 @@ public class IndexBean {
public int getTunnelStatus(int tunnel) {
TunnelController tun = getController(tunnel);
if (tun == null) return NOT_RUNNING;
if (tun.getIsRunning()) return RUNNING;
else if (tun.getIsStarting()) return STARTING;
if (tun.getIsRunning()) {
if (isClient(tunnel) && tun.getIsStandby())
return STANDBY;
else
return RUNNING;
} else if (tun.getIsStarting()) return STARTING;
else return NOT_RUNNING;
}
@ -778,12 +783,6 @@ public class IndexBean {
config.setProperty("interface", _reachableByOther);
else
config.setProperty("interface", _reachableBy);
config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
if (_name != null && !_sharedClient) {
config.setProperty("option.inbound.nickname", _name);
config.setProperty("option.outbound.nickname", _name);
}
config.setProperty("sharedClient", _sharedClient + "");
for (String p : _booleanClientOpts)
config.setProperty("option." + p, "" + _booleanOptions.contains(p));
@ -896,14 +895,12 @@ public class IndexBean {
config.setProperty("option.i2p.streaming.connectDelay", "1000");
else
config.setProperty("option.i2p.streaming.connectDelay", "0");
if (_name != null) {
if ( (!isClient(_type)) || (!_sharedClient) ) {
config.setProperty("option.inbound.nickname", _name);
config.setProperty("option.outbound.nickname", _name);
} else {
config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
}
if (isClient(_type) && _sharedClient) {
config.setProperty("option.inbound.nickname", CLIENT_NICKNAME);
config.setProperty("option.outbound.nickname", CLIENT_NICKNAME);
} else if (_name != null) {
config.setProperty("option.inbound.nickname", _name);
config.setProperty("option.outbound.nickname", _name);
}
if ("interactive".equals(_profile))
// This was 1 which doesn't make much sense

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

@ -97,6 +97,11 @@
case IndexBean.STARTING:
%><div class="statusStarting text">Starting...</div>
<a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>">Stop</a>
<%
break;
case IndexBean.STANDBY:
%><div class="statusStarting text">Standby</div>
<a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>">Stop</a>
<%
break;
case IndexBean.RUNNING:

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" />
@ -84,7 +86,7 @@
<mkdir dir="../jsp/WEB-INF/" />
<mkdir dir="../jsp/WEB-INF/classes" />
<!-- there are various jspc ant tasks, but they all seem a bit flakey -->
<java classname="org.apache.jasper.JspC" fork="true">
<java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
<classpath>
<pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
@ -114,6 +116,7 @@
<javac debug="true" deprecation="on" source="1.5" target="1.5"
destdir="../jsp/WEB-INF/classes/"
srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
@ -140,7 +143,7 @@
</target>
<uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
<srcfiles dir= "../jsp" includes="**/*.jsp, **/*.html, susimail/susimail, web.xml"/>
<srcfiles dir= "../jsp" includes="**/*.jsp, **/*.html, *.css, susimail/susimail, web.xml"/>
</uptodate>
<target name="javadoc">

View File

@ -1,9 +1,9 @@
package net.i2p.router.web;
import net.i2p.data.RouterInfo;
import net.i2p.router.LoadTestManager;
import net.i2p.router.Router;
import net.i2p.router.transport.FIFOBandwidthRefiller;
import net.i2p.router.transport.TransportManager;
import net.i2p.router.transport.udp.UDPTransport;
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
import net.i2p.time.Timestamper;
@ -25,9 +25,13 @@ public class ConfigNetHandler extends FormHandler {
private String _ntcpHostname;
private String _ntcpPort;
private String _tcpPort;
private String _udpHost1;
private String _udpHost2;
private String _udpPort;
private boolean _ntcpAutoIP;
private String _udpAutoIP;
private String _ntcpAutoIP;
private boolean _ntcpAutoPort;
private boolean _upnp;
private String _inboundRate;
private String _inboundBurstRate;
private String _inboundBurst;
@ -37,7 +41,8 @@ public class ConfigNetHandler extends FormHandler {
private String _reseedFrom;
private boolean _enableLoadTesting;
private String _sharePct;
private boolean _ratesOnly;
private static final boolean _ratesOnly = false; // always false - delete me
private static final String PROP_HIDDEN = Router.PROP_HIDDEN_HIDDEN; // see Router for other choice
protected void processForm() {
if (_saveRequested || ( (_action != null) && ("Save changes".equals(_action)) )) {
@ -53,12 +58,19 @@ public class ConfigNetHandler extends FormHandler {
public void setEnabletimesync(String moo) { _timeSyncEnabled = true; }
public void setRecheckReachability(String moo) { _recheckReachabilityRequested = true; }
public void setRequireIntroductions(String moo) { _requireIntroductions = true; }
public void setHiddenMode(String moo) { _hiddenMode = true; }
public void setDynamicKeys(String moo) { _dynamicKeys = true; }
public void setUpdateratesonly(String moo) { _ratesOnly = true; }
public void setEnableloadtesting(String moo) { _enableLoadTesting = true; }
public void setNtcpAutoIP(String moo) { _ntcpAutoIP = true; }
public void setNtcpAutoPort(String moo) { _ntcpAutoPort = true; }
public void setUdpAutoIP(String mode) {
_udpAutoIP = mode;
_hiddenMode = "hidden".equals(mode);
}
public void setNtcpAutoIP(String mode) {
_ntcpAutoIP = mode;
}
public void setNtcpAutoPort(String mode) {
_ntcpAutoPort = mode.equals("2");
}
public void setUpnp(String moo) { _upnp = true; }
public void setHostname(String hostname) {
_hostname = (hostname != null ? hostname.trim() : null);
@ -72,6 +84,12 @@ public class ConfigNetHandler extends FormHandler {
public void setNtcpport(String port) {
_ntcpPort = (port != null ? port.trim() : null);
}
public void setUdpHost1(String host) {
_udpHost1 = (host != null ? host.trim() : null);
}
public void setUdpHost2(String host) {
_udpHost2 = (host != null ? host.trim() : null);
}
public void setUdpPort(String port) {
_udpPort = (port != null ? port.trim() : null);
}
@ -111,58 +129,75 @@ public class ConfigNetHandler extends FormHandler {
boolean restartRequired = false;
if (!_ratesOnly) {
// IP Settings
String oldUdp = _context.getProperty(UDPTransport.PROP_SOURCES, UDPTransport.DEFAULT_SOURCES);
String oldUHost = _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST, "");
if (_udpAutoIP != null) {
String uhost = "";
if (_udpAutoIP.equals("fixed")) {
if (_udpHost1 != null && _udpHost1.length() > 0)
uhost = _udpHost1;
else if (_udpHost2 != null && _udpHost2.length() > 0)
uhost = _udpHost2;
else
_udpAutoIP = UDPTransport.DEFAULT_SOURCES;
}
_context.router().setConfigSetting(UDPTransport.PROP_SOURCES, _udpAutoIP);
// Todo: Catch local IPs right here rather than complaining later
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_HOST, uhost);
if ((!oldUdp.equals(_udpAutoIP)) || (!oldUHost.equals(uhost))) {
addFormNotice("Updating IP address");
restartRequired = true;
}
}
// NTCP Settings
// Normalize some things to make the following code a little easier...
String oldNHost = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
if (oldNHost == null) oldNHost = "";
String oldNPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
if (oldNPort == null) oldNPort = "";
String sAutoHost = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP);
String sAutoPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
boolean oldAutoHost = "true".equalsIgnoreCase(sAutoHost);
String oldNHost = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, "");
String oldNPort = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT, "");
String oldAutoHost = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, "true");
String sAutoPort = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "true");
boolean oldAutoPort = "true".equalsIgnoreCase(sAutoPort);
if (_ntcpHostname == null) _ntcpHostname = "";
if (_ntcpPort == null) _ntcpPort = "";
if (_ntcpAutoIP == null) _ntcpAutoIP = "true";
if (oldAutoHost != _ntcpAutoIP || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
if (_ntcpAutoIP) {
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, "true");
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
addFormNotice("Updating inbound TCP address to auto");
} else if (_ntcpHostname.length() > 0) {
if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
if ("disabled".equals(_ntcpAutoIP)) {
addFormNotice("Disabling TCP completely");
} else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
// Todo: Catch local IPs right here rather than complaining later
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname);
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP);
addFormNotice("Updating inbound TCP address to " + _ntcpHostname);
} else {
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP);
addFormNotice("Disabling inbound TCP");
if ("false".equals(_ntcpAutoIP))
addFormNotice("Disabling inbound TCP");
else
addFormNotice("Updating inbound TCP address to auto"); // true or always
}
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP));
restartRequired = true;
}
if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) {
if ( _ntcpAutoPort ) {
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "true");
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
addFormNotice("Updating inbound TCP port to auto");
} else if (_ntcpPort.length() > 0) {
if (_ntcpPort.length() > 0 && !_ntcpAutoPort) {
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort);
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
addFormNotice("Updating inbound TCP port to " + _ntcpPort);
} else {
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT);
addFormNotice("Disabling inbound TCP");
addFormNotice("Updating inbound TCP port to auto");
}
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
restartRequired = true;
}
// UDP Settings
if ( (_udpPort != null) && (_udpPort.length() > 0) ) {
String oldPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_UDP_PORT);
if ( (oldPort == null) && (_udpPort.equals("8887")) ) {
// still on default.. noop
} else if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_udpPort)) ) {
// its not the default OR it has changed
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_UDP_PORT, _udpPort);
String oldPort = "" + _context.getProperty(UDPTransport.PROP_INTERNAL_PORT, UDPTransport.DEFAULT_INTERNAL_PORT);
if (!oldPort.equals(_udpPort)) {
_context.router().setConfigSetting(UDPTransport.PROP_INTERNAL_PORT, _udpPort);
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_PORT, _udpPort);
addFormNotice("Updating UDP port from " + oldPort + " to " + _udpPort);
restartRequired = true;
}
@ -172,36 +207,29 @@ public class ConfigNetHandler extends FormHandler {
updateRates();
boolean switchRequired = false;
if (!_ratesOnly) {
if (_sharePct != null) {
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) {
_context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
addFormNotice("Updating bandwidth share percentage");
}
}
// If hidden mode value changes, restart is required
if (_hiddenMode && "false".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false"))) {
_context.router().setConfigSetting(Router.PROP_HIDDEN, "true");
_context.router().addCapabilities(_context.router().getRouterInfo());
addFormNotice("Gracefully restarting into Hidden Router Mode. Make sure you have no 0-1 length "
+ "<a href=\"configtunnels.jsp\">tunnels!</a>");
hiddenSwitch();
switchRequired = _hiddenMode != _context.router().isHidden();
if (switchRequired) {
_context.router().setConfigSetting(PROP_HIDDEN, "" + _hiddenMode);
if (_hiddenMode)
addFormError("Gracefully restarting into Hidden Router Mode");
else
addFormError("Gracefully restarting to exit Hidden Router Mode");
}
if (!_hiddenMode && "true".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false"))) {
_context.router().removeConfigSetting(Router.PROP_HIDDEN);
_context.router().getRouterInfo().delCapability(RouterInfo.CAPABILITY_HIDDEN);
addFormNotice("Gracefully restarting to exit Hidden Router Mode");
hiddenSwitch();
}
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
if (_dynamicKeys) {
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "true");
} else {
_context.router().removeConfigSetting(Router.PROP_DYNAMIC_KEYS);
if (Boolean.valueOf(_context.getProperty(TransportManager.PROP_ENABLE_UPNP)).booleanValue() !=
_upnp) {
// This is minor, don't set restartRequired
if (_upnp)
addFormNotice("Enabling UPnP, restart required to take effect");
else
addFormNotice("Disabling UPnP, restart required to take effect");
}
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
if (_requireIntroductions) {
_context.router().setConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS, "true");
@ -210,14 +238,12 @@ public class ConfigNetHandler extends FormHandler {
_context.router().removeConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS);
}
if (true || _timeSyncEnabled) {
// Time sync enable, means NOT disabled
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "false");
} else {
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "true");
}
// Time sync enable, means NOT disabled
// Hmm router sets this at startup, not required here
//_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "false");
LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
// Hidden in the GUI
//LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
}
boolean saved = _context.router().saveConfig();
@ -228,10 +254,27 @@ public class ConfigNetHandler extends FormHandler {
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
}
if (restartRequired) {
addFormNotice("Performing a soft restart");
_context.router().restart();
addFormNotice("Soft restart complete");
if (switchRequired) {
hiddenSwitch();
} else if (restartRequired) {
// Wow this dumps all conns immediately and really isn't nice
//addFormNotice("Performing a soft restart");
//_context.router().restart();
//addFormNotice("Soft restart complete");
// Most of the time we aren't changing addresses, just enabling or disabling
// things, so let's try just a new routerInfo and see how that works.
// Maybe we should restart if we change addresses though?
// No, this doesn't work well, really need to call SSU Transport externalAddressReceived(),
// but that's hard to get to, and doesn't handle port changes, etc.
// So don't do this...
//_context.router().rebuildRouterInfo();
//addFormNotice("Router Info rebuilt");
// There's a few changes that don't really require restart (e.g. enabling inbound TCP)
// But it would be hard to get right, so just do a restart.
addFormError("Gracefully restarting I2P to change published router address");
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
}
}
@ -243,19 +286,36 @@ public class ConfigNetHandler extends FormHandler {
private void updateRates() {
boolean updated = false;
if ( (_inboundRate != null) && (_inboundRate.length() > 0) ) {
if (_sharePct != null) {
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) {
_context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
addFormNotice("Updating bandwidth share percentage");
updated = true;
}
}
if ( (_inboundRate != null) && (_inboundRate.length() > 0) &&
!_inboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_INBOUND_BANDWIDTH))) {
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, _inboundRate);
updated = true;
}
if ( (_outboundRate != null) && (_outboundRate.length() > 0) ) {
if ( (_outboundRate != null) && (_outboundRate.length() > 0) &&
!_outboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BANDWIDTH))) {
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, _outboundRate);
updated = true;
}
if ( (_inboundBurstRate != null) && (_inboundBurstRate.length() > 0) ) {
/******* These aren't in the GUI for now
if ( (_inboundBurstRate != null) && (_inboundBurstRate.length() > 0) &&
!_inboundBurstRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_INBOUND_BURST_BANDWIDTH))) {
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, _inboundBurstRate);
updated = true;
}
if ( (_outboundBurstRate != null) && (_outboundBurstRate.length() > 0) ) {
if ( (_outboundBurstRate != null) && (_outboundBurstRate.length() > 0) &&
!_outboundBurstRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BURST_BANDWIDTH))) {
_context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, _outboundBurstRate);
updated = true;
}
@ -295,9 +355,13 @@ public class ConfigNetHandler extends FormHandler {
updated = true;
}
}
***********/
if (updated && !_ratesOnly)
if (updated && !_ratesOnly) {
_context.bandwidthLimiter().reinitialize();
addFormNotice("Updated bandwidth limits");
}
}
}

View File

@ -1,10 +1,11 @@
package net.i2p.router.web;
import net.i2p.data.DataHelper;
import net.i2p.data.RouterAddress;
import net.i2p.router.CommSystemFacade;
import net.i2p.router.LoadTestManager;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.transport.Addresses;
import net.i2p.router.transport.TransportManager;
import net.i2p.router.transport.udp.UDPAddress;
import net.i2p.router.transport.udp.UDPTransport;
@ -14,25 +15,23 @@ public class ConfigNetHelper extends HelperBase {
public ConfigNetHelper() {}
/** copied from various private components */
public final static String PROP_I2NP_UDP_PORT = "i2np.udp.port";
public final static String PROP_I2NP_INTERNAL_UDP_PORT = "i2np.udp.internalPort";
public final static String PROP_I2NP_NTCP_HOSTNAME = "i2np.ntcp.hostname";
public final static String PROP_I2NP_NTCP_PORT = "i2np.ntcp.port";
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoip";
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoport";
public String getNtcphostname() {
if (!TransportManager.enableNTCP(_context))
return "\" disabled=\"true";
String hostname = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
if (hostname == null) return "";
return hostname;
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoport";
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoip";
private final static String CHECKED = " checked=\"true\" ";
private final static String DISABLED = " disabled=\"true\" ";
public String getUdphostname() {
return _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST, "");
}
public String getNtcphostname() {
return _context.getProperty(PROP_I2NP_NTCP_HOSTNAME, "");
}
public String getNtcpport() {
if (!TransportManager.enableNTCP(_context))
return "\" disabled=\"true";
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
if (port == null) return "";
return port;
return _context.getProperty(PROP_I2NP_NTCP_PORT, "");
}
public String getUdpAddress() {
@ -63,75 +62,109 @@ public class ConfigNetHelper extends HelperBase {
return "" + ua.getPort();
}
public String getConfiguredUdpPort() {
return "" + _context.getProperty(UDPTransport.PROP_INTERNAL_PORT, UDPTransport.DEFAULT_INTERNAL_PORT);
}
public String getEnableTimeSyncChecked() {
String disabled = _context.getProperty(Timestamper.PROP_DISABLED, "false");
if ( (disabled != null) && ("true".equalsIgnoreCase(disabled)) )
return "";
else
return " checked ";
return CHECKED;
}
public String getHiddenModeChecked() {
String enabled = _context.getProperty(Router.PROP_HIDDEN, "false");
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
return " checked ";
else
return "";
/** @param prop must default to false */
public String getChecked(String prop) {
if (Boolean.valueOf(_context.getProperty(prop)).booleanValue())
return CHECKED;
return "";
}
public String getDynamicKeysChecked() {
String enabled = _context.getProperty(Router.PROP_DYNAMIC_KEYS, "false");
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
return " checked ";
else
return "";
return getChecked(Router.PROP_DYNAMIC_KEYS);
}
public String getTcpAutoPortChecked() {
if (!TransportManager.enableNTCP(_context))
return " disabled=\"true\" ";
String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_PORT, "false");
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
return " checked ";
else
return "";
public String getTcpAutoPortChecked(int mode) {
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
boolean specified = port != null && port.length() > 0;
if ((mode == 1 && specified) ||
(mode == 2 && !specified))
return CHECKED;
return "";
}
public String getTcpAutoIPChecked() {
if (!TransportManager.enableNTCP(_context))
return " disabled=\"true\" ";
String enabled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "false");
if ( (enabled != null) && ("true".equalsIgnoreCase(enabled)) )
return " checked ";
else
return "";
public String getTcpAutoIPChecked(int mode) {
boolean enabled = TransportManager.enableNTCP(_context);
String hostname = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
boolean specified = hostname != null && hostname.length() > 0;
String auto = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "false");
if ((mode == 0 && (!specified) && auto.equals("false") && enabled) ||
(mode == 1 && specified && auto.equals("false") && enabled) ||
(mode == 2 && auto.equals("true") && enabled) ||
(mode == 3 && auto.equals("always") && enabled) ||
(mode == 4 && !enabled))
return CHECKED;
return "";
}
public String getUdpAutoIPChecked(int mode) {
String hostname = _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST);
boolean specified = hostname != null && hostname.length() > 0;
boolean hidden = _context.router().isHidden();
String sources = _context.getProperty(UDPTransport.PROP_SOURCES, UDPTransport.DEFAULT_SOURCES);
if ((mode == 0 && sources.equals("ssu") && !hidden) ||
(mode == 1 && specified && !hidden) ||
(mode == 2 && hidden) ||
(mode == 3 && sources.equals("local,upnp,ssu") && !hidden) ||
(mode == 4 && sources.equals("local,ssu") && !hidden) ||
(mode == 5 && sources.equals("upnp,ssu") && !hidden))
return CHECKED;
return "";
}
/** default true */
public String getUpnpChecked() {
if (Boolean.valueOf(_context.getProperty(TransportManager.PROP_ENABLE_UPNP, "true")).booleanValue())
return CHECKED;
return "";
}
public String getRequireIntroductionsChecked() {
short status = _context.commSystem().getReachabilityStatus();
switch (status) {
case CommSystemFacade.STATUS_OK:
if ("true".equalsIgnoreCase(_context.getProperty(UDPTransport.PROP_FORCE_INTRODUCERS, "false")))
return "checked=\"true\"";
return "";
case CommSystemFacade.STATUS_UNKNOWN:
return getChecked(UDPTransport.PROP_FORCE_INTRODUCERS);
case CommSystemFacade.STATUS_DIFFERENT:
case CommSystemFacade.STATUS_REJECT_UNSOLICITED:
return "checked=\"true\"";
case CommSystemFacade.STATUS_UNKNOWN:
if ("true".equalsIgnoreCase(_context.getProperty(UDPTransport.PROP_FORCE_INTRODUCERS, "false")))
return "checked=\"true\"";
return "";
default:
return "checked=\"true\"";
return CHECKED;
}
}
public String[] getAddresses() {
return Addresses.getAddresses();
}
public String getInboundRate() {
return "" + _context.bandwidthLimiter().getInboundKBytesPerSecond();
}
public String getOutboundRate() {
return "" + _context.bandwidthLimiter().getOutboundKBytesPerSecond();
}
public String getInboundRateBits() {
return kbytesToBits(_context.bandwidthLimiter().getInboundKBytesPerSecond());
}
public String getOutboundRateBits() {
return kbytesToBits(_context.bandwidthLimiter().getOutboundKBytesPerSecond());
}
public String getShareRateBits() {
return kbytesToBits(getShareBandwidth());
}
private String kbytesToBits(int kbytes) {
return DataHelper.formatSize(kbytes * 8 * 1024) + " bits per second";
}
public String getInboundBurstRate() {
return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond();
}
@ -180,17 +213,15 @@ public class ConfigNetHelper extends HelperBase {
return buf.toString();
}
/** removed */
public String getEnableLoadTesting() {
if (LoadTestManager.isEnabled(_context))
return " checked ";
else
return "";
return "";
}
public String getSharePercentageBox() {
int pct = (int) (100 * _context.router().getSharePercentage());
StringBuffer buf = new StringBuffer(256);
buf.append("<select name=\"sharePercentage\">\n");
buf.append("<select style=\"text-align: right;\" name=\"sharePercentage\">\n");
boolean found = false;
for (int i = 30; i <= 110; i += 10) {
int val = i;
@ -200,12 +231,12 @@ public class ConfigNetHelper extends HelperBase {
else
val = pct;
}
buf.append("<option value=\"").append(val).append("\" ");
buf.append("<option style=\"text-align: right;\" value=\"").append(val).append("\" ");
if (pct == val) {
buf.append("selected=\"true\" ");
found = true;
}
buf.append(">Up to ").append(val).append("%</option>\n");
buf.append(">").append(val).append("%</option>\n");
}
buf.append("</select>\n");
return buf.toString();

View File

@ -63,6 +63,11 @@ public class ConfigTunnelsHelper extends HelperBase {
out.getLength() <= 0 ||
out.getLength() + out.getLengthVariance() <= 0)
buf.append("<tr><td colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels</font></td></tr>");
else if (in.getLength() <= 1 ||
in.getLength() + in.getLengthVariance() <= 1 ||
out.getLength() <= 1 ||
out.getLength() + out.getLengthVariance() <= 1)
buf.append("<tr><td colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels</font></td></tr>");
if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
buf.append("<tr><td colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels</font></td></tr>");

View File

@ -12,7 +12,7 @@ import net.i2p.util.Log;
* <jsp:setProperty name="handler" property="*" />
*
* The form is "processed" after the properties are set and the first output
* property is retrieved - either getNotices() or getErrors().
* property is retrieved - either getAll(), getNotices() or getErrors().
*
*/
public class FormHandler {
@ -21,8 +21,8 @@ public class FormHandler {
private String _nonce;
protected String _action;
protected String _passphrase;
private List _errors;
private List _notices;
private List<String> _errors;
private List<String> _notices;
private boolean _processed;
private boolean _valid;
@ -78,6 +78,31 @@ public class FormHandler {
_notices.add(msg);
}
/**
* Display everything, wrap it in a div for consistent presentation
*
*/
public String getAllMessages() {
validate();
process();
if (_errors.size() <= 0 && _notices.size() <= 0)
return "";
StringBuffer buf = new StringBuffer(512);
buf.append("<div class=\"messages\" id=\"messages\"><p>");
if (_errors.size() > 0) {
buf.append("<span class=\"error\">");
buf.append(render(_errors));
buf.append("</span>");
}
if (_notices.size() > 0) {
buf.append("<span class=\"notice\">");
buf.append(render(_notices));
buf.append("</span>");
}
buf.append("</p></div>");
return buf.toString();
}
/**
* Display any error messages (processing the form if it hasn't
* been yet)
@ -85,6 +110,7 @@ public class FormHandler {
*/
public String getErrors() {
validate();
process();
return render(_errors);
}
@ -95,6 +121,7 @@ public class FormHandler {
*/
public String getNotices() {
validate();
process();
return render(_notices);
}
@ -133,28 +160,29 @@ public class FormHandler {
if ( (expected != null) && (expected.trim().length() > 0) && (expected.equals(_passphrase)) ) {
// ok
} else {
addFormError("Invalid nonce, are you being spoofed?");
addFormError("Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.");
_valid = false;
}
}
}
private String render(List source) {
private void process() {
if (!_processed) {
if (_valid)
processForm();
_processed = true;
}
}
private String render(List<String> source) {
if (source.size() <= 0) {
return "";
} else if (source.size() == 1) {
return (String)source.get(0);
} else {
StringBuffer buf = new StringBuffer(512);
buf.append("<ul>\n");
for (int i = 0; i < source.size(); i++) {
buf.append("<li>");
buf.append((String)source.get(i));
buf.append(source.get(i));
buf.append("</li>\n");
}
buf.append("</ul>\n");

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

@ -91,8 +91,9 @@ public class ReseedHandler {
public boolean isRunning() { return _isRunning; }
public void run() {
_isRunning = true;
System.out.println("Reseed start");
reseed(false);
System.out.println("Reseeding complete");
System.out.println("Reseed complete");
System.setProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false");
_isRunning = false;
}
@ -133,7 +134,7 @@ public class ReseedHandler {
}
/**
* Fetch a directory listing and then all the routerInfo files in the listing.
* Fetch a directory listing and then up to 200 routerInfo files in the listing.
* The listing must contain (exactly) strings that match:
* href="routerInfo-{hash}.dat">
* and then it fetches the files
@ -147,6 +148,7 @@ public class ReseedHandler {
try {
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage","");
System.setProperty("net.i2p.router.web.ReseedHandler.statusMessage","Reseeding: fetching seed URL.");
System.err.println("Reseed from " + seedURL);
URL dir = new URL(seedURL);
byte contentRaw[] = readURL(dir);
if (contentRaw == null) {
@ -160,7 +162,8 @@ public class ReseedHandler {
String content = new String(contentRaw);
Set urls = new HashSet();
int cur = 0;
while (true) {
int total = 0;
while (total++ < 1000) {
int start = content.indexOf("href=\"routerInfo-", cur);
if (start < 0)
break;
@ -170,7 +173,7 @@ public class ReseedHandler {
urls.add(name);
cur = end + 1;
}
if (urls.size() <= 0) {
if (total <= 0) {
_log.error("Read " + contentRaw.length + " bytes from seed " + seedURL + ", but found no routerInfo URLs.");
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
"Last reseed failed fully (no routerInfo URLs at seed URL). " +
@ -178,13 +181,16 @@ public class ReseedHandler {
return;
}
List urlList = new ArrayList(urls);
Collections.shuffle(urlList);
int fetched = 0;
int errors = 0;
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
// 200 max from one URL
for (Iterator iter = urlList.iterator(); iter.hasNext() && fetched < 200; ) {
try {
System.setProperty("net.i2p.router.web.ReseedHandler.statusMessage",
"Reseeding: fetching router info from seed URL (" +
fetched + " successful, " + errors + " errors, " + urls.size() + " total).");
fetched + " successful, " + errors + " errors, " + total + " total).");
fetchSeed(seedURL, (String)iter.next());
fetched++;
@ -197,24 +203,24 @@ public class ReseedHandler {
errors++;
}
}
if (echoStatus) System.out.println();
System.err.println("Reseed got " + fetched + " router infos from " + seedURL);
int failPercent = 100 * errors / urls.size();
int failPercent = 100 * errors / total;
// Less than 10% of failures is considered success,
// because some routerInfos will always fail.
if ((failPercent >= 10) && (failPercent < 90)) {
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
"Last reseed failed partly (" + failPercent + "% of " + urls.size() + "). " +
"Last reseed failed partly (" + failPercent + "% of " + total + "). " +
RESEED_TIPS);
}
if (failPercent >= 90) {
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",
"Last reseed failed (" + failPercent + "% of " + urls.size() + "). " +
"Last reseed failed (" + failPercent + "% of " + total + "). " +
RESEED_TIPS);
}
// Don't go on to the next URL if we have enough
if (fetched > 25)
if (fetched >= 100)
_isRunning = false;
} catch (Throwable t) {
System.setProperty("net.i2p.router.web.ReseedHandler.errorMessage",

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)
@ -78,24 +78,10 @@ public class SummaryHelper extends HelperBase {
long ms = _context.clock().getOffset();
long diff = ms;
if (diff < 0)
diff = 0 - diff;
if (diff == 0) {
return now + " (no skew)";
} else if (diff < 1000) {
return now + " (" + ms + "ms skew)";
} else if (diff < 5 * 1000) {
return now + " (" + (ms / 1000) + "s skew)";
} else if (diff < 60 * 1000) {
return now + " <b>(" + (ms / 1000) + "s skew)</b>";
} else if (diff < 60 * 60 * 1000) {
return now + " <b>(" + (ms / (60 * 1000)) + "m skew)</b>";
} else if (diff < 24 * 60 * 60 * 1000) {
return now + " <b>(" + (ms / (60 * 60 * 1000)) + "h skew)</b>";
} else {
return now + " <b>(" + (ms / (24 * 60 * 60 * 1000)) + "d skew)</b>";
}
long diff = Math.abs(ms);
if (diff < 100)
return now;
return now + " (" + DataHelper.formatDuration(diff) + " skew)";
}
public boolean allowReseed() {
@ -135,7 +121,7 @@ public class SummaryHelper extends HelperBase {
return "ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart";
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
default:
ra = _context.router().getRouterInfo().getTargetAddress("UDP");
ra = _context.router().getRouterInfo().getTargetAddress("SSU");
if (ra == null && _context.router().getUptime() > 5*60*1000) {
if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null ||
_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null)
@ -364,7 +350,10 @@ public class SummaryHelper extends HelperBase {
Destination client = (Destination)iter.next();
String name = getName(client);
buf.append("<b>*</b> ").append(name).append("<br />\n");
buf.append("<b>*</b> ");
buf.append("<a href=\"tunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
buf.append("\" target=\"_top\" title=\"Show tunnels\">");
buf.append(name).append("</a><br />\n");
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(client.calculateHash());
if (ls != null) {
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
@ -375,10 +364,6 @@ public class SummaryHelper extends HelperBase {
} else {
buf.append("<i>No leases</i><br />\n");
}
buf.append("<a href=\"tunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
buf.append("\" target=\"_top\">Details</a> ");
buf.append("<a href=\"configtunnels.jsp#").append(client.calculateHash().toBase64().substring(0,4));
buf.append("\" target=\"_top\">Config</a><br />\n");
}
buf.append("<hr />\n");
return buf.toString();

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,13 +172,18 @@ public class UpdateHandler {
f.delete();
if (err == null) {
String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY);
this.done = true;
if ("install".equals(policy)) {
_log.log(Log.CRIT, "Update was VERIFIED, restarting to install it");
_status = "<b>Update verified</b><br />Restarting";
restart();
} else {
_log.log(Log.CRIT, "Update was VERIFIED, will be installed at next restart");
_status = "<b>Update downloaded</b><br />Click Restart to Install";
_status = "<b>Update downloaded</b><br />";
if (System.getProperty("wrapper.version") != null)
_status += "Click Restart to install";
else
_status += "Click Shutdown and restart to install";
if (up.newVersion() != null)
_status += " Version " + up.newVersion();
}

View File

@ -18,8 +18,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigNetHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<form action="config.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigNetHandler.nonce");
@ -28,21 +27,32 @@
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigNetHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" />
<b>Bandwidth limiter</b><br />
Inbound rate:
<input name="inboundrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps
<div class="configure" id="configure">
<h3>Bandwidth limiter</h3>
<p>
<b>I2P will work best if you configure your rates to match the speed of your internet connection.</b>
</p><p>
<table>
<tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps
In <td>(<jsp:getProperty name="nethelper" property="inboundRateBits" />)<br />
<!-- let's keep this simple...
bursting up to
<input name="inboundburstrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" /> KBps for
<input name="inboundburstrate" type="text" size="5" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" /> KBps for
<jsp:getProperty name="nethelper" property="inboundBurstFactorBox" /><br />
Outbound rate:
<input name="outboundrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps
-->
<tr><td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps
Out <td>(<jsp:getProperty name="nethelper" property="outboundRateBits" />)<br />
<!-- let's keep this simple...
bursting up to
<input name="outboundburstrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="outboundBurstRate" />" /> KBps for
<jsp:getProperty name="nethelper" property="outboundBurstFactorBox" /><br />
<i>KBps = kilobytes per second = 1024 bytes per second = 8192 bits per second.<br />
A negative rate sets the default.</i><br />
Bandwidth share percentage:
<jsp:getProperty name="nethelper" property="sharePercentageBox" /><br />
-->
<tr><td><jsp:getProperty name="nethelper" property="sharePercentageBox" />
Share <td>(<jsp:getProperty name="nethelper" property="shareRateBits" />)<br />
</table>
</p><p>
<% int share = nethelper.getShareBandwidth();
if (share < 12) {
out.print("<b>NOTE</b>: You have configured I2P to share only " + share + "KBps. ");
@ -54,8 +64,10 @@
out.print("The higher the share bandwidth the more you improve your anonymity and help the network.<br />");
}
%>
<p>
</p><p>
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
</p>
</div>
<hr />
<!--
<b>Enable load testing: </b>
@ -67,49 +79,122 @@
<a href="oldstats.jsp#test.rtt">test.rtt</a> and related stats.</p>
<hr />
-->
<b>External UDP address:</b> <i><jsp:getProperty name="nethelper" property="udpAddress" /></i><br />
<b>Require SSU introductions? </b>
<input type="checkbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> /><br />
<p>If you can, please poke a hole in your NAT or firewall to allow unsolicited UDP packets to reach
you on your external UDP address. If you can't, I2P now includes supports UDP hole punching
with "SSU introductions" - peers who will relay a request from someone you don't know to your
router for your router so that you can make an outbound connection to them. I2P will use these
introductions automatically if it detects that the port is not forwarded (as shown by
the <i>Status: Firewalled</i> line), or you can manually require them here.
Users behind symmetric NATs, such as OpenBSD's pf, are not currently supported.</p>
<input type="submit" name="recheckReachability" value="Check network reachability..." />
<hr />
<b>Inbound TCP connection configuration:</b><br />
Externally reachable hostname or IP address:
<input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" />
(dyndns and the like are fine)<br />
OR use IP address detected by SSU
(currently <jsp:getProperty name="nethelper" property="udpIP" />)?
<input type="checkbox" name="ntcpAutoIP" value="true" <jsp:getProperty name="nethelper" property="tcpAutoIPChecked" /> /><br />
<h3>IP and Transport Configuration</h3>
<p>
Externally reachable TCP port:
<input name ="ntcpport" type="text" size="6" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
OR use the same port configured for SSU
(currently <jsp:getProperty name="nethelper" property="udpPort" />)?
<input type="checkbox" name="ntcpAutoPort" value="true" <jsp:getProperty name="nethelper" property="tcpAutoPortChecked" /> /><br />
<p>A hostname entered here will be published in the network database.
It is <b>not private</b>.
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.
</p>
<p>You do <i>not</i> need to allow inbound TCP connections - outbound connections work with no
configuration. However, if you want to receive inbound TCP connections, you <b>must</b> poke a hole
in your NAT or firewall for unsolicited TCP connections. If you specify the wrong IP address or
hostname, or do not properly configure your NAT or firewall, your network performance will degrade
substantially. When in doubt, leave the hostname and port number blank.</p>
<p><b>Note: changing any of these settings will terminate all of your connections and effectively
restart your router.</b>
<b>The default settings will work for most people. There is <a href="#chelp">help below</a>.</b>
</p><p>
<b>UPnP Configuration:</b><br />
<input type="checkbox" name="upnp" value="true" <jsp:getProperty name="nethelper" property="upnpChecked" /> />
Enable UPnP to open firewall ports - <a href="peers.jsp#upnp">UPnP status</a>
</p><p>
<b>IP Configuration:</b><br />
Externally reachable hostname or IP address:<br />
<input type="radio" name="udpAutoIP" value="local,upnp,ssu" <%=nethelper.getUdpAutoIPChecked(3) %> />
Use all auto-detect methods<br />
<input type="radio" name="udpAutoIP" value="local,ssu" <%=nethelper.getUdpAutoIPChecked(4) %> />
Disable UPnP IP address detection<br />
<input type="radio" name="udpAutoIP" value="upnp,ssu" <%=nethelper.getUdpAutoIPChecked(5) %> />
Ignore local interface IP address<br />
<input type="radio" name="udpAutoIP" value="ssu" <%=nethelper.getUdpAutoIPChecked(0) %> />
Use SSU IP address detection only<br />
<input type="radio" name="udpAutoIP" value="fixed" <%=nethelper.getUdpAutoIPChecked(1) %> />
Specify hostname or IP:
<input name ="udpHost1" type="text" size="16" value="<jsp:getProperty name="nethelper" property="udphostname" />" />
<% String[] ips = nethelper.getAddresses();
if (ips.length > 0) {
out.print(" or <select name=\"udpHost2\"><option value=\"\" selected=\"true\">Select Interface</option>\n");
for (int i = 0; i < ips.length; i++) {
out.print("<option value=\"");
out.print(ips[i]);
out.print("\">");
out.print(ips[i]);
out.print("</option>\n");
}
out.print("</select>\n");
}
%>
<br />
<input type="radio" name="udpAutoIP" value="hidden" <%=nethelper.getUdpAutoIPChecked(2) %> />
Hidden mode - do not publish IP <i>(prevents participating traffic)</i><br />
</p><p>
<b>UDP Configuration:</b><br />
UDP port:
<input name ="udpPort" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="configuredUdpPort" />" /><br />
<!-- let's keep this simple...
<input type="checkbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> />
Require SSU introductions
<i>(Enable if you cannot open your firewall)</i>
</p><p>
Current External UDP address: <i><jsp:getProperty name="nethelper" property="udpAddress" /></i><br />
-->
</p><p>
<b>TCP Configuration:</b><br />
Externally reachable hostname or IP address:<br />
<input type="radio" name="ntcpAutoIP" value="true" <%=nethelper.getTcpAutoIPChecked(2) %> />
Use auto-detected IP address
<i>(currently <jsp:getProperty name="nethelper" property="udpIP" />)</i>
if we are not firewalled<br />
<input type="radio" name="ntcpAutoIP" value="always" <%=nethelper.getTcpAutoIPChecked(3) %> />
Always use auto-detected IP address (Not firewalled)<br />
<input type="radio" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(1) %> />
Specify hostname or IP:
<input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" /><br />
<input type="radio" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(0) %> />
Disable inbound (Firewalled)<br />
<input type="radio" name="ntcpAutoIP" value="disabled" <%=nethelper.getTcpAutoIPChecked(4) %> />
Completely disable <i>(select only if behind a firewall that throttles or blocks outbound TCP)</i><br />
</p><p>
Externally reachable TCP port:<br />
<input type="radio" name="ntcpAutoPort" value="2" <%=nethelper.getTcpAutoPortChecked(2) %> />
Use the same port configured for UDP
<i>(currently <jsp:getProperty name="nethelper" property="udpPort" />)</i><br />
<input type="radio" name="ntcpAutoPort" value="1" <%=nethelper.getTcpAutoPortChecked(1) %> />
Specify Port:
<input name ="ntcpport" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
</p><p><b>Note: Changing these settings will restart your router.</b>
</p>
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
<hr />
<b><a name="chelp">Configuration Help:</a></b>
<p>
While I2P will work fine behind most firewalls, your speeds and network integration will generally improve
if the I2P port (generally 8887) is forwarded for both UDP and TCP.
</p><p>
If you can, please poke a hole in your firewall to allow unsolicited UDP and TCP packets to reach
you. If you can't, I2P supports UPnP (Universal Plug and Play) and UDP hole punching
with "SSU introductions" to relay traffic. Most of the options above are for special situations,
for example where UPnP does not work correctly, or a firewall not under your control is doing
harm. Certain firewalls such as symmetric NATs may not work well with I2P.
</p>
<!-- let's keep this simple...
<input type="submit" name="recheckReachability" value="Check network reachability..." />
-->
</p><p>
UPnP is used to communicate with Internet Gateway Devices (IGDs) to detect the external IP address
and forward ports.
UPnP support is beta, and may not work for any number of reasons:
<ul>
<li>No UPnP-compatible device present
<li>UPnP disabled on the device
<li>Software firewall interference with UPnP
<li>Bugs in the device's UPnP implementation
<li>Multiple firewall/routers in the internet connection path
<li>UPnP device change, reset, or address change
</ul>
Reviewing the <a href="peers.jsp#upnp">UPnP status</a> may help.
UPnP may be enabled or disabled above, but a change requires a router restart to take effect.
</p><p>Hostnames entered above will be published in the network database.
They are <b>not private</b>.
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.
If you specify the wrong IP address or
hostname, or do not properly configure your NAT or firewall, your network performance will degrade
substantially. When in doubt, leave the settings at the defaults.</p>
</p>
<hr />
<b><a name="help">Reachability Help:</a></b>
<p>
While I2P will work adequately behind a firewall, your speeds and network integration will generally improve
if you open up your port (generally 8887) to both UDP and TCP, and enable inbound TCP above.
While I2P will work fine behind most firewalls, your speeds and network integration will generally improve
if the I2P port (generally 8887) to both UDP and TCP.
If you think you have opened up your firewall and I2P still thinks you are firewalled, remember
that you may have multiple firewalls, for example both software packages and external hardware routers.
If there is an error, the <a href="logs.jsp">logs</a> may also help diagnose the problem.
@ -118,7 +203,13 @@
<li><b>Firewalled</b> - Your UDP port appears to be firewalled.
As the firewall detection methods are not 100% reliable, this may occasionally be displayed in error.
However, if it appears consistently, you should check whether both your external and internal
firewalls are open on port 8887.
firewalls are open on port 8887. I2P will work fine when firewalled, there is no reason for concern.
When firewalled, the router uses "introducers" to relay inbound connections.
However, you will get more participating traffic and help the network more if you can open your
firewall(s). If you think you have already done so, remember that you may have both a hardware
and a software firewall, or be behind an additional, institutional firewall you cannot control.
Also, some routers cannot correctly forward both TCP and UDP on a single port, or may have other
limitations or bugs that prevent them from passing traffic through to I2P.
<li><b>Testing</b> - The router is currently testing whether your UDP port is firewalled.
<li><b>Hidden</b> - The router is not configured to publish its address,
therefore it does not expect incoming connections.
@ -142,7 +233,8 @@
<li><b>ERR - Private TCP Address</b> - You must never advertise an unroutable IP address such as
127.0.0.1 or 192.168.1.1 as your external address. Correct the address or disable inbound TCP above.
<li><b>ERR - SymmetricNAT</b> - I2P detected that you are firewalled by a Symmetric NAT.
I2P does not work behind this type of firewall.
I2P does not work well behind this type of firewall. You will probably not be able to
accept inbound connections, which will limit your participation in the network.
<li><b>ERR - UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart</b> -
I2P was unable to bind to port 8887 or other configured port.
Check to see if another program is using port 8887. If so, stop that program or configure

View File

@ -19,8 +19,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigAdvancedHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<form action="configadvanced.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce");
@ -29,14 +28,12 @@
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigAdvancedHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" />
<textarea rows="20" cols="100" name="config" wrap="off"><jsp:getProperty name="advancedhelper" property="settings" /></textarea><br />
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" /><!-- <br />
<b>Force restart:</b> <input type="checkbox" name="restart" value="force" /> <i>(specify this
if the changes made above require the router to reset itself - e.g. you are updating TCP ports
or hostnames, etc)</i>-->
If you are changing any of the I2NP settings, you should go to the
<a href="configservice.jsp">service config</a> page and do a graceful restart after saving.
<p>
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" />
</p><p>
NOTE: Some changes may require a restart to take effect.
</p>
</form>
</div>
</body>
</html>

View File

@ -26,8 +26,7 @@ button span.hide{
<jsp:setProperty name="formhandler" property="action" value="<%=request.getParameter("action")%>" />
<jsp:setProperty name="formhandler" property="nonce" value="<%=request.getParameter("nonce")%>" />
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<form action="configclients.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigClientsHandler.nonce");

View File

@ -16,8 +16,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigKeyringHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />

View File

@ -18,8 +18,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigLoggingHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<form action="configlogging.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigLoggingHandler.nonce");
@ -27,25 +26,27 @@
System.setProperty("net.i2p.router.web.ConfigLoggingHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigLoggingHandler.nonce")%>" />
<input type="hidden" name="action" value="blah" />
<b>Logging filename:</b>
<input type="text" name="logfilename" size="40" value="<jsp:getProperty name="logginghelper" property="logFilePattern" />" /><br />
<i>(the symbol '@' will be replaced during log rotation)</i><br />
<b>Log record format:</b>
<input type="text" name="logformat" size="20" value="<jsp:getProperty name="logginghelper" property="recordPattern" />" /><br />
<i>(use 'd' = date, 'c' = class, 't' = thread, 'p' = priority, 'm' = message)</i><br />
<b>Log date format:</b>
<input type="text" name="logdateformat" size="20" value="<jsp:getProperty name="logginghelper" property="datePattern" />" /><br />
<i>('MM' = month, 'dd' = day, 'HH' = hour, 'mm' = minute, 'ss' = second, 'SSS' = millisecond)</i><br />
<b>Max log file size:</b>
<input type="text" name="logfilesize" size="4" value="<jsp:getProperty name="logginghelper" property="maxFileSize" />" /><br />
<hr />
<b>Log levels:</b> <br />
<b>Default log level:</b>
<jsp:getProperty name="logginghelper" property="defaultLogLevelBox" /><br />
<jsp:getProperty name="logginghelper" property="logLevelTable" />
<hr />
<table border="0" cellspacing="5">
<tr><td valign="top"><b>Logging filename:</b>
<td><input type="text" name="logfilename" size="40" value="<jsp:getProperty name="logginghelper" property="logFilePattern" />" /><br />
<i>(the symbol '@' will be replaced during log rotation)</i>
<tr><td valign="top"><b>Log record format:</b>
<td><input type="text" name="logformat" size="20" value="<jsp:getProperty name="logginghelper" property="recordPattern" />" /><br />
<i>(use 'd' = date, 'c' = class, 't' = thread, 'p' = priority, 'm' = message)</i>
<tr><td valign="top"><b>Log date format:</b>
<td><input type="text" name="logdateformat" size="20" value="<jsp:getProperty name="logginghelper" property="datePattern" />" /><br />
<i>('MM' = month, 'dd' = day, 'HH' = hour, 'mm' = minute, 'ss' = second, 'SSS' = millisecond)</i>
<tr><td valign="top"><b>Max log file size:</b>
<td><input type="text" name="logfilesize" size="4" value="<jsp:getProperty name="logginghelper" property="maxFileSize" />" /><br />
<tr><td valign="top"><b>Default log level:</b>
<td><jsp:getProperty name="logginghelper" property="defaultLogLevelBox" />
<br /><i>(DEBUG and INFO are not recommended defaults, as they will drastically slow down your router)</i>
<tr><td valign="top"><b>Log level overrides:</b>
<td><jsp:getProperty name="logginghelper" property="logLevelTable" />
<tr><td><td>
<input type="submit" name="shouldsave" value="Save changes" />
<input type="reset" value="Cancel" />
</table>
</form>
</div>

View File

@ -1,3 +1,27 @@
<div class="confignav" id="confignav">
<center>
<b>
<% if (request.getRequestURI().indexOf("config.jsp") != -1) {
%>Network<% }
else if (request.getRequestURI().indexOf("configservice.jsp") != -1) {
%>Service<% }
else if (request.getRequestURI().indexOf("configupdate.jsp") != -1) {
%>Update<% }
else if (request.getRequestURI().indexOf("configtunnels.jsp") != -1) {
%>Tunnels<% }
else if (request.getRequestURI().indexOf("configclients.jsp") != -1) {
%>Clients<% }
else if (request.getRequestURI().indexOf("configpeer.jsp") != -1) {
%>Peers<% }
else if (request.getRequestURI().indexOf("configkeyring.jsp") != -1) {
%>Keyring<% }
else if (request.getRequestURI().indexOf("configlogging.jsp") != -1) {
%>Logging<% }
else if (request.getRequestURI().indexOf("configstats.jsp") != -1) {
%>Stats<% }
else if (request.getRequestURI().indexOf("configadvanced.jsp") != -1) {
%>Advanced<% }%>
Configuration</b>
<h4><% if (request.getRequestURI().indexOf("config.jsp") != -1) {
%>Network | <% } else { %><a href="config.jsp">Network</a> | <% }
if (request.getRequestURI().indexOf("configservice.jsp") != -1) {
@ -18,3 +42,6 @@
%>Stats | <% } else { %><a href="configstats.jsp">Stats</a> | <% }
if (request.getRequestURI().indexOf("configadvanced.jsp") != -1) {
%>Advanced<% } else { %><a href="configadvanced.jsp">Advanced</a><% } %></h4>
</center>
<hr />
</div>

View File

@ -16,8 +16,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigPeerHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />

View File

@ -16,8 +16,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigServiceHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<form action="configservice.jsp" method="POST">
<% String prev = System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce");
@ -33,6 +32,7 @@
<input type="submit" name="action" value="Shutdown immediately" />
<input type="submit" name="action" value="Cancel graceful shutdown" />
<% if (System.getProperty("wrapper.version") != null) { %>
<p>If you want the router to restart itself after shutting down, you can choose one of
the following. This is useful in some situations - for example, if you changed
some settings that client applications only read at startup, such as the routerconsole password
@ -42,6 +42,7 @@
<input type="submit" name="action" value="Graceful restart" />
<input type="submit" name="action" value="Hard restart" />
<% } %>
<% if ( (System.getProperty("os.name") != null) && (System.getProperty("os.name").startsWith("Win")) ) { %>
<h4>Systray integration</h4>
@ -62,11 +63,14 @@
down your router immediately. You may want to consider shutting down gracefully, as
above, then running uninstall_i2p_service_winnt.bat.</p>
<% } %>
<% if (System.getProperty("wrapper.version") != null) { %>
<h4>Debugging</h4>
<p>At times, it may be helpful to debug I2P by getting a thread dump. To do so,
please select the following option and review the thread dumped to
<a href="logs.jsp#servicelogs">wrapper.log</a>.</p>
<input type="submit" name="action" value="Dump threads" />
<% } %>
<h4>Launch browser on router startup?</h4>
<p>I2P's main configuration interface is this web console, so for your convenience

View File

@ -61,8 +61,7 @@ function toggleAll(category)
<jsp:useBean class="net.i2p.router.web.ConfigStatsHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="formhandler" property="*" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<jsp:useBean class="net.i2p.router.web.ConfigStatsHelper" id="statshelper" scope="request" />
<jsp:setProperty name="statshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />

View File

@ -22,8 +22,7 @@
<jsp:setProperty name="formhandler" property="action" value="<%=request.getParameter("action")%>" />
<jsp:setProperty name="formhandler" property="nonce" value="<%=request.getParameter("nonce")%>" />
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<p><i>
NOTE: The default settings work for most people.

View File

@ -16,8 +16,7 @@
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHandler" id="formhandler" scope="request" />
<jsp:setProperty name="formhandler" property="*" />
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<font color="red"><jsp:getProperty name="formhandler" property="errors" /></font>
<i><jsp:getProperty name="formhandler" property="notices" /></i>
<jsp:getProperty name="formhandler" property="allMessages" />
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHelper" id="updatehelper" scope="request" />
<jsp:setProperty name="updatehelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />

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;
@ -75,3 +87,26 @@ div.news {
text-align: left;
color: inherit;
}
div.confignav {
padding: 1em;
background-color: #efefff;
}
div.configure {
padding: 1em;
background-color: #ffffc0;
}
div.messages {
padding: 1em;
background-color: #fafaff;
}
div.messages span.error {
color: #d00000;
}
div.messages span.notice {
font-style: italic;
}

View File

@ -0,0 +1,27 @@
<%
/*
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*/
/**
* flags.jsp?c=de => icons/flags/de.png
* with headers set so the browser caches.
*/
boolean rendered = false;
String c = request.getParameter("c");
if (c != null && c.length() > 0) {
java.io.OutputStream cout = response.getOutputStream();
response.setContentType("image/png");
response.setHeader("Cache-Control", "max-age=86400"); // cache for a day
try {
net.i2p.util.FileUtil.readFile(c + ".png", "docs/icons/flags", cout);
rendered = true;
} catch (java.io.IOException ioe) {}
if (rendered)
cout.close();;
}
if (!rendered)
response.sendError(404, "Not found");
%>

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 (<a href="configlogging.jsp">configure</a>):</h4>
<jsp:getProperty name="logsHelper" property="logs" />
<hr />
<h4>Service (Wrapper) logs:</h4><a name="servicelogs"> </a>
<jsp:getProperty name="logsHelper" property="serviceLogs" />
<hr />
<h4>Java Version:</h4><a name="version"> </a>
<pre>
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%>
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%>
</pre>
</div>
</body>

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