Compare commits

...

177 Commits

Author SHA1 Message Date
9e1181900b * Update versions, package release
* Remove the last reference to my eepsite as a "news.xml" source,
  and likewise stop my public key from being included
  among valid release signing keys.
2009-06-29 01:07:51 +00:00
56a700e82d 2009-06-25 sponge
* Summary frame layout change so it makes sense.
2009-06-25 00:16:19 +00:00
zzz
b93aada213 -4 2009-06-23 15:59:30 +00:00
zzz
0ce6872693 propagate from branch 'i2p.i2p.zzz.test2' (head 42f7b1b8a91a44aed4bcc09170bbcdc52be5ff74)
to branch 'i2p.i2p' (head 84f8e11c39666abc7fac5c6cd14ab1f9532d721c)
2009-06-23 15:52:07 +00:00
zzz
1c9d84771e configupdate.jsp cleanup 2009-06-23 01:35:55 +00:00
zzz
6699366597 * Browser Launch: Add sensible-browser, x-www-browser, defaultbrowser, and
www-browser in an attempt to launch the user's preferred browser
2009-06-22 19:56:03 +00:00
zzz
5d0d7aca58 minor cleanup 2009-06-22 17:01:56 +00:00
zzz
29d0c19b0e Update: increase max retries 2009-06-22 14:50:59 +00:00
zzz
917e1023e4 Catch AIOOBE reported by tuna http://zzz.i2p/topics/332 2009-06-22 14:16:52 +00:00
zzz
1fd5a20373 Include console.css in new installs! 2009-06-22 14:07:31 +00:00
zzz
abc83362e7 Try again to prevent two EventPumpers 2009-06-22 12:57:38 +00:00
zzz
9792336b33 -3 2009-06-21 00:23:14 +00:00
zzz
4a6d0e4ba2 Fix wrapper.config installs on windows 2009-06-21 00:06:54 +00:00
zzz
bc38ca4f91 Pluck of revision 45a25185236e38606e761060427ee8fa60144a8c from branch i2p.i2p.zzz.test
---------------------------------------------------------------------------------------
    * netdb.jsp: Add country chart at bottom, clean up version chart
2009-06-21 00:03:59 +00:00
zzz
306b3017e4 Pluck of revision 493986d03c43bac019996ea0b10b8a6a40e92a32 from branch i2p.i2p.zzz.test
---------------------------------------------------------------------------------------
    * Browser Launch: Wait until the routerconsole is up before launching the browser
2009-06-21 00:01:14 +00:00
zzz
ce92b6cb66 Pluck of revision 0dc8693b99a852b0183ffc6cd06804878f37ec89 from branch i2p.i2p.zzz.test
---------------------------------------------------------------------------------------
Treat 5.0.0.0/8 (Hamachi) as local
2009-06-21 00:01:02 +00:00
zzz
8e2df567d8 Pluck of revision 546257906e9b26c3a35e38967ebcaa54098d969f from branch i2p.i2p.zzz.test
---------------------------------------------------------------------------------------
    * ReseedHandler:
      - check for upper case HREF to be compatible with apache indexes
2009-06-21 00:00:54 +00:00
zzz
4622f369c3 Pluck of revision aad5b15235be51189b696e6cabb7cc04e1b5e89f from branch i2p.i2p.zzz.test
---------------------------------------------------------------------------------------
post-0.7.4 cleanup
2009-06-21 00:00:39 +00:00
zzz
1eb4473e9d * News Fetcher:
- Change default news URL, use it instead of the old one even if
        the old one is saved in the configuration, to assist in the transition
2009-06-19 00:04:19 +00:00
22c2829714 * desktopgui:
- Added client and server tunnel view
        (saving does not work yet)
2009-06-17 21:54:29 +00:00
zzz
c89fb9ad73 * PeerSelector:
- Limit exploratory tunnels to connected peers when over
        half the connection limit (was 80%)
      - Have the high capacity tier fall back to a new connected tier
        before moving on to the not failing tier
        so that tunnel build success doesn't collapse
    * PeerTestJob:
      - Limit to connected peers
2009-06-17 12:37:03 +00:00
zzz
7c646f8693 -1 2009-06-12 13:05:35 +00:00
zzz
1479ef9a6a propagate from branch 'i2p.i2p.zzz.test' (head 1d4b529f1b52692195f1547338e186819dbd0cab)
to branch 'i2p.i2p' (head 1b8226cb70a7d72f0f674908d8213f8d29eb64eb)
2009-06-12 12:58:33 +00:00
zzz
daf078d4d7 * Installer:
- Add install and temp path substitution to wrapper.config and
        i2prouter on install
2009-06-12 12:23:25 +00:00
c0fd1dbcbc * Update versions, package release 2009-06-12 06:52:09 +00:00
zzz
821dcddda0 * Installer:
- Change the wrapper.config classpath to one line: lib/*.jar
        This means we lose control of classpath load order, so move the windows installer
        jars copy.jar, delete.jar, and exec.jar to a new installer/ directory so
        these jars won't be in the classpath or potentially conflict, since
        copy.jar and delete.jar include FileUtil.class, and we don't want to have
        to remember to add them to the updater if we ever change FileUtil.class.
        Delete the installer/ directory in postinstall.sh since it is windows-only.
2009-06-11 23:38:15 +00:00
zzz
d9cb4e2620 * Console:
- Move the console css from default.css in the .war to docs/themes/console/console.css,
        and support console themes in the main console with routerconsole.theme=foo
2009-06-11 18:05:05 +00:00
zzz
11ad98e7bd Remove unused NoticeHelper 2009-06-11 16:24:44 +00:00
zzz
ce50a9ca44 Upgrade to izpack 4.3.0 and add a short script to fix Vista install problems.
(previous izpack was 3.7.2 from 2005-04-22)

izpack 4.3.0 from :
http://dist.codehaus.org/izpack/releases/4.3.0/IzPack-install-4.3.0.jar
SHA1 f06da6b26ac2c68fed64ab38980352989b8d8841
(no signatures or sha1sums found on website, and the jar is unsigned)
License: Apache 2.0

upack izpack:
java -jar IzPack-install-4.3.0.jar
or
java -jar IzPack-install-4.3.0.jar -console

get the standalone-compiler.jar from the installation lib/ directory:
SHA1 6d2b4a5657bfb864a333b1c4b1c0f8223aa57d80
(no signatures or sha1sums found on website, and the jar is unsigned)

This fixes the bug with the install windows centered in all the
workspaces, not the current workspace. And who knows what other
bugs in the last 4 years.

To fix Vista (and presumably Windows 7) permissiom problems,
add a run-privileged flag for those, and run the new fixperms.bat
which calls icacls to add the privileges to the install directory.

Add support for 6 more language packs found in the new release.
Change from ISO3 codes to native language names.

Disable creation of the i2p.tar.bz2 file in build.xml
(distributed as i2pheadless-0.7.x.tar.bz2), as izpack 4.3.0 now
supports headless installation with java -jar i2pinstall.exe -console.
Update INSTALL.txt and INSTALL-headless.txt accordingly.
2009-06-11 13:31:27 +00:00
zzz
b7d581b412 Dont try to dump threads unless there is a wrapper and we arent on windows 2009-06-11 13:22:56 +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
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
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
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
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
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
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
0e4c846942 - Simplify bw form
- Add config link to UPnP status
2009-05-01 15:26:49 +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
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
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
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
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
551 changed files with 117460 additions and 2903 deletions

View File

@ -1,13 +1,17 @@
$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)
3) sh postinstall.sh (this launches the router)
4) lynx http://localhost:7657/index.jsp (configure the router)
1) java -jar i2pinstall.exe -console (you've already done this)
If you're having trouble, swing by http://forum.i2p.net/, check the
website at http://www.i2p.net/, or get on irc://irc.freenode.net/#i2p
This will run the installer in text mode, including running the postinstall.sh
script, which will start the router and launch a browser.
If you do not have an X server running, the browser launch will fail, and
you may use:
lynx http://localhost:7657/index.jsp
to configure the router.
If you're having trouble, swing by http://forum.i2p2.de/, check the
website at http://www.i2p2.de/, or get on irc://irc.freenode.net/#i2p
To run I2P explicitly:
(*nix): sh i2prouter start

View File

@ -6,16 +6,20 @@ and package up the appropriate installer by running:
ant pkg
This will produce a few key files:
* i2p.tar.bz2: the headless installation
* install.jar: the GUI installer
* i2pupdate.zip: the update package
* install.jar: the GUI and console installer
* i2pinstall.exe: the GUI and console installer wrapped for cross-platform execution
* i2pupdate.zip: the update package
From there, you can follow the headless installation instructions
with the headless installer, run the GUI installer, or deploy
the update into an existing installation.
From there, you can run the headless (console mode) installer:
java -jar i2pinstall.exe -console
Or run the GUI installer:
java -jar i2pinstall.exe
Or move the update file into an existing installation directory and restart.
You will need to have ant installed from http://ant.apache.org/
(1.5 or newer)
(1.7.0 or newer)
Supported JVMs:
Windows: Latest available from http://java.sun.com/ (1.5+ supported)

View File

@ -67,23 +67,64 @@ 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/)
Izpack:
See licenses/LICENSE-Apache1.1.txt
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 4.3.0:
Copyright (c) 2001-2008 Julien Ponge
See licenses/LICENSE-Apache2.0.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 +162,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 +177,7 @@ Applications:
Router console:
Public domain.
Flag icons public domain, courtesy mjames@gmail.com http://www.famfamfam.com/
SAM:
Public domain.
@ -168,6 +209,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 = "06", 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,7 +1279,10 @@ 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 {
@ -1270,8 +1292,10 @@ public class DoCMDS implements Runnable {
// }
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

@ -25,8 +25,6 @@ package net.i2p.BOB;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocket;

View File

@ -52,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();
}
@ -74,6 +74,8 @@ public class I2PtoTCP implements Runnable {
OutputStream out = null;
InputStream Iin = null;
OutputStream Iout = null;
Thread t = null;
Thread q = null;
try {
die:
{
@ -113,17 +115,33 @@ public class I2PtoTCP 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, Thread.currentThread().getName() + " TCPioA");
Thread q = new Thread(conn_a, Thread.currentThread().getName() + " 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
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) {
@ -132,6 +150,14 @@ public class I2PtoTCP implements Runnable {
}
} // die
} finally {
try {
t.interrupt();
} catch (Exception e) {
}
try {
q.interrupt();
} catch (Exception e) {
}
try {
in.close();
} catch (Exception ex) {

View File

@ -28,6 +28,7 @@ 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.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
@ -42,7 +43,7 @@ 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;
@ -52,6 +53,7 @@ public class MUXlisten implements Runnable {
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.
@ -62,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;
@ -151,12 +154,11 @@ public class MUXlisten implements Runnable {
return;
}
// socketManager.addDisconnectListener(new DisconnectListener());
lock.set(false);
quit:
{
try {
tg = new ThreadGroup(N);
die:
{
// toss the connections to a new threads.
// will wrap with TCP and UDP when UDP works
@ -182,22 +184,22 @@ public class MUXlisten implements Runnable {
info.add("STARTING", new Boolean(false));
} catch (Exception e) {
wunlock();
break die;
break quit;
}
} catch (Exception e) {
break die;
break quit;
}
try {
wunlock();
} catch (Exception e) {
break die;
break quit;
}
boolean spin = true;
while (spin) {
try {
Thread.sleep(1000); //sleep for 1 second
} catch (InterruptedException e) {
break die;
break quit;
}
try {
rlock();
@ -205,34 +207,17 @@ public class MUXlisten implements Runnable {
spin = info.get("STOPPING").equals(Boolean.FALSE);
} catch (Exception e) {
runlock();
break die;
break quit;
}
} catch (Exception e) {
break die;
break quit;
}
try {
runlock();
} catch (Exception e) {
break die;
break quit;
}
}
try {
wlock();
try {
info.add("RUNNING", new Boolean(false));
} catch (Exception e) {
wunlock();
break die;
}
} catch (Exception e) {
break die;
}
try {
wunlock();
} catch (Exception e) {
break die;
}
} // die
} catch (Exception e) {
@ -241,11 +226,11 @@ public class MUXlisten implements Runnable {
}
} // quit
} finally {
// Start cleanup. Allow threads above this one to catch the stop signal.
try {
Thread.sleep(250);
} catch (InterruptedException ex) {
// Start cleanup.
while (!lock.compareAndSet(false, true)) {
// wait
}
// zero out everything.
try {
wlock();
@ -261,7 +246,6 @@ public class MUXlisten implements Runnable {
} catch (Exception e) {
}
if (SS != null) {
try {
SS.close();
@ -275,17 +259,21 @@ public class MUXlisten implements Runnable {
}
}
// Some grace time.
try {
socketManager.destroySocketManager();
} catch (Exception e) {
// nop
}
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;
@ -296,11 +284,11 @@ public class MUXlisten implements Runnable {
// Happily spin forever :-(
while (foo != 0) {
foo = tg.activeCount() + tg.activeGroupCount();
// if (foo != bar) {
// System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
// visit(tg, 0, boner);
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
// }
// 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)
@ -309,11 +297,18 @@ public class MUXlisten implements Runnable {
}
}
}
// 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
}
}
}
@ -362,39 +357,4 @@ public class MUXlisten implements Runnable {
}
}
private static void nuke(ThreadGroup group, int level) {
// Get threads in `group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
// Enumerate each thread in `group' and stop it.
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
try {
if (thread.isAlive()) {
thread.stop();
}
} catch (SecurityException se) {
//nop
}
}
// Get thread subgroups of `group'
int numGroups = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
numGroups = group.enumerate(groups, false);
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
nuke(groups[i], level + 1);
}
try {
group.destroy();
} catch (IllegalThreadStateException IE) {
//nop
} catch (SecurityException se) {
//nop
}
}
}

View File

@ -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,30 +86,35 @@ public class TCPio implements Runnable {
byte a[] = new byte[1];
boolean spin = true;
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) {
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);
}
} 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) {
}
} catch(Exception e) {
// System.out.println("TCPio: Leaving.");
} finally {
// Eject!!! Eject!!!
//System.out.println("TCPio: Caught an exception " + e);
try {
@ -122,6 +127,5 @@ public class TCPio implements Runnable {
}
return;
}
// System.out.println("TCPio: Leaving.");
}
}

View File

@ -29,8 +29,6 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
// import net.i2p.client.I2PSession;
// import net.i2p.client.I2PSessionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.Log;
@ -44,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;
@ -62,7 +59,6 @@ public class TCPlistener implements Runnable {
this._log = _log;
this.socketManager = S;
this.listener = listener;
tgwatch = 1;
}
private void rlock() throws Exception {
@ -86,28 +82,6 @@ public class TCPlistener implements Runnable {
try {
die:
{
try {
rlock();
} catch (Exception e) {
break die;
}
try {
if (info.exists("OUTPORT")) {
tgwatch = 2;
}
} catch (Exception e) {
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
try {
Socket server = new Socket();
listener.setSoTimeout(50); // We don't block, we cycle and check.
@ -136,18 +110,13 @@ public class TCPlistener implements Runnable {
if (g) {
conn++;
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server);
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
}
listener.close();
} catch (IOException ioe) {
try {
listener.close();
} catch (IOException e) {
}
}
}
} finally {

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,19 +46,33 @@ 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;
/**
* Constructor
* @param i2p
* @param socket
* param info
* param database
*/
TCPtoI2P(I2PSocketManager i2p, Socket socket , NamedDB info, NamedDB database) {
this.sock = socket;
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 Exception
* @throws IOException
*/
private static String lnRead(InputStream in) throws Exception {
private static String lnRead(InputStream in) throws IOException {
String S;
int b;
char c;
@ -80,20 +95,6 @@ public class TCPtoI2P implements Runnable {
return S;
}
/**
* Constructor
* @param i2p
* @param socket
* param info
* param database
*/
TCPtoI2P(I2PSocketManager i2p, Socket socket /*, NamedDB info, NamedDB database */) {
this.sock = socket;
// this.info = info;
// this.database = database;
this.socketManager = i2p;
}
/**
* 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,59 +132,80 @@ public class TCPtoI2P implements Runnable {
OutputStream Iout = null;
InputStream in = null;
OutputStream out = null;
Thread t = null;
Thread q = null;
try {
try {
in = sock.getInputStream();
out = sock.getOutputStream();
try {
line = lnRead(in);
input = line.toLowerCase();
Destination dest = null;
if (input.endsWith(".i2p")) {
dest = I2PTunnel.destFromName(input);
line = dest.toBase64();
}
dest = new Destination();
dest.fromBase64(line);
try {
// get a client socket
I2P = socketManager.connect(dest);
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
// make readers/writers
Iin = I2P.getInputStream();
Iout = I2P.getOutputStream();
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P
TCPio conn_a = new TCPio(Iin, out /*, info, database */); // I2P -> app
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
Thread q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();
while (t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
Thread.sleep(10); //sleep for 10 ms
}
} catch (I2PException e) {
Emsg("ERROR " + e.toString(), out);
} catch (ConnectException e) {
Emsg("ERROR " + e.toString(), out);
} catch (NoRouteToHostException e) {
Emsg("ERROR " + e.toString(), out);
} catch (InterruptedIOException e) {
// We're breaking away.
}
} catch (Exception e) {
Emsg("ERROR " + e.toString(), out);
line = lnRead(in);
input = line.toLowerCase();
Destination dest = null;
if (input.endsWith(".i2p")) {
dest = I2PTunnel.destFromName(input);
line = dest.toBase64();
}
dest = new Destination();
dest.fromBase64(line);
try {
// get a client socket
I2P = socketManager.connect(dest);
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
// make readers/writers
Iin = I2P.getInputStream();
Iout = I2P.getOutputStream();
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P
TCPio conn_a = new TCPio(Iin, out /*, info, database */); // I2P -> app
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()) { // 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();
}
} catch (I2PException e) {
Emsg(e.toString(), out);
} catch (ConnectException e) {
Emsg(e.toString(), out);
} catch (NoRouteToHostException e) {
Emsg(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
}
} finally {
try {
t.interrupt();
} catch (Exception e) {
}
try {
q.interrupt();
} catch (Exception e) {
}
try {
in.close();
} catch (Exception e) {

View File

@ -76,10 +76,14 @@
<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/"/>
<property name="build_i2ptunnel" location="../i2ptunnel/java/build/"/>
<path id="build_classpath">
<fileset dir="${build_lib}" includes="**/*.jar"/>
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
<fileset dir="${build_routerconsole}" includes="**/*.jar"/>
<fileset dir="${build_i2ptunnel}" includes="**/*.jar"/>
</path>
<target name="build_init">
<!-- Create the time stamp -->

View File

@ -22,7 +22,9 @@ dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.appframework.jar=lib/appframework.jar
file.reference.i2p.jar=../../core/java/build/i2p.jar
file.reference.i2ptunnel.jar=../i2ptunnel/java/build/i2ptunnel.jar
file.reference.router.jar=../../router/java/build/router.jar
file.reference.routerconsole.jar=../routerconsole/java/build/routerconsole.jar
file.reference.swing-worker.jar=lib/swing-worker.jar
includes=**
jar.compress=false
@ -30,7 +32,9 @@ 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}:\
${file.reference.i2ptunnel.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -10,5 +10,5 @@ package net.i2p.desktopgui.desktopgui;
* @author mathias
*/
public class GUIVersion {
public static final String VERSION = "0.0.1.2";
public static final String VERSION = "0.0.2";
}

View File

@ -0,0 +1,396 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" 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>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<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"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,48,0,0,2,48"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="tunnelNameLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelNameLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelNameLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="20" width="120" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelTypeLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelTypeLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelTypeLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="50" width="120" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelPortLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelPortLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelPortLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="80" width="110" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelDestinationLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelDestinationLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelDestinationLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="110" width="110" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelProfileLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelProfileLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelProfileLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="140" width="110" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="delayConnect">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="delayConnect.text"/>
<Property name="name" type="java.lang.String" value="delayConnect" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="170" width="160" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="sharedClient">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="sharedClient.text"/>
<Property name="name" type="java.lang.String" value="sharedClient" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="200" width="160" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="autoStart">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="autoStart.text"/>
<Property name="name" type="java.lang.String" value="autoStart" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="230" width="160" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
<Properties>
<Property name="name" type="java.lang.String" value="jSeparator1" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="0" y="510" width="750" height="10"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelDepthLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelDepthLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelDepthLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="280" width="160" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="depthVarianceLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="depthVarianceLabel.text"/>
<Property name="name" type="java.lang.String" value="depthVarianceLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="310" width="160" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelCountLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelCountLabel.text"/>
<Property name="name" type="java.lang.String" value="tunnelCountLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="340" width="160" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="backupTunnelCountLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="backupTunnelCountLabel.text"/>
<Property name="name" type="java.lang.String" value="backupTunnelCountLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="370" width="170" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator2">
<Properties>
<Property name="name" type="java.lang.String" value="jSeparator2" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="0" y="260" width="750" height="10"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="reduceIdle">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="reduceIdle.text"/>
<Property name="name" type="java.lang.String" value="reduceIdle" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="420" width="300" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="closeIdle">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="closeIdle.text"/>
<Property name="name" type="java.lang.String" value="closeIdle" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="450" width="370" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="delayIdle">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="delayIdle.text"/>
<Property name="name" type="java.lang.String" value="delayIdle" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="480" width="400" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator3">
<Properties>
<Property name="name" type="java.lang.String" value="jSeparator3" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="0" y="400" width="760" height="10"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="save">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="save.text"/>
<Property name="name" type="java.lang.String" value="save" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="520" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="cancel">
<Properties>
<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="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="60" y="520" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="tunnelName">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelName.text"/>
<Property name="name" type="java.lang.String" value="tunnelName" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="20" width="340" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="tunnelType">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelType.text"/>
<Property name="name" type="java.lang.String" value="tunnelType" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="50" width="340" height="20"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="tunnelPort">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelPort.text"/>
<Property name="name" type="java.lang.String" value="tunnelPort" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="70" width="340" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="tunnelDestination">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="tunnelDestination.text"/>
<Property name="name" type="java.lang.String" value="tunnelDestination" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="100" width="340" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="tunnelProfile">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="Interactive connection (Instant messaging)"/>
<StringItem index="1" value="Bulk connection (Downloads, websites...)"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="tunnelProfile" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="130" width="340" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="tunnelDepth">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="0 hop tunnel (no anonymity, low latency)"/>
<StringItem index="1" value="1 hop tunnel (low anonymity, low latency)"/>
<StringItem index="2" value="2 hop tunnel (medium anonymity, medium latency)"/>
<StringItem index="3" value="3 hop tunnel (high anonymity, high latency)"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="tunnelDepth" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="280" width="350" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="depthVariance">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="5">
<StringItem index="0" value="0 hop variance (no random, good performance)"/>
<StringItem index="1" value="+ 0-1 hop variance (slightly random, lower performance)"/>
<StringItem index="2" value="+ 0-2 hop variance (very random, lower performance)"/>
<StringItem index="3" value="+/- 0-1 hop variance (slightly random, standard performance)"/>
<StringItem index="4" value="+/- 0-2 hop variance (not recommended)"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="depthVariance" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="310" width="350" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="tunnelCount">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="1 tunnel (low bandwidth usage, low reliability)"/>
<StringItem index="1" value="2 tunnels (standard bandwidth usage, standard reliability)"/>
<StringItem index="2" value="3 tunnels (high bandwidth usage, high reliability)"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="tunnelCount" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="340" width="350" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="backupTunnelCount">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="0 backup tunnels (no redundancy, no resource usage)"/>
<StringItem index="1" value="1 backup tunnel (low redundancy, low resource usage)"/>
<StringItem index="2" value="2 backup tunnels (medium redundancy, medium resource usage)"/>
<StringItem index="3" value="3 backup tunnels (high redundancy, high resource usage)"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="backupTunnelCount" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="200" y="370" width="350" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="changeTunnelState">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="changeTunnelState.text"/>
<Property name="name" type="java.lang.String" value="changeTunnelState" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="520" width="150" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,434 @@
/*
* ClientTunnelWindow.java
*
* Created on 10-jun-2009, 16:49:12
*/
package net.i2p.desktopgui.gui;
import net.i2p.i2ptunnel.web.EditBean;
import java.awt.event.ActionListener;
/**
*
* @author mathias
*/
public class ClientTunnelWindow extends javax.swing.JFrame {
/** Creates new form ClientTunnelWindow */
public ClientTunnelWindow(int tunnelNumber, ActionListener al) {
initComponents();
this.tunnelNumber = tunnelNumber;
this.al = al;
extraInitComponents();
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setSize(600, 600);
this.setLocationRelativeTo(null);
this.requestFocus();
this.changeTunnelState.setVisible(false); //TODO: implement tunnel state change
this.setVisible(true);
}
public void extraInitComponents() {
EditBean bean = new EditBean();
if(!bean.isClient(tunnelNumber)) {
this.dispose();
}
else {
this.tunnelName.setText(bean.getTunnelName(tunnelNumber));
this.tunnelType.setText(bean.getTunnelType(tunnelNumber));
this.tunnelPort.setText(bean.getClientPort(tunnelNumber));
this.tunnelDestination.setText(bean.getClientDestination(tunnelNumber));
if(bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
tunnelProfile.setVisible(false);
tunnelProfileLabel.setVisible(false);
this.delayConnect.setVisible(false);
this.sharedClient.setVisible(false);
this.autoStart.setVisible(false);
}
else {
if(bean.isInteractive(tunnelNumber)) {
tunnelProfile.setSelectedIndex(TUNNEL_INTERACTIVE);
}
else {
tunnelProfile.setSelectedIndex(TUNNEL_BULK);
}
this.delayConnect.setSelected(bean.shouldDelay(tunnelNumber));
this.sharedClient.setSelected(bean.isSharedClient(tunnelNumber));
this.autoStart.setSelected(bean.startAutomatically(tunnelNumber));
}
this.tunnelDepth.setSelectedIndex(bean.getTunnelDepth(tunnelNumber, 2));
int variance = bean.getTunnelVariance(tunnelNumber, 0);
if(variance == 0) {
this.depthVariance.setSelectedIndex(0);
}
else if(variance == 1) {
this.depthVariance.setSelectedIndex(1);
}
else if(variance == 2) {
this.depthVariance.setSelectedIndex(2);
}
else if(variance == -1) {
this.depthVariance.setSelectedIndex(3);
}
else if(variance == -2) {
this.depthVariance.setSelectedIndex(4);
}
int tunnelQuantity = bean.getTunnelQuantity(tunnelNumber, 2) - 1;
if(tunnelQuantity >= 0 && tunnelQuantity <= 2) {
this.tunnelCount.setSelectedIndex(tunnelQuantity);
}
int backupTunnelQuantity = bean.getTunnelBackupQuantity(tunnelNumber, 0);
if(backupTunnelQuantity >= 0 && backupTunnelQuantity <= 3) {
this.backupTunnelCount.setSelectedIndex(backupTunnelQuantity);
}
if(bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
this.reduceIdle.setVisible(false);
this.closeIdle.setVisible(false);
this.delayIdle.setVisible(false);
}
else {
this.reduceIdle.setSelected(bean.getReduce(tunnelNumber));
this.closeIdle.setSelected(bean.getClose(tunnelNumber));
this.delayIdle.setSelected(bean.getDelayOpen(tunnelNumber));
}
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
tunnelNameLabel = new javax.swing.JLabel();
tunnelTypeLabel = new javax.swing.JLabel();
tunnelPortLabel = new javax.swing.JLabel();
tunnelDestinationLabel = new javax.swing.JLabel();
tunnelProfileLabel = new javax.swing.JLabel();
delayConnect = new javax.swing.JCheckBox();
sharedClient = new javax.swing.JCheckBox();
autoStart = new javax.swing.JCheckBox();
jSeparator1 = new javax.swing.JSeparator();
tunnelDepthLabel = new javax.swing.JLabel();
depthVarianceLabel = new javax.swing.JLabel();
tunnelCountLabel = new javax.swing.JLabel();
backupTunnelCountLabel = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
reduceIdle = new javax.swing.JCheckBox();
closeIdle = new javax.swing.JCheckBox();
delayIdle = new javax.swing.JCheckBox();
jSeparator3 = new javax.swing.JSeparator();
save = new javax.swing.JButton();
cancel = new javax.swing.JButton();
tunnelName = new javax.swing.JTextField();
tunnelType = new javax.swing.JLabel();
tunnelPort = new javax.swing.JTextField();
tunnelDestination = new javax.swing.JTextField();
tunnelProfile = new javax.swing.JComboBox();
tunnelDepth = new javax.swing.JComboBox();
depthVariance = new javax.swing.JComboBox();
tunnelCount = new javax.swing.JComboBox();
backupTunnelCount = new javax.swing.JComboBox();
changeTunnelState = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(ClientTunnelWindow.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setName("Form"); // NOI18N
getContentPane().setLayout(null);
tunnelNameLabel.setText(resourceMap.getString("tunnelNameLabel.text")); // NOI18N
tunnelNameLabel.setName("tunnelNameLabel"); // NOI18N
getContentPane().add(tunnelNameLabel);
tunnelNameLabel.setBounds(20, 20, 120, 17);
tunnelTypeLabel.setText(resourceMap.getString("tunnelTypeLabel.text")); // NOI18N
tunnelTypeLabel.setName("tunnelTypeLabel"); // NOI18N
getContentPane().add(tunnelTypeLabel);
tunnelTypeLabel.setBounds(20, 50, 120, 17);
tunnelPortLabel.setText(resourceMap.getString("tunnelPortLabel.text")); // NOI18N
tunnelPortLabel.setName("tunnelPortLabel"); // NOI18N
getContentPane().add(tunnelPortLabel);
tunnelPortLabel.setBounds(20, 80, 110, 17);
tunnelDestinationLabel.setText(resourceMap.getString("tunnelDestinationLabel.text")); // NOI18N
tunnelDestinationLabel.setName("tunnelDestinationLabel"); // NOI18N
getContentPane().add(tunnelDestinationLabel);
tunnelDestinationLabel.setBounds(20, 110, 110, 17);
tunnelProfileLabel.setText(resourceMap.getString("tunnelProfileLabel.text")); // NOI18N
tunnelProfileLabel.setName("tunnelProfileLabel"); // NOI18N
getContentPane().add(tunnelProfileLabel);
tunnelProfileLabel.setBounds(20, 140, 110, 17);
delayConnect.setText(resourceMap.getString("delayConnect.text")); // NOI18N
delayConnect.setName("delayConnect"); // NOI18N
getContentPane().add(delayConnect);
delayConnect.setBounds(20, 170, 160, 22);
sharedClient.setText(resourceMap.getString("sharedClient.text")); // NOI18N
sharedClient.setName("sharedClient"); // NOI18N
getContentPane().add(sharedClient);
sharedClient.setBounds(20, 200, 160, 22);
autoStart.setText(resourceMap.getString("autoStart.text")); // NOI18N
autoStart.setName("autoStart"); // NOI18N
getContentPane().add(autoStart);
autoStart.setBounds(20, 230, 160, 22);
jSeparator1.setName("jSeparator1"); // NOI18N
getContentPane().add(jSeparator1);
jSeparator1.setBounds(0, 510, 750, 10);
tunnelDepthLabel.setText(resourceMap.getString("tunnelDepthLabel.text")); // NOI18N
tunnelDepthLabel.setName("tunnelDepthLabel"); // NOI18N
getContentPane().add(tunnelDepthLabel);
tunnelDepthLabel.setBounds(20, 280, 160, 17);
depthVarianceLabel.setText(resourceMap.getString("depthVarianceLabel.text")); // NOI18N
depthVarianceLabel.setName("depthVarianceLabel"); // NOI18N
getContentPane().add(depthVarianceLabel);
depthVarianceLabel.setBounds(20, 310, 160, 17);
tunnelCountLabel.setText(resourceMap.getString("tunnelCountLabel.text")); // NOI18N
tunnelCountLabel.setName("tunnelCountLabel"); // NOI18N
getContentPane().add(tunnelCountLabel);
tunnelCountLabel.setBounds(20, 340, 160, 17);
backupTunnelCountLabel.setText(resourceMap.getString("backupTunnelCountLabel.text")); // NOI18N
backupTunnelCountLabel.setName("backupTunnelCountLabel"); // NOI18N
getContentPane().add(backupTunnelCountLabel);
backupTunnelCountLabel.setBounds(20, 370, 170, 17);
jSeparator2.setName("jSeparator2"); // NOI18N
getContentPane().add(jSeparator2);
jSeparator2.setBounds(0, 260, 750, 10);
reduceIdle.setText(resourceMap.getString("reduceIdle.text")); // NOI18N
reduceIdle.setName("reduceIdle"); // NOI18N
getContentPane().add(reduceIdle);
reduceIdle.setBounds(20, 420, 300, 22);
closeIdle.setText(resourceMap.getString("closeIdle.text")); // NOI18N
closeIdle.setName("closeIdle"); // NOI18N
getContentPane().add(closeIdle);
closeIdle.setBounds(20, 450, 370, 22);
delayIdle.setText(resourceMap.getString("delayIdle.text")); // NOI18N
delayIdle.setName("delayIdle"); // NOI18N
getContentPane().add(delayIdle);
delayIdle.setBounds(20, 480, 400, 22);
jSeparator3.setName("jSeparator3"); // NOI18N
getContentPane().add(jSeparator3);
jSeparator3.setBounds(0, 400, 760, 10);
save.setText(resourceMap.getString("save.text")); // NOI18N
save.setName("save"); // NOI18N
save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveActionPerformed(evt);
}
});
getContentPane().add(save);
save.setBounds(10, 520, 44, 29);
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
cancel.setName("cancel"); // NOI18N
cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelActionPerformed(evt);
}
});
getContentPane().add(cancel);
cancel.setBounds(60, 520, 55, 29);
tunnelName.setText(resourceMap.getString("tunnelName.text")); // NOI18N
tunnelName.setName("tunnelName"); // NOI18N
getContentPane().add(tunnelName);
tunnelName.setBounds(200, 20, 340, 27);
tunnelType.setText(resourceMap.getString("tunnelType.text")); // NOI18N
tunnelType.setName("tunnelType"); // NOI18N
getContentPane().add(tunnelType);
tunnelType.setBounds(200, 50, 340, 20);
tunnelPort.setText(resourceMap.getString("tunnelPort.text")); // NOI18N
tunnelPort.setName("tunnelPort"); // NOI18N
getContentPane().add(tunnelPort);
tunnelPort.setBounds(200, 70, 340, 27);
tunnelDestination.setText(resourceMap.getString("tunnelDestination.text")); // NOI18N
tunnelDestination.setName("tunnelDestination"); // NOI18N
getContentPane().add(tunnelDestination);
tunnelDestination.setBounds(200, 100, 340, 27);
tunnelProfile.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Interactive connection (Instant messaging)", "Bulk connection (Downloads, websites...)" }));
tunnelProfile.setName("tunnelProfile"); // NOI18N
getContentPane().add(tunnelProfile);
tunnelProfile.setBounds(200, 130, 340, 27);
tunnelDepth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 hop tunnel (no anonymity, low latency)", "1 hop tunnel (low anonymity, low latency)", "2 hop tunnel (medium anonymity, medium latency)", "3 hop tunnel (high anonymity, high latency)" }));
tunnelDepth.setName("tunnelDepth"); // NOI18N
getContentPane().add(tunnelDepth);
tunnelDepth.setBounds(200, 280, 350, 27);
depthVariance.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 hop variance (no random, good performance)", "+ 0-1 hop variance (slightly random, lower performance)", "+ 0-2 hop variance (very random, lower performance)", "+/- 0-1 hop variance (slightly random, standard performance)", "+/- 0-2 hop variance (not recommended)" }));
depthVariance.setName("depthVariance"); // NOI18N
getContentPane().add(depthVariance);
depthVariance.setBounds(200, 310, 350, 27);
tunnelCount.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1 tunnel (low bandwidth usage, low reliability)", "2 tunnels (standard bandwidth usage, standard reliability)", "3 tunnels (high bandwidth usage, high reliability)" }));
tunnelCount.setName("tunnelCount"); // NOI18N
getContentPane().add(tunnelCount);
tunnelCount.setBounds(200, 340, 350, 27);
backupTunnelCount.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 backup tunnels (no redundancy, no resource usage)", "1 backup tunnel (low redundancy, low resource usage)", "2 backup tunnels (medium redundancy, medium resource usage)", "3 backup tunnels (high redundancy, high resource usage)" }));
backupTunnelCount.setName("backupTunnelCount"); // NOI18N
getContentPane().add(backupTunnelCount);
backupTunnelCount.setBounds(200, 370, 350, 27);
changeTunnelState.setText(resourceMap.getString("changeTunnelState.text")); // NOI18N
changeTunnelState.setName("changeTunnelState"); // NOI18N
getContentPane().add(changeTunnelState);
changeTunnelState.setBounds(160, 520, 150, 29);
pack();
}// </editor-fold>//GEN-END:initComponents
private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
EditBean bean = new EditBean();
if(!bean.isClient(tunnelNumber)) {
al.actionPerformed(evt);
this.dispose();
}
else {
bean.setTunnel("" + tunnelNumber);
bean.setName(tunnelName.getText());
bean.setPort(tunnelPort.getText());
bean.setTargetDestination(tunnelDestination.getText());
if(!bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
if(tunnelProfile.getSelectedIndex() == TUNNEL_INTERACTIVE) {
bean.setProfile("interactive");
}
else {
bean.setProfile("bulk");
}
if(delayConnect.isSelected()) {
bean.setConnectDelay("true");
}
else {
bean.setConnectDelay("false");
}
if(sharedClient.isSelected()) {
bean.setShared(true);
}
else {
bean.setShared(false);
}
if(autoStart.isSelected()) {
bean.setStartOnLoad("true");
}
else {
}
}
bean.setTunnelDepth("" + tunnelDepth.getSelectedIndex());
int variance = depthVariance.getSelectedIndex();
if(variance >= 0 && variance <= 2) {
bean.setTunnelVariance("" + variance);
}
else if(variance == 3) {
bean.setTunnelVariance("-1");
}
else if(variance == 4) {
bean.setTunnelVariance("-2");
}
bean.setTunnelQuantity("" + tunnelCount.getSelectedIndex() + 1);
bean.setTunnelBackupQuantity("" + backupTunnelCount.getSelectedIndex());
if(!bean.getTunnelType(tunnelNumber).equals(TYPE_STREAMR_CLIENT)) {
if(reduceIdle.isSelected()) {
bean.setReduce("true");
}
else {
}
if(closeIdle.isSelected()) {
bean.setClose("true");
}
else {
}
if(delayIdle.isSelected()) {
bean.setDelayOpen("true");
}
}
}
al.actionPerformed(evt);
this.dispose();
}//GEN-LAST:event_saveActionPerformed
private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed
al.actionPerformed(evt);
this.dispose();
}//GEN-LAST:event_cancelActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox autoStart;
private javax.swing.JComboBox backupTunnelCount;
private javax.swing.JLabel backupTunnelCountLabel;
private javax.swing.JButton cancel;
private javax.swing.JButton changeTunnelState;
private javax.swing.JCheckBox closeIdle;
private javax.swing.JCheckBox delayConnect;
private javax.swing.JCheckBox delayIdle;
private javax.swing.JComboBox depthVariance;
private javax.swing.JLabel depthVarianceLabel;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JCheckBox reduceIdle;
private javax.swing.JButton save;
private javax.swing.JCheckBox sharedClient;
private javax.swing.JComboBox tunnelCount;
private javax.swing.JLabel tunnelCountLabel;
private javax.swing.JComboBox tunnelDepth;
private javax.swing.JLabel tunnelDepthLabel;
private javax.swing.JTextField tunnelDestination;
private javax.swing.JLabel tunnelDestinationLabel;
private javax.swing.JTextField tunnelName;
private javax.swing.JLabel tunnelNameLabel;
private javax.swing.JTextField tunnelPort;
private javax.swing.JLabel tunnelPortLabel;
private javax.swing.JComboBox tunnelProfile;
private javax.swing.JLabel tunnelProfileLabel;
private javax.swing.JLabel tunnelType;
private javax.swing.JLabel tunnelTypeLabel;
// End of variables declaration//GEN-END:variables
private int tunnelNumber;
private ActionListener al;
private static final int TUNNEL_INTERACTIVE = 0;
private static final int TUNNEL_BULK = 1;
private static final String TYPE_STREAMR_CLIENT = "Streamr client";
}

View File

@ -2,7 +2,7 @@
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
<Component class="javax.swing.ButtonGroup" name="updateButtonGroup">
</Component>
</NonVisualComponents>
<Properties>
@ -81,12 +81,18 @@
<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>
@ -141,7 +147,7 @@
<Property name="name" type="java.lang.String" value="uploadspeed" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
<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">
@ -155,7 +161,7 @@
<Property name="name" type="java.lang.String" value="downloadspeed" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
<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">
@ -201,10 +207,10 @@
</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">
@ -212,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">
@ -229,7 +235,7 @@
<Property name="name" type="java.lang.String" value="uploadgb" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="uploadgbKeyTyped"/>
<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">
@ -243,7 +249,7 @@
<Property name="name" type="java.lang.String" value="downloadgb" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="downloadgbKeyTyped"/>
<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">
@ -251,10 +257,10 @@
</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">
@ -262,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">
@ -273,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">
@ -316,14 +322,14 @@
</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="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 type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="updateInform" alignment="0" pref="377" max="32767" attributes="1"/>
<Component id="updateDownload" alignment="0" max="32767" attributes="1"/>
<Component id="updateDownloadRestart" alignment="0" max="32767" attributes="1"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="339" max="32767" attributes="0"/>
@ -365,7 +371,7 @@
<Component class="javax.swing.JRadioButton" name="updateInform">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
<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"/>
@ -374,7 +380,7 @@
<Component class="javax.swing.JRadioButton" name="updateDownload">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
<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"/>
@ -383,7 +389,7 @@
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
<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"/>
@ -394,18 +400,27 @@
<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="updateNow">
<Properties>
<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="advancedUpdateConfig">
<Properties>
<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>
@ -424,11 +439,11 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="serverFrame" alignment="1" pref="538" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="tunnelsExplanation" alignment="0" pref="538" max="32767" attributes="0"/>
<Component id="serverFrame" alignment="1" 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"/>
@ -448,9 +463,9 @@
<Component id="serverTunnelLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="serverFrame" pref="122" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="tunnelsExplanation" min="-2" pref="65" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tunnelsExplanation" min="-2" pref="45" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -462,6 +477,51 @@
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="clientTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="0">
<Column editable="true" title="Name" type="java.lang.Object"/>
<Column editable="true" title="Type" type="java.lang.Object"/>
<Column editable="true" title="Address" type="java.lang.Object"/>
<Column editable="true" title="Status" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="clientTable.columnModel.title0"/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="clientTable.columnModel.title1"/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="clientTable.columnModel.title2"/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="clientTable.columnModel.title3"/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="name" type="java.lang.String" value="clientTable" noResource="true"/>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="clientTableMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="serverFrame">
<Properties>
@ -469,6 +529,45 @@
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="serverTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="4">
<Column editable="true" title="Name" type="java.lang.Object"/>
<Column editable="true" title="Address" type="java.lang.Object"/>
<Column editable="true" title="Status" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="serverTable.columnModel.title0"/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="serverTable.columnModel.title1"/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title resourceKey="serverTable.columnModel.title2"/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="name" type="java.lang.String" value="serverTable" noResource="true"/>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="serverTableMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="tunnelsExplanation">
<Properties>

View File

@ -6,7 +6,27 @@
package net.i2p.desktopgui.gui;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
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;
import net.i2p.i2ptunnel.web.IndexBean;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionListener;
/**
*
@ -19,11 +39,99 @@ public class GeneralConfiguration extends javax.swing.JFrame {
initComponents();
extraInitComponents();
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
this.requestFocus();
this.setVisible(true);
}
private void extraInitComponents() {
downloadspeed.setText(SpeedHelper.getInboundBandwidth());
initSpeedTab();
initUpdateTab();
initTunnelTab();
}
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);
}
}
private void initTunnelTab() {
while(((DefaultTableModel) clientTable.getModel()).getRowCount() > 0) {
((DefaultTableModel) clientTable.getModel()).removeRow(0);
}
while(((DefaultTableModel) serverTable.getModel()).getRowCount() > 0) {
((DefaultTableModel) serverTable.getModel()).removeRow(0);
}
IndexBean bean = new IndexBean();
for(int i=0; i<bean.getTunnelCount(); i++) {
if(bean.isClient(i)) {
Object[] row = {bean.getTunnelName(i), bean.getTunnelType(i),
bean.getClientInterface(i) + ":" + bean.getClientPort(i),
getTunnelStatus(bean.getTunnelStatus(i))};
((DefaultTableModel) clientTable.getModel()).addRow(row);
}
else {
Object[] row = {bean.getTunnelName(i),
bean.getServerTarget(i),
getTunnelStatus(bean.getTunnelStatus(i))};
((DefaultTableModel) serverTable.getModel()).addRow(row);
}
}
}
public String getTunnelStatus(int status) {
if(status == IndexBean.NOT_RUNNING) {
return "Not running";
}
else if(status == IndexBean.RUNNING) {
return "Running";
}
else if(status == IndexBean.STANDBY) {
return "Standby";
}
else if(status == IndexBean.STARTING) {
return "Starting";
}
else {
return "Error: status not found";
}
}
/** This method is called from within the constructor to
@ -35,7 +143,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
updateButtonGroup = new javax.swing.ButtonGroup();
applyPanel = new javax.swing.JPanel();
cancel = new javax.swing.JToggleButton();
ok = new javax.swing.JToggleButton();
@ -47,13 +155,13 @@ public class GeneralConfiguration extends javax.swing.JFrame {
downloadspeed = new javax.swing.JTextField();
uploadkbps = new javax.swing.JComboBox();
downloadkbps = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
uploadUsageLabel = new javax.swing.JLabel();
downloadUsageLabel = new javax.swing.JLabel();
uploadgb = new javax.swing.JTextField();
downloadgb = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
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();
@ -64,7 +172,9 @@ public class GeneralConfiguration extends javax.swing.JFrame {
advancedUpdateConfig = new javax.swing.JToggleButton();
tunnelPanel = new javax.swing.JPanel();
clientFrame = new javax.swing.JScrollPane();
clientTable = new javax.swing.JTable();
serverFrame = new javax.swing.JScrollPane();
serverTable = new javax.swing.JTable();
tunnelsExplanation = new javax.swing.JLabel();
clientTunnelLabel = new javax.swing.JLabel();
serverTunnelLabel = new javax.swing.JLabel();
@ -80,9 +190,19 @@ public class GeneralConfiguration extends javax.swing.JFrame {
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);
@ -122,8 +242,8 @@ public class GeneralConfiguration extends javax.swing.JFrame {
uploadspeed.setText(resourceMap.getString("uploadspeed.text")); // NOI18N
uploadspeed.setName("uploadspeed"); // NOI18N
uploadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
speedKeyTyped(evt);
public void keyReleased(java.awt.event.KeyEvent evt) {
speedKeyReleased(evt);
}
});
speedPanel.add(uploadspeed);
@ -132,8 +252,8 @@ public class GeneralConfiguration extends javax.swing.JFrame {
downloadspeed.setText(resourceMap.getString("downloadspeed.text")); // NOI18N
downloadspeed.setName("downloadspeed"); // NOI18N
downloadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
speedKeyTyped(evt);
public void keyReleased(java.awt.event.KeyEvent evt) {
speedKeyReleased(evt);
}
});
speedPanel.add(downloadspeed);
@ -159,21 +279,21 @@ public class GeneralConfiguration extends javax.swing.JFrame {
speedPanel.add(downloadkbps);
downloadkbps.setBounds(240, 60, 68, 27);
jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
jLabel3.setName("jLabel3"); // NOI18N
speedPanel.add(jLabel3);
jLabel3.setBounds(330, 20, 97, 30);
uploadUsageLabel.setText(resourceMap.getString("uploadUsageLabel.text")); // NOI18N
uploadUsageLabel.setName("uploadUsageLabel"); // NOI18N
speedPanel.add(uploadUsageLabel);
uploadUsageLabel.setBounds(330, 20, 97, 30);
jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
jLabel4.setName("jLabel4"); // NOI18N
speedPanel.add(jLabel4);
jLabel4.setBounds(330, 60, 97, 30);
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 keyTyped(java.awt.event.KeyEvent evt) {
uploadgbKeyTyped(evt);
public void keyReleased(java.awt.event.KeyEvent evt) {
monthKeyReleased(evt);
}
});
speedPanel.add(uploadgb);
@ -182,27 +302,27 @@ public class GeneralConfiguration extends javax.swing.JFrame {
downloadgb.setText(resourceMap.getString("downloadgb.text")); // NOI18N
downloadgb.setName("downloadgb"); // NOI18N
downloadgb.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
downloadgbKeyTyped(evt);
public void keyReleased(java.awt.event.KeyEvent evt) {
monthKeyReleased(evt);
}
});
speedPanel.add(downloadgb);
downloadgb.setBounds(440, 60, 60, 27);
jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
jLabel5.setName("jLabel5"); // NOI18N
speedPanel.add(jLabel5);
jLabel5.setBounds(510, 20, 19, 30);
gbUploadLabel.setText(resourceMap.getString("gbUploadLabel.text")); // NOI18N
gbUploadLabel.setName("gbUploadLabel"); // NOI18N
speedPanel.add(gbUploadLabel);
gbUploadLabel.setBounds(510, 20, 19, 30);
jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
jLabel6.setName("jLabel6"); // NOI18N
speedPanel.add(jLabel6);
jLabel6.setBounds(510, 60, 19, 30);
gbDownloadLabel.setText(resourceMap.getString("gbDownloadLabel.text")); // NOI18N
gbDownloadLabel.setName("gbDownloadLabel"); // NOI18N
speedPanel.add(gbDownloadLabel);
gbDownloadLabel.setBounds(510, 60, 19, 30);
jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
jLabel7.setName("jLabel7"); // NOI18N
speedPanel.add(jLabel7);
jLabel7.setBounds(20, 100, 520, 70);
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
@ -211,26 +331,41 @@ public class GeneralConfiguration extends javax.swing.JFrame {
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
updateMethod.setName("updateMethod"); // NOI18N
buttonGroup1.add(updateInform);
updateButtonGroup.add(updateInform);
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
updateInform.setName("updateInform"); // NOI18N
buttonGroup1.add(updateDownload);
updateButtonGroup.add(updateDownload);
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
updateDownload.setName("updateDownload"); // NOI18N
buttonGroup1.add(updateDownloadRestart);
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);
@ -248,11 +383,11 @@ public class GeneralConfiguration extends javax.swing.JFrame {
.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(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(updateInform, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
.addComponent(updateDownload, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(updateDownloadRestart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, updatesPanelLayout.createSequentialGroup()
.addContainerGap(339, Short.MAX_VALUE)
.addComponent(advancedUpdateConfig)
@ -284,8 +419,50 @@ public class GeneralConfiguration extends javax.swing.JFrame {
clientFrame.setName("clientFrame"); // NOI18N
clientTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Name", "Type", "Address", "Status"
}
));
clientTable.setName("clientTable"); // NOI18N
clientTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
clientTableMouseClicked(evt);
}
});
clientFrame.setViewportView(clientTable);
clientTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("clientTable.columnModel.title0")); // NOI18N
clientTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("clientTable.columnModel.title1")); // NOI18N
clientTable.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("clientTable.columnModel.title2")); // NOI18N
clientTable.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("clientTable.columnModel.title3")); // NOI18N
serverFrame.setName("serverFrame"); // NOI18N
serverTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Name", "Address", "Status"
}
));
serverTable.setName("serverTable"); // NOI18N
serverTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
serverTableMouseClicked(evt);
}
});
serverFrame.setViewportView(serverTable);
serverTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("serverTable.columnModel.title0")); // NOI18N
serverTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("serverTable.columnModel.title1")); // NOI18N
serverTable.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("serverTable.columnModel.title2")); // NOI18N
tunnelsExplanation.setText(resourceMap.getString("tunnelsExplanation.text")); // NOI18N
tunnelsExplanation.setName("tunnelsExplanation"); // NOI18N
@ -299,14 +476,14 @@ public class GeneralConfiguration extends javax.swing.JFrame {
tunnelPanel.setLayout(tunnelPanelLayout);
tunnelPanelLayout.setHorizontalGroup(
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tunnelPanelLayout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, 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))
.addGroup(tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(tunnelsExplanation, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(serverFrame, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(clientTunnelLabel, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(clientFrame, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(serverTunnelLabel, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap())
);
tunnelPanelLayout.setVerticalGroup(
@ -321,8 +498,8 @@ public class GeneralConfiguration extends javax.swing.JFrame {
.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())
.addComponent(tunnelsExplanation, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32))
);
settingsPanel.addTab(resourceMap.getString("tunnelPanel.TabConstraints.tabTitle"), tunnelPanel); // NOI18N
@ -377,7 +554,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
pack();
}// </editor-fold>//GEN-END:initComponents
private void speedKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyTyped
private void speedKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyReleased
try {
String upload = "";
if(uploadkbps.getSelectedIndex() == KILOBIT)
@ -395,62 +572,261 @@ private void speedKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speed
e.printStackTrace();
return;
}
}//GEN-LAST:event_speedKeyTyped
}//GEN-LAST:event_speedKeyReleased
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
// TODO add your handling code here:
kbpsSwitchPerformed(uploadkbps, uploadspeed);
}//GEN-LAST:event_uploadkbpsActionPerformed
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
// TODO add your handling code here:
kbpsSwitchPerformed(downloadkbps, downloadspeed);
}//GEN-LAST:event_downloadkbpsActionPerformed
private void uploadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_uploadgbKeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_uploadgbKeyTyped
private void monthKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_monthKeyReleased
try {
int uploadMonthValue = Integer.parseInt(uploadgb.getText());
int downloadMonthValue = Integer.parseInt(downloadgb.getText());
private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_downloadgbKeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_downloadgbKeyTyped
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
private void clientTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clientTableMouseClicked
int row = clientTable.getSelectedRow();
if(row == -1) { //No selected row
return;
}
else {
IndexBean bean = new IndexBean();
/*
* TODO: This is not entirely good: if one adds/removes a tunnel without desktopgui, this number will be wrong
*/
int clientNumber = 0;
int i = 0;
for(clientNumber=0; clientNumber<bean.getTunnelCount(); clientNumber++) {
if(bean.isClient(clientNumber)) {
if(i == row) {
break;
}
i++;
}
}
new ClientTunnelWindow(clientNumber, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
initTunnelTab();
}
});
}
}//GEN-LAST:event_clientTableMouseClicked
private void serverTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_serverTableMouseClicked
int row = serverTable.getSelectedRow();
if(row == -1) { //No selected row
return;
}
else {
IndexBean bean = new IndexBean();
/*
* TODO: This is not entirely good: if one adds/removes a tunnel without desktopgui, this number will be wrong
*/
int serverNumber = 0;
int i = 0;
for(serverNumber=0; serverNumber<bean.getTunnelCount(); serverNumber++) {
if(!bean.isClient(serverNumber)) {
if(i == row) {
break;
}
i++;
}
}
new ServerTunnelWindow(serverNumber, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
initTunnelTab();
}
});
}
}//GEN-LAST:event_serverTableMouseClicked
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.ButtonGroup buttonGroup1;
private javax.swing.JToggleButton cancel;
private javax.swing.JToggleButton checkUpdates;
private javax.swing.JScrollPane clientFrame;
private javax.swing.JTable clientTable;
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 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 gbDownloadLabel;
private javax.swing.JLabel gbUploadLabel;
private javax.swing.JPanel networkPanel;
private javax.swing.JToggleButton ok;
private javax.swing.JScrollPane serverFrame;
private javax.swing.JTable serverTable;
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;
@ -458,4 +834,6 @@ private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_
public static final int KILOBIT = 0;
public static final int KILOBYTE = 1;
private long newsLastFetched = 0;
}

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<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"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="10" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,60 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* ServerTunnelWindow.java
*
* Created on 11-jun-2009, 14:55:53
*/
package net.i2p.desktopgui.gui;
import java.awt.event.ActionListener;
/**
*
* @author mathias
*/
public class ServerTunnelWindow extends javax.swing.JFrame {
/** Creates new form ServerTunnelWindow */
public ServerTunnelWindow(int tunnelNumber, ActionListener al) {
initComponents();
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setSize(600, 600);
this.setLocationRelativeTo(null);
this.requestFocus();
this.setVisible(true);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setName("Form"); // NOI18N
getContentPane().setLayout(null);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(ServerTunnelWindow.class);
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
getContentPane().add(jLabel1);
jLabel1.setBounds(10, 10, 43, 17);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}

View File

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

@ -0,0 +1,26 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.
Form.title=Client Tunnel Configuration
tunnelNameLabel.text=Name:
tunnelTypeLabel.text=Type:
tunnelType.text=jLabel10
tunnelName.text=jTextField1
tunnelPortLabel.text=Port:
tunnelPort.text=jTextField2
tunnelDestination.text=jTextField3
tunnelDestinationLabel.text=Destination:
tunnelProfileLabel.text=Profile:
delayConnect.text=Delay connect
sharedClient.text=Shared client
autoStart.text=Auto start
tunnelDepthLabel.text=Tunnel depth:
depthVarianceLabel.text=Depth variance:
tunnelCountLabel.text=Tunnel count:
backupTunnelCountLabel.text=Backup tunnel count:
reduceIdle.text=Reduce tunnel count when idle
closeIdle.text=Close tunnels when idle
delayIdle.text=Delay opening of tunnels when idle
save.text=Save
cancel.text=Cancel
changeTunnelState.text=Start Tunnel

View File

@ -1,10 +1,5 @@
cancel.text=Cancel
ok.text=OK
jLabel3.text=Monthly usage:
jLabel4.text=Monthly usage:
jLabel5.text=GB
jLabel6.text=GB
jLabel7.text=Explanation ...
Form.title=General Configuration
speedPanel.TabConstraints.tabTitle=Speed
updatesPanel.TabConstraints.tabTitle=Updates
@ -18,7 +13,7 @@ downloadspeed.text=jTextField2
uploadgb.text=jTextField3
downloadgb.text=jTextField4
updateMethod.text=What is your preferred automatic update setting?
updateInform.text=Only inform about updates
updateInform.text=Only inform about updates (not advised)
updateDownload.text=Download and verify update file, do not restart
updateDownloadRestart.text=Download, verify and restart
checkUpdates.text=Check for updates now
@ -26,4 +21,17 @@ updateNow.text=Update available: update now
advancedUpdateConfig.text=Advanced update configuration
clientTunnelLabel.text=Client tunnels:
serverTunnelLabel.text=Server tunnels:
tunnelsExplanation.text=Tunnel explanation
tunnelsExplanation.text=Click on a tunnel to view and change its configuration. + Tunnel explanation
uploadUsageLabel.text=Monthly usage:
downloadUsageLabel.text=Monthly usage:
gbUploadLabel.text=GB
gbDownloadLabel.text=GB
uploadDownloadExplanation.text=Explanation ...
clientTable.columnModel.title3=Status
clientTable.columnModel.title2=Address
clientTable.columnModel.title1=Type
clientTable.columnModel.title0=Name
serverTable.columnModel.title0=Name
serverTable.columnModel.title3=Title 4
serverTable.columnModel.title2=Status
serverTable.columnModel.title1=Address

View File

@ -0,0 +1 @@
jLabel1.text=Name:

View File

@ -36,4 +36,8 @@ public class SpeedHelper {
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,65 @@
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://echelon.i2p/i2p/news.xml";
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
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://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

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

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;
@ -179,7 +179,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
}
}
List getSessions() {
List<I2PSession> getSessions() {
synchronized (_sessions) {
return new ArrayList(_sessions);
}

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,12 +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()
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
verifySocketManager();
return createI2PSocket(dest, getDefaultOptions());
}
@ -369,22 +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
synchronized(sockLock) {
sockMgr = getSocketManager();
}
} else if (Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")).booleanValue() &&
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
synchronized(sockLock) {
I2PSocketManager oldSockMgr = sockMgr;
// This will build a new socket manager and a new dest if the session is closed.
sockMgr = getSocketManager();
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

@ -157,11 +157,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
// delayed start
if (sockMgr == null) {
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
verifySocketManager();
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

View File

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

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

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

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

@ -75,8 +75,9 @@
<ant target="war" />
</target>
<target name="war" depends="precompilejsp">
<!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
<war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
basedir="../jsp/" excludes="web.xml, *.java, *.jsp, web-fragment.xml">
basedir="../jsp/" excludes="web.xml, *.css, *.java, *.jsp, web-fragment.xml">
</war>
</target>
<target name="precompilejsp" unless="precompilejsp.uptodate">
@ -86,7 +87,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" />
@ -143,7 +144,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

@ -0,0 +1,20 @@
package net.i2p.router.web;
/**
* Copied and modded from I2PTunnel IndexBean (GPL)
* @author zzz
*/
public class CSSHelper extends HelperBase {
public CSSHelper() {}
public static final String PROP_THEME_NAME = "routerconsole.theme";
private static final String BASE = "/themes/console/";
public String getTheme() {
String url = BASE;
String theme = _context.getProperty(PROP_THEME_NAME);
if (theme != null)
url += theme + "/";
return url;
}
}

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.autoport";
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoip";
public String getNtcphostname() {
if (!TransportManager.enableNTCP(_context))
return "\" disabled=\"true";
String hostname = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
if (hostname == null) return "";
return hostname;
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

@ -19,7 +19,8 @@ public class ConfigUpdateHandler extends FormHandler {
public static final String PROP_NEWS_URL = "router.newsURL";
// public static final String DEFAULT_NEWS_URL = "http://dev.i2p.net/cgi-bin/cvsweb.cgi/i2p/news.xml?rev=HEAD";
public static final String DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
public static final String OLD_DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
public static final String DEFAULT_NEWS_URL = "http://echelon.i2p/i2p/news.xml";
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
public static final String PROP_UPDATE_POLICY = "router.updatePolicy";
@ -57,7 +58,7 @@ public class ConfigUpdateHandler extends FormHandler {
}
if ( (_newsURL != null) && (_newsURL.length() > 0) ) {
String oldURL = _context.router().getConfigSetting(PROP_NEWS_URL);
String oldURL = ConfigUpdateHelper.getNewsURL(_context);
if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_NEWS_URL, _newsURL);
addFormNotice("Updating news URL to " + _newsURL);

View File

@ -1,5 +1,6 @@
package net.i2p.router.web;
import net.i2p.I2PAppContext;
import net.i2p.crypto.TrustedUpdate;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
@ -12,8 +13,14 @@ public class ConfigUpdateHelper extends HelperBase {
}
public String getNewsURL() {
String url = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL);
if (url != null)
return getNewsURL(_context);
}
/** hack to replace the old news location with the new one, even if they have saved
the update page at some point */
public static String getNewsURL(I2PAppContext ctx) {
String url = ctx.getProperty(ConfigUpdateHandler.PROP_NEWS_URL);
if (url != null && !url.equals(ConfigUpdateHandler.OLD_DEFAULT_NEWS_URL))
return url;
else
return ConfigUpdateHandler.DEFAULT_NEWS_URL;
@ -26,18 +33,10 @@ public class ConfigUpdateHelper extends HelperBase {
return ConfigUpdateHandler.DEFAULT_UPDATE_URL;
}
public String getProxyHost() {
String host = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST);
if (host != null)
return host;
else
return ConfigUpdateHandler.DEFAULT_PROXY_HOST;
return _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
}
public String getProxyPort() {
String port = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT);
if (port != null)
return port;
else
return ConfigUpdateHandler.DEFAULT_PROXY_PORT;
return _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT, ConfigUpdateHandler.DEFAULT_PROXY_PORT);
}
public String getUpdateThroughProxy() {
@ -76,8 +75,7 @@ public class ConfigUpdateHelper extends HelperBase {
}
public String getUpdatePolicySelectBox() {
String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY);
if (policy == null) policy = ConfigUpdateHandler.DEFAULT_UPDATE_POLICY;
String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY, ConfigUpdateHandler.DEFAULT_UPDATE_POLICY);
StringBuffer buf = new StringBuffer(256);
buf.append("<select name=\"updatePolicy\">");

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

@ -110,7 +110,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
}
}
public void fetchNews() {
String newsURL = _context.getProperty(ConfigUpdateHandler.PROP_NEWS_URL, ConfigUpdateHandler.DEFAULT_NEWS_URL);
String newsURL = ConfigUpdateHelper.getNewsURL(_context);
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
String port = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT, ConfigUpdateHandler.DEFAULT_PROXY_PORT);

View File

@ -1,23 +0,0 @@
package net.i2p.router.web;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
/**
* Simple helper to query the appropriate router for data necessary to render
* any emergency notices
*/
public class NoticeHelper extends HelperBase {
public String getSystemNotice() {
if (true) return ""; // moved to the left hand nav
if (_context.router().gracefulShutdownInProgress()) {
long remaining = _context.router().getShutdownTimeRemaining();
if (remaining > 0)
return "Graceful shutdown in " + DataHelper.formatDuration(remaining);
else
return "Graceful shutdown imminent, please be patient as state is written to disk";
} else {
return "";
}
}
}

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,20 +134,26 @@ 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">
* OR
* HREF="routerInfo-{hash}.dat">
* and then it fetches the files
* {seedURL}routerInfo-{hash}.dat
* after appending a '/' to seedURL if it doesn't have one.
* Essentially this means that the seedURL must be a directory, it
* can't end with 'index.html', for example.
*
* Jetty directory listings are not compatible, as they look like
* HREF="/full/path/to/routerInfo-...
**/
private void reseedOne(String seedURL, boolean echoStatus) {
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,17 +167,21 @@ 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;
if (start < 0) {
start = content.indexOf("HREF=\"routerInfo-", cur);
if (start < 0)
break;
}
int end = content.indexOf(".dat\">", start);
String name = content.substring(start+"href=\"routerInfo-".length(), end);
urls.add(name);
cur = end + 1;
}
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 +189,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 +211,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

@ -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() {
@ -379,7 +365,7 @@ public class SummaryHelper extends HelperBase {
buf.append("<i>No leases</i><br />\n");
}
}
buf.append("<hr />\n");
// buf.append("<hr />\n");
return buf.toString();
}

View File

@ -137,7 +137,8 @@ public class UpdateHandler {
try {
EepGet get = null;
if (shouldProxy)
get = new EepGet(_context, proxyHost, proxyPort, 20, SIGNED_UPDATE_FILE, updateURL, false);
// 40 retries!!
get = new EepGet(_context, proxyHost, proxyPort, 40, SIGNED_UPDATE_FILE, updateURL, false);
else
get = new EepGet(_context, 1, SIGNED_UPDATE_FILE, updateURL, false);
get.addStatusListener(UpdateRunner.this);
@ -179,7 +180,11 @@ public class UpdateHandler {
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

@ -3,7 +3,7 @@
<html><head>
<title>I2P Router Console - config networking</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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..." />
<h3>IP and Transport Configuration</h3>
<p>
<b>Inbound TCP connection configuration:</b><br />
Externally reachable hostname or IP address:
<input name ="ntcphost" type="text" size="16" value="<jsp:getProperty name="nethelper" property="ntcphostname" />" />
(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 />
<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.

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config advanced</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config clients</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
<style type='text/css'>
button span.hide{
display:none;
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config keyring</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config logging</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<jsp:useBean class="net.i2p.router.web.ConfigLoggingHelper" id="logginghelper" scope="request" />
<jsp:setProperty name="logginghelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
@ -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,27 +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" />
<i>(DEBUG and INFO are not recommended defaults, as they will drastically slow down your router)</i>
<br />
<jsp:getProperty name="logginghelper" property="logLevelTable" />
<hr />
<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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config peers</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config service</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config stats</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
<script type="text/javascript">
function init()
{
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config tunnels</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - config update</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -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")%>" />
@ -28,27 +27,32 @@
if (prev != null) System.setProperty("net.i2p.router.web.ConfigUpdateHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigUpdateHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigUpdateHandler.nonce")%>" />
<table border="0" cellspacing="5"><tr><td valign="top"><b>News:</b><td>
<% if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) { %>
<i>Update In Progress</i><br /><br />
<% } else { %>
<input type="submit" name="action" value="Check for update now" /><br /><br />
<% } %>
News URL:
<input type="text" size="60" name="newsURL" value="<jsp:getProperty name="updatehelper" property="newsURL" />"><br />
Refresh frequency:
<jsp:getProperty name="updatehelper" property="refreshFrequencySelectBox" /><br />
Update policy:
<jsp:getProperty name="updatehelper" property="updatePolicySelectBox" /><br />
<p>Update through the eepProxy?
<jsp:getProperty name="updatehelper" property="updateThroughProxy" /><br />
eepProxy host: <input type="text" size="10" name="proxyHost" value="<jsp:getProperty name="updatehelper" property="proxyHost" />" /><br />
eepProxy port: <input type="text" size="4" name="proxyPort" value="<jsp:getProperty name="updatehelper" property="proxyPort" />" /></p>
<p>Update URLs:<br />
<textarea name="updateURL" cols="90" rows="4" wrap="off"><jsp:getProperty name="updatehelper" property="updateURL" /></textarea></p>
<p>Trusted keys:</br />
<textarea name="trustedKeys" cols="90" rows="4" wrap="off"><jsp:getProperty name="updatehelper" property="trustedKeys" /></textarea></p>
<br />
<input type="submit" name="action" value="Save" />
<tr><td><td>
<tr><td valign="top"><b>News URL:</b>
<td><input type="text" size="60" name="newsURL" value="<jsp:getProperty name="updatehelper" property="newsURL" />">
<tr><td valign="top"><b>Refresh frequency:</b>
<td><jsp:getProperty name="updatehelper" property="refreshFrequencySelectBox" />
<tr><td valign="top"><b>Update policy:</b>
<td><jsp:getProperty name="updatehelper" property="updatePolicySelectBox" />
<tr><td valign="top"><b>Update through the eepProxy?</b>
<td><jsp:getProperty name="updatehelper" property="updateThroughProxy" />
<tr><td valign="top"><b>eepProxy host:</b>
<td><input type="text" size="10" name="proxyHost" value="<jsp:getProperty name="updatehelper" property="proxyHost" />" />
<tr><td valign="top"><b>eepProxy port:</b>
<td><input type="text" size="4" name="proxyPort" value="<jsp:getProperty name="updatehelper" property="proxyPort" />" />
<tr><td valign="top"><b>Update URLs:</b>
<td><textarea name="updateURL" cols="90" rows="4" wrap="off"><jsp:getProperty name="updatehelper" property="updateURL" /></textarea>
<tr><td valign="top"><b>Trusted keys:</b>
<td><textarea name="trustedKeys" cols="90" rows="4" wrap="off"><jsp:getProperty name="updatehelper" property="trustedKeys" /></textarea>
<tr><td><td>
<tr><td><td><input type="submit" name="action" value="Save" /> <input type="reset" value="Cancel" />
</table>
</form>
</div>

View File

@ -0,0 +1,20 @@
<%
/*
* This should be included inside <head>...</head>,
* as it sets the stylesheet.
*/
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
// the above will b0rk if the servlet engine has already flushed
// the response prior to including this file, so it should be
// near the top
if (request.getParameter("i2p.contextId") != null) {
session.setAttribute("i2p.contextId", request.getParameter("i2p.contextId"));
}
%>
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="cssHelper" scope="request" />
<jsp:setProperty name="cssHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<link href="<%=cssHelper.getTheme()%>console.css" rel="stylesheet" type="text/css" />

View File

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

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - graphs</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - help</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -5,7 +5,7 @@
<html><head>
<title>I2P Router Console - home</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
<link rel="shortcut icon" href="favicon.ico" />
</head><body>
<%

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - job queue</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - logs</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>
@ -26,7 +26,7 @@ jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%><br />
<h4>Critical logs:</h4><a name="criticallogs"> </a>
<jsp:getProperty name="logsHelper" property="criticalLogs" />
<hr />
<h4>Router logs:</h4>
<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>

View File

@ -1,15 +1,4 @@
<%@page import="java.io.File" %>
<% response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
// the above will b0rk if the servlet engine has already flushed
// the response prior to including nav.jsp, so nav should be
// near the top
if (request.getParameter("i2p.contextId") != null) {
session.setAttribute("i2p.contextId", request.getParameter("i2p.contextId"));
}%>
<div class="logo">
<a href="index.jsp"><img src="i2plogo.png" alt="Router Console" width="187" height="35" /></a><br />
</div>
@ -35,12 +24,10 @@
<a href="graphs.jsp">Graphs</a> |
<a href="oldstats.jsp">Stats</a> <!-- |
<a href="oldconsole.jsp">Internals</a> -->
<% } %>
<% }
// the following is unused and a candidate for removal
%>
<jsp:useBean class="net.i2p.router.web.NavHelper" id="navhelper" scope="request" />
<jsp:setProperty name="navhelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:getProperty name="navhelper" property="clientAppLinks" />
</div>
<jsp:useBean class="net.i2p.router.web.NoticeHelper" id="noticehelper" scope="request" />
<jsp:setProperty name="noticehelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<b><jsp:getProperty name="noticehelper" property="systemNotice" /></b>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - network database summary</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - internals</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - statistics</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - peer connections</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - peer profiles</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -50,7 +50,7 @@
}
}
%>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head>
<body style="margin: 0;">

View File

@ -83,8 +83,6 @@
<b>Used:</b> <jsp:getProperty name="helper" property="inboundTransferred" />/<jsp:getProperty name="helper" property="outboundTransferred" /><br />
<hr />
<jsp:getProperty name="helper" property="destinations" />
<u><b>Tunnels in/out</b></u><br />
<b>Exploratory:</b> <jsp:getProperty name="helper" property="inboundTunnels" />/<jsp:getProperty name="helper" property="outboundTunnels" /><br />
<b>Client:</b> <jsp:getProperty name="helper" property="inboundClientTunnels" />/<jsp:getProperty name="helper" property="outboundClientTunnels" /><br />
@ -97,4 +95,6 @@
<b>Tunnel lag:</b> <jsp:getProperty name="helper" property="tunnelLag" /><br />
<b>Handle backlog:</b> <jsp:getProperty name="helper" property="inboundBacklog" /><br />
<b><jsp:getProperty name="helper" property="tunnelStatus" /></b><br />
<hr />
<jsp:getProperty name="helper" property="destinations" />

View File

@ -4,7 +4,7 @@
<html><head>
<title>I2P Router Console - tunnel summary</title>
<link rel="stylesheet" href="default.css" type="text/css" />
<%@include file="css.jsp" %>
</head><body>
<%@include file="nav.jsp" %>

View File

@ -1,12 +0,0 @@
<%@page contentType="text/html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>I2P Router Console - verify update file signature</title>
</head>
<body>
<!-- net.i2p.crypto.TrustedUpdate.verify(request.getParameter("filename")) -->
</body>
</html>

View File

@ -1,4 +1,10 @@
<%
/*
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*/
boolean rendered = false;
String templateFile = request.getParameter("template");
if (templateFile != null) {

View File

@ -1,4 +1,10 @@
<%
/*
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*/
String uri = request.getRequestURI();
if (uri.endsWith(".css")) {
response.setContentType("text/css");

View File

@ -107,11 +107,26 @@ public class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatag
break;
}
msg = DataHelper.readLine(getClientSocket().socket().getInputStream()).trim();
SocketChannel clientSocketChannel = getClientSocket() ;
if (clientSocketChannel == null) {
_log.info("Connection closed by client");
break;
}
if (clientSocketChannel.socket() == null) {
_log.info("Connection closed by client");
break;
}
java.io.InputStream is = clientSocketChannel.socket().getInputStream();
if (is == null) {
_log.info("Connection closed by client");
break;
}
msg = DataHelper.readLine(is);
if (msg == null) {
_log.debug("Connection closed by client");
_log.info("Connection closed by client (line read : null)");
break;
}
msg = msg.trim();
if (_log.shouldLog(Log.DEBUG)) {
_log.debug("New message received: [" + msg + "]");

View File

@ -38,7 +38,7 @@ public class SAMv3DatagramSession extends SAMDatagramSession implements SAMv3Han
* @throws I2PSessionException
*/
public SAMv3DatagramSession(String nick)
throws IOException, DataFormatException, I2PSessionException {
throws IOException, DataFormatException, I2PSessionException, SAMException {
super(SAMv3Handler.sSessionsHash.get(nick).getDest(),
SAMv3Handler.sSessionsHash.get(nick).getProps(),
@ -49,7 +49,7 @@ public class SAMv3DatagramSession extends SAMDatagramSession implements SAMv3Han
this.server = SAMv3Handler.DatagramServer.getInstance() ;
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
if ( rec==null ) throw new InterruptedIOException() ;
if ( rec==null ) throw new SAMException("Record disappeared for nickname : \""+nick+"\"") ;
this.handler = rec.getHandler();

View File

@ -564,7 +564,7 @@ public class SAMv3Handler extends SAMv1Handler
_log.debug("I2P error when instantiating session", e);
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
} catch (SAMException e) {
_log.error("Unexpected SAM error", e);
_log.info("Funny SAM error", e);
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
} catch (IOException e) {
_log.error("Unexpected IOException", e);

View File

@ -197,7 +197,7 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
if ( rec==null ) throw new InterruptedIOException() ;
if ( rec==null || i2ps==null ) throw new InterruptedIOException() ;
if (verbose)
handler.notifyStreamIncomingConnection(i2ps.getPeerDestination()) ;

View File

@ -171,7 +171,9 @@ class ConnectionHandler {
// Send it through the packet handler again
if (_log.shouldLog(Log.WARN))
_log.warn("Found con for queued non-syn packet: " + packet);
_manager.getPacketHandler().receivePacket(packet);
// false -> don't requeue, fixes a race where a SYN gets dropped
// between here and PacketHandler, causing the packet to loop forever....
_manager.getPacketHandler().receivePacketDirect(packet, false);
} else {
// goodbye
if (_log.shouldLog(Log.WARN))

View File

@ -90,10 +90,10 @@ public class PacketHandler {
void receivePacket(Packet packet) {
//boolean ok = choke(packet);
//if (ok)
receivePacketDirect(packet);
receivePacketDirect(packet, true);
}
private void receivePacketDirect(Packet packet) {
void receivePacketDirect(Packet packet, boolean queueIfNoConn) {
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("packet received: " + packet);
@ -105,7 +105,7 @@ public class PacketHandler {
if (_log.shouldLog(Log.INFO))
displayPacket(packet, "RECV", "wsize " + con.getOptions().getWindowSize() + " rto " + con.getOptions().getRTO());
} else {
receiveUnknownCon(packet, sendId);
receiveUnknownCon(packet, sendId, queueIfNoConn);
displayPacket(packet, "UNKN", null);
}
}
@ -228,7 +228,7 @@ public class PacketHandler {
_manager.getPacketQueue().enqueue(reply);
}
private void receiveUnknownCon(Packet packet, long sendId) {
private void receiveUnknownCon(Packet packet, long sendId, boolean queueIfNoConn) {
if (packet.isFlagSet(Packet.FLAG_ECHO)) {
if (packet.getSendStreamId() > 0) {
receivePing(packet);
@ -262,7 +262,7 @@ public class PacketHandler {
if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) {
_manager.getConnectionHandler().receiveNewSyn(packet);
} else {
} else if (queueIfNoConn) {
// We can get here on the 2nd+ packet if the 1st (SYN) packet
// is still on the _synQueue in the ConnectionHandler, and
// ConnectionManager.receiveConnection() hasn't run yet to put
@ -287,6 +287,10 @@ public class PacketHandler {
}
//packet.releasePayload();
_manager.getConnectionHandler().receiveNewSyn(packet);
} else {
// don't queue again (infinite loop!)
sendReset(packet);
packet.releasePayload();
}
}
}

View File

@ -35,7 +35,7 @@
<delete file="WEB-INF/web-out.xml" />
<mkdir dir="${tmp}" />
<echo message="Ignore any warning about /WEB-INF/web.xml not found" />
<java classname="org.apache.jasper.JspC" fork="true" classpathref="cp">
<java classname="org.apache.jasper.JspC" fork="true" classpathref="cp" failonerror="true">
<arg value="-d" />
<arg value="${tmp}" />
<arg value="-v" />

View File

@ -37,11 +37,13 @@ import java.util.Properties;
public class AddressbookBean
{
private String book, action, serial, lastSerial, filter, search, hostname, destination;
private int beginIndex, endIndex;
private Properties properties, addressbook;
private int trClass;
private LinkedList deletionMarks;
private static Comparator sorter;
private static final int DISPLAY_SIZE=100;
static {
sorter = new AddressByNameSorter();
}
@ -74,6 +76,8 @@ public class AddressbookBean
{
properties = new Properties();
deletionMarks = new LinkedList();
beginIndex = 0;
endIndex = DISPLAY_SIZE - 1;
}
private long configLastLoaded = 0;
private static final String PRIVATE_BOOK = "private_addressbook";
@ -106,6 +110,8 @@ public class AddressbookBean
{
loadConfig();
String filename = properties.getProperty( getBook() + "_addressbook" );
if (filename.startsWith("../"))
return filename.substring(3);
return ConfigBean.addressbookPrefix + filename;
}
private Object[] entries;
@ -174,17 +180,45 @@ public class AddressbookBean
}
list.addLast( new AddressBean( name, destination ) );
}
// Format a message about filtered addressbook size, and the number of displayed entries
if( filter != null && filter.length() > 0 )
message = "Filtered l";
else
message = "L";
message += "ist contains " + list.size() + " entries";
if (list.size() > 300) message += ", displaying the first 300."; else message += ".";
Object array[] = list.toArray();
Arrays.sort( array, sorter );
entries = array;
// Format a message about filtered addressbook size, and the number of displayed entries
// addressbook.jsp catches the case where the whole book is empty.
String filterArg = "";
if( search != null && search.length() > 0 ) {
message = "Search ";
}
if( filter != null && filter.length() > 0 ) {
if( search != null && search.length() > 0 )
message += "within ";
message += "Filtered list ";
filterArg = "&filter=" + filter;
}
if (entries.length == 0) {
message += "- no matches";
} else if (getBeginInt() == 0 && getEndInt() == entries.length - 1) {
if (message.length() == 0)
message = "Addressbook ";
message += "contains " + entries.length + " entries";
} else {
if (getBeginInt() > 0) {
int newBegin = Math.max(0, getBeginInt() - DISPLAY_SIZE);
int newEnd = Math.max(0, getBeginInt() - 1);
message += "<a href=\"addressbook.jsp?book=" + getBook() + filterArg +
"&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin +
'-' + newEnd + "</a> | ";
}
message += "Showing " + getBegin() + '-' + getEnd() + " of " + entries.length;
if (getEndInt() < entries.length - 1) {
int newBegin = Math.min(entries.length - 1, getEndInt() + 1);
int newEnd = Math.min(entries.length, getEndInt() + DISPLAY_SIZE);
message += " | <a href=\"addressbook.jsp?book=" + getBook() + filterArg +
"&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin +
'-' + newEnd + "</a>";
}
}
}
catch (Exception e) {
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
@ -236,7 +270,7 @@ public class AddressbookBean
}
}
else {
message += "Invalid nonce. Are you being spoofed?";
message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.";
}
}
@ -302,4 +336,26 @@ public class AddressbookBean
public void setHostname(String hostname) {
this.hostname = hostname;
}
private int getBeginInt() {
return Math.max(0, Math.min(entries.length - 1, beginIndex));
}
public String getBegin() {
return "" + getBeginInt();
}
public void setBegin(String s) {
try {
beginIndex = Integer.parseInt(s);
} catch (NumberFormatException nfe) {}
}
private int getEndInt() {
return Math.max(0, Math.max(getBeginInt(), Math.min(entries.length - 1, endIndex)));
}
public String getEnd() {
return "" + getEndInt();
}
public void setEnd(String s) {
try {
endIndex = Integer.parseInt(s);
} catch (NumberFormatException nfe) {}
}
}

View File

@ -142,7 +142,7 @@ public class ConfigBean implements Serializable {
}
}
else {
message = "Invalid nonce. Are you being spoofed?";
message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.";
}
}
if( message.length() > 0 )

View File

@ -136,7 +136,7 @@ public class SubscriptionsBean
}
}
else {
message = "Invalid nonce. Are you being spoofed?";
message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.";
}
}
if( message.length() > 0 )

View File

@ -46,10 +46,10 @@
<div id="navi">
<p>addressbooks
<a href="addressbook.jsp?book=master">master</a> |
<a href="addressbook.jsp?book=router">router</a> |
<a href="addressbook.jsp?book=published">published</a> |
<a href="addressbook.jsp?book=private">private</a> *
<a href="addressbook.jsp?book=master&filter=none&begin=0&end=99">master</a> |
<a href="addressbook.jsp?book=router&filter=none&begin=0&end=99">router</a> |
<a href="addressbook.jsp?book=published&filter=none&begin=0&end=99">published</a> |
<a href="addressbook.jsp?book=private&filter=none&begin=0&end=99">private</a> *
<a href="subscriptions.jsp">subscriptions</a> *
<a href="config.jsp">configuration</a> *
<a href="index.jsp">overview</a>
@ -64,42 +64,46 @@
<span>${book.loadBookMessages}</span>
<c:if test="${book.notEmpty}">
<div id="filter">
<p>Filter: <a href="addressbook.jsp?filter=a">a</a>
<a href="addressbook.jsp?filter=b">b</a>
<a href="addressbook.jsp?filter=c">c</a>
<a href="addressbook.jsp?filter=d">d</a>
<a href="addressbook.jsp?filter=e">e</a>
<a href="addressbook.jsp?filter=f">f</a>
<a href="addressbook.jsp?filter=g">g</a>
<a href="addressbook.jsp?filter=h">h</a>
<a href="addressbook.jsp?filter=i">i</a>
<a href="addressbook.jsp?filter=j">j</a>
<a href="addressbook.jsp?filter=k">k</a>
<a href="addressbook.jsp?filter=l">l</a>
<a href="addressbook.jsp?filter=m">m</a>
<a href="addressbook.jsp?filter=n">n</a>
<a href="addressbook.jsp?filter=o">o</a>
<a href="addressbook.jsp?filter=p">p</a>
<a href="addressbook.jsp?filter=q">q</a>
<a href="addressbook.jsp?filter=r">r</a>
<a href="addressbook.jsp?filter=s">s</a>
<a href="addressbook.jsp?filter=t">t</a>
<a href="addressbook.jsp?filter=u">u</a>
<a href="addressbook.jsp?filter=v">v</a>
<a href="addressbook.jsp?filter=w">w</a>
<a href="addressbook.jsp?filter=x">x</a>
<a href="addressbook.jsp?filter=y">y</a>
<a href="addressbook.jsp?filter=z">z</a>
<a href="addressbook.jsp?filter=0-9">0-9</a>
<a href="addressbook.jsp?filter=none">all</a></p>
<p>Filter:
<a href="addressbook.jsp?filter=a&begin=0&end=99">a</a>
<a href="addressbook.jsp?filter=b&begin=0&end=99">b</a>
<a href="addressbook.jsp?filter=c&begin=0&end=99">c</a>
<a href="addressbook.jsp?filter=d&begin=0&end=99">d</a>
<a href="addressbook.jsp?filter=e&begin=0&end=99">e</a>
<a href="addressbook.jsp?filter=f&begin=0&end=99">f</a>
<a href="addressbook.jsp?filter=g&begin=0&end=99">g</a>
<a href="addressbook.jsp?filter=h&begin=0&end=99">h</a>
<a href="addressbook.jsp?filter=i&begin=0&end=99">i</a>
<a href="addressbook.jsp?filter=j&begin=0&end=99">j</a>
<a href="addressbook.jsp?filter=k&begin=0&end=99">k</a>
<a href="addressbook.jsp?filter=l&begin=0&end=99">l</a>
<a href="addressbook.jsp?filter=m&begin=0&end=99">m</a>
<a href="addressbook.jsp?filter=n&begin=0&end=99">n</a>
<a href="addressbook.jsp?filter=o&begin=0&end=99">o</a>
<a href="addressbook.jsp?filter=p&begin=0&end=99">p</a>
<a href="addressbook.jsp?filter=q&begin=0&end=99">q</a>
<a href="addressbook.jsp?filter=r&begin=0&end=99">r</a>
<a href="addressbook.jsp?filter=s&begin=0&end=99">s</a>
<a href="addressbook.jsp?filter=t&begin=0&end=99">t</a>
<a href="addressbook.jsp?filter=u&begin=0&end=99">u</a>
<a href="addressbook.jsp?filter=v&begin=0&end=99">v</a>
<a href="addressbook.jsp?filter=w&begin=0&end=99">w</a>
<a href="addressbook.jsp?filter=x&begin=0&end=99">x</a>
<a href="addressbook.jsp?filter=y&begin=0&end=99">y</a>
<a href="addressbook.jsp?filter=z&begin=0&end=99">z</a>
<a href="addressbook.jsp?filter=0-9&begin=0&end=99">0-9</a>
<a href="addressbook.jsp?filter=none&begin=0&end=99">all</a></p>
<c:if test="${book.hasFilter}">
<p>Current filter: ${book.filter}
(<a href="addressbook.jsp?filter=none">clear filter</a>)</p>
(<a href="addressbook.jsp?filter=none&begin=0&end=99">clear filter</a>)</p>
</c:if>
</div>
<form method="POST" action="addressbook.jsp">
<input type="hidden" name="begin" value="0"/>
<input type="hidden" name="end" value="99"/>
<div id="search">
<table><tr>
<td class="search">Search: <input type="text" name="search" value="${book.search}" size="20" /></td>
@ -109,9 +113,12 @@
</div>
</form>
</c:if>
<form method="POST" action="addressbook.jsp">
<input type="hidden" name="serial" value="${book.serial}"/>
<input type="hidden" name="begin" value="0"/>
<input type="hidden" name="end" value="99"/>
<c:if test="${book.notEmpty}">
@ -127,8 +134,8 @@
<th>Name</th>
<th>Destination</th>
</tr>
<!-- limit iterator to 300, or "Form too large" may result on submit -->
<c:forEach items="${book.entries}" var="addr" begin="0" end="299">
<!-- limit iterator, or "Form too large" may result on submit, and is a huge web page if we don't -->
<c:forEach items="${book.entries}" var="addr" begin="${book.begin}" end="${book.end}">
<tr class="list${book.trClass}">
<c:if test="${book.master || book.router || book.published || book.private}">
<td class="checkbox"><input type="checkbox" name="checked" value="${addr.name}" alt="Mark for deletion"></td>
@ -136,7 +143,7 @@
<td class="names"><a href="http://${addr.name}/">${addr.name}</a> -
<span class="addrhlpr"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}">(addrhlpr)</a></span>
</td>
<td class="destinations"><textarea rows="1" cols="20" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td>
<td class="destinations"><textarea rows="1" cols="40" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td>
</tr>
</c:forEach>
</table>
@ -160,8 +167,9 @@
<div id="add">
<p class="add">
<h3>Add new destination:</h3>
Hostname: <input type="text" name="hostname" value="${book.hostname}" size="20">
Destination: <textarea name="destination" rows="1" cols="20" wrap="off" >${book.destination}</textarea><br/>
<b>Hostname:</b> <input type="text" name="hostname" value="${book.hostname}" size="20">
<b>Destination:</b> <textarea name="destination" rows="1" cols="40" wrap="off" >${book.destination}</textarea><br/>
</p><p>
<input type="image" name="action" value="add" src="images/add.png" alt="Add destination" />
</p>
</div>

View File

@ -12,9 +12,12 @@ package net.i2p.apps.systray;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.net.InetSocketAddress;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.URL;
import net.i2p.util.ShellCommand;
@ -33,6 +36,56 @@ public class UrlLauncher {
ShellCommand _shellCommand = new ShellCommand();
private static final int WAIT_TIME = 5*1000;
private static final int MAX_WAIT_TIME = 5*60*1000;
private static final int MAX_TRIES = 99;
/**
* Prevent bad user experience by waiting for the server to be there
* before launching the browser.
* @return success
*/
public boolean waitForServer(String urlString) {
URL url;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
return false;
}
String host = url.getHost();
int port = url.getPort();
if (port <= 0) {
port = url.getDefaultPort();
if (port <= 0)
return false;
}
SocketAddress sa;
try {
sa = new InetSocketAddress(host, port);
} catch (IllegalArgumentException iae) {
return false;
}
long done = System.currentTimeMillis() + MAX_WAIT_TIME;
for (int i = 0; i < MAX_TRIES; i++) {
try {
Socket test = new Socket();
// this will usually fail right away if it's going to fail since it's local
test.connect(sa, WAIT_TIME);
// it worked
try {
test.close();
} catch (IOException ioe) {}
return true;
} catch (Exception e) {}
if (System.currentTimeMillis() > done)
break;
try {
Thread.sleep(WAIT_TIME);
} catch (InterruptedException ie) {}
}
return false;
}
/**
* Discovers the operating system the installer is running under and tries
* to launch the given URL using the default browser for that platform; if
@ -49,6 +102,7 @@ public class UrlLauncher {
String osName = System.getProperty("os.name");
waitForServer(url);
if (validateUrlFormat(url)) {
if (osName.toLowerCase().indexOf("mac") > -1) {
if (osName.toLowerCase().startsWith("mac os x")) {
@ -101,6 +155,20 @@ public class UrlLauncher {
// fall through
}
// This debian script tries everything in $BROWSER, then gnome-www-browser and x-www-browser
// if X is running and www-browser otherwise. Those point to the user's preferred
// browser using the update-alternatives system.
if (_shellCommand.executeSilentAndWaitTimed("sensible-browser " + url, 5))
return true;
// Try x-www-browser directly
if (_shellCommand.executeSilentAndWaitTimed("x-www-browser " + url, 5))
return true;
// puppy linux
if (_shellCommand.executeSilentAndWaitTimed("defaultbrowser " + url, 5))
return true;
if (_shellCommand.executeSilentAndWaitTimed("opera -newpage " + url, 5))
return true;
@ -119,6 +187,10 @@ public class UrlLauncher {
if (_shellCommand.executeSilentAndWaitTimed("galeon " + url, 5))
return true;
// Text Mode Browsers only below here
if (_shellCommand.executeSilentAndWaitTimed("www-browser " + url, 5))
return true;
if (_shellCommand.executeSilentAndWaitTimed("links " + url, 5))
return true;
@ -141,6 +213,7 @@ public class UrlLauncher {
*/
public boolean openUrl(String url, String browser) throws Exception {
waitForServer(url);
if (validateUrlFormat(url))
if (_shellCommand.executeSilentAndWaitTimed(browser + " " + url, 5))
return true;

112
build.xml
View File

@ -17,6 +17,8 @@
<echo message=" updater: tar the built i2p specific files into an i2pupdate.zip (extracts safely over existing installs)" />
<echo message=" updaterWithJetty: tar the built i2p specific files and jetty into an i2pupdate.zip (extracts safely over existing installs)" />
<echo message=" updaterWithJettyFixes: updater including local jetty patches" />
<echo message=" updaterWithGeoIP: updater including GeoIP Files" />
<echo message=" updaterWithJettyFixesAndGeoIP" />
<echo message=" updaterSmall: updater with the essentials only - no SAM, i2psnark, SusiMail, SusiDNS, news.xml, or history.txt" />
<echo message=" updaterRouter: updater with the i2p.jar and router.jar only" />
<echo message=" distclean: clean up all derived files" />
@ -72,7 +74,6 @@
<copy file="apps/routerconsole/java/build/routerconsole.jar" todir="build/" />
<copy file="apps/routerconsole/java/build/routerconsole.war" todir="build/" />
<copy file="apps/jetty/jettylib/org.mortbay.jetty.jar" todir="build/" />
<copy file="apps/jetty/jettylib/ant.jar" todir="build/" />
<copy file="apps/jetty/jettylib/jasper-compiler.jar" todir="build/" />
<copy file="apps/jetty/jettylib/jasper-runtime.jar" todir="build/" />
<copy file="apps/jetty/jettylib/commons-logging.jar" todir="build/" />
@ -103,7 +104,7 @@
<jar destfile="./build/launchi2p.jar">
<manifest>
<attribute name="Main-Class" value="net.i2p.router.RouterLaunch" />
<attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/ant.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar" />
<attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar" />
</manifest>
</jar>
<!-- now the standalone launcher exe -->
@ -201,16 +202,14 @@
<fileset dir="." includes="**/*.java~" />
</delete>
</target>
<target name="pkg" depends="distclean, updaterWithJettyFixes, tarball, installer" />
<target name="pkgclean">
<delete dir="pkg-temp" />
<!-- one release only, then back to updaterWithJettyFixes -->
<target name="pkg" depends="distclean, updaterWithJettyFixesAndGeoIP, preppkg, installer" />
<target name="pkgclean" depends="deletepkg-temp">
<delete>
<fileset dir="." includes="i2p.tar.bz2 install.jar i2pupdate.zip" />
</delete>
</target>
<target name="preppkg" depends="build, buildexe">
<delete dir="pkg-temp" />
<copy file="build/ant.jar" todir="pkg-temp/lib/" />
<target name="preppkg" depends="build, buildexe, preplicenses, prepconsoleDocs">
<copy file="build/i2p.jar" todir="pkg-temp/lib/" />
<copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
<copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
@ -250,6 +249,7 @@
<copy file="installer/resources/eepget" todir="pkg-temp/" />
<copy file="installer/resources/i2prouter" todir="pkg-temp/" />
<copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
<copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
<copy file="installer/resources/i2ptunnel.config" todir="pkg-temp/" />
<!-- <copy file="installer/resources/install_i2p_service_unix" todir="pkg-temp/" /> -->
<copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
@ -279,18 +279,12 @@
<fileset dir="installer/lib/wrapper/win32/" />
</copy>
<copy file="hosts.txt" todir="pkg-temp/" />
<copy file="install-headless.txt" todir="pkg-temp/" />
<copy file="INSTALL-headless.txt" todir="pkg-temp/" />
<copy file="history.txt" todir="pkg-temp/" />
<mkdir dir="pkg-temp/scripts" />
<copy file="apps/proxyscript/i2pProxy.pac" todir="pkg-temp/scripts/" />
<copy file="core/perl/i2pbench.sh" todir="pkg-temp/scripts/" />
<copy file="core/perl/i2ptest.sh" todir="pkg-temp/scripts/" />
<mkdir dir="pkg-temp/docs" />
<copy file="readme.html" todir="pkg-temp/docs/" />
<copy file="readme_de.html" todir="pkg-temp/docs/" />
<copy file="readme_fr.html" todir="pkg-temp/docs/" />
<copy file="readme_nl.html" todir="pkg-temp/docs/" />
<copy file="readme_sv.html" todir="pkg-temp/docs/" />
<!-- polecat: please put your modified toolbar.html in installer/resources/toolbar.html
and uncomment the following -->
<!-- <copy file="installer/resources/toolbar.html" todir="pkg-temp/docs/" /> -->
@ -299,15 +293,13 @@
<copy file="installer/resources/start.ico" todir="pkg-temp/docs/" />
<copy file="installer/resources/console.ico" todir="pkg-temp/docs/" />
<copy file="installer/resources/uninstall.ico" todir="pkg-temp/docs/" />
<copy file="installer/resources/dnf-header.ht" todir="pkg-temp/docs/" />
<copy file="installer/resources/dnfp-header.ht" todir="pkg-temp/docs/" />
<copy file="installer/resources/dnfb-header.ht" todir="pkg-temp/docs/" />
<copy file="installer/resources/dnfh-header.ht" todir="pkg-temp/docs/" />
<copy file="installer/resources/ahelper-conflict-header.ht" todir="pkg-temp/docs/" />
<mkdir dir="pkg-temp/docs/themes/" />
<copy todir="pkg-temp/docs/themes/" >
<fileset dir="installer/resources/themes/" />
</copy>
<!-- CSS now in docs/, not in the .war -->
<copy file="apps/routerconsole/jsp/default.css" tofile="pkg-temp/docs/themes/console/console.css" />
<copy file="apps/routerconsole/jsp/default.css" tofile="pkg-temp/docs/themes/console/defCon1/console.css" />
<mkdir dir="pkg-temp/eepsite" />
<mkdir dir="pkg-temp/eepsite/webapps" />
<mkdir dir="pkg-temp/eepsite/logs" />
@ -316,39 +308,44 @@
<copy file="installer/resources/eepsite_index.html" tofile="pkg-temp/eepsite/docroot/index.html" />
<copy file="installer/resources/favicon.ico" tofile="pkg-temp/eepsite/docroot/favicon.ico" />
<copy file="installer/resources/jetty.xml" tofile="pkg-temp/eepsite/jetty.xml" />
</target>
<target name="preplicenses">
<copy file="LICENSE.txt" todir="pkg-temp/" />
<mkdir dir="pkg-temp/licenses/" />
<copy todir="pkg-temp/licenses/" >
<fileset dir="licenses/" />
</copy>
<copy file="installer/lib/launch4j/lib/foxtrot.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Foxtrot.txt" />
<copy file="installer/lib/launch4j/lib/JGoodies.Forms.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Forms.txt" />
<copy file="installer/lib/launch4j/lib/JGoodies.Looks.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Looks.txt" />
<copy file="installer/lib/launch4j/lib/XStream.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-XStream.txt" />
</target>
<!-- this is no longer required, izpack 4.3.0 supports headless installs with java -jar i2pinstall.exe -console -->
<target name="tarball" depends="preppkg">
<tar compression="bzip2" destfile="i2p.tar.bz2">
<tarfileset dir="pkg-temp" includes="**/*" prefix="i2p" />
</tar>
</target>
<target name="consoleDocs">
<target name="deletepkg-temp">
<delete dir="pkg-temp" />
</target>
<target name="prepconsoleDocs" depends="prepgeoupdate">
<copy todir="pkg-temp/docs/" >
<fileset dir="." includes="readme*.html" />
<fileset dir="installer/resources/" includes="*-header.ht" />
</copy>
<zip destfile="docs.zip" basedir="pkg-temp" />
</target>
<target name="updater" depends="prepupdate">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
<target name="consoleDocs" depends="deletepkg-temp, prepconsoleDocs">
<zip destfile="docs.zip" basedir="pkg-temp" whenempty="fail" />
</target>
<target name="updaterWithJetty" depends="prepjupdate">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
</target>
<target name="updaterWithJettyFixes" depends="prepjupdatefixes">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
</target>
<target name="updaterSmall" depends="prepupdateSmall">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
</target>
<target name="updaterRouter" depends="prepupdateRouter">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
<target name="updater" depends="prepupdate, preplicenses, zipit" />
<target name="updaterWithGeoIP" depends="prepupdate, prepgeoupdate, preplicenses, zipit" />
<target name="updaterWithJetty" depends="prepjupdate, preplicenses, zipit" />
<target name="updaterWithJettyFixes" depends="prepjupdatefixes, preplicenses, zipit" />
<target name="updaterWithJettyFixesAndGeoIP" depends="prepjupdatefixes, prepgeoupdate, preplicenses, zipit" />
<target name="updaterSmall" depends="prepupdateSmall, zipit" />
<target name="updaterRouter" depends="prepupdateRouter, zipit" />
<target name="zipit">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" whenempty="fail" />
</target>
<target name="updateTest" depends="prepupdate">
<ant dir="core/java/" target="jarTest" />
@ -365,38 +362,34 @@
<copy file="build/susidns.war" todir="pkg-temp/webapps/" />
<copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
<copy file="history.txt" todir="pkg-temp/" />
<mkdir dir="pkg-temp/docs/" />
<copy file="news.xml" todir="pkg-temp/docs/" />
<copy file="LICENSE.txt" todir="pkg-temp/" />
<mkdir dir="pkg-temp/licenses/" />
<copy todir="pkg-temp/licenses/" >
<fileset dir="licenses/" />
</copy>
</target>
<target name="prepupdateSmall" depends="buildSmall">
<delete dir="pkg-temp" />
<copy file="build/i2p.jar" todir="pkg-temp/lib/" />
<target name="prepupdateSmall" depends="buildSmall, prepupdateRouter">
<copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
<copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
<copy file="build/streaming.jar" todir="pkg-temp/lib/" />
<copy file="build/router.jar" todir="pkg-temp/lib/" />
<copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
<copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
<copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
<copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
<!-- New readme_*.html files - For one release only -->
<!--
<mkdir dir="pkg-temp/docs" />
<copy file="readme_fr.html" todir="pkg-temp/docs/" />
-->
<copy file="readme_zh.html" todir="pkg-temp/docs/" />
<!-- CSS now in docs/, not in the .war -->
<copy file="apps/routerconsole/jsp/default.css" tofile="pkg-temp/docs/themes/console/console.css" />
<copy file="apps/routerconsole/jsp/default.css" tofile="pkg-temp/docs/themes/console/defCon1/console.css" />
</target>
<target name="prepupdateRouter" depends="buildrouter">
<delete dir="pkg-temp" />
<target name="prepupdateRouter" depends="buildrouter, deletepkg-temp">
<copy file="build/i2p.jar" todir="pkg-temp/lib/" />
<copy file="build/router.jar" todir="pkg-temp/lib/" />
</target>
<target name="prepgeoupdate">
<copy file="installer/resources/geoip.txt" todir="pkg-temp/geoip/" />
<copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
<copy todir="pkg-temp/docs/icons/flags" >
<fileset dir="installer/resources/icons/flags" />
</copy>
</target>
<target name="prepjupdate" depends="prepupdate, buildWEB">
<copy file="build/ant.jar" todir="pkg-temp/lib/" />
<copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
<copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
<copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
@ -409,13 +402,14 @@
</target>
<target name="installer" depends="preppkg">
<taskdef name="izpack" classpath="${basedir}/installer/lib/izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask" />
<jar destfile="./pkg-temp/lib/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
<mkdir dir="pkg-temp/installer" />
<jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
<manifest><attribute name="Main-Class" value="net.i2p.util.Copy" /></manifest>
</jar>
<jar destfile="./pkg-temp/lib/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
<jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
<manifest><attribute name="Main-Class" value="net.i2p.util.Delete" /></manifest>
</jar>
<jar destfile="./pkg-temp/lib/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
<jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
<manifest><attribute name="Main-Class" value="net.i2p.util.Exec" /></manifest>
</jar>
<izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
@ -491,7 +485,7 @@
<arg value="-output"/>
<arg value="findbugs.xml"/>
<arg value="-auxclasspath"/>
<arg value="build/ant.jar:build/commons-el.jar:build/commons-logging.jar:build/jasper-compiler.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.4.0.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/linux/wrapper.jar"/>
<arg value="build/commons-el.jar:build/commons-logging.jar:build/jasper-compiler.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.4.0.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/linux/wrapper.jar"/>
<arg value="-sourcepath"/>
<arg value="apps/BOB/src/:apps/addressbook/java/src/:apps/i2psnark/java/src/:apps/i2ptunnel/java/src/:apps/ministreaming/java/src/:apps/routerconsole/java/src/:apps/sam/java/src/:apps/streaming/java/src/:apps/susidns/src/java/src/:apps/susimail/src/src/:apps/systray/java/src/:core/java/src/:router/java/src/"/>
<!-- start of the files to be analyzed -->
@ -515,7 +509,7 @@
</exec>
<echo message="Findbugs output stored in findbugs.xml" />
</target>
<target name="buildWithDesktopgui" depends="buildrouter">
<target name="buildWithDesktopgui" depends="buildrouter,builddepSmall">
<ant dir="apps/desktopgui" target="build_jar" />
</target>
<target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
@ -538,7 +532,7 @@
</copy>
</target>
<target name="updaterWithDesktopgui" depends="prepupdateWithDesktopgui,updater" />
<target name="pkgWithDesktopgui" depends="distclean, updaterWithDesktopgui, installerWithDesktopgui, tarball" />
<target name="pkgWithDesktopgui" depends="distclean, updaterWithDesktopgui, installerWithDesktopgui, preppkg" />
<target name="distWithDesktopgui" depends="pkgWithDesktopgui, javadoc" />
<target name="distcleanWithDesktopgui" depends="distclean">
<ant dir="apps/desktopgui" target="build_clean" />

View File

@ -12,12 +12,17 @@ Change revision in:
installer/install.xml
news.xml
router/java/src/net/i2p/router/RouterVersion.java
(change to BUILD = 0 and EXTRA = "")
core/java/src/net/i2p/CoreVersion.java
Review the complete diff from the last release:
mtn diff -r t:i2p-0.7.(xx-1) > out.diff
vi out.diff
Verify that no untrusted revisions were inadvertently
blessed by a trusted party:
mtn log --brief --no-graph --to t:i2p-0.7.(xx-1) | cut -d ' ' -f 2- | sort
Build and tag:
ant pkg
mtn ci
@ -40,7 +45,6 @@ Make the source tarball:
Until the build script gets this ability, you need to rename some files:
mv i2pinstall.exe i2pinstall-0.7.xx.exe
mv i2p.tar.bz2 i2pheadless-0.7.xx.tar.bz2
mv i2pupdate.zip i2pupdate-0.7.xx.zip
you probably don't need to rename i2pupdate.sud
@ -51,7 +55,6 @@ Generate hashes:
Generate PGP signatures:
gpg -b i2pinstall-0.7.xx.exe
gpg -b i2pheadless-0.7.xx.tar.bz2
gpg -b i2psource-0.7.xx.tar.bz2
gpg -b i2pupdate-0.7.xx.zip
gpg -b i2pupdate.sud

View File

@ -15,7 +15,7 @@ package net.i2p;
*/
public class CoreVersion {
public final static String ID = "$Revision: 1.72 $ $Date: 2008-08-24 12:00:00 $";
public final static String VERSION = "0.7.3";
public final static String VERSION = "0.7.5";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@ -17,9 +17,9 @@ import net.i2p.crypto.ElGamalEngine;
import net.i2p.crypto.HMAC256Generator;
import net.i2p.crypto.HMACGenerator;
import net.i2p.crypto.KeyGenerator;
import net.i2p.crypto.PersistentSessionKeyManager;
import net.i2p.crypto.SHA256Generator;
import net.i2p.crypto.SessionKeyManager;
import net.i2p.crypto.TransientSessionKeyManager;
import net.i2p.data.RoutingKeyGenerator;
import net.i2p.stat.StatManager;
import net.i2p.util.Clock;
@ -256,7 +256,8 @@ public class I2PAppContext {
private void initializeSessionKeyManager() {
synchronized (this) {
if (_sessionKeyManager == null)
_sessionKeyManager = new PersistentSessionKeyManager(this);
//_sessionKeyManager = new PersistentSessionKeyManager(this);
_sessionKeyManager = new TransientSessionKeyManager(this);
_sessionKeyManagerInitialized = true;
}
}

View File

@ -58,12 +58,19 @@ public class ElGamalAESEngine {
new long[] { 60 * 60 * 1000l, 24 * 60 * 60 * 1000l});
}
/**
* Decrypt the message using the given private key using tags from the given key manager.
*/
public byte[] decrypt(byte data[], PrivateKey targetPrivateKey) throws DataFormatException {
return decrypt(data, targetPrivateKey, _context.sessionKeyManager());
}
/**
* Decrypt the message using the given private key. This works according to the
* ElGamal+AES algorithm in the data structure spec.
*
*/
public byte[] decrypt(byte data[], PrivateKey targetPrivateKey) throws DataFormatException {
public byte[] decrypt(byte data[], PrivateKey targetPrivateKey, SessionKeyManager keyManager) throws DataFormatException {
if (data == null) {
if (_log.shouldLog(Log.ERROR)) _log.error("Null data being decrypted?");
return null;
@ -76,7 +83,7 @@ public class ElGamalAESEngine {
byte tag[] = new byte[32];
System.arraycopy(data, 0, tag, 0, tag.length);
SessionTag st = new SessionTag(tag);
SessionKey key = _context.sessionKeyManager().consumeTag(st);
SessionKey key = keyManager.consumeTag(st);
SessionKey foundKey = new SessionKey();
foundKey.setData(null);
SessionKey usedKey = new SessionKey();
@ -124,11 +131,11 @@ public class ElGamalAESEngine {
if (foundKey.getData() != null) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Found key: " + foundKey.toBase64() + " tags: " + foundTags + " wasExisting? " + wasExisting);
_context.sessionKeyManager().tagsReceived(foundKey, foundTags);
keyManager.tagsReceived(foundKey, foundTags);
} else {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Used key: " + usedKey.toBase64() + " tags: " + foundTags + " wasExisting? " + wasExisting);
_context.sessionKeyManager().tagsReceived(usedKey, foundTags);
keyManager.tagsReceived(usedKey, foundTags);
}
}
return decrypted;

View File

@ -1,190 +0,0 @@
package net.i2p.crypto;
/*
* free (adj.): unencumbered; not under the control of others
* Written by jrandom in 2003 and released into the public domain
* with no warranty of any kind, either expressed or implied.
* It probably won't make your computer catch on fire, or eat
* your children, but it might. Use at your own risk.
*
*/
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.i2p.I2PAppContext;
import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
import net.i2p.data.PublicKey;
import net.i2p.data.SessionKey;
import net.i2p.data.SessionTag;
import net.i2p.util.Log;
/**
* Expose the functionality to allow people to write out and read in the
* session key and session tag information via streams. This implementation
* does not write anywhere except where its told.
*
*/
public class PersistentSessionKeyManager extends TransientSessionKeyManager {
private Log _log;
private Object _yk = YKGenerator.class;
/**
* The session key manager should only be constructed and accessed through the
* application context. This constructor should only be used by the
* appropriate application context itself.
*
*/
public PersistentSessionKeyManager(I2PAppContext context) {
super(context);
_log = context.logManager().getLog(PersistentSessionKeyManager.class);
}
private PersistentSessionKeyManager() {
this(null);
}
/**
* Write the session key data to the given stream
*
*/
public void saveState(OutputStream out) throws IOException, DataFormatException {
if (true) return;
Set tagSets = getInboundTagSets();
Set sessions = getOutboundSessions();
if (_log.shouldLog(Log.INFO))
_log.info("Saving state with " + tagSets.size() + " inbound tagSets and "
+ sessions.size() + " outbound sessions");
DataHelper.writeLong(out, 4, tagSets.size());
for (Iterator iter = tagSets.iterator(); iter.hasNext();) {
TagSet ts = (TagSet) iter.next();
writeTagSet(out, ts);
}
DataHelper.writeLong(out, 4, sessions.size());
for (Iterator iter = sessions.iterator(); iter.hasNext();) {
OutboundSession sess = (OutboundSession) iter.next();
writeOutboundSession(out, sess);
}
}
/**
* Load the session key data from the given stream
*
*/
public void loadState(InputStream in) throws IOException, DataFormatException {
int inboundSets = (int) DataHelper.readLong(in, 4);
Set tagSets = new HashSet(inboundSets);
for (int i = 0; i < inboundSets; i++) {
TagSet ts = readTagSet(in);
tagSets.add(ts);
}
int outboundSessions = (int) DataHelper.readLong(in, 4);
Set sessions = new HashSet(outboundSessions);
for (int i = 0; i < outboundSessions; i++) {
OutboundSession sess = readOutboundSession(in);
sessions.add(sess);
}
if (_log.shouldLog(Log.INFO))
_log.info("Loading state with " + tagSets.size() + " inbound tagSets and "
+ sessions.size() + " outbound sessions");
setData(tagSets, sessions);
}
private void writeOutboundSession(OutputStream out, OutboundSession sess) throws IOException, DataFormatException {
sess.getTarget().writeBytes(out);
sess.getCurrentKey().writeBytes(out);
DataHelper.writeDate(out, new Date(sess.getEstablishedDate()));
DataHelper.writeDate(out, new Date(sess.getLastUsedDate()));
List sets = sess.getTagSets();
DataHelper.writeLong(out, 2, sets.size());
for (Iterator iter = sets.iterator(); iter.hasNext();) {
TagSet set = (TagSet) iter.next();
writeTagSet(out, set);
}
}
private void writeTagSet(OutputStream out, TagSet ts) throws IOException, DataFormatException {
ts.getAssociatedKey().writeBytes(out);
DataHelper.writeDate(out, new Date(ts.getDate()));
DataHelper.writeLong(out, 2, ts.getTags().size());
for (Iterator iter = ts.getTags().iterator(); iter.hasNext();) {
SessionTag tag = (SessionTag) iter.next();
out.write(tag.getData());
}
}
private OutboundSession readOutboundSession(InputStream in) throws IOException, DataFormatException {
PublicKey key = new PublicKey();
key.readBytes(in);
SessionKey skey = new SessionKey();
skey.readBytes(in);
Date established = DataHelper.readDate(in);
Date lastUsed = DataHelper.readDate(in);
int tagSets = (int) DataHelper.readLong(in, 2);
ArrayList sets = new ArrayList(tagSets);
for (int i = 0; i < tagSets; i++) {
TagSet ts = readTagSet(in);
sets.add(ts);
}
return new OutboundSession(key, skey, established.getTime(), lastUsed.getTime(), sets);
}
private TagSet readTagSet(InputStream in) throws IOException, DataFormatException {
SessionKey key = new SessionKey();
key.readBytes(in);
Date date = DataHelper.readDate(in);
int numTags = (int) DataHelper.readLong(in, 2);
Set tags = new HashSet(numTags);
for (int i = 0; i < numTags; i++) {
SessionTag tag = new SessionTag();
byte val[] = new byte[SessionTag.BYTE_LENGTH];
int read = DataHelper.read(in, val);
if (read != SessionTag.BYTE_LENGTH)
throw new IOException("Unable to fully read a session tag [" + read + " not " + SessionTag.BYTE_LENGTH
+ ")");
tag.setData(val);
tags.add(tag);
}
TagSet ts = new TagSet(tags, key, _context.clock().now());
ts.setDate(date.getTime());
return ts;
}
public static void main(String args[]) {
I2PAppContext ctx = new I2PAppContext();
Log log = ctx.logManager().getLog(PersistentSessionKeyManager.class);
PersistentSessionKeyManager mgr = (PersistentSessionKeyManager)ctx.sessionKeyManager();
try {
mgr.loadState(new FileInputStream("sessionKeys.dat"));
String state = mgr.renderStatusHTML();
FileOutputStream fos = new FileOutputStream("sessionKeysBeforeExpire.html");
fos.write(state.getBytes());
fos.close();
int expired = mgr.aggressiveExpire();
log.error("Expired: " + expired);
String stateAfter = mgr.renderStatusHTML();
FileOutputStream fos2 = new FileOutputStream("sessionKeysAfterExpire.html");
fos2.write(stateAfter.getBytes());
fos2.close();
} catch (Throwable t) {
log.error("Error loading/storing sessionKeys", t);
}
try {
Thread.sleep(3000);
} catch (Throwable t) { // nop
}
}
}

View File

@ -93,7 +93,7 @@ public class SessionKeyManager {
* method after receiving an ack to a message delivering them)
*
*/
public void tagsDelivered(PublicKey target, SessionKey key, Set sessionTags) { // nop
public void tagsDelivered(PublicKey target, SessionKey key, Set<SessionTag> sessionTags) { // nop
}
/**
@ -109,7 +109,7 @@ public class SessionKeyManager {
* Accept the given tags and associate them with the given key for decryption
*
*/
public void tagsReceived(SessionKey key, Set sessionTags) { // nop
public void tagsReceived(SessionKey key, Set<SessionTag> sessionTags) { // nop
}
/**
@ -130,4 +130,4 @@ public class SessionKeyManager {
*/
public void shutdown() { // nop
}
}
}

View File

@ -33,13 +33,14 @@ import net.i2p.util.SimpleTimer;
* out to disk so this should not be considered secure in that sense.
*
*/
class TransientSessionKeyManager extends SessionKeyManager {
public class TransientSessionKeyManager extends SessionKeyManager {
private Log _log;
/** Map allowing us to go from the targeted PublicKey to the OutboundSession used */
private Map _outboundSessions;
private Map<PublicKey, OutboundSession> _outboundSessions;
/** Map allowing us to go from a SessionTag to the containing TagSet */
private Map _inboundTagSets;
private Map<SessionTag, TagSet> _inboundTagSets;
protected I2PAppContext _context;
private volatile boolean _alive;
/**
* Let session tags sit around for 10 minutes before expiring them. We can now have such a large
@ -55,6 +56,10 @@ class TransientSessionKeyManager extends SessionKeyManager {
*
*/
public final static long SESSION_LIFETIME_MAX_MS = SESSION_TAG_DURATION_MS + 5 * 60 * 1000;
/**
* a few MB? how about 16MB!
* This is the max size of _inboundTagSets.
*/
public final static int MAX_INBOUND_SESSION_TAGS = 500 * 1000; // this will consume at most a few MB
/**
@ -67,46 +72,61 @@ class TransientSessionKeyManager extends SessionKeyManager {
super(context);
_log = context.logManager().getLog(TransientSessionKeyManager.class);
_context = context;
_outboundSessions = new HashMap(1024);
_outboundSessions = new HashMap(64);
_inboundTagSets = new HashMap(1024);
context.statManager().createRateStat("crypto.sessionTagsExpired", "How many tags/sessions are expired?", "Encryption", new long[] { 10*60*1000, 60*60*1000, 3*60*60*1000 });
context.statManager().createRateStat("crypto.sessionTagsRemaining", "How many tags/sessions are remaining after a cleanup?", "Encryption", new long[] { 10*60*1000, 60*60*1000, 3*60*60*1000 });
SimpleScheduler.getInstance().addPeriodicEvent(new CleanupEvent(), 60*1000);
_alive = true;
SimpleScheduler.getInstance().addEvent(new CleanupEvent(), 60*1000);
}
private TransientSessionKeyManager() { this(null); }
public void shutdown() {
_alive = false;
synchronized (_inboundTagSets) {
_inboundTagSets.clear();
}
synchronized (_outboundSessions) {
_outboundSessions.clear();
}
}
private class CleanupEvent implements SimpleTimer.TimedEvent {
public void timeReached() {
if (!_alive)
return;
long beforeExpire = _context.clock().now();
int expired = aggressiveExpire();
long expireTime = _context.clock().now() - beforeExpire;
_context.statManager().addRateData("crypto.sessionTagsExpired", expired, expireTime);
SimpleScheduler.getInstance().addEvent(this, 60*1000);
}
}
/** TagSet */
protected Set getInboundTagSets() {
protected Set<TagSet> getInboundTagSets() {
synchronized (_inboundTagSets) {
return new HashSet(_inboundTagSets.values());
}
}
/** OutboundSession */
protected Set getOutboundSessions() {
protected Set<OutboundSession> getOutboundSessions() {
synchronized (_outboundSessions) {
return new HashSet(_outboundSessions.values());
}
}
protected void setData(Set inboundTagSets, Set outboundSessions) {
protected void setData(Set<TagSet> inboundTagSets, Set<OutboundSession> outboundSessions) {
if (_log.shouldLog(Log.INFO))
_log.info("Loading " + inboundTagSets.size() + " inbound tag sets, and "
+ outboundSessions.size() + " outbound sessions");
Map tagSets = new HashMap(inboundTagSets.size());
for (Iterator iter = inboundTagSets.iterator(); iter.hasNext();) {
TagSet ts = (TagSet) iter.next();
for (Iterator tsIter = ts.getTags().iterator(); tsIter.hasNext();) {
SessionTag tag = (SessionTag) tsIter.next();
Map<SessionTag, TagSet> tagSets = new HashMap(inboundTagSets.size());
for (Iterator<TagSet> iter = inboundTagSets.iterator(); iter.hasNext();) {
TagSet ts = iter.next();
for (Iterator<SessionTag> tsIter = ts.getTags().iterator(); tsIter.hasNext();) {
SessionTag tag = tsIter.next();
tagSets.put(tag, ts);
}
}
@ -114,9 +134,9 @@ class TransientSessionKeyManager extends SessionKeyManager {
_inboundTagSets.clear();
_inboundTagSets.putAll(tagSets);
}
Map sessions = new HashMap(outboundSessions.size());
for (Iterator iter = outboundSessions.iterator(); iter.hasNext();) {
OutboundSession sess = (OutboundSession) iter.next();
Map<PublicKey, OutboundSession> sessions = new HashMap(outboundSessions.size());
for (Iterator<OutboundSession> iter = outboundSessions.iterator(); iter.hasNext();) {
OutboundSession sess = iter.next();
sessions.put(sess.getTarget(), sess);
}
synchronized (_outboundSessions) {
@ -151,6 +171,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
* Associate a new session key with the specified target. Metrics to determine
* when to expire that key begin with this call.
*
* Unused except in tests?
*/
@Override
public void createSession(PublicKey target, SessionKey key) {
@ -159,6 +180,18 @@ class TransientSessionKeyManager extends SessionKeyManager {
addSession(sess);
}
/**
* Same as above but for internal use, returns OutboundSession so we don't have
* to do a subsequent getSession()
*
*/
private OutboundSession createAndReturnSession(PublicKey target, SessionKey key) {
OutboundSession sess = new OutboundSession(target);
sess.setCurrentKey(key);
addSession(sess);
return sess;
}
/**
* Retrieve the next available session tag for identifying the use of the given
* key when communicating with the target. If this returns null, no tags are
@ -232,10 +265,8 @@ class TransientSessionKeyManager extends SessionKeyManager {
_log.debug("Tags delivered: " + sessionTags.size() + " for key: " + key.toBase64() + ": " + sessionTags);
}
OutboundSession sess = getSession(target);
if (sess == null) {
createSession(target, key);
sess = getSession(target);
}
if (sess == null)
sess = createAndReturnSession(target, key);
sess.setCurrentKey(key);
TagSet set = new TagSet(sessionTags, key, _context.clock().now());
sess.addTags(set);
@ -257,13 +288,13 @@ class TransientSessionKeyManager extends SessionKeyManager {
*
*/
@Override
public void tagsReceived(SessionKey key, Set sessionTags) {
public void tagsReceived(SessionKey key, Set<SessionTag> sessionTags) {
int overage = 0;
TagSet tagSet = new TagSet(sessionTags, key, _context.clock().now());
TagSet old = null;
SessionTag dupTag = null;
for (Iterator iter = sessionTags.iterator(); iter.hasNext();) {
SessionTag tag = (SessionTag) iter.next();
for (Iterator<SessionTag> iter = sessionTags.iterator(); iter.hasNext();) {
SessionTag tag = iter.next();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Receiving tag " + tag + " for key " + key.toBase64() + " / " + key.toString() + ": tagSet: " + tagSet);
synchronized (_inboundTagSets) {
@ -284,12 +315,12 @@ class TransientSessionKeyManager extends SessionKeyManager {
if (old != null) {
// drop both old and tagSet tags
synchronized (_inboundTagSets) {
for (Iterator iter = old.getTags().iterator(); iter.hasNext(); ) {
SessionTag tag = (SessionTag)iter.next();
for (Iterator<SessionTag> iter = old.getTags().iterator(); iter.hasNext(); ) {
SessionTag tag = iter.next();
_inboundTagSets.remove(tag);
}
for (Iterator iter = sessionTags.iterator(); iter.hasNext(); ) {
SessionTag tag = (SessionTag)iter.next();
for (Iterator<SessionTag> iter = sessionTags.iterator(); iter.hasNext(); ) {
SessionTag tag = iter.next();
_inboundTagSets.remove(tag);
}
}
@ -326,10 +357,10 @@ class TransientSessionKeyManager extends SessionKeyManager {
int tags = 0;
int toRemove = overage * 2;
_log.log(Log.CRIT, "TOO MANY SESSION TAGS! Starting cleanup, overage = " + overage);
List removed = new ArrayList(toRemove);
List<TagSet> removed = new ArrayList(toRemove);
synchronized (_inboundTagSets) {
for (Iterator iter = _inboundTagSets.values().iterator(); iter.hasNext(); ) {
TagSet set = (TagSet)iter.next();
for (Iterator<TagSet> iter = _inboundTagSets.values().iterator(); iter.hasNext(); ) {
TagSet set = iter.next();
int size = set.getTags().size();
if (size > 1000)
absurd++;
@ -345,8 +376,8 @@ class TransientSessionKeyManager extends SessionKeyManager {
}
for (int i = 0; i < removed.size(); i++) {
TagSet cur = (TagSet)removed.get(i);
for (Iterator iter = cur.getTags().iterator(); iter.hasNext(); ) {
SessionTag tag = (SessionTag)iter.next();
for (Iterator<SessionTag> iter = cur.getTags().iterator(); iter.hasNext(); ) {
SessionTag tag = iter.next();
_inboundTagSets.remove(tag);
tags++;
}
@ -429,9 +460,9 @@ class TransientSessionKeyManager extends SessionKeyManager {
bufSummary = new StringBuffer(1024);
}
synchronized (_inboundTagSets) {
for (Iterator iter = _inboundTagSets.keySet().iterator(); iter.hasNext();) {
SessionTag tag = (SessionTag) iter.next();
TagSet ts = (TagSet) _inboundTagSets.get(tag);
for (Iterator<SessionTag> iter = _inboundTagSets.keySet().iterator(); iter.hasNext();) {
SessionTag tag = iter.next();
TagSet ts = _inboundTagSets.get(tag);
long age = now - ts.getDate();
if (age > SESSION_LIFETIME_MAX_MS) {
//if (ts.getDate() < now - SESSION_LIFETIME_MAX_MS) {
@ -455,9 +486,9 @@ class TransientSessionKeyManager extends SessionKeyManager {
//_log.warn("Expiring tags: [" + tagsToDrop + "]");
synchronized (_outboundSessions) {
for (Iterator iter = _outboundSessions.keySet().iterator(); iter.hasNext();) {
PublicKey key = (PublicKey) iter.next();
OutboundSession sess = (OutboundSession) _outboundSessions.get(key);
for (Iterator<PublicKey> iter = _outboundSessions.keySet().iterator(); iter.hasNext();) {
PublicKey key = iter.next();
OutboundSession sess = _outboundSessions.get(key);
removed += sess.expireTags();
if (sess.availableTags() <= 0) {
iter.remove();
@ -472,22 +503,22 @@ class TransientSessionKeyManager extends SessionKeyManager {
StringBuffer buf = new StringBuffer(1024);
buf.append("<h2>Inbound sessions</h2>");
buf.append("<table border=\"1\">");
Set inbound = getInboundTagSets();
Map inboundSets = new HashMap(inbound.size());
for (Iterator iter = inbound.iterator(); iter.hasNext();) {
TagSet ts = (TagSet) iter.next();
Set<TagSet> inbound = getInboundTagSets();
Map<SessionKey, Set<TagSet>> inboundSets = new HashMap(inbound.size());
for (Iterator<TagSet> iter = inbound.iterator(); iter.hasNext();) {
TagSet ts = iter.next();
if (!inboundSets.containsKey(ts.getAssociatedKey())) inboundSets.put(ts.getAssociatedKey(), new HashSet());
Set sets = (Set) inboundSets.get(ts.getAssociatedKey());
Set<TagSet> sets = inboundSets.get(ts.getAssociatedKey());
sets.add(ts);
}
for (Iterator iter = inboundSets.keySet().iterator(); iter.hasNext();) {
SessionKey skey = (SessionKey) iter.next();
Set sets = (Set) inboundSets.get(skey);
for (Iterator<SessionKey> iter = inboundSets.keySet().iterator(); iter.hasNext();) {
SessionKey skey = iter.next();
Set<TagSet> sets = inboundSets.get(skey);
buf.append("<tr><td><b>Session key</b>: ").append(skey.toBase64()).append("</td>");
buf.append("<td><b># Sets:</b> ").append(sets.size()).append("</td></tr>");
buf.append("<tr><td colspan=\"2\"><ul>");
for (Iterator siter = sets.iterator(); siter.hasNext();) {
TagSet ts = (TagSet) siter.next();
for (Iterator<TagSet> siter = sets.iterator(); siter.hasNext();) {
TagSet ts = siter.next();
buf.append("<li><b>Received on:</b> ").append(new Date(ts.getDate())).append(" with ")
.append(ts.getTags().size()).append(" tags remaining</li>");
}
@ -498,17 +529,17 @@ class TransientSessionKeyManager extends SessionKeyManager {
buf.append("<h2><b>Outbound sessions</b></h2>");
buf.append("<table border=\"1\">");
Set outbound = getOutboundSessions();
for (Iterator iter = outbound.iterator(); iter.hasNext();) {
OutboundSession sess = (OutboundSession) iter.next();
Set<OutboundSession> outbound = getOutboundSessions();
for (Iterator<OutboundSession> iter = outbound.iterator(); iter.hasNext();) {
OutboundSession sess = iter.next();
buf.append("<tr><td><b>Target key:</b> ").append(sess.getTarget().toString()).append("<br />");
buf.append("<b>Established:</b> ").append(new Date(sess.getEstablishedDate())).append("<br />");
buf.append("<b>Last Used:</b> ").append(new Date(sess.getLastUsedDate())).append("<br />");
buf.append("<b># Sets:</b> ").append(sess.getTagSets().size()).append("</td></tr>");
buf.append("<tr><td><b>Session key:</b> ").append(sess.getCurrentKey().toBase64()).append("</td></tr>");
buf.append("<tr><td><ul>");
for (Iterator siter = sess.getTagSets().iterator(); siter.hasNext();) {
TagSet ts = (TagSet) siter.next();
for (Iterator<TagSet> siter = sess.getTagSets().iterator(); siter.hasNext();) {
TagSet ts = siter.next();
buf.append("<li><b>Sent on:</b> ").append(new Date(ts.getDate())).append(" with ").append(
ts.getTags()
.size())
@ -526,13 +557,13 @@ class TransientSessionKeyManager extends SessionKeyManager {
private SessionKey _currentKey;
private long _established;
private long _lastUsed;
private List _tagSets;
private List<TagSet> _tagSets;
public OutboundSession(PublicKey target) {
this(target, null, _context.clock().now(), _context.clock().now(), new ArrayList());
}
OutboundSession(PublicKey target, SessionKey curKey, long established, long lastUsed, List tagSets) {
OutboundSession(PublicKey target, SessionKey curKey, long established, long lastUsed, List<TagSet> tagSets) {
_target = target;
_currentKey = curKey;
_established = established;
@ -541,7 +572,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
}
/** list of TagSet objects */
List getTagSets() {
List<TagSet> getTagSets() {
synchronized (_tagSets) {
return new ArrayList(_tagSets);
}
@ -560,7 +591,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
if (_currentKey != null) {
if (!_currentKey.equals(key)) {
int dropped = 0;
List sets = _tagSets;
List<TagSet> sets = _tagSets;
_tagSets = new ArrayList();
for (int i = 0; i < sets.size(); i++) {
TagSet set = (TagSet) sets.get(i);
@ -642,8 +673,8 @@ class TransientSessionKeyManager extends SessionKeyManager {
public long getLastExpirationDate() {
long last = 0;
synchronized (_tagSets) {
for (Iterator iter = _tagSets.iterator(); iter.hasNext();) {
TagSet set = (TagSet) iter.next();
for (Iterator<TagSet> iter = _tagSets.iterator(); iter.hasNext();) {
TagSet set = iter.next();
if ( (set.getDate() > last) && (set.getTags().size() > 0) )
last = set.getDate();
}
@ -663,12 +694,12 @@ class TransientSessionKeyManager extends SessionKeyManager {
}
static class TagSet {
private Set _sessionTags;
private Set<SessionTag> _sessionTags;
private SessionKey _key;
private long _date;
private Exception _createdBy;
public TagSet(Set tags, SessionKey key, long date) {
public TagSet(Set<SessionTag> tags, SessionKey key, long date) {
if (key == null) throw new IllegalArgumentException("Missing key");
if (tags == null) throw new IllegalArgumentException("Missing tags");
_sessionTags = tags;
@ -692,7 +723,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
}
/** tags still available */
public Set getTags() {
public Set<SessionTag> getTags() {
return _sessionTags;
}

View File

@ -141,7 +141,6 @@ D8usM7Dxp5yrDrCYZ5AIijc=
} else {
_trustedKeys.add(DEFAULT_TRUSTED_KEY);
_trustedKeys.add(DEFAULT_TRUSTED_KEY2);
_trustedKeys.add(DEFAULT_TRUSTED_KEY3);
}
if (_log.shouldLog(Log.DEBUG))
_log.debug("TrustedUpdate created, trusting " + _trustedKeys.size() + " keys.");

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