Compare commits

...

713 Commits

Author SHA1 Message Date
c93ccd15eb * Update versions, package release, fix typo in comment 2008-12-01 00:23:53 +00:00
zzz
73280ab834 amiga->echelon 2008-11-28 18:08:15 +00:00
6a3c52b7fa Added verify command to check that a destination's BASE64 is correct for
external applications that need it.
2008-11-28 16:07:29 +00:00
dev
90983c8761 added inital version of a deploy script 2008-11-27 19:19:24 +00:00
zzz
daac598bde fix windows url launcher 2008-11-26 18:32:51 +00:00
dev
41d98acc95 minor style changes 2008-11-26 15:56:36 +00:00
dev
c8970c0fc6 changed some of the URL's 2008-11-26 15:20:00 +00:00
zzz
4e5825c648 * Cache DNS and negative DNS for 5m (was 1m and forever)
* Delay shitlist cleaner at startup
    * Strip wrapper properties from client config
    * Define multiple cert type
    * Prohibit negative maxSends in streaming
    * HTML fixup on configtunnels.jsp
    * Increase wrapper exit timeout from default 15s to 30s
2008-11-21 16:29:16 +00:00
zzz
93f0092437 propagate from branch 'i2p.i2p.zzz.test' (head fa1d7d3151cb0b03dde308766d3d350afda8f14a)
to branch 'i2p.i2p' (head 8cb6295e6a3492fd3b93366bfb0ebf231115fa85)
2008-11-20 15:53:30 +00:00
zzz
da9a4ce557 EepGet:
- Better handling of 504 gateway timeout
     (keep going up to limit of retry count rather
      than just one more partial fetch)
   - Add -t cmd line option for timeout
   - Better handling of 403, 409, 503 errors
   - Don't keep going after unknown return code
   - Don't delay before exiting after a failure
2008-11-20 14:14:13 +00:00
zzz
9ae589449d tweak 2008-11-16 19:12:58 +00:00
zzz
de21a5ec48 drop old tcp transport and old tunnel build sources 2008-11-15 20:57:52 +00:00
zzz
b1a9dcf77e move dummy to his own file to help the build dependencies 2008-11-15 19:09:56 +00:00
zzz
15e7783477 handle missing fields in i2ptunnel edit pages better 2008-11-15 19:00:08 +00:00
zzz
afa17a8c04 * I2CP Compression:
- Add i2cp.gzip option (default true)
      - Don't bother compressing if really small
2008-11-15 15:03:19 +00:00
zzz
c7bb2e8f76 * build files:
- Don't die if depend not available
   - Only verify Jetty hash once
   - Add streaming lib tests to depends task
2008-11-14 14:48:08 +00:00
zzz
b4d299804b update history before propagate 2008-11-13 20:12:45 +00:00
zzz
77f5dd2d14 Fix blocklists with hashes only 2008-11-12 22:46:07 +00:00
zzz
c941d7bfa1 HTTPClient: Add config options to pass Via, Referer, and User-Agent through 2008-11-12 20:14:08 +00:00
zzz
049d6b2fa8 * Streaming:
- Add more info to Connection.toString() for debugging
      - Fix lifetimeMessages{Sent,Received} stats
      - Reduce RTT damping to 0.875 (was 0.9)
      - Add a stream.con.initialRTT.{in,out} stats
2008-11-12 20:10:39 +00:00
zzz
98038e9282 * Build files:
- Use the depend task with caching for more accurate dependencies
      - Make sure the routerconsole gets the latest router version
      - Fix addressbook repeated builds
2008-11-12 17:08:09 +00:00
zzz
6169904c76 oops remove extra stuff in IndexBean 2008-11-11 13:02:45 +00:00
zzz
04509f593a * Streaming: Enforce a minimum MTU of 512 2008-11-11 02:30:49 +00:00
zzz
875dd65dcb * I2PTunnel: Change "interactive" max window size to 16 (was 1) 2008-11-11 02:30:21 +00:00
zzz
b0ec6a0870 * Streaming - Fix several bugs and improve performance
when the initial data is larger than one MTU,
      e.g. HTTP GETs with large URLs, CGI params or cookies,
      or large HTTP POSTS:
      - Don't reject additional packets received without a
        send stream ID (i.e. sent before the SYN ACK was received)
      - Put unknown non-SYN packets on the SYN queue also
        so they won't be rejected
      - Reduce flusher delay to 250ms (was 500)
      - Flush unless window is full (was window is non-empty)
2008-11-10 20:30:14 +00:00
zzz
6ce2767514 * NetDb: Fix a deadlock caused by last checkin 2008-11-10 20:28:47 +00:00
zzz
5271838a14 -9 2008-11-09 16:18:45 +00:00
zzz
9ec45bbcf5 provide a link when starting a webapp 2008-11-09 16:10:59 +00:00
zzz
c9cef19a68 * Tunnel BuildHandler: add config router.participantOnly,
set to true to refuse OBEP and IBGW roles, should
      reduce connections significantly if set.
2008-11-09 16:08:24 +00:00
zzz
9f57be5f03 * Jetty: Add a I2PRequestLog class to log request dest hash 2008-11-09 16:05:13 +00:00
zzz
1793b05784 * NetDb: Don't drop routerInfos if we have connectivity issues or other problems 2008-11-09 16:02:44 +00:00
zzz
f95c324832 * configtunnels.jsp:
- Code cleanup
      - Add 4-hop option
      - Remove +/- 0-2 option
2008-11-09 15:59:35 +00:00
zzz
016c843ad6 * I2PTunnelHTTPServer: Put the requestor's dest hash
in the request headers
2008-11-09 15:57:58 +00:00
zzz
e52526b256 * NTCP: Lower idle timeout to 10m (was 15m) 2008-11-09 15:57:07 +00:00
zzz
7722ab5f6f * Routerconsole: Replace wtf msg w/ something nicer 2008-11-09 15:55:40 +00:00
zzz
c024398b93 Add some javadoc files 2008-11-09 15:54:04 +00:00
zzz
2e72ece384 * build.xml: Build speedups:
- Don't distclean in the updaterRouter target
      - Don't make prepUpdate and prepupdateSmall depend
        on distclean
      - Don't make susimail build always clean
      - Make pkg depend on distclean to be sure
      - Clean out more routerconsole and susidns files in 'ant clean'
      - i2ptunnel, routerconsole, susidns:
        Only build WEB-INF when necessary
      - systray: Only build jar when necessary
      - Don't build i2psnark standalone for the updater target
2008-11-09 15:46:08 +00:00
zzz
2b8d59d9f4 more override removals 2008-11-09 15:42:50 +00:00
dev
28b4c92241 should compile on 1.5 again now 2008-11-09 14:32:27 +00:00
dev
c9d9a83f73 finished core 2008-11-09 10:09:01 +00:00
dev
7bf57870d6 and again some more ;) 2008-11-09 09:49:54 +00:00
dev
d41b68438d and another bunch 2008-11-08 23:14:47 +00:00
dev
c634e5005d cleanup: annotated a bunch of files 2008-11-08 22:46:42 +00:00
dev
e0926b8ccd minor update to the checklist 2008-11-08 21:56:45 +00:00
dev
5ea7adb857 updated style of PrivateKeyFile to conform (more or less) to sun coding standards 2008-11-08 19:11:41 +00:00
zzz
bf12c5f9bf * Certificates:
- Add a signed Certificate type
      - Add a main() to PrivateKeyFile to generate
        Destinations with various Certificate types
      - Add a VerifiedDestination class to check Certificates
        of various types
      - Add a HashCash library from http://www.nettgryppa.com/code/
        (no distribution restrictions)
      - Allow non-null Certificates in addressbook
2008-11-02 22:13:11 +00:00
zzz
47d5e44b16 * Throttle: Reduce default max tunnels to 2000 (was 2500) 2008-11-02 21:53:17 +00:00
zzz
f6996c7d8b * NamingServices: Implement caching in the abstract class 2008-11-02 21:41:08 +00:00
zzz
fb7f4f2d11 * clients.config: Disable SAM and BOB by default for new installs 2008-11-02 21:39:32 +00:00
zzz
d89f97acd5 * I2PTunnel: Move some wayward stats to the I2PTunnel group 2008-11-02 21:38:49 +00:00
zzz
f3c9343c79 * NewsFetcher: Fix last updated time 2008-11-02 21:37:28 +00:00
zzz
16ec091209 * Streaming: Increase MTU to 1730 (was 960);
see ConnectionOptions.java for analysis
2008-11-02 21:36:52 +00:00
0b599c45ec Refactored code.
Piles of pedantic lock checks to ensure we don't get deadlocked, it's ugly.
2008-10-31 21:11:03 +00:00
7f3f6dfde3 Patches to (hoefully) fix deadlock in BOB and revision bumpped to B
SusiMail JavaDoc additions.
2008-10-30 15:04:16 +00:00
d736b75dc2 merge of '146998571b0b88243eb67af215b740f504fbcc50'
and 'ee93f3940b59255ddab5fa4aafd6f567f46783f7'
2008-10-29 09:00:13 +00:00
fa2f06b1d8 JavaDoc fixes 2008-10-29 08:59:56 +00:00
zzz
4212858409 fix english link in readme_nl.html 2008-10-28 19:07:39 +00:00
zzz
33221ce7fd More findbugs cleanup 2008-10-26 18:18:34 +00:00
zzz
fd5fcebae9 * NetDb:
- Fix behavior when router.isHidden=true
       - Delay StartExplorersJob for 10m at startup
       - More findbugs cleanups
    * netdb.jsp: Indicate if hidden
2008-10-26 18:16:18 +00:00
zzz
b743449715 * NetDb:
- Update dbLookup profile stats in FloodOnlySearchJob
         and FloodfillVerifyStoreJob
       - Fix response time store in profile in SearchJob
    * profiles.jsp: Don't override locale number format,
       clean up the response time output for floodfills
2008-10-26 18:12:36 +00:00
zzz
2a08fc7a34 * FloodfillMonitor:
- Fix ff count (we forgot ourselves)
       - Don't become ff if hidden
2008-10-26 18:08:20 +00:00
zzz
0c520de6e5 * HandleFloodfillDatabaseLookupMessageJob:
- Send back your routerinfo with the DSRM if not ff to
         spread the word that you aren't ff anymore
       - Fix behavior when router.isHidden=true
2008-10-26 18:05:51 +00:00
zzz
09b868e243 * Blocklist: Change logging from ERROR to WARN 2008-10-26 18:02:21 +00:00
zzz
83801c9feb * Stats:
- Remove unused tunnel.buildSuccess and tunnel.buildFailure
       - Remove tunnel.buildRequestTime and 5m rate stats from
         netDb, effective in next release
2008-10-26 18:00:49 +00:00
zzz
152f824779 * config.jsp: Add more help
* summary.jsp: Indicate if hidden
2008-10-26 17:24:11 +00:00
zzz
68256930b9 * UDP:
- Don't do peer tests when hidden
       - Don't offer to introduce when hidden
       - Don't continually rebuild routerInfo when hidden
       - Don't continually rebuild routerInfo when
         i2np.udp.internalPort is set but i2np.udp.port is not
       - Remove some unused functions
2008-10-26 17:20:19 +00:00
zzz
622951c794 * tunnels.jsp: Indicate if pool is dead 2008-10-26 17:18:07 +00:00
zzz
baa70299fc * I2Ping:
- Add -n count option
       - Add rtt output
       - Enhance help
       - Fix option handling
2008-10-26 17:15:59 +00:00
zzz
47856f312c * i2ptunnel/edit.jsp: Disable word wrap in textarea 2008-10-26 17:14:07 +00:00
zzz
b4c808918b * peers.jsp: Clean up 'Listening on' formatting 2008-10-26 17:11:12 +00:00
e6e4c60a25 BOB version bump to 0xA 2008-10-22 06:59:48 +00:00
2dc699b382 Better handling of listening sockets. 2008-10-22 06:57:07 +00:00
zzz
22454a06d4 UTF-8 readme_sv.html 2008-10-21 17:45:19 +00:00
zzz
0e0459f88a more findbugs 2008-10-19 22:36:18 +00:00
zzz
20effe3a7f Big findbugs cleanup 2008-10-19 22:09:14 +00:00
zzz
8a756a6e81 * FloodOnlySearchJob: Recover better if the floodfills
you know are no longer floodfill or are gone
2008-10-19 21:50:12 +00:00
zzz
a7e876da1e * FloodfillMonitor:
- Don't become ff if clock skew is high
       - Rebuild routerinfo immediately when ff status changes
2008-10-19 21:48:55 +00:00
zzz
06be4515e4 * ShellCommand: Fix main() 2008-10-19 21:46:04 +00:00
zzz
af630e9559 * configclients.jsp: Handle clients with no args 2008-10-19 21:45:04 +00:00
zzz
50c93e25c7 * Installer: Bump min JRE to 1.5 2008-10-19 21:43:56 +00:00
zzz
2d6007cf49 readme_sv.html 2008-10-19 21:42:56 +00:00
zzz
7aaed8e686 * Client: Prevent a race causing session reconnect 2008-10-19 21:41:07 +00:00
zzz
e2a1835142 readme_nl.html 2008-10-15 20:05:21 +00:00
zzz
078256da83 change to _de links 2008-10-14 17:53:16 +00:00
zzz
4f8d84e9e7 Add multilanguage support for index.jsp 2008-10-14 16:23:23 +00:00
zzz
ae967d6ef4 Disable word wrap in textareas 2008-10-14 15:46:21 +00:00
zzz
3b46b16038 Remove failing count from summary bar 2008-10-14 14:28:02 +00:00
zzz
25bf6e59bc Update install.txt files for 1.5 2008-10-14 14:26:40 +00:00
c4030f8dab Fixed one javadoc problem in snark.
This patch completes the javadoc fixups. Additions are pending.
2008-10-13 03:18:44 +00:00
e103f33c29 Addressbook javadoc fixes
Addressbook now JDK5
build.xml fixed to remove annoying javadoc warnings.
2008-10-12 17:07:21 +00:00
1c6b78a8da SAM davadoc cleanups
JDK5 compliance
2008-10-12 16:07:23 +00:00
8117d0465c BOB fixes: Default Properties work, files are properly closed. 2008-10-11 21:59:18 +00:00
0ff846deee Added package details for BOB 2008-10-11 16:50:55 +00:00
87a992bd3f Patched java docs to remove sam and bob from the SDK;
SAM and BOB are not part of the SDK in the first place.
2008-10-11 16:50:20 +00:00
41c38e64c3 Added JDK5 lint fixes
Streaming lib javadocs
2008-10-11 13:23:55 +00:00
ca5c15d4de Added more complete javadocs to ministreaming and cleaned up overrides so
the code is JDK5 compliant. There remains some unchecked warnings, but these
aren't important at this juncture.
2008-10-11 10:28:31 +00:00
f3f7537ec6 Set BOB source/target to JDK 5 (AKA 1.5)
Minor bugfixes/code cleanup on BOB
Add/Cleanup some documentation to streaming lib javadocs
2008-10-11 07:45:30 +00:00
zzz
855293d673 * Tunnels: Implement random discard to enforce share limit 2008-10-10 17:34:25 +00:00
zzz
4c2d4144d1 * i2psnark: Change default tunnel length from 1+1 to 2+0 2008-10-10 17:33:27 +00:00
zzz
387587b0b6 * Throttle: Change reject to BANDWIDTH from CRIT on shutdown
for improved anonymity
2008-10-10 17:30:35 +00:00
zzz
43e95a70d1 * configpeer.jsp: Table cleanup 2008-10-10 17:29:48 +00:00
zzz
ad56eb7220 * UDPPacketReader: Adjust logging 2008-10-10 17:29:18 +00:00
zzz
d2d32f0ad1 * peers.jsp: Change <,> to in,out for UDP 2008-10-10 17:28:23 +00:00
zzz
0428726e30 * Profiles: Reduce reject penalty in
capacity calculation to avoid a congestion collapse
2008-10-10 17:27:23 +00:00
zzz
2eb154c24c * Tunnel Tests: Add time for outbound delay, to avoid
congestion collapse
2008-10-10 17:26:44 +00:00
zzz
4ec82beec5 * build files: Change to source=1.5, target=1.5 2008-10-10 17:25:58 +00:00
224ebb16d4 Bugfixes for BOB, Important database locking to prevent thread collisions. 2008-10-09 11:58:00 +00:00
cb17fb8805 Made BOB 1.4 java compliant. 2008-10-08 16:40:07 +00:00
2c048d7465 Revision/history changes 2008-10-08 15:39:39 +00:00
00d537e5e4 Added new command to BOB, and made API a little better. 2008-10-08 15:28:06 +00:00
5eef43d239 BOB "option" added, next small push will have an API fix. 2008-10-08 14:57:02 +00:00
caaf0ccfc3 Additional BOB fixes.
Added BOB to clients.config and wrapper.config for new installs.
2008-10-08 14:28:35 +00:00
18d42ec925 A few fixes to make BOB a little more quiet,
there is possibly a little left, though.
2008-10-07 20:00:08 +00:00
872d2c48c9 Added demos for BOB 2008-10-07 19:43:43 +00:00
a3b9345ff1 Patch to reflect build version 2008-10-07 18:52:19 +00:00
eae67a44f0 merge of '07188d6eb4d52af5bdde5cbb23dc6facea726ad0'
and 'be6f83df49d5f766fd655b9ca0388bb30d68dfeb'
2008-10-07 18:50:53 +00:00
a988358ebb history.txt additions 2008-10-07 18:38:45 +00:00
bb32672c11 NEW BOB, a replacement for SAM, added It does have a different API. See it's java-doc. 2008-10-07 18:30:07 +00:00
ae0a51669c * Update versions, package release 2008-10-06 13:28:34 +00:00
f1c4a85991 Code cleanup in I2PSocketManagerFull and I2PServerSocketFull
BUGFIX ConnectionHandler had a comparason bug that caused it to block when infact it was asked NOT to block
2008-10-06 09:28:59 +00:00
0a5eeed370 merge of '2f46bb4293a808d63ad2494aaebced5cf2227f52'
and '702d19f746dabc901ebadec705ce42950c124f55'
2008-10-04 18:41:55 +00:00
zzz
bf07a6a3c2 * checklist update
* i2psnark: Add codevoid link, remove mastertracker
    * hosts.txt: add echelon, codevoid
2008-09-29 11:49:09 +00:00
5913d9ee4a ADDED SimpleStore, cuz I forgot to add it 2008-09-28 16:36:59 +00:00
61749aaaa9 Added Simple true/false storage class to the utilities
Added socketSoTimeout
CHANGED RetransmissionTimer is now public
FIXED SimpleTimer has a way to be stopped, and reap it's children
CLEANUP A few javadoc additions, where I could figgure out bits
CLEANUP all code that needed to catch the timeout exception for socketSoTimeout
2008-09-27 22:59:22 +00:00
b0313bd6bf disapproval of revision '7ed18fd4c3a5430150a2d76bfe202bc491115974' 2008-09-27 16:00:06 +00:00
dd7d993631 Added Simple true/false storage class to the utilities
Added socketSoTimeout
CHANGED RetransmissionTimer is now public
FIXED SimpleTimer has a way to be stopped, and reap it's children
FIXED Lots of javadoc additions, where I could
CLEANUP all code that needed to catch the timeout exception for socketSoTimeout
2008-09-25 23:59:01 +00:00
ee2fd32a97 disapproval of revision 'bd09bb36a90e766b3a406d78055d427a6200dd41' 2008-09-25 23:31:57 +00:00
fa5c7219d3 Added {get,set}SOTimeout() to the ServerSocket API,
and fixed all the broken mainstream applications depending on it.
Fixed a grave bug in SimpleTimer.
Fixed Steraming Timer to be public.
Fixed a pile of JavaDoc comments, and reformatted the files I touched.
2008-09-25 06:55:04 +00:00
8d78a77a8c Allow SimplerTimer to die.
Still needs some methods to be able to reap it, and it's children.
2008-09-24 10:35:32 +00:00
zzz
52d38e0452 * config.jsp: Add some reachability help
* configpeer.jsp: Add blocklist info
    * help.jsp: Add link to German FAQ
    * tunnels.jsp: Fix inactive participating count
2008-09-23 18:48:59 +00:00
zzz
fbad8a1e8e * SearchReplyJob: Don't look up references to shitlisted peers 2008-09-23 18:47:30 +00:00
zzz
f49277087c * TunnelPeerSelector: Avoid a peer for 20s after a reject or timeout 2008-09-23 18:47:10 +00:00
zzz
e5c7b79cf5 * NetDb: Fix the totally broken "check new routers against blocklist"
code from 3 checkins ago
    * tunnels.jsp: Sort participating tunnels by usage, display rate
2008-09-20 14:08:02 +00:00
zzz
6b1224b23e 2008-09-19 zzz
* Tunnels:
      - Add missing message accounting for inbound gateways,
        we were underestimating participating traffic because of it,
        and the tunnels were classified "inactive"
      - Add participating tunnel role on tunnels.jsp
2008-09-19 01:03:57 +00:00
zzz
0bbc94f43c * Throttle:
- Correctly check inbound and outbound total bw limits separately
      - Fix up and actually use the tunnel.participatingMessageCount stat,
        favor it if lower than the total bw stat, so that
        client traffic isn't included for throttle decisions
      - Reduce min message count from 60 to 40
    * Tunnel Dispatcher:
      - Add tunnel.participatingBandwidth stat
      - Remove all 3h and 24h stats
2008-09-18 17:14:14 +00:00
zzz
7c083ed33b * logs.jsp: Remove unused connection log, cut wrapper log output in half
* configlogging.jsp: Increase box width
2008-09-15 16:23:47 +00:00
zzz
50f10e8cf1 * FloodOnlySearchJob:
- Ask non-floodfill peers if we don't know any floodfills
      - Lookup hashes in the DatabaseSearchReplyMessage if we
        don't know enough floodfills
2008-09-15 16:22:09 +00:00
zzz
69d9c054d8 * Tunnel Pool:
- Prevent excess zero-hop tunnels
      - Always wait before looping in BuildExecutor
2008-09-15 16:21:23 +00:00
zzz
fcfe4397c4 * NetDb: Check new routers against blocklist 2008-09-15 16:20:23 +00:00
zzz
e734a55872 * Router: Shutdown clients first
* Throttle:
      - Use 60s rather than 10m tunnel.participatingMessageCount stat
      - Fix a summary bar message
    * Tunnel Dispatcher: Update tunnel.participatingMessageCount
      every 20s, rather than at tunnel expiration, to maintain
      a more current stat
2008-09-15 16:19:08 +00:00
zzz
825af3e6c1 * HarvesterJob: Don't instantiate if disabled
* NetDb: Add netDb.exploreKeySet stat
    * netdb.jsp: Add parameter ?r=xxxxxx to view a single routerinfo,
      and ?r=. to view our own; change links on other pages too
2008-09-12 13:37:22 +00:00
zzz
cf54dd159d * Blocklist: Fix a log message format 2008-09-12 13:28:14 +00:00
zzz
6b1fb674ea * i2psnark:
- Add config i2psnark.linkPrefix to enable access to completed
        torrents from a different machine - examples:
           i2psnark.linkPrefix=file://///localserver/path/to/files/
           i2psnark.linkPrefix=http://localwebserver/path/
        Stop i2psnark, add to i2psnark.config, restart
      - Remove Galen and NickyB trackers
2008-09-12 13:27:07 +00:00
zzz
97366824d6 * Transport: Make 0.0.0.0/8 and 169.254.0.0/16 private 2008-09-12 13:25:51 +00:00
zzz
2ac5361937 fix compile error 2008-09-06 15:54:53 +00:00
zzz
9a2792e64c * EepGet command line: Fix byte counts after a failed resume
* UpdateHandler: Cleanup, clarify failure message
2008-09-06 13:52:46 +00:00
zzz
1091a289d2 * NTCP: Mark unreachable on outbound connection timeout 2008-09-06 13:49:31 +00:00
zzz
536f5d0c7b * Shitlist: Fix partial shitlisting (still unused though) 2008-09-06 13:48:57 +00:00
zzz
a3108ead4a * Throttle: Combine current and last bw measurement,
reduce default max tunnels to 2500 (was 3000)
2008-09-06 13:48:25 +00:00
zzz
808557d24f * Summary Bar: Warn if firewalled and floodfill 2008-09-06 13:47:56 +00:00
zzz
6501d403ab * Tunnel BuildHandler: Logging cleanup 2008-09-06 13:47:30 +00:00
zzz
ef328ed3cc * DataHelper: Prepare for 999 day uptime :) 2008-09-06 13:46:58 +00:00
zzz
62bf269c42 * Profiles: Penalize capacity when tunnel build request times out
* Tunnel BuildExecutor: Debug cleanup
2008-08-29 13:15:28 +00:00
zzz
ee4d68cf6a * Stats: Remove tunnel.Bps.* stats when the tunnel pool is closed 2008-08-29 13:13:45 +00:00
zzz
e064b0a0e1 * Shutdown: Call the shutdown hooks before the router shutdown
rather than after
2008-08-29 13:12:55 +00:00
zzz
c321251bb7 Add galen.i2p and tracker.mastertracker.i2p 2008-08-28 16:08:01 +00:00
zzz
896ba7ae1c * Floodfill Peer Selector: Prefer already-connected floodfill
peer for direct RouterInfo stores, to mimimize floodfill
      connections
    * Peer Profiles: Classify connected peers as "active",
      which will help improve the fast pool
    * Transport Manager: Add isEstablished(Hash)
2008-08-27 19:58:13 +00:00
zzz
2c48831604 ntcp reduce idle timeout 2008-08-27 19:56:06 +00:00
zzz
9d70a5293f netdb stats cleanup 2008-08-27 19:55:47 +00:00
bf51741134 * Update versions, package release 2008-08-24 10:28:57 +00:00
zzz
33e8abfc3e * Persistent data store: Increase write limit from 300 to 600
so floodfill routers don't get backed up
2008-08-20 15:02:56 +00:00
zzz
258d01f0d9 * Blocklists: Handle blank lines and \r\n in blocklist.txt
* NTCP: Add connection limit, set by i2np.ntcp.maxConnections,
      default is 500 (very high for now)
2008-08-20 14:58:45 +00:00
zzz
49af13a3ca * i2psnark: Fix OOM vulnerability by checking incoming message length
(thanks devzero!)
2008-08-13 15:59:16 +00:00
zzz
719ba3f66f * Floodfill Peer Selector:
- Avoid peers whose netdb is old, or have a recent failed store,
        or are forever-shitlisted
2008-08-04 19:31:11 +00:00
zzz
9652db9623 * Blocklists:
- New, disabled by default, except for blocking of
        forever-shitlisted peers. See source for instructions
        and file format.
    * Transport - Reject peers from inbound connections:
      - Check IP against blocklist
      - Check router hash against forever-shitlist, then block IP
2008-07-30 03:59:18 +00:00
zzz
481af00bab -9 2008-07-16 15:05:56 +00:00
zzz
11d267bc9a * configpeer.jsp: New 2008-07-16 15:05:07 +00:00
zzz
40f0cb65a1 * SSU:
Don't proactively reconnect until 30m idle, so
        we don't lose introducer tags prematurely
2008-07-16 15:04:02 +00:00
zzz
2ba9929277 * PRNG: Move logging from wrapper to router log 2008-07-16 15:03:00 +00:00
zzz
616abba328 * i2psnark: Open completed files read-only the first time 2008-07-16 15:02:20 +00:00
14a6352d9a Corrected UTF-8 encoding 2008-07-16 14:44:17 +00:00
5782c42d25 Cleaned up all 'imports' in all applications, core and router. 2008-07-16 13:42:54 +00:00
dev
f261deaf16 made code more 1.5 compatible 2008-07-14 15:05:26 +00:00
zzz
5228543236 * SSU:
- Try to pick better introducers by checking shitlist,
        wasUnreachable list, failing list, and idle times
      - To keep introducer connections up and valid,
        periodically send a "ping" (a data packet with no data and no acks)
        to everybody that has been an introducer in the last two hours
      - Add a stat udp.receiveRelayRequestBadTag, make udp.receiveRelayRequest only for good ones
      - Remove some 60s and 5m stats, leave only the 10m ones
      - Narrow the range for the retransmit time after an allocation fail
      - Adjust some logging
2008-07-07 14:18:38 +00:00
zzz
e173a47e01 * Streaming lib - adjust some loggging, cleanup Connection.toString() 2008-07-07 14:18:15 +00:00
zzz
07b895a069 * Router console: Flag placeholder pages as noncacheable 2008-07-07 14:10:10 +00:00
zzz
4d8ffc85e2 * LoadTestManager: Don't instantiate, it's disabled 2008-07-07 14:09:16 +00:00
zzz
53e2e0d1c9 * KeyManager:
- Don't write router key backup when leaseSet keys are updated
      - Synchronize to prevent concurrent writes (thanks Galen!)
      - Backup keys every 7 days instead of every 5 minutes
2008-07-07 14:07:59 +00:00
zzz
e0dcf82697 * HTTP Proxy: Don't show jump links for unknown jump hosts 2008-07-07 14:07:14 +00:00
zzz
0cfac58adb * i2psnark:
- Repair corrupted files with wrong length rather than die
      - Register shutdown hook to properly shutdown torrents when
        the router shuts down, hopefully will reduce corruption
      - Add Galen tracker
      - Add a note about how to chane directory
2008-07-07 14:05:54 +00:00
zzz
2768bef991 * NTCP:
- Try to fix 100% CPU, caused perhaps by JVM NIO bug...
      - Fix failsafe stats
2008-06-30 03:14:32 +00:00
zzz
bae712ad96 * i2psnark:
- Fix NPE caused by race (thanks echelon!)
      - Add mastertracker, remove de-ebook
2008-06-30 03:09:20 +00:00
zzz
49cb4c13b3 * PersistentDataStore: More leaseSet code cleanup 2008-06-30 03:08:16 +00:00
zzz
28da17276c * configstats.jsp: Fix NPE when no stats checked (thanks nothome27!) 2008-06-30 03:07:52 +00:00
zzz
14099ace69 * SimpleTimer: Change congestion message from error to warn 2008-06-30 03:07:00 +00:00
zzz
9289799c97 * FloodfillMonitorJob: Change range from 5-7 to 4-6 2008-06-24 14:41:41 +00:00
zzz
f057666ac2 * PersistentDataStore: Don't try to remove nonexistent leaseSet files 2008-06-24 14:39:14 +00:00
zzz
a11b74b2d8 * NTCP: Remove getIsInbound(), duplicate of isInbound() 2008-06-24 14:38:09 +00:00
zzz
0e018c5b4d * Router console: add placeholder pages for i2psnark, i2ptunnel,
susidns, and susimail for use when the .wars are not running
2008-06-24 14:36:39 +00:00
zzz
107a90fa33 increase max window size to 128 2008-06-24 14:33:30 +00:00
dev
01259cc07d merge of '5c7631359fea237f6aa916acd4f76a8a00d519fb'
and '88d299913d4aeb0ef7e8adabb5c39255e9cca0d2'
2008-06-22 14:08:06 +00:00
dev
4d955f3be5 minor optimization in I2PDatagramDissector(only verfy signature once) 2008-06-22 14:07:30 +00:00
zzz
49e429c166 * PRNG: Add two stats
* Summary bar:
      - Display Warning for TCP private IP address
      - Display PRNG stats
2008-06-20 20:22:38 +00:00
zzz
53c5b1446a * OutNetMessage: Change cache logging from WARN to INFO 2008-06-20 20:21:21 +00:00
zzz
dc68ebbaeb * configclients.jsp: Add start button for clients and webapps. 2008-06-20 20:20:50 +00:00
zzz
f3d73a6c15 * configclients.jsp: Implement saves for clients and webapps. 2008-06-17 13:48:41 +00:00
zzz
91950a37f5 * Comm System: Add new STATUS_HOSED for use when UDP bind fails
* Summary bar: Display helpful errror message when UDP bind fails
    * UDP: Don't bid when UDP bind fails
2008-06-17 13:47:54 +00:00
zzz
a8c266402e * configclients.jsp: New. For both clients and webapps.
Saves are not yet implemented.
2008-06-16 12:31:14 +00:00
zzz
d78fb4df3c * RouterConsoleRunner: Use a new config file, webapps.config,
to control which .wars in webapps/ get run. Apps are enabled
      by default; disable by (e.g.) webapps.syndie.startOnLoad=false
      Config file is written if it does not exist.
      Implement methods for use by upcoming configclients.jsp.
2008-06-16 12:26:36 +00:00
zzz
fb5a8ee0d8 * Refactor LoadClientAppsJob.java, move some functions to new
ClientAppConfig.java, to make them easily available to
      a future configclients.jsp
2008-06-16 12:19:55 +00:00
zzz
7b81062816 * UDP: Prevent 100% CPU when UDP bind fails;
change bind fail message from ERROR to CRIT
2008-06-16 12:18:43 +00:00
zzz
c3a2adc97e minor updates 2008-06-13 17:19:42 +00:00
zzz
bff685f7ca * Throttle: Use BANDWIDTH rather than CRIT as the rejection reason at
startup, so peers don't list us as failing.
2008-06-10 14:05:55 +00:00
zzz
7e51c86c38 * Floodfill: Add new FloodfillMonitorJob, which tracks active
floodfills, and automatically enables/disables floodfill on
      Class O routers to maintain 5-7 total active floodfills
2008-06-10 13:37:27 +00:00
zzz
df069ec9d1 * NetDb Stats:
- Remove several more stats
      - Don't publish bw stats in first hour of uptime
      - Publish floodfill stats even if other stats are disabled
      - Changes not effective until 0.6.2.1 to provide cover.
2008-06-10 13:28:13 +00:00
zzz
eb3164d0e0 * graphs.jsp: Fix a bug where it tries to display the combined
bandwidth graph when it isn't available
2008-06-10 13:17:28 +00:00
zzz
5a69de3650 0.6.2-1 2008-06-09 14:12:09 +00:00
zzz
87b933fd3a propagate from branch 'i2p.i2p.i2p-0.6.2.1-pre' (head 8b23a248995e5c57ccef1c2620a47929f4b257cf)
to branch 'i2p.i2p' (head f65d1f225d8700ea812e1c3cbc0ee9e7a5bbaf98)
2008-06-09 14:00:50 +00:00
zzz
2404078bfa 2008-06-09 zzz
* Reachability: Restrict peers with no SSU address at all from inbound tunnels
    * News:
      - Add display of last updated and last checked time
        on index.jsp and configupdate.jsp
      - Add a function to get update version (unused for now)
    * config.jsp: Add another warning
2008-06-09 13:14:52 +00:00
zzz
6b33378a0a fix date in the xml 2008-06-08 17:37:13 +00:00
c46c9b2b7c * Fix version in news.xml so it could be published 2008-06-07 21:46:33 +00:00
acf22bf8fc * Write announcement and prepare for release 2008-06-07 20:34:07 +00:00
zzz
f3b8c73e96 * NetDb: Tweak some logging on lease problems
* Shitlist:
      - Add shitlistForever() and isShitlistedForever(), unused for now
      - Sort the HTML output by router hash
    * config.jsp: Add another warning
    * netdb.jsp:
      - Sort the lease HTML output by dest hash, local first
      - Sort the router HTML output by router hash
2008-06-07 17:44:13 +00:00
zzz
a8e625072b add de-ebook-archiv.i2p 2008-06-06 21:36:34 +00:00
zzz
88e26224c2 * LeaseSet:
- Sort the leases by expiration date in TunnelPool.locked_buildNewLeaseSet()
        to make later LeaseSet comparisons reliable. This cleans up the code too.
      - Fix broken old vs. new LeaseSet comparison
        in ClientConnectionRunner.requestLeaseSet(),
        so that we only sign and publish a new LeaseSet when it's really new.
        Should reduce outbound overhead both in LeaseSet publishing and LeaseSet bundling,
        and floodfill router load, since locked_buildNewLeaseSet() generates
        the same LeaseSet as before quite frequently, often just seconds apart.
2008-06-06 16:17:07 +00:00
zzz
db9db18bdf * LeaseSet - code cleanup:
- Add exception to enforce max # of leases = 6, should be plenty
      - Rewrite TunnelPool.locked_buildNewLeaseSet() so it doesn't add lots of
        leases and then immediately remove them again, triggering
        the new leaseSet size exception
      - Remove the now unused LeaseSet.removeLease(lease) and
        LeaseSet.removeLease(index)
      - Store first and last expiration for efficiency
2008-06-05 12:30:12 +00:00
zzz
9c06bb3fca * HTTP Proxy error pages: Don't say eepsites are 'temporarily' down since we don't know 2008-06-05 00:46:24 +00:00
zzz
8edfa746e5 * configtunnels.jsp: Add warnings for <= 0 and >= 4 hop configurations 2008-06-04 16:03:34 +00:00
zzz
5729b34f8b * Peer Profiles - Preparation for using bonuses:
- Use CapacityBonus rather than ReachablilityBonus in the Capacity calculation
      - Persist CapacityBonus rather than ReachabilityBonus
      - Include SpeedBonus in the Speed calculation
      - Prevent negative values in Speed and Capacity when using bonuses
      - Clean up SpeedCalculator.java
2008-06-04 15:06:55 +00:00
zzz
2f80f7fa63 Add some config files for a future small distribution 2008-06-04 14:54:05 +00:00
zzz
592e609291 .33-2001 2008-06-01 20:55:32 +00:00
zzz
3396a8813f * Add some compiler flexibility to two obscure SAM makefiles 2008-06-01 20:50:29 +00:00
zzz
6345e669bc * summary bar: Add a warning if you are firewalled and class O 2008-06-01 20:43:51 +00:00
zzz
74a5abbc11 * ProfileOrganizer: Restrict !isSelectable() (i.e. shitlisted) peers from the High Capacity tier,
not just the Fast tier, since we don't use them for tunnels anyway
2008-06-01 20:34:20 +00:00
zzz
19992b1d1b * Logging: Move common WARN output to DEBUG so we can ask users to
set the default log level to WARN without massive spewage
2008-06-01 20:24:43 +00:00
zzz
02e7a19f65 * i2psnark: Change displayed peer idents to match that shown by bytemonsoon 2008-06-01 20:17:48 +00:00
zzz
c6a697df57 * Client Apps: Add new parameter for clients.config,
clientApp.x.startOnLoad=false, to disable loading
        (for SAM for example). Defaults to true of course.
2008-06-01 20:16:17 +00:00
zzz
26bb479957 * summary bar: Hide ident, provide a tooltip and a link 2008-06-01 20:14:00 +00:00
zzz
0c42e7e4b2 make a nicer initialNews.xml, add clarification to config.jsp 2008-05-30 00:08:29 +00:00
zzz
699a62a9b9 Dont bid on private IP addresses in transports 2008-05-27 13:20:56 +00:00
zzz
ffc67d1e5a add a updaterRouter target, containing only i2p.jar and router.jar 2008-05-26 14:39:39 +00:00
zzz
2f72f5ca67 * Throttle: Set a default router.maxParticipatingTunnels = 3000 (was none)
* Stats: Add a fake uptime if not publishing stats, to get participating tunnels
    * build.xml:
      - Add an updateSmall target which includes only the essentials
      - Clean up the build file some 
      - Remove empty eepsite/ and subdirs from i2pupdate.zip
    * configtunnels.jsp: Add warning
    * i2psnark: Catch a bencode exception (bad peer from tracker) earlier
    * i2psnark-standalone: Fix exception http://forum.i2p/viewtopic.php?p=12217
2008-05-26 13:13:26 +00:00
dev
955e7823ad replaced jetty download-url 2008-05-22 20:52:56 +00:00
zzz
7e3800a5cb * Reachability:
- Call the previously unused profile.tunnelTestFailed()
        (redefined to include a probability argument)
        and severely downgrade a peer's capacity upon failures,
        depending on tunnel length and direction.
        This will help push unreachable and malicious peers
        out of the High Capacity tier.
      - Put recent fail rate on profiles.jsp
    * ProfileOrganizer: Logging cleanup
    * eepsite_index.html: Update add-host and jump links
    * HTTP Proxy: Remove trevorreznik jump server from list
2008-05-20 12:48:41 +00:00
dev
6c7691cecb updated history 2008-05-20 11:31:52 +00:00
dev
760c316486 merge of '883c453307272eee439471d4e9da1e120804dac1'
and 'c60598471c5f08b7d7e12e38d39f7a1d4c8ccf63'
2008-05-20 11:30:41 +00:00
dev
5d9d82879f implemented PrivateKeyFile(implements #3) 2008-05-20 11:30:03 +00:00
zzz
9b8772a470 * Throttle: Reject tunnels for first 20m uptime (was 10m)
* TunnelPeerSelectors:
       - Re-enable strict ordering of peers,
         based on XOR distance from a random hash
       - Restrict peers with uptime < 90m from tunnels (was 2h),
         which is really 60m due to rounding in netDb publishing.
    * i2psnark:
       - Limit max pipelined requests from a single peer to 128KB
         (was unlimited; i2p-bt default is 5 * 64KB)
       - Increase max uploaders per torrent to 6 (was 4)
       - Reduce max connections per torrent to 16 (was 24) to increase
         unchoke time and reduce memory consumption
       - Strictly enforce max connections per torrent
       - Choke more gradually when over BW limit
    * help.jsp: Add a link to the FAQ
    * peers.jsp: Fix UDP direction indicators
    * hosts.txt: Add update.postman.i2p
2008-05-18 21:45:54 +00:00
zzz
bc5d87e6f0 * i2psnark:
- Randomize the PeerCheckerTask start times to make global limiting
        work better
      - Calculate bw limits using 40s rather than 4m averages to make
        bw limiting work better
      - Change default bw limit from uplimit/3 to uplimit/2 due to
        overhead reduction from the leaseset bundling change
2008-05-12 13:53:11 +00:00
zzz
d81bff267a * Outbound message:
- Tweak the cache key for efficiency
2008-05-12 13:50:15 +00:00
zzz
042399f293 * Stats:
- Require two udp stats when stats.full=false, caused NPE on peers.jsp
2008-05-12 13:48:41 +00:00
zzz
5be7ea1fc5 * libjbigi:
- Add documentation on dynamic build option
      - Add two speed tests to the build script
      - Clean up the build script, make it easier to build dynamic
2008-05-12 13:47:15 +00:00
zzz
db34665bb1 * Update Handler:
- Add postman to the list
2008-05-12 13:46:23 +00:00
zzz
ed9a03ebc7 * Summary bar:
- Add messages when dropping tunnel requests due to load
2008-05-12 13:45:08 +00:00
zzz
619b5c0e45 * Update Handler:
- Add option to download and verify only
      - Add distinct error message if version check fails
2008-05-10 14:31:18 +00:00
zzz
4c2c5ca232 Simplify oldstats.jsp if no events in a stat 2008-05-10 14:28:37 +00:00
zzz
3a203c3018 Fix the hosed inNetPool.droppedDeliveryStatusDelay stat (caused by an SSU hack) 2008-05-10 14:27:49 +00:00
zzz
3e86ee9746 Dont write out the my.info file 2008-05-10 14:26:24 +00:00
dev
d0855e1fc6 added http://www.i2p2.i2p/_static/i2pupdate.sud as another update-site 2008-05-09 12:37:11 +00:00
zzz
0bde8a24e4 * Reachability:
- Restrict peers requiring introducers from inbound tunnels,
        since it's slow and unreliable... and many of them advertise
        NTCP, which seems unlikely to work
      - Provide warning on summary bar if firewalled with inbound NTCP enabled
    * Stats: Remove the bw.[send,recv]Bps[1,15]s stats unless
      log level net.i2p.router.transport.FIFOBandwidthLimiter >= WARN
      at startup (you didn't get any data unless you set the log level anyway)
    * oldstats.jsp: Don't put 2 decimal places on integer event counts
    * Remove the Internals link from the menu bar
    * i2psnark: Extend startup delay from 1 to 3 minutes
2008-05-07 16:23:54 +00:00
dev
4049ff5167 -2 2008-05-06 20:04:26 +00:00
dev
89389ccc13 added i2jump.i2p as jump-site 2008-05-06 19:44:35 +00:00
zzz
959e308578 Add router version to profiles.jsp 2008-05-05 16:26:15 +00:00
zzz
8d4cbd8556 I2PTunnel: Change default outproxy to false.i2p 2008-05-05 14:42:17 +00:00
zzz
99b9c93636 -1 2008-05-05 14:10:19 +00:00
zzz
47c666c582 * Summary bar:
- Add reachability status
      - Add participating tunnel acceptance status
    * Throttle: Reject tunnels for first 10m uptime
2008-05-05 14:07:40 +00:00
zzz
a3c330fd9d - Restrict <= .32 SSU-only peers from inbound tunnels,
since they don't know if they are unreachable
2008-05-05 14:04:41 +00:00
zzz
a6f3478db3 * Outbound message:
- Fix a couple of tunnel cache cleaning bugs
      - Cache based on source+dest pairs rather than just dest
      - Send the reply leaseSet only when necessary,
        rather than all the time (big savings in overhead)
      - Enable persistent lease selection again
      - Logging tweaks
2008-05-05 14:01:22 +00:00
zzz
b1af22a15e - Have SSU bid aggressively when it has less than 3 peers, so
we can determine our IP address and do peer testing.
        Otherwise a router may never determine its IP address or reachability status.
2008-05-05 13:57:54 +00:00
zzz
65ec41c48f NetDb Stats: Cleanup of commented out stats 2008-05-05 13:55:50 +00:00
zzz
aebf16add7 0.6.1.33 version and news 2008-04-25 13:57:38 +00:00
zzz
1de0563c94 update forum link on susidns page 2008-04-25 13:22:41 +00:00
dev
c6059b9d85 merge of '20e06eb5e2ee39991682cae68511fca1944cd5b0'
and '8adc3b02e35ce3275e813ca9c64d75d02a0d9310'
2008-04-20 19:21:35 +00:00
dev
f68c9242a9 added news-entry for trac 2008-04-20 19:21:13 +00:00
zzz
51838ba051 * Outbound message/Reachability:
- Fix a bug from -19 causing the persistent lease selection
        removed in -17 to be back again
      - Use netDb-listed-unreachable instead of detected-unreachable
        for exclusion of unreachable peers from selected leases,
        as there are potential anonymity problems with using
        detected-unreachable
      - Tweak logging some more
    * NetDb stats: Remove a couple more including the inefficient stat_identities
2008-04-20 18:02:15 +00:00
zzz
cf50b7eac1 * Reachability:
- Track unreachable peers persistently
        (i.e. separately from shitlist, and not cleared when they contact us)
      - Exclude detected unreachable peers from inbound tunnels
      - Exclude detected unreachable peers from selected leases
      - Exclude detected unreachable floodfill peers from lookups
      - Show unreachable status on profiles.jsp
2008-04-17 18:59:15 +00:00
zzz
2edd84e088 * SSU/Reachability:
- Extend shitlist time from 4-8m to 40-60m
      - Add some shitlist logging
      - Don't shitlist twice when unreachable on all transports
      - Exclude netDb-listed unreachable peers from inbound tunnels;
        this won't help much since there are very few of these now
      - Remove 10s delay on inbound UDP connections used for the
        0.6.1.10 transition
      - Track and display UDP connection direction on peers.jsp
      - Show shitlist status in-line on profiles.jsp
2008-04-16 20:51:57 +00:00
zzz
5ba1e458c6 * SSU Reachability/PeerTestManager:
- Back out strict peer ordering until we fix SSU
      - Back out persistent lease selection until we fix SSU
      - Fix detection of UDP REJECT_UNSOLICITED by recording status on expiration
      - Increase known Charlie time to 10m; 3m wasn't enough
      - Don't continue retransmitting peer test if we know Charlie
      - Don't run multiple peer tests at once
      - Tighten test frequency range to 6.5-19.5m, was 0-26m
2008-04-15 18:27:43 +00:00
zzz
0b600669c7 * Addressbook: Disallow '.-' and '-.' in host names
* NTCP: Don't drop a connection unless both directions are idle;
            Fix idle time for outbound connections
    * Outbound message: Make sure cached lease is in current leaseSet
    * Stats: Put all NetworkDatabase stats in same group
    * TunnelPool: Stop building tunnels and leaseSets after client shutdown
    * i2psnark: Add locking to prevent two I2CP connections
2008-04-12 21:34:25 +00:00
dev
215eb14d38 no need anymore to set I2P-Home when using eepget 2008-04-07 18:54:48 +00:00
zzz
20ff2f5bdc Minor cleanups, -15 2008-04-07 17:42:54 +00:00
zzz
edc02e5efa Implement outbound bandwidth limiting for i2psnark 2008-04-07 17:41:58 +00:00
zzz
d57356f807 Reduce priority of participating traffic 2008-04-07 17:41:19 +00:00
zzz
a7a6c75ac5 * ExploratoryPeerSelector: Try NonFailing even more
* HostsTxtNamingService: Add reverse lookup support
    * Outbound message: Minor cleanup
    * i2psnark TrackerCLient: Minor cleanup
    * checklist.txt: Minor edit
    * hosts.txt: Add perv.i2p, false.i2p, mtn.i2p2.i2p
    * i2ptunnel.config: Change CVS client to mtn
    * netdb.jsp: Show leaseSet destinations using reverse lookup
    * profiles.jsp: First cut at showing floodfill data
2008-03-30 21:50:35 +00:00
zzz
b9e2def552 * Send messages for the same destination to the same inbound
lease to reduce out-of-order delivery.
    * ExploratoryPeerSelector: Back out the floodfill peer exclusion
      for now, as it prevents speed rating of those peers
2008-03-27 13:03:16 +00:00
zzz
4d7417401c * ReseedHandler: Support multiple urls,
add netdb.i2p2.de as a 2nd default
2008-03-26 20:15:47 +00:00
zzz
40a9e959e8 * i2psnark:
- Add support for secondary open trackers
      - Refactor and simplify the TrackerClient code
      - Add welterde's tracker to the default list
      - Don't have eepget retry announces
      - Slow down tracker contacts if they've failed for a while
      - Add some debug support showing connections (?p=2)
2008-03-25 21:54:54 +00:00
zzz
42bbb4a9ff * NewsFetcher: Fix bug causing fetch every 10m 2008-03-22 17:10:49 +00:00
zzz
9500a55532 * Tunnel Testing:
- Fix counting so it really takes 4 consecutive failures
        rather than 4 total to remove a tunnel
      - Credit or blame goes to the exploratory tunnel as well
        as the tunnel being tested
      - Adjust tunnel test timeout based on tunnel length
    * ExploratoryPeerSelector: Tweak logging
    * ProfileOrganizer: Adjust integration calculation again
    * build.xml: Add to help
    * checklist.txt: Tweak
    * readme.html: Fix forum links
    * netDb: Remove tunnel.testFailedTime
2008-03-22 13:07:38 +00:00
zzz
0556f15068 remove corrupt sex0r.i2p from hosts.txt 2008-03-21 15:23:10 +00:00
zzz
6e981874a5 * ExploratoryPeerSelector:
- Exclude floodfill peers
      - Tweak the HighCap vs. NonFailing decision
    * i2psnark: Increase retries for .torrent fetch
    * IRC Proxy: Prevent mIRC from sending an alternate DCC request
      containing an IP
    * readme.html: Reorder some items
    * Stats: Add some more required stats
    * Streaming lib: Fix slow start to be exponential growth,
      fix congestion avoidance to be linear growth.
      Should speed up local connections a lot, and remote
      connections a little.
2008-03-19 00:20:15 +00:00
zzz
8886d61caa forum news 2008-03-16 16:12:57 +00:00
zzz
b6fe81a982 Floodfill Search: Prefer heard-from, unfailing, unshitlisted floodfill peers 2008-03-14 22:53:18 +00:00
zzz
e7cdb965ba * ProfileOrganizer:
- Use more recent stats to calculate integrationory.txt
       - Show that fast peers are also high-capacity on profiles.jsp
    * readme.html: Update Syndie link
    * TunnelPool: Update comments
    * netDb: Report 1-2h uptime as 90m to further frustrate tracking,
      get rid of the 60s tunnel stats
      (effective as of .33 to provide cover)
2008-03-13 23:13:32 +00:00
zzz
4fa4357bf1 * Floodfill Search:
- Fix a bug that caused a single FloodfillOnlySearchJob
         instance to be run multiple times, with unpredictable
         results
       - Select ff peers randomly to improve reliability
       - Add some bulletproofing
2008-03-13 20:23:46 +00:00
zzz
46307c60d4 * ProfileOrganizer:
- Don't require a peer to be high-capacity to be
         well-integrated (not used for anything right now,
         but want to get it right for possible floodfill verification)
       - Don't fall back to median for high-capacity threshold
         if the mean is higher than the median, this prevents
         frequent large high-capacity counts
       - Fix high-capacity selector that picked one too many
    * Console: put well-integrated count back in the summary
2008-03-11 22:59:47 +00:00
zzz
e6a0c2f4f0 * EepGet: Fix byte count for bytesTransferred status listeners
(fixes command line status)
    * UpdateHandler:
       - Fix byte count display
       - Display final status on router console
       - Don't allow multiple update jobs to queue up
       - Increase max retries
       - Code cleanup
       - Don't show 'check for update' button when update in progress
       - Enhance error messages
2008-03-10 16:27:40 +00:00
zzz
cb41bf6023 NetDb: Comment out published netDb stats disabled for .32 2008-03-10 16:22:24 +00:00
zzz
d23c8a8331 -2 2008-03-09 14:55:44 +00:00
zzz
b1beb46ca2 propagate from branch 'i2p.i2p.i2p-0.6.1.33-pre' (head adbe93ae091c4ca78306ef94968a0c1d788e2c01)
to branch 'i2p.i2p' (head f541ec6c1ca7ffae49e31ee75559695d64152fa1)
2008-03-09 14:45:31 +00:00
6606c83cb2 2008-03-09 Complication
* Give the Jetty build file ability to ask permission
      before downloading the Jetty archive from the web,
      and to verify its SHA1 + MD5 hashes. Adjust the main build file
      in accordance with this change.
    * Improve the release checklist.
2008-03-08 20:37:45 +00:00
zzz
5998f5c9bd * ClientPeerSelector: Implement strict ordering of peers,
based on XOR distance from a random hash
      separately generated for each tunnel pool
2008-03-07 23:24:49 +00:00
zzz
cffcbe5f94 update news and version numbers to .32 2008-03-07 15:08:26 +00:00
zzz
0c75725f5e * ProfileOrganizer, TunnelPoolSettings, ClientPeerSelector:
- Prevent peers with matching IPs from joining same tunnel.
        Match 0-4 bytes of IP (0=off, 1=most restrictive, 4=least).
        Default is 2 (disallow routers in same /16).
        Set with router.defaultPool.IPRestriction=x
      - Comment out unused RebuildPeriod pool setting
      - Add random key to pool in preparation for XOR peer ordering
2008-03-07 14:36:40 +00:00
zzz
5ef325408c Optimize naming lookups for a destkey 2008-03-07 14:31:36 +00:00
zzz
d957712e88 Change a common wtf error to a warn 2008-03-06 14:03:49 +00:00
zzz
9233c2ed4c Add create account link in susimail 2008-03-06 14:00:33 +00:00
zzz
7ad54eb749 * Stats: Add code to disable most stats to save memory.
Set on configstats.jsp or set stat.full=false to disable the stats.
      (true by default for now)
2008-03-05 18:44:45 +00:00
zzz
5740e20c62 -3201 2008-03-05 14:25:39 +00:00
zzz
0a9114fc2f add a i2psnark StartAll button 2008-03-05 14:20:02 +00:00
zzz
71ddfa42e1 * i2psnark: Don't do a naming lookup for Base64 destkeys 2008-03-05 14:19:19 +00:00
zzz
1ecb84f3fb * Naming: Make HostsTxt the sole default NamingService
(was Meta = PetName + HostsTxt)
    * Naming: Add two new experimental NamingServices, EepGet and Exec,
      not enabled by default -
      see source comments in core/java/src/net/i2p/client/naming
      for configuration instructions
2008-03-05 14:16:04 +00:00
zzz
c46b06fb81 Fix netdb.knownLeaseSets count reported by floodfill routers 2008-03-01 16:13:41 +00:00
zzz
a7397879aa correct instructions 2008-02-29 16:50:37 +00:00
zzz
9b86da7ce5 upcoming .32 news 2008-02-29 14:51:24 +00:00
zzz
c68977ca8c * i2ptunnel: Add 3-hop option to edit.jsp to match configtunnels.jsp
* i2psnark: Remove orion and gaytorrents from default tracker list
    * Remove orion from jump list and from eepsite_index.html
    * Jbigi: Change jbigi version to 4.2.2 in build scripts - tested by amiga
    * Capitalize OutboundMessageDistributor job name
    * TunnelPool: Add a warning if all tunnels are backlogged
2008-02-27 15:18:32 +00:00
zzz
bc7bd628db * Reintroduce NTCP backlog pushback, with switch back to
previous tunnel when no longer backlogged
    * Catch an nio exception in an NTCP logging statement if loglevel is WARN
    * IRC Proxy: terminate all messages with \r\n (thanks TrivialPursuit!)
2008-02-26 19:33:11 +00:00
zzz
bc7ab39131 +x the c build files 2008-02-21 14:53:50 +00:00
zzz
100163e03b * Raise inbound default bandwidth to 32KBps
* Fix config.jsp that showed 0KBps share bandwidth by default
2008-02-21 14:05:33 +00:00
zzz
49c02f13b2 -5 2008-02-19 15:39:44 +00:00
zzz
40f072e25e Display capabilities on profiles.jsp 2008-02-19 15:32:39 +00:00
zzz
918b1acb8f * Tunnels: Enforce max tunnel length of 8, catch an index error
http://forum.i2p/viewtopic.php?t=2561
2008-02-19 15:28:41 +00:00
zzz
bc16078e3f Remove some stats from netDb, effective in .32 2008-02-19 15:22:46 +00:00
zzz
4a8dbd0634 * Addressbook: Disallow '--' in host names except in IDN,
add some reserved host names
2008-02-19 15:21:58 +00:00
zzz
38c0184f95 clarify the i2ptunnel edit page dropdowns 2008-02-19 15:20:42 +00:00
zzz
68829ddb99 merge of 'cc7dee6f711dd10db6c1f42af8dc7ba6f6b0002d'
and 'dc2fa2d01da4c7b3733d4dadb85d757d592c1fa6'
2008-02-19 15:16:53 +00:00
zzz
19089bd6a7 * Fix race in TunnelDispatcher which caused
participating tunnel count to seesaw -
      should increase network capacity
    * Leave participating tunnels in 10s batches for efficiency
    * Update participating tunnel ratestat when leaving a tunnel too,
      to generate a smoother graph
    * Fix tunnel.participatingMessageCount stat to include all
      participating tunnels, not just outbound endpoints
    * Simplify Expire Tunnel job name
2008-02-16 16:25:21 +00:00
zzz
69cc0afd1b * PersistentDataStore: Write out 300 records every 10 min
rather than 1 every 10 sec;
      Don't store leasesets to disk or read them in
    * Combine rates for pools with the same length setting
      in the new tunnel build algorithm
    * Clarify a log message in the UpdateHandler
2008-02-13 21:42:09 +00:00
zzz
d2f3a262db * Make graphs clickable to get larger graphs
* Change SimpleTimer CRIT to a WARN, increase threshold
    * Checklist update
2008-02-13 11:49:24 +00:00
dev
c1703b872d probably fixed a bug in udp-transport 2008-02-11 20:45:33 +00:00
dev
f7b0e8181b merge of '1d753ff05fc1c942cf6ce8feeadfaa577bff27ab'
and 'e20c0075f57440edcebaac0009a0ef0327d563cc'
2008-02-11 20:38:47 +00:00
zzz
43f2695901 * Add new tunnel build algorithm (preliminary)
* Change NTCP backlogged message from error to warning
    * Checklist updates
2008-02-10 18:29:21 +00:00
ea0d4ffd7f * 2008-02-10 0.6.1.31 released
2008-02-10 Complication
    * Update news and version numbers
2008-02-10 13:59:20 +00:00
dev
0ed29573a7 minor 2008-02-09 13:18:22 +00:00
zzz
1365d3e3b9 Remove orion reference in dnfh error page 2008-02-08 21:04:23 +00:00
zzz
40befb5a92 remove comments from hosts.txt 2008-02-08 19:16:48 +00:00
zzz
9c16eec361 checklist updates, +x some files 2008-02-08 00:15:32 +00:00
zzz
093c69637d * build.xml: Add some apps to javadoc
* checklist.txt: Add some things
    * news.xml: Minor edit
    * runplain.sh: Add some comments
2008-02-06 16:38:23 +00:00
zzz
134ec7acea * news.xml: make links relative
* wrapper.config: Add some comments
* checklist.txt: Add some things
2008-02-05 03:14:18 +00:00
0802a5ae40 2008-02-05 Complication
* Change the dates too (sorry for such forgetfulness!)
2008-02-04 23:52:11 +00:00
14ddfb360f 2008-02-04 Complication
* Also use the new key for checking, and add it into news.xml
2008-02-04 23:20:28 +00:00
78ad831028 2008-02-04 Complication
* Added my release signing key into TrustedUpdate.java
2008-02-04 21:34:52 +00:00
zzz
22f1684262 * NewsFetcher: Change fetch failed from error to warning
* installer: Fix URL and "email"
    * checklist.txt: New release checklist
2008-01-31 19:56:00 +00:00
zzz
83f51b4a66 2008-01-29 zzz
* Addressbook: Change default subscription
    * ConfigUpdateHandler: Change default news URL
    * initialNews.xml: Update version to .31
    * news.xml: More updates
    * hosts.txt: Add i2p-projekt.i2p
    * readme.html: More URL updates
    * SusiDNS: Change references to default subscription
2008-01-29 22:20:04 +00:00
zzz
9c28de0704 2008-01-28 zzz
* news.xml: Updates, still preliminary
    * ReseedHandler: Change default URL
    * i2ptunnel.config: Change default outproxies
    * readme.html: Change *.i2p.net URLs
    * help.jsp: Change *.i2p.net URLs
    * eepsite_index.html: Change stats.i2p addressbook subscription URL
    * hosts.txt: Add krabs.i2p, true.i2p, www.i2p2.i2p
2008-01-28 19:24:12 +00:00
zzz
c69fda2298 Drop unused directories 2008-01-27 14:48:50 +00:00
zzz
cabb22331b Drop unused directories 2008-01-27 14:42:04 +00:00
zzz
5b3aca29a8 replace orion.i2p with perv.i2p/stats.cgi 2008-01-09 22:40:33 +00:00
zzz
f35cbf59d8 * NewsFetcher: add last-modified support, reduce number of retries
* Error pages: add icon and logo,
        clarify 'destination not found' and 'proxy not found' pages
2008-01-09 04:11:12 +00:00
zzz
a96119d09b 2008-01-08 zzz
* addressbook: Limit size of subscribed hosts.txt,
        don't save old etag or last-modified data
    * EepGet: Add some logging,
        enforce size limits even when size not in returned header,
        don't return old etag or last-modified data,
        don't call transferFailed listener more than once
2008-01-09 02:15:43 +00:00
zzz
2711294aee (zzz) sign my update signing key 2008-01-09 01:56:38 +00:00
zzz
f838b1828b 2008-01-07 zzz
* profiles.jsp formatting cleanup
    * NTCP: Reduce max idle time from 60m to 20m
    * NTCP: Fix idle time on connections with zero messages,
      correctly drop these connections
2008-01-07 08:09:43 +00:00
zzz
fbf6282c1a 2008-01-03 zzz
* addressbook: Do basic validation of hostnames and destkeys
    * susidns: Add support for the private addressbook,
      update the text and links somewhat
2008-01-04 02:37:24 +00:00
zzz
5195a5c1fc 2008-01-02 zzz
* Add stats.i2p to the jump list
    * Impose 20MB limit on POSTs and catch OOMs in POST
    * eepsite_index.html: add stats.i2p services
    * addressbook: log source of new keys; disallow dests > 516 bytes
    * addressbook: convert hostnames to lower case to prevent duplicates
    * susidns: generalize references to orion
2008-01-02 22:08:48 +00:00
zzz
62b18b18b5 2007-12-29 zzz
* Tweak IRC inbound PONG filtering to fix xchat/BitchX lagometers
2007-12-30 03:45:09 +00:00
zzz
7c8f519b35 2007-12-29 zzz
* Allow commas in router.trustedUpdateKeys and router.updateURL again
2007-12-29 23:59:24 +00:00
zzz
d6fb979616 2007-12-29 zzz
* Change default news host from dev.i2p.net to dev.i2p
2007-12-29 22:15:11 +00:00
zzz
f568d21969 2007-12-29 zzz
* Change jetty timeout from 30 to 60 sec (thanks sponge!)
2007-12-29 21:08:29 +00:00
zzz
7fe9d590f5 2007-12-28 zzz
* Add zzz's update signing key
2007-12-28 20:27:16 +00:00
0a1240ebfd 2007-12-26 Complication
* Improve reseed handler (less repetitive code,
      avoid reporting errors when less than 10% of fetches fail)
2007-12-26 20:55:07 +00:00
4e68f2a157 2007-12-26 Complication
* Escape both CR, LF and CR LF line breaks in Router.saveConfig()
      and unescape them in DataHelper.loadProps() to support
      saving and loading config properties with line breaks
    * Change the update URLs textbox into a textarea like keys have,
      so different URLs go on different lines
    * Modify TrustedUpdate to provide a method which supplies a key list
      delimited with CR LF line breaks
    * Modify DEFAULT_UPDATE_URL to supply a default URL list
      delimited with CR LF line breaks
    * Modify selectUpdateURL() to handle URL lists
      delimited by any kind of line breaks
    * Start saving trusted update keys
    * Improve formatting on configupdate.jsp
2007-12-26 08:14:54 +00:00
zzz
e9bd6907d1 2007-12-22 zzz
* Add support for multiple update URLs
    * Change default for update to use i2p proxy,
      add several URLs as defaults
    * Enable trusted key form on configupdate.jsp
2007-12-22 23:58:46 +00:00
zzz
b20495c39f (zzz) Clarify the 'destination not found' error page 2007-12-22 20:54:44 +00:00
zzz
0ecbc4c27b (zzz) remove anonymitytracker from default tracker list, not seen in over 6 months 2007-12-17 02:33:05 +00:00
zzz
4d5b1d4c3f 2007-12-10 zzz
* Fix NPE in CLI TrustedUpdate keygen
2007-12-10 22:22:59 +00:00
17b719f3f7 2007-12-02 Complication
* Commit SAM v2 patch from mkvore (thank you!)
    * Minor reformatting to preserve consistent whitespace
      in old SAM classes (new classes unaltered)
2007-12-03 04:19:25 +00:00
979a3e98d8 2007-12-01 Complication
* Separate the checks "does Jetty .zip file need downloading"
      and "does Jetty .zip file need extracting" in the Jetty buildfile.
      First download (unless already done), then extract (unless done).
2007-12-02 03:13:15 +00:00
zzz
c6a1112f0a 2007-11-26 zzz
* i2psnark: add timeout for receive inactivity
2007-11-26 21:53:58 +00:00
zzz
4ebcc95d9f 2007-11-24 zzz
* i2psnark: increase streaming lib write timeout to 240 sec and change
      timeout action from "ping" to "disconect", as the fix in .30 to
      honor options on outbound connections led to hung outbound connections
      (bitfield never transmitted, connection never dropped)
2007-11-24 20:22:45 +00:00
zzz
7e59ce27fa (zzz) i2phost.i2p => i2host.i2p 2007-11-06 20:15:25 +00:00
zzz
22345a264e (zzz) fix new jump server typo 2007-11-06 19:53:06 +00:00
03739996da 2007-11-06 jrandom
* add i2phost.i2p to the jump list
2007-11-06 11:26:01 +00:00
zzz
819a72d4f6 2007-10-11 zzz
* IRC Proxy: Fix several possible anonymity holes:
      - Block CTCP in NOTICE messages
      - Block CTCP anywhere in PRIVMSG and NOTICE, not just at first character
      - Check for lower case commands
    (Thanks sponge!)
2007-10-11 06:03:21 +00:00
e480931e20 2007-10-07 jrandom
* back out the NTCP backlog pushback, as it could be used to mount an
      active anonymity attack.
2007-10-08 04:11:36 +00:00
zzz
3f01d0a69e (zzz) .30 details 2007-10-08 04:03:40 +00:00
f67f47f0cd 0.6.1.30 2007-10-08 03:09:35 +00:00
5ad6ee60eb 0.6.1.30 2007-10-08 03:01:47 +00:00
5accba6cdc 2007-10-07 Complication
* Fix an issue in EepGet whereby sending of "etag" and "lastModified" headers
      broke retrying.
2007-10-08 02:36:17 +00:00
zzz
313e1704df 2007-09-27 zzz
* Implement pushback of NTCP transport backlog to the outbound tunnel selection code
    * Clean up the NTCP and UDP tables on peers.jsp to be consistent,
      fix some of the sorting
2007-09-27 03:52:32 +00:00
zzz
cf4d2b17c9 2007-09-22 zzz
* Send messages for the same destination out the same outbound
      tunnel to reduce out-of-order delivery.
2007-09-23 02:44:34 +00:00
zzz
9145eedc35 2007-09-19 zzz
* i2psnark: Fix broken multifile torrent Delete;
        cleanup Storage resources in AddTorrent;
        don't autostart torrent after Create
2007-09-20 01:44:02 +00:00
zzz
b772179077 2007-09-18 zzz
* eepsite_index.html: Add links to trevorreznik address book
    * streaming lib: Fix SocketManagerFactory to honor options on outbound connections
    * streaming lib: Fix setDefaultOptions() when called with a ConnectionOptions parameter
    * i2psnark: Don't make outbound connections to already-connected peers
    * i2psnark: Debug logging cleanup
2007-09-18 19:09:19 +00:00
zzz
9054a196ce 2007-09-14 zzz
* eepget: Increase header timeout to 45s
    * HTTP proxy: Return a better error message for localhost requests
    * tunnels: Fix PooledTunnelCreatorConfig memory leak
2007-09-15 01:58:30 +00:00
zzz
d28a96ac7d 2007-09-09 zzz
* eepget: Add support for Last-Modified and If-Modified-Since
    * addressbook: Finish incomplete support for Last-Modified
2007-09-09 17:38:53 +00:00
zzz
9c73f80ac3 (zzz) Copy over SocketTimeout.java file from syndie for EepGet.java 2007-09-08 20:21:15 +00:00
20c46cff04 synced up with the eepget from the syndie source tree (allowing better
control of timeouts and transparent redirection).  the users of eepget
in this source tree don't necessarily use the timeout controls, though
they can be updated to do so
2007-09-08 02:24:01 +00:00
f332513755 added trevorreznik.i2p 2007-09-02 01:36:54 +00:00
zzz
cb69a66498 (zzz) .29 announcement 2007-08-24 02:34:40 +00:00
1c66543938 0.6.1.29 released 2007-08-24 00:33:28 +00:00
zzz
53ab3c472e 2007-08-13 zzz
* readme.html - Add inproxy.tino.i2p, replace search.i2p with eepsites.i2p,
      tweak the eepsite and troubleshooting sections
2007-08-13 19:42:59 +00:00
zzz
a4b221fa71 2007-08-11 zzz
* Add stats for individual tunnel rates (nice when graphed)
    * i2psnark: Fix outbound tunnel nickname
2007-08-11 20:48:14 +00:00
e3e1d0842d 2007-08-05 Complication
* Update the sharing calculator on config.jsp
      and explain the trade-off even more thoroughly.
2007-08-06 03:35:42 +00:00
99b5bf9609 2007-08-04 Complication
* Lower the threshold between the K and L bandwidth class,
      so that K is now < 12 KB/s, instead of <= 16 KB/s.
      Hopefully this lets people with 128 kbit/s (16 KB/s) upload lines
      participate in routing, if they keep the default share percentage.
2007-08-05 03:25:30 +00:00
zzz
da10fe0df7 (zzz) ask for bandwidth 2007-07-19 18:05:44 +00:00
zzz
9fd5ba7b2d 2007-07-16 zzz
* i2psnark: Add tooltip info for choked/uninterested
2007-07-16 21:15:51 +00:00
zzz
05b5df9d76 2007-07-16 zzz
* Make selection of graphed data configurable via configstats.jsp,
      remove most of the default graphs to save some memory
2007-07-16 20:47:57 +00:00
zzz
5c1dc79767 2007-07-15 zzz
* Add current values to graph legends
    * Fix up previous Rate fix to check for divide by zero
2007-07-15 18:34:33 +00:00
4acd2996c5 2007-07-14 Complication
* Take the post-download routerInfo size check back out of ReseedHandler,
      since it wasn't helpful, and a lower limit caused false warnings.
    * Give EepGet ability to enforce a min/max HTTP response size.
    * Enforce a maximum response size of 8 MB when ReseedHandler
      downloads into a ByteArrayOutputStream.
    * Refactor ReseedHandler/ReseedRunner from static to ordinary classes,
      change invocation from RouterConsoleRunner accordingly.
    * Add an EepGet status listener to ReseedHandler to log causes of reseed failure,
      provide status reports to indicate the progress of reseeding.
    * Enable icon for default eepsite, and the index page
      of the router console (more later).
2007-07-15 00:56:18 +00:00
zzz
16fa6a89bc 2007-07-14 zzz
* Clean up graphs.jsp - set K=1024 where appropriate,
      output image sizes in html, catch ooms, other minor tweaks
    * Fix current event count truncation which fixes graphs with low
      60-sec event counts displaying high values
      (bw.* and router.* graphs for example were 1.5x too high)
      Affects all "events per period" (non-lifetime) counts.
2007-07-14 18:44:11 +00:00
zzz
2a72e8574b 2007-07-09 zzz
* i2psnark: give a better error message for a non-i2p torrent
2007-07-10 01:20:37 +00:00
zzz
d4a1bcf28f 2007-07-07 zzz
* Add auto-detect IP/Port to NTCP. When enabled on config.jsp,
      SSU will notify/restart NTCP when the external address changes.
      Now you can enable inbound TCP without a static IP or dyndns service.
2007-07-07 20:03:50 +00:00
zzz
409b71def5 2007-07-04 zzz
* Display calculated share bandwidth and remove load testing
      on config.jsp
2007-07-04 22:58:48 +00:00
zzz
2dc5fbda02 2007-07-01 zzz
* Replace broken option i2np.udp.alwaysPreferred with
      i2np.udp.preferred and adjust UDP bids; possible settings are
      "false" (default), "true", and "always".
      Default setting results in same behavior as before
      (NTCP is preferred unless it isn't established and UDP is established).
      Use to compare NTCP and UDP transports.
2007-07-01 22:07:52 +00:00
71aaf03d09 2007-06-27 jrandom
* fix for a streaming lib bug that could leave a thread waiting
      indefinitely (thanks Complication!)
2007-06-28 01:51:16 +00:00
30c99e630b 2007-06-16 Complication
* First pass on EepGet and ReseedHandler improvements,
      please avoid use on routers which matter!
    * Give EepGet ability of downloading into an OutputStream,
      such as the ByteArrayOutputStream of ReseedHandler.
    * Detect failure to reseed better, report it persistently
      and more verbosely, provide a link to logs
      and suggest manual reseed.
2007-06-16 23:15:49 +00:00
445b39171a 2007-05-06 Complication
* spelling correction to history.txt
2007-05-06 20:02:04 +00:00
571c2d6047 2007-05-06 Complication
* Fix the build.xml file, so the preppkg build target won't try copying files
      which became deprecated with the old Syndie (thank for alerting, itsu!)
2007-05-06 19:52:39 +00:00
zzz
42ff763933 (zzz) 4-10 2007-04-11 06:01:35 +00:00
zzz
727edc3ff9 (zzz) add 204 log link 2007-04-08 04:18:18 +00:00
zzz
82a4758a0a (zzz) 3-27 and 4-3 2007-04-05 06:11:21 +00:00
zzz
915914ebb3 2007-03-31 zzz
* Add trevorreznik jump server to the http proxy error page
    * Add anonymity to the trackers supporting details links in i2psnark
2007-03-31 21:50:51 +00:00
zzz
c438b56378 (zzz) 3-20 2007-03-25 22:58:18 +00:00
zzz
307ccfb1b4 2007-03-24 zzz
* Remove Syndie from build targets and navbar
2007-03-24 07:57:37 +00:00
zzz
34e23259b4 2007-03-22 zzz
* i2psnark tracker handling tweaks:
    -   Add link to tracker details page (Postman only for now, requires bytemonsoon patch)
    -   Add Base URL to tracker list configuration
    -   Web page links built from tracker list Base URLs
    -   Only build and sort tracker list once
    -   Add anonymityWeb tracker to default list
    -   Add tooltip info for TrackerErrs
    -   Stop torrent if not registered with tracker
    -   Mark temp files as delete on exit
2007-03-22 05:21:25 +00:00
zzz
036802d66a 2007-03-18 zzz
* i2psnark: Cleanup some handling of saved partial pieces
    * i2psnark: Put bit counting in Bitfield.java for efficiency
    * i2psnark: Save torrent completion state in i2psnark.config
2007-03-18 21:57:01 +00:00
zzz
6a7dbc8e3a (zzz) i2psnark: Save torrent completion status in i2psnark.config 2007-03-18 21:43:41 +00:00
zzz
cf4a9ffc27 (zzz) i2psnark: Put bit counting in Bitfield.java for efficiency 2007-03-18 21:28:28 +00:00
zzz
6ef4adf318 (zzz) i2psnark: Remove saved partial when halted, don't save partial when halted 2007-03-18 21:25:18 +00:00
zzz
f84c9bf3b1 (zzz) .28 news 2007-03-18 02:17:16 +00:00
da0837bd58 ugh, jrandom sucks. 0.6.1.28 2007-03-18 01:47:59 +00:00
9094a62273 oops 2007-03-17 21:19:37 +00:00
026183a655 * 2007-03-17 0.6.1.2 released 2007-03-17 21:18:12 +00:00
zzz
b033c7945c (zzz) i2psnark: clarify that total uploader value is peers on UI. (thanks jadeSerpent) 2007-03-15 18:26:06 +00:00
zzz
0c2dcf0845 (zzz) 3-13 mtg 2007-03-15 08:21:35 +00:00
zzz
b6e597e5bf 2007-03-13 zzz
* i2psnark: Make max total uploaders configurable (thanks Amiga4000!)
2007-03-14 04:06:27 +00:00
ae402baa71 2007-03-12 jrandom
* dodge a race on startup (thanks zzz!)
2007-03-12 18:19:57 +00:00
zzz
d6c8a4d9eb 2007-03-10 zzz
* Streaming lib: Change initial RTT deviation from RTT to RTT/2
      to reduce early RTO values
2007-03-10 08:45:27 +00:00
zzz
8e2849b7e5 2007-03-08 zzz
* i2psnark changes to improve upload performance:
    *  Implement total uploader limit (10)
    *  Don't timeout non-piece messages out
    *  Change chunk size to 32K (was 64K)
    *  Change request limit to 64K (was 256K)
    * i2psnark: Disconnect from seeds when complete
2007-03-08 18:55:17 +00:00
zzz
0aa0cd330f (zzz) take dynamic router keys off the config page 2007-03-07 21:05:21 +00:00
zzz
0960cafaf5 2007-03-07 zzz
* Streaming lib changes to improve upstream performance during congestion:
    *   Change min window size from 12 to 1
    *   Change max timeout from 10 to 45 sec
    *   Change initial timeout from 10 to 15 sec
    *   Change intial window size for i2psnark from 12 to 1
    *   Change slow start growth rate for i2psnark from 1/2 to 1
2007-03-07 05:11:45 +00:00
zzz
2088a28053 (zzz) Mar. 04 - More tweaks to the default eepsite start page to help
people start up the tunnel which is now stopped by default
2007-03-04 23:25:18 +00:00
zzz
a5c4ba3bff 2007-03-03 zzz
* Upgrade from Jetty 5.1.6 to 5.1.12 which fixes spaces in URL
    * Add a updaterWithJetty build target
2007-03-03 20:30:52 +00:00
zzz
1bbd2cf52e 2007-03-03 zzz
* Implement priority sending for NTCP
    * Disable trimForOverload() in tunnel BuildExecutor which
      was preventing tunnel builds when outbound traffic was high
      (i.e. most of the time when running i2psnark)
2007-03-03 20:11:05 +00:00
zzz
ce50efa60c (zzz) 02-28 i2psnark file reopen cleanup 2007-03-01 02:29:11 +00:00
zzz
a3c64a9ba3 (zzz) 02-28 add peer details to i2psnark web page 2007-03-01 02:22:14 +00:00
zzz
1447164a8a (zzz) 2-20 2007-02-24 09:15:29 +00:00
zzz
bc0bf8d7ff (zzz) Fix Syndie URL typo 2007-02-22 08:51:14 +00:00
zzz
9f346f488e (zzz) add links 2007-02-17 02:07:45 +00:00
zzz
760d7d9704 (zzz) 0.6.1.27 2007-02-16 19:35:09 +00:00
77310e17d1 * 2007-02-15 0.6.1.27 released
2007-02-15  jrandom
    * Limit the whispering floodfill sends to at most 3 randomly
      chosen from the known floodfill peers
2007-02-15 23:25:04 +00:00
e54b964929 2007-02-14 jrandom
* Don't filter out KICK and H(ide oper status) IRC messages
      (thanks Takk and postman!)
2007-02-14 21:35:43 +00:00
809f3e847b 2007-02-13 jrandom
* Tell our peers about who we know in the floodfill netDb every
      6 hours or so, mitigating the situation where peers lose track
      of floodfill routers.
    * Disable the Syndie updater (people should use the new Syndie,
      not this one)
    * Disable the eepsite tunnel by default
2007-02-14 04:33:36 +00:00
zzz
f4beebe60d (zzz) 02-13 2007-02-14 03:04:11 +00:00
827e427f0b added trac.i2p 2007-02-12 10:26:21 +00:00
zzz
c02125511d (zzz) 02-06 2007-02-08 18:51:58 +00:00
zzz
1aa1069b6f (zzz) 01-30 2007-02-02 02:50:43 +00:00
zzz
91d281077d 2007-01-30 zzz
* i2psnark: Don't hold _snarks lock while checking a snark,
      so web page is responsive at startup
2007-01-30 08:58:19 +00:00
zzz
f339dec024 2007-01-29 zzz
* i2psnark: Add NickyB tracker
2007-01-30 04:05:21 +00:00
zzz
2aeef44f8d 2007-01-28 zzz
* i2psnark: Don't hold sendQueue lock while flushing output,
      to make everything run smoother
2007-01-29 04:03:36 +00:00
zzz
0fd41a9490 2007-01-27 zzz
* i2psnark: Fix orphaned Snark reader tasks leading to OOMs
2007-01-28 02:30:05 +00:00
58f10d14b2 2007-01-20 Complication
* Drop overlooked comment
2007-01-21 03:49:41 +00:00
46ca42ddf8 2007-01-20 Complication
* Modify ReseedHandler to query the "i2p.reseedURL" property from I2PAppContext
      instead of System, so setting a reseed URL in advanced configuration has effect.
    * Clean out obsolete reseed code from ConfigNetHandler.
2007-01-21 03:35:49 +00:00
zzz
e6e6d6f4ee 2007-01-20 zzz
* Improve performance by not reading in the whole
      piece from disk for each request. A huge memory savings
      on 1MB torrents with many peers.
2007-01-21 01:43:31 +00:00
zzz
8a87df605b 2007-01-20 zzz
* i2psnark: More choking rotation tweaks
    * Improve performance by not reading in the whole
      piece from disk for each request. A huge memory savings
      on 1MB torrents with many peers.
2007-01-21 00:35:09 +00:00
zzz
8ca085bceb (zzz) 1/16 2007-01-19 03:04:49 +00:00
zzz
df47587db0 * Add new HTTP Proxy error message for non-http protocols 2007-01-18 01:42:13 +00:00
zzz
d705e0ad04 2007-01-17 zzz
* Add note on Syndie index.html steering people to new Syndie
2007-01-17 05:13:27 +00:00
zzz
40d209dd7c 2007-01-17 zzz
* i2psnark: Fix crash when autostart off and
      tcrrent started manually
2007-01-16 06:20:23 +00:00
zzz
7f2a0457bf 2007-01-16 zzz
* i2psnark: Fix bug caused by last i2psnark checkin
      (ConnectionAcceptor not started)
    * Don't start PeerCoordinator, ConnectionAcceptor,
      and TrackerClient unless starting torrent
2007-01-16 04:47:58 +00:00
f4749f2483 2007-01-15 jrandom
* small guard against unnecessary streaming lib reset packets
      (thanks Complication!)
2007-01-15 06:35:59 +00:00
zzz
9c42830076 2007-01-15 zzz
* i2psnark: Add 'Stop All' link on web page
    * Add some links to trackers and forum on web page
    * Don't start tunnel if 'Autostart' unchecked
    * Fix torrent restart bug by reopening file descriptors
2007-01-15 04:36:03 +00:00
zzz
53ba6c2a64 2007-01-14 zzz
* i2psnark: Improvements for torrents with > 4 leechers:
      choke based on upload rate when seeding, and
      be smarter and fairer about rotating choked peers.
    * Handle two common i2psnark OOM situations rather
      than shutting down the whole thing.
    * Fix reporting to tracker of remaining bytes for
      torrents > 4GB (but ByteMonsoon still has a bug)
2007-01-14 19:49:33 +00:00
zzz
61b3f21f69 (zzz) 01-09 2007-01-13 01:15:04 +00:00
zzz
506fd5f889 (zzz) Jan. 2 2007-01-03 03:19:06 +00:00
zzz
d538f888b4 (zzz) 12-19,12-26 2006-12-28 09:11:30 +00:00
976c5fdd47 new syndie httpserv 2006-12-16 22:31:07 +00:00
zzz
b63f3437f2 (zzz) 12-12 mtg 2006-12-13 06:40:15 +00:00
zzz
e760f2e538 (zzz) 12/5 mtg 2006-12-06 02:52:13 +00:00
zzz
17c8fca779 (zzz) 11-28 mtg 2006-11-29 01:37:18 +00:00
zzz
87fda382c3 (zzz) 11/14 and 11/21 mtgs 2006-11-22 02:31:23 +00:00
zzz
1e404cd7ac 2006-10-29 zzz
* i2psnark: Fix and enable generation of multifile torrents,
      print error if no tracker selected at create-torrent,
      fix stopping a torrent that hasn't started successfully,
      add eBook and GayTorrents trackers to form,
      web page formatting tweaks
2006-11-10 01:44:35 +00:00
zzz
098f99d806 (zzz) 11/7 mtg 2006-11-10 01:34:54 +00:00
zzz
da93f96035 (zzz) 10/31 mtg 2006-11-02 02:39:07 +00:00
ead39cc87e 2006-10-29 Complication
* Ensure we get NTP samples from more diverse sources
      (0.pool.ntp.org, 1.pool.ntp.org, etc)
    * Discard median-based peer skew calculator as framed average works,
      and adjusting its percentage can make it behave median-like
    * Require more data points (from at least 20 peers)
      before considering a peer skew measurement reliable
2006-10-29 19:29:50 +00:00
zzz
e4e3c44459 (zzz) 10/24 2006-10-25 08:22:09 +00:00
zzz
af151e32e5 (zzz) 10/17 mtg 2006-10-21 08:22:24 +00:00
12819a2a17 added mtn.i2p 2006-10-15 02:10:36 +00:00
87eedff254 0.6.1.26 2006-10-09 05:10:22 +00:00
4c59cd7621 * 2006-10-10 0.6.1.26 released
2006-10-10  jrandom
    * Removed the status display from the console, as its more confusing
      than informative (though the content is still displayed in the HTML)
2006-10-09 01:44:47 +00:00
ef707e7956 2006-10-08 Complication
* Update comment to reflect current status
2006-10-08 23:10:58 +00:00
73cf3fb299 2006-10-08 Complication
* Add a framed average peer clock skew calculator
    * Add config property "router.clockOffsetSanityCheck" to determine
      if NTP-suggested clock offsets get sanity checked (default "true")
    * Reject NTP-suggested clock offsets if they'd increase peer clock skew
      by more than 5 seconds, or make it more than 20 seconds total
    * Decrease log level in getMedianPeerClockSkew()
2006-10-08 22:52:59 +00:00
zzz
80b0c97d72 (zzz) 10/3 status notes 2006-10-04 19:41:09 +00:00
zzz
5cf85c1d7b (zzz)
* i2psnark: Second try at synchronization fix - synch addRequest()
      completely rather than just portions of it and requestNextPiece()
2006-09-29 23:54:17 +00:00
c14e52ceb5 2006-09-27 jrandom
* added HMAC-SHA256
    * properly use CRLF with EepPost
    * suppress jbigi/jcpuid messages if jbigi.dontLog/jcpuid.dontLog is set
    * PBE session key generation (with 1000 rounds of SHA256)
    * misc SDK helper functions
2006-09-27 06:00:33 +00:00
32a579e480 2006-09-26 Complication
* Take back another inadverent logging change in NTCPConnection
2006-09-27 04:44:13 +00:00
0a240a4436 2006-09-26 Complication
* Take back an accidental log level change
2006-09-27 04:31:34 +00:00
9325b806e4 2006-09-26 Complication
* Subclass from Clock a RouterClock which can access router transports,
      with the goal of developing it to second-guess NTP results
    * Make transports report clock skew in seconds
    * Adjust renderStatusHTML() methods accordingly
    * Show average for NTCP clock skews too
    * Give transports a getClockSkews() method to report clock skews
    * Give transport manager a getClockSkews() method to aggregate results
    * Give comm system facade a getMedianPeerClockSkew() method which RouterClock calls
      (to observe results, add "net.i2p.router.transport.CommSystemFacadeImpl=WARN" to
logging)
    * Extra explicitness in NTCP classes to denote unit of time.
    * Fix some places in NTCPConnection where milliseconds and seconds were confused
2006-09-27 04:02:13 +00:00
zzz
ef2e24ea11 (zzz)
* i2psnark: Paranoid copy before writing pieces,
      recheck files on completion, redownload bad pieces
    * i2psnark: Don't contact tracker as often when seeding
2006-09-26 03:11:39 +00:00
zzz
373934c6e0 (zzz)
* i2psnark: Add some synchronization to prevent rare problem
      after restoring orphan piece
2006-09-24 18:30:22 +00:00
zzz
e8e8bac694 (zzz)
* i2psnark: Eliminate duplicate requests caused by i2p-bt's
      rapid choke/unchokes
    * i2psnark: Truncate long TrackerErr messages on web page
2006-09-20 22:39:24 +00:00
zzz
23e8a558c2 (zzz)
* i2psnark: Implement retransmission of requests. This
      eliminates one cause of complete stalls with a peer.
      This problem is common on torrents with a small number of
      active peers where there are no choke/unchokes to kickstart things.
2006-09-16 21:07:28 +00:00
46f2645834 2006-09-14 Complication
* news.xml update
2006-09-14 03:16:53 +00:00
zzz
2329439034 (zzz)
* i2psnark: Fix restoral of partial pieces broken by last patch
2006-09-14 02:37:32 +00:00
zzz
6d400368b9 (zzz) changelog date fix 2006-09-13 23:24:14 +00:00
zzz
26c13b40fe (zzz)
* i2psnark: Mark a peer's requests as unrequested on disconnect,
      preventing premature end game
    * i2psnark: Randomize selection of next piece during end game
    * i2psnark: Don't restore a partial piece to a peer that is already working on it
    * i2psnark: strip ".torrent" on web page
    * i2psnark: Limit piece size in generated torrent to 1MB max
2006-09-13 23:02:07 +00:00
zzz
9fd0e95fe8 (zzz) 9/12 status 2006-09-13 17:34:58 +00:00
zzz
7e21f2c92b (zzz)
* i2psnark: Add "Stalled" indication and stat totals on web page
2006-09-10 01:55:37 +00:00
zzz
c9d8e796c6 (zzz)
* i2psnark: Fix bug where new peers would always be set to "interested"
      regardless of actual interest
    * i2psnark: Reduce max piece size from 10MB to 1MB; larger may have severe
      memory and efficiency problems
2006-09-09 22:15:05 +00:00
zzz
e7203f5d46 (zzz) 0.6.1.25 2006-09-09 21:19:49 +00:00
22d76a1b64 * 2006-09-09 0.6.1.25 released 2006-09-09 17:46:21 +00:00
0903dc46c6 2006-09-08 jrandom
* Tweak the PRNG logging so it only displays error messages if there are
      problems
    * Disable dynamic router keys for the time being, as they don't offer
      meaningful security, may hurt the router, and makes it harder to
      determine the network health.  The code to restart on SSU IP change is
      still enabled however.
    * Disable tunnel load testing, leaning back on the tiered selection for
      the time being.
    * Spattering of bugfixes
2006-09-09 01:41:57 +00:00
zzz
0f56ec8078 (zzz) oops remove duplicate 2006-09-07 23:26:53 +00:00
zzz
70ee1df2bf (zzz)
* i2psnark: Increase output timeout from 2 min to 4 min
    * i2psnark: Orphan debug msg cleanup
    * i2psnark: More web rate report cleanup
2006-09-07 23:22:12 +00:00
zzz
61a6a29bec cCVS: ---------------------------------------------------------------------- 2006-09-07 23:03:18 +00:00
zzz
678f7d8f72 (zzz)
* i2psnark: Implement basic partial-piece saves across connections
    * i2psnark: Implement keep-alive sending. This will keep non-i2psnark clients
      from dropping us for inactivity but also renders the 2-minute transmit-inactivity
      code in i2psnark ineffective. Will have to research why there is transmit but
      not receive inactivity code. With the current connection limit of 24 peers
      we aren't in any danger of keeping out new peers by keeping inactive ones.
    * i2psnark: Increase CHECK_PERIOD from 20 to 40 since nothing happens in 20 seconds
    * i2psnark: Fix dropped chunk handling
    * i2psnark: Web rate report cleanup
2006-09-06 06:32:53 +00:00
zzz
b92ee364bc (zzz)
* i2psnark: Report cleared trackerErr immediately
    * i2psnark: Add trackerErr reporting after previous success; retry more quickly
    * i2psnark: Set up new connections more quickly
    * i2psnark: Don't delay tracker fetch when setting up lots of connections
    * i2psnark: Reduce MAX_UPLOADERS from 12 to 4
2006-09-04 08:26:21 +00:00
zzz
aef19fcd38 (zzz) i2psnark: enable pipelining, set tunnel length default to 1 + 0-1 2006-09-04 06:01:53 +00:00
zzz
3b01df1d2c (zzz) Add rate reporting to i2psnark 2006-09-03 09:12:22 +00:00
4aed23b198 2006-09-03 Complication
* Limit form size in SusiDNS to avoid exceeding a POST size limit on postback
    * Print messages about addressbook size to give better overview
    * Enable delete function in published addressbook
2006-09-03 06:37:46 +00:00
03e8875c27 2006-08-21 Complication
* Fix error reporting discrepancy (thanks for helping notice, yojoe!)
2006-08-21 05:55:33 +00:00
48921a0875 2006-08-03 Complication
* news.xml update
2006-08-04 00:49:40 +00:00
633fabb09e 2006-08-03 jrandom
* Decrease the recently modified tunnel building timeout, though keep
      the scaling on their processing
2006-08-03 22:34:24 +00:00
bc42c26d94 2006-07-31 jrandom
* Increase the tunnel building timeout
    * Avoid a rare race (thanks bar!)
    * Fix the bandwidth capacity publishing code to factor in share percentage
      and outbound throttling (oops)
2006-08-01 02:26:52 +00:00
3c09ca3359 2006-07-29 Complication
* Treat NTP responses from unexpected stratums like failures
2006-07-30 05:08:20 +00:00
zzz
1e9e7dd345 (zzz) 0.6.1.24 2006-07-29 23:02:57 +00:00
034803add7 * 2006-07-28 0.6.1.24 released 2006-07-29 18:03:14 +00:00
b25bb053bb 2006-07-28 jrandom
* Don't try to reverify too many netDb entries at once (thanks
      cervantes and Complication!)
2006-07-29 04:41:15 +00:00
9bd0c79441 2006-07-28 jrandom
* Actually fix the threading deadlock issue in the netDb (removing
      the synchronized access to individual kbuckets while validating
      individual entries) (thanks cervantes, postman, frosk, et al!)
2006-07-29 01:11:50 +00:00
06b8670410 * 2006-07-27 0.6.1.23 released 2006-07-28 03:34:59 +00:00
6577ae499f 2006-07-27 jrandom
* Cut down NTCP connection establishments once we know the peer is skewed
      (rather than wait for full establishment before verifying)
    * Removed a lock on the stats framework when accessing rates, which
      shouldn't be a problem, assuming rates are created (pretty much) all at
      once and merely updated during the lifetime of the jvm.
2006-07-27 23:40:00 +00:00
54bc5485ec oops, thanks bar! 2006-07-27 07:06:55 +00:00
84b741ac98 2006-07-27 jrandom
* Further NTCP write status cleanup
    * Handle more oddly-timed NTCP disconnections (thanks bar!)
2006-07-27 06:20:25 +00:00
c48c419d74 quick prng workaround 2006-07-27 01:34:31 +00:00
fb2e795add 2006-07-26 jrandom
* When dropping a netDb router reference, only accept newer
      references as part of the update check
    * If we have been up for a while, don't accept really old
      router references (published 2 or more days ago)
    * Drop router references once they are no longer valid, even if
      they were allowed in due to the lax restrictions on startup
2006-07-27 01:04:59 +00:00
ec215777ec 2006-07-26 jrandom
* When dropping a netDb router reference, only accept newer
      references as part of the update check
    * If we have been up for a while, don't accept really old
      router references (published 2 or more days ago)
    * Drop router references once they are no longer valid, even if
      they were allowed in due to the lax restrictions on startup
2006-07-27 00:56:49 +00:00
d4e0f27c56 2006-07-26 jrandom
* Every time we create a new router identity, add an entry to the
      new "identlog.txt" text file in the I2P install directory.  For
      debugging purposes, publish the count of how many identities the
      router has cycled through, though not the identities itself.
    * Cleaned up the way the multitransport shitlisting worked, and
      added per-transport shitlists
    * When dropping a router reference locally, first fire a netDb
      lookup for the entry
    * Take the peer selection filters into account when organizing the
      profiles (thanks Complication!)
    * Avoid some obvious configuration errors for the NTCP transport
      (invalid ports, "null" ip, etc)
    * Deal with some small NTCP bugs found in the wild (unresolveable
      hosts, strange network discons, etc)
    * Send our netDb info to peers we have direct NTCP connections to
      after each 6-12 hours of connection uptime
    * Clean up the NTCP reading and writing queue logic to avoid some
      potential delays
    * Allow people to specify the IP that the SSU transport binds on
      locally, via the advanced config "i2np.udp.bindInterface=1.2.3.4"
2006-07-26 06:36:18 +00:00
e1c686baa6 2006-07-18 Complication
* URL and date fix in news.xml
2006-07-18 23:35:54 +00:00
d57af1aef4 remove 1.5ism 2006-07-18 20:20:08 +00:00
a52dd57215 * 2006-07-18 0.6.1.22 released
2006-07-18  jrandom
    * Add a failsafe to the NTCP transport to make sure we keep
      pumping writes when we should.
    * Properly reallow 16-32KBps routers in the default config
      (thanks Complication!)
2006-07-18 20:08:00 +00:00
65138357d3 2006-07-16 Complication
* Collect tunnel build agree/reject/expire statistics
      for each bandwidth tier of peers (and peers of unknown tiers,
      even if those shouldn't exist)
2006-07-16 17:20:46 +00:00
f6320696dd 2006-07-14 jrandom
* Improve the multitransport shitlisting (thanks Complication!)
    * Allow routers with a capacity of 16-32KBps to be used in tunnels under
      the default configuration (thanks for the stats Complication!)
    * Properly allow older router references to load on startup
      (thanks bar, Complication, et al!)
    * Add a new "i2p.alwaysAllowReseed" advanced config property, though
      hopefully today's changes should make this unnecessary (thanks void!)
    * Improved NTCP buffering
    * Close NTCP connections if we are too backlogged when writing to them
2006-07-14 18:08:44 +00:00
900d8a2026 oops, test method. thanks cervantes 2006-07-07 19:04:24 +00:00
ccc9a87e8c unnecessary 2006-07-07 18:59:16 +00:00
208634e5de 2006-07-04 jrandom
* New NIO-based tcp transport (NTCP), enabled by default for outbound
      connections only.  Those who configure their NAT/firewall to allow
      inbound connections and specify the external host and port
      (dyndns/etc is ok) on /config.jsp can receive inbound connections.
      SSU is still enabled for use by default for all users as a fallback.
    * Substantial bugfix to the tunnel gateway processing to transfer
      messages sequentially instead of interleaved
    * Renamed GNU/crypto classes to avoid name clashes with kaffe and other
      GNU/Classpath based JVMs
    * Adjust the Fortuna PRNG's pooling system to reduce contention on
      refill with a background thread to refill the output buffer
    * Add per-transport support for the shitlist
    * Add a new async pumped tunnel gateway to reduce tunnel dispatcher
      contention
2006-07-04 21:17:44 +00:00
3d07205c9d 2006-07-01 Complication
* Ensure that the I2PTunnel web interface won't update tunnel settings
      for shared clients when a non-shared client is modified
      (thanks for spotting, BarkerJr!)
2006-07-01 22:44:34 +00:00
zzz
f0a424a93f (zzz) .21, 6-13 mtg 2006-06-15 22:15:09 +00:00
f9b59ee07d 2006-06-14 cervantes
* Small tweak to I2PTunnel CSS, so it looks better with desktops
      that use Bitstream Vera fonts @ 96 dpi
2006-06-14 05:24:34 +00:00
b92b9d2618 * 2006-06-14 0.6.1.21 released 2006-06-14 02:17:40 +00:00
a3db9429a7 2006-06-13 jrandom
* Use a minimum uptime of 2 hours, not 4 (oops)
2006-06-13 23:29:51 +00:00
291a5c9578 2006-06-13 jrandom
* Cut down the proactive rejections due to queue size - if we are
      at the point of having decrypted the request off the queue, might
      as well let it through, rather than waste that decryption
2006-06-13 09:38:48 +00:00
0a3281c279 2006-06-11 Kloug
* Bugfix to the I2PTunnel IRC filter to support multiple concurrent
      outstanding pings/pongs
2006-06-11 19:48:37 +00:00
23f30ba576 2006-06-10 jrandom
* Further reduction in proactive rejections
2006-06-10 20:14:57 +00:00
f3de85c4de 2006-06-09 jrandom
* Don't let the pending tunnel request queue grow beyond reason
      (letting things sit for up to 30s when they fail after 10s
      seems a bit... off)
2006-06-10 00:34:44 +00:00
a3a4888e0b 2006-06-08 jrandom
* Be more conservative in the proactive rejections
2006-06-09 01:02:40 +00:00
6fd7881f8e thanks bar 2006-06-05 06:41:11 +00:00
381f716769 2006-06-04 Complication
* Stop sending a blank line before USER in susimail.
      Seemed to break in rare cases, thanks for reporting, Brachtus!
2006-06-05 01:33:03 +00:00
f2078e1523 * 2006-06-04 0.6.1.20 released
2006-06-04  jrandom
    * Reduce the SSU ack frequency
    * Tweaked the tunnel rejection settings to reject less aggressively
2006-06-04 22:25:08 +00:00
f2fb87c88b 2006-05-31 jrandom
* Only send netDb searches to the floodfill peers for the time being
    * Add some proof of concept filters for tunnel participation.  By default,
      it will skip peers with an advertised bandwith of less than 32KBps or
      an advertised uptime of less than 2 hours.  If this is sufficient, a
      safer implementation of these filters will be implemented.
2006-05-31 23:23:37 +00:00
fcbea19478 2006-05-30 Complication
* weekly news.xml update
2006-05-31 03:19:24 +00:00
92f25bd4fa 2006-05-18 Complication
* news.xml update
2006-05-19 00:17:10 +00:00
85c2c11217 * 2006-05-18 0.6.1.19 released
2006-05-18  jrandom
    * Made the SSU ACKs less frequent when possible
2006-05-18 22:31:06 +00:00
de1ca4aea4 2006-05-17 Complication
* Fix some oversights in my previous changes:
      adjust some loglevels, make a few statements less wasteful,
      make one comparison less confusing and more likely to log unexpected values
2006-05-18 03:42:55 +00:00
a0f865fb99 2006-05-17 jrandom
* Make the peer page sortable
    * SSU modifications to cut down on unnecessary connection failures
2006-05-18 03:00:48 +00:00
2c3fea5605 2006-05-16 jrandom
* Further shitlist randomizations
    * Adjust the stats monitored for detecting cpu overload when dropping new
      tunnel requests
2006-05-16 18:34:08 +00:00
ba1d88b5c9 2006-05-15 jrandom
* Add a load dependent throttle on the pending inbound tunnel request
      backlog
    * Increased the tunnel test failure slack before killing a tunnel
2006-05-15 17:33:02 +00:00
2ad715c668 2006-05-13 Complication
* Update the build number too
2006-05-14 05:11:36 +00:00
5f17557e54 2006-05-13 Complication
* Separate growth factors for tunnel count and tunnel test time
    * Reduce growth factors, so probabalistic throttle would activate
    * Square probAccept values to decelerate stronger when far from average
    * Create a bandwidth stat with approximately 15-second half life
    * Make allowTunnel() check the 1-second bandwidth for overload
      before doing allowance calculations using 15-second bandwidth
    * Tweak the overload detector in BuildExecutor to be more sensitive
      for rising edges, add ability to initiate tunnel drops
    * Add a function to seek and drop the highest-rate participating tunnel,
      keeping a fixed+random grace period between such drops.
      It doesn't seem very effective, so disabled by default
      ("router.dropTunnelsOnOverload=true" to enable)
2006-05-14 04:52:44 +00:00
2ad5a6f907 2006-05-11 jrandom
* PRNG bugfix (thanks cervantes and Complication!)
2006-05-12 03:31:44 +00:00
0920462060 2006-05-09 Complication
* weekly news.xml update
2006-05-10 02:38:42 +00:00
870e94e184 * 2006-05-09 0.6.1.18 released
2006-05-09  jrandom
    * Further tunnel creation timeout revamp
2006-05-09 21:17:17 +00:00
6b0d507644 2006-05-07 Complication
* Fix problem whereby repeated calls to allowed() would make
      the 1-tunnel exception permit more than one concurrent build
2006-05-08 03:19:46 +00:00
70cf9e4ca7 2006-05-06 jrandom
* Readjust the tunnel creation timeouts to reject less but fail earlier,
      while tracking the extended timeout events.
2006-05-06 20:27:34 +00:00
2a3974c71d 2006-05-04 jrandom
* Short circuit a highly congested part of the stat logging unless its
      required (may or may not help with a synchronization issue reported by
      andreas)
2006-05-04 23:08:48 +00:00
46ac9292e8 2006-05-03 Complication
* Allow a single build attempt to proceed despite 1-minute overload
      only if the 1-second rate shows enough spare bandwidth
      (e.g. overload has already eased)
2006-05-03 11:13:26 +00:00
4307097472 2006-05-02 Complication
* Correct a misnamed property in SummaryHelper.java
      to avoid confusion
    * Make the maximum allowance of our own concurrent
      tunnel builds slightly adaptive: one concurrent build per 6 KB/s
      within the fixed range 2..10
    * While overloaded, try to avoid completely choking our own build attempts,
      instead prefer limiting them to 1
2006-05-03 04:30:26 +00:00
ed3fdaf4f1 2006-05-02 Complication
* Fixed URL in previous update, sorry
2006-05-03 02:11:06 +00:00
378a9a8f5c 2006-05-02 Complication
* Weekly news.xml update
2006-05-03 02:03:01 +00:00
4ef6180455 2006-05-01 jrandom
* Adjust the tunnel build timeouts to cut down on expirations, and
      increased the SSU connection establishment retransmission rate to
      something less glacial.
    * For the first 5 minutes of uptime, be less aggressive with tunnel
      exploration, opting for more reliable peers to start with.
2006-05-01 22:40:21 +00:00
d4970e23c0 2006-05-01 jrandom
* Fix for a netDb lookup race (thanks cervantes!)
2006-05-01 19:09:02 +00:00
0c9f165016 fix typos 2006-05-01 15:39:37 +00:00
be3a899ecb 2006-04-27 jrandom
* Avoid a race in the message reply registry (thanks cervantes!)
2006-04-28 00:31:20 +00:00
7a6a749004 2006-04-27 jrandom
* Fixed the tunnel expiration desync code (thanks Complication!)
2006-04-28 00:08:40 +00:00
17271ee3f0 2006-04-25 Complication
* weekly news.xml update
2006-04-26 02:30:05 +00:00
99bcfa90df 2006-04-24 Complication
* Update news.xml to reflect 0.6.1.17
2006-04-24 12:43:25 +00:00
eb36e993c1 * 2006-04-23 0.6.1.17 released 2006-04-23 21:06:12 +00:00
zzz
e5eca5fa45 zzz update 2006-04-22 20:37:21 +00:00
8cba2f4236 2006-04-19 jrandom
* Adjust how we pick high capacity peers to allow the inclusion of fast
      peers (the previous filter assumed an old usage pattern)
    * New set of stats to help track per-packet-type bandwidth usage better
    * Cut out the proactive tail drop from the SSU transport, for now
    * Reduce the frequency of tunnel build attempts while we're saturated
    * Don't drop tunnel requests as easily - prefer to explicitly reject them
2006-04-19 17:46:51 +00:00
40d5ed31ac 2006-04-15 Complication
* Update news.xml to reflect 0.6.1.16
2006-04-15 17:25:50 +00:00
181275fe35 * 2006-04-15 0.6.1.16 released 2006-04-15 07:58:12 +00:00
23d8c01ce7 2006-04-15 jrandom
* Adjust the proactive tunnel request dropping so we will reject what we
      can instead of dropping so much (but still dropping if we get too far
      overloaded)
2006-04-15 07:15:19 +00:00
de83944486 2006-04-14 jrandom
* 0 isn't very random
    * Adjust the tunnel drop to be more reasonable
2006-04-14 20:24:07 +00:00
90cd7ff23a 2006-04-14 jrandom
* -28.00230115311259 is not between 0 and 1 in any universe I know.
    * Made the bw-related tunnel join throttle much simpler
2006-04-14 18:04:11 +00:00
8d0a9b4ccd 2006-04-14 jrandom
* Make some more stats graphable, and allow some internal tweaking on the
      tunnel pairing for creation and testing.
2006-04-14 11:40:35 +00:00
230d4cd23f * 2006-04-13 0.6.1.15 released 2006-04-13 12:40:21 +00:00
e9b6fcc0a4 2006-04-12 jrandom
* Added a further failsafe against trying to queue up too many messages to
      a peer.
2006-04-13 04:22:06 +00:00
8fcb871409 2006-04-12 jrandom
* Watch out for failed syndie index fetches (thanks bar!)
2006-04-12 06:49:01 +00:00
83bef43fd5 2006-04-11 jrandom
* Throttling improvements on SSU - throttle all transmissions to a peer
      when we are retransmitting, not just retransmissions.  Also, if
      we're already retransmitting to a peer, probabalistically tail drop new
      messages targetting that peer, based on the estimated wait time before
      transmission.
    * Fixed the rounding error in the inbound tunnel drop probability.
2006-04-11 13:39:06 +00:00
b4fc6ca31b 2006-04-10 jrandom
* Include a combined send/receive graph (good idea cervantes!)
    * Proactively drop inbound tunnel requests probabalistically as the
      estimated queue time approaches our limit, rather than letting them all
      through up to that limit.
2006-04-10 05:37:28 +00:00
ab3f1b708d 2006-04-08 jrandom
* Stat summarization fix (removing the occational holes in the jrobin
      graphs)
2006-04-09 01:14:08 +00:00
c76402a160 2006-04-08 jrandom
* Process inbound tunnel requests more efficiently
    * Proactively drop inbound tunnel requests if the queue before we'd
      process it in is too long (dynamically adjusted by cpu load)
    * Adjust the tunnel rejection throttle to reject requeusts when we have to
      proactively drop too many requests.
    * Display the number of pending inbound tunnel join requests on the router
      console (as the "handle backlog")
    * Include a few more stats in the default set of graphs
2006-04-08 06:15:43 +00:00
a50c73aa5e 2006-04-06 jrandom
* Fix for a bug in the new irc ping/pong filter (thanks Complication!)
2006-04-07 01:26:32 +00:00
5aa66795d2 2006-04-06 jrandom
* Fixed a typo in the reply cleanup code
2006-04-06 10:33:44 +00:00
ac3c2d2b15 * 2006-04-05 0.6.1.14 released 2006-04-05 17:08:04 +00:00
072a45e5ce 2006-04-05 jrandom
* Cut down on the time that we allow a tunnel creation request to sit by
      without response, and reject tunnel creation requests that are lagged
      locally.  Also switch to a bounded FIFO instead of a LIFO
    * Threading tweaks for the message handling (thanks bar!)
    * Don't add addresses to syndie with blank names (thanks Complication!)
    * Further ban clearance
2006-04-05 04:40:00 +00:00
1ab14e52d2 2006-04-04 Complication
* weekly news.xml update
2006-04-05 03:06:00 +00:00
9a820961a2 2006-04-05 jrandom
* Fix during the ssu handshake to avoid an unnecessary failure on
      packet retransmission (thanks ripple!)
    * Fix during the SSU handshake to use the negotiated session key asap,
      rather than using the intro key for more than we should (thanks ripple!)
    * Fixes to the message reply registry (thanks Complication!)
    * More comprehensive syndie banning (for repeated pushes)
    * Publish the router's ballpark bandwidth limit (w/in a power of 2), for
      testing purposes
    * Put a floor back on the capacity threshold, so too many failing peers
      won't cause us to pick very bad peers (unless we have very few good
      ones)
    * Bugfix to cut down on peers using introducers unneessarily (thanks
      Complication!)
    * Reduced the default streaming lib message size to fit into a single
      tunnel message, rather than require 5 tunnel messages to be transferred
      without loss before recomposition.  This reduces throughput, but should
      increase reliability, at least for the time being.
    * Misc small bugfixes in the router (thanks all!)
    * More tweaking for Syndie's CSS (thanks Doubtful Salmon!)
2006-04-04 12:20:32 +00:00
764149aef3 2006-04-01 jrandom
* Take out the router watchdog's teeth (don't restart on leaseset failure)
    * Filter the IRC ping/pong messages, as some clients send unsafe
      information in them (thanks aardvax and dust!)
2006-04-03 10:07:22 +00:00
1b3ad31bff 2006-04-01 jrandom
* Take out the router watchdog's teeth (don't restart on leaseset failure)
2006-04-01 19:05:35 +00:00
15e6c27c04 2006-03-30 jrandom
* Substantially reduced the lock contention in the message registry (a
      major hotspot that can choke most threads).  Also reworked the locking
      so we don't need per-message timer events
    * No need to have additional per-peer message clearing, as they are
      either unregistered individually or expired.
    * Include some of the more transient tunnel throttling
2006-03-30 07:26:43 +00:00
8b707e569f 2006-03-28 Complication
* weekly news.xml update
2006-03-29 02:09:23 +00:00
e4c4b24c61 2006-03-26 Complication
* announce 0.6.1.3
2006-03-27 03:24:38 +00:00
031636e607 * 2006-03-26 0.6.1.13 released 2006-03-26 23:23:49 +00:00
b5c0d77c69 2006-03-25 jrandom
* Added a simple purge and ban of syndie authors, shown as the
      "Purge and ban" button on the addressbook for authors that are already
      on the ignore list.  All of their entries and metadata are deleted from
      the archive, and the are transparently filtered from any remote
      syndication (so no user on the syndie instance will pull any new posts
      from them)
    * More strict tunnel join throtting when congested
2006-03-25 23:50:48 +00:00
d489caa88c 2006-03-24 jrandom
* Try to desync tunnel building near startup (thanks Complication!)
    * If we are highly congested, fall back on only querying the floodfill
      netDb peers, and only storing to those peers too
    * Cleaned up the floodfill-only queries
2006-03-24 20:53:28 +00:00
2a24029acf 2006-03-21 Complication
* Weekly news.xml update
2006-03-22 02:15:13 +00:00
c5aab8c750 2006-03-21 jrandom
* Avoid a very strange (unconfirmed) bug that people using the systray's
      browser picker dialog could cause by disabling the GUI-based browser
      picker.
    * Cut down on subsequent streaming lib reset packets transmitted
    * Use a larger MTU more often
    * Allow netDb searches to query shitlisted peers, as the queries are
      indirect.
    * Add an option to disable non-floodfill netDb searches (non-floodfill
      searches are used by default, but can be disabled by adding
      netDb.floodfillOnly=true to the advanced config)
2006-03-21 23:11:32 +00:00
343748111a 2006-03-20 jrandom
* Fix to allow for some slack when coalescing stats
    * Workaround some oddball errors
2006-03-20 05:39:54 +00:00
c5ddfabfe9 2006-03-20 jrandom
* Fix to allow for some slack when coalescing stats
    * Workaround some oddball errors
2006-03-20 05:31:09 +00:00
1ef33906ed 2006-03-18 jrandom
* Added a new graphs.jsp page to show all of the stats being harvested
2006-03-19 00:23:23 +00:00
f3849a22ad 2006-03-18 jrandom
* Made the netDb search load limitations a little less stringent
    * Add support for specifying the number of periods to be plotted on the
      graphs - e.g. to plot only the last hour of a stat that is averaged at
      the 60 second period, add &periodCount=60
2006-03-18 23:09:35 +00:00
b03ff21d3b 2006-03-17 jrandom
* Add support for graphing the event count as well as the average stat
      value (done by adding &showEvents=true to the URL).  Also supports
      hiding the legend (&hideLegend=true), the grid (&hideGrid=true), and
      the title (&hideTitle=true).
    * Removed an unnecessary arbitrary filter on the profile organizer so we
      can pick high capacity and fast peers more appropriately
2006-03-17 23:46:00 +00:00
52094b10c9 aych tee emm ell smells 2006-03-16 22:37:57 +00:00
fc927efaa3 2006-03-16 jrandom
* Integrate basic hooks for jrobin (http://jrobin.org) into the router
      console.  Selected stats can be harvested automatically and fed into
      in-memory RRD databases, and those databases can be served up either as
      PNG images or as RRDtool compatible XML dumps (see oldstats.jsp for
      details).  A base set of stats are harvested by default, but an
      alternate list can be specified by setting the 'stat.summaries' list on
      the advanced config.  For instance:
      stat.summaries=bw.recvRate.60000,bw.sendRate.60000
    * HTML tweaking for the general config page (thanks void!)
    * Odd NPE fix (thanks Complication!)
2006-03-16 21:52:09 +00:00
65dc803fb7 2006-03-16 jrandom
* Integrate basic hooks for jrobin (http://jrobin.org) into the router
      console.  Selected stats can be harvested automatically and fed into
      in-memory RRD databases, and those databases can be served up either as
      PNG images or as RRDtool compatible XML dumps (see oldstats.jsp for
      details).  A base set of stats are harvested by default, but an
      alternate list can be specified by setting the 'stat.summaries' list on
      the advanced config.  For instance:
      stat.summaries=bw.recvRate.60000,bw.sendRate.60000
    * HTML tweaking for the general config page (thanks void!)
    * Odd NPE fix (thanks Complication!)
2006-03-16 21:45:17 +00:00
349adf6690 2006-03-15 Complication
* Trim out an old, inactive IP second-guessing method
      (thanks for spotting, Anonymous!)
2006-03-16 00:49:22 +00:00
2c843fd818 2006-03-15 jrandom
* Further stat cleanup
    * Keep track of how many peers we are actively trying to communicate with,
      beyond those who are just trying to communicate with us.
    * Further router tunnel participation throttle revisions to avoid spurious
      rejections
    * Rate stat display cleanup (thanks ripple!)
    * Don't even try to send messages that have been queued too long
2006-03-15 22:36:10 +00:00
863b511cde 2006-03-15 jrandom
* Further stat cleanup
    * Keep track of how many peers we are actively trying to communicate with,
      beyond those who are just trying to communicate with us.
    * Further router tunnel participation throttle revisions to avoid spurious
      rejections
    * Rate stat display cleanup (thanks ripple!)
    * Don't even try to send messages that have been queued too long
2006-03-15 22:26:42 +00:00
zzz
c417e7c237 2006-03-14 zzz update 2006-03-15 06:02:07 +00:00
zzz
1822c0d7d8 2006-03-07 zzz update 2006-03-09 02:19:42 +00:00
zzz
94c1c32b51 2006-03-05 zzz
* Remove the +++--- from the logs on i2psnark startup
2006-03-06 01:57:47 +00:00
deb35f4af4 2006-03-05 jrandom
* HTML fixes in Syndie to work better with opera (thanks shaklen!)
    * Give netDb lookups to floodfill peers more time, as they are much more
      likely to succeed (thereby cutting down on the unnecessary netDb
      searches outside the floodfill set)
    * Fix to the SSU IP detection code so we won't use introducers when we
      don't need them (thanks Complication!)
    * Add a brief shitlist to i2psnark so it doesn't keep on trying to reach
      peers given to it
    * Don't let netDb searches wander across too many peers
    * Don't use the 1s bandwidth usage in the tunnel participation throttle,
      as its too volatile to have much meaning.
    * Don't bork if a Syndie post is missing an entry.sml
2006-03-05 17:07:07 +00:00
883150f943 2006-03-05 Complication
* Reduce exposed statistical information,
      to make build and uptime tracking more expensive
2006-03-05 07:44:59 +00:00
717d1b97b2 2006-03-04 Complication
* Fix the announce URL of orion's tracker in Snark sources
2006-03-04 23:50:01 +00:00
e62135eacc 2006-03-03 Complication
* Explicit check for an index out of bounds exception while parsing
      an inbound IRC command (implicit check was there already)
2006-03-04 03:04:06 +00:00
2c6d953359 2006-03-01 jrandom
* More aggressive tunnel throttling as we approach our bandwidth limit,
      and throttle based off periods wider than 1 second.
    * Included Doubtful Salmon's syndie stylings (thanks!)
2006-03-01 23:01:20 +00:00
zzz
2b79e2df3f 2006-02-28 zzz update 2006-03-01 04:11:16 +00:00
zzz
fab6e421b8 2006-02-27 zzz
* Update error page templates to add \r, Connection: close, and
      Proxy-connection: close.
2006-02-28 03:55:18 +00:00
589cbd675a * 2006-02-27 0.6.1.12 released
2006-02-27  jrandom
    * Adjust the jbigi.jar to use the athlon-optimized jbigi on windows/amd64
      machines, rather than the generic jbigi (until we have an athlon64
      optimized version)
2006-02-27 19:05:40 +00:00
c486f5980a * 2006-02-27 0.6.1.12 released
2006-02-27  jrandom
    * Adjust the jbigi.jar to use the athlon-optimized jbigi on windows/amd64
      machines, rather than the generic jbigi (until we have an athlon64
      optimized version)
2006-02-27 18:51:31 +00:00
eee21aa301 2006-02-26 jrandom
* Switch from the bouncycastle to the gnu-crypto implementation for
      SHA256, as benchmarks show a 10-30% speedup.
    * Removed some unnecessary object caches
    * Don't close i2psnark streams prematurely
2006-02-26 21:30:56 +00:00
zzz
a2854cf6f6 2006-02-25 zzz spelling fix 2006-02-25 21:51:46 +00:00
62b7cf64da 2006-02-25 jrandom
* Made the Syndie permalinks in the thread view point to the blog view
    * Disabled TCP again (since the live net seems to be doing well w/out it)
    * Fix the message time on inbound SSU establishment (thanks zzz!)
    * Don't be so aggressive with parallel tunnel creation when a tunnel pool
      just starts up
2006-02-25 20:41:51 +00:00
7b2a435aad 2006-02-24 jrandom
* Rounding calculation cleanup in the stats, and avoid an uncontested
      mutex (thanks ripple!)
    * SSU handshake cleanup to help force incompatible peers to stop nagging
      us by both not giving them an updated reference to us and by dropping
      future handshake packets from them.
2006-02-24 09:35:52 +00:00
3d8d21e543 2006-02-23 jrandom
* Increase the SSU retransmit ceiling (for slow links)
    * Estimate the sender's SSU MTU (to help see if we agree)
2006-02-23 14:38:39 +00:00
8b7958cff2 2006-02-22 jrandom
* Fix to properly profile tunnel joins (thanks Ragnarok, frosk, et al!)
    * More aggressive poor-man's PMTU, allowing larger MTUs on less reliable
      links
    * Further class validator refactorings
2006-02-23 08:08:37 +00:00
7bb792836d 2006-02-22 jrandom
* Fix to properly profile tunnel joins (thanks Ragnarok, frosk, et al!)
    * More aggressive poor-man's PMTU, allowing larger MTUs on less reliable
      links
    * Further class validator refactorings
2006-02-23 01:48:47 +00:00
03f509ca54 2006-02-22 jrandom
* Handle a rare race under high bandwidth situations in the SSU transport
    * Minor refactoring so we don't confuse sun's 1.6.0-b2 validator
2006-02-22 14:54:22 +00:00
5f05631936 2006-02-21 Complication
* Reactivate TCP tranport by default, in addition to re-allowing
2006-02-22 06:19:19 +00:00
zzz
5cfedd4c8b 2006-02-21 zzz update 2006-02-22 03:34:02 +00:00
zzz
269fec64a5 2006-02-21 zzz
announce 0.6.1.11
2006-02-21 20:12:14 +00:00
f63c6f4717 * 2006-02-21 0.6.1.11 released 2006-02-21 15:20:17 +00:00
b4c495531a 2006-02-21 jrandom
* Throttle the outbound SSU establishment queue, so it doesn't fill up the
      heap when backlogged (and so that the messages queued up on it don't sit
      there forever)
    * Further SSU memory cleanup
    * Clean up the address regeneration code so it knows when to rebuild the
      local info more precisely.
2006-02-21 13:31:18 +00:00
9990126e3e 2006-02-20 jrandom
* Throttle the outbound SSU establishment queue, so it doesn't fill up the
      heap when backlogged (and so that the messages queued up on it don't sit
      there forever)
    * Further SSU memory cleanup
2006-02-21 02:02:48 +00:00
ac8436a8eb 2006-02-20 jrandom
* Properly enable TCP this time (oops)
    * Deal with multiple form handlers on the same page in the console without
      being too annoying (thanks blubb and bd_!)
2006-02-20 18:12:47 +00:00
dee79dfb1c 2006-02-20 jrandom
* Reenable the TCP transport as a fallback (we'll continue to muck with
      debugging SSU-only elsewhere)
2006-02-20 16:42:29 +00:00
9b4e6f475d no need to include this stuff in the updates (they havent changed) 2006-02-20 14:28:09 +00:00
7672ba23d1 2006-02-20 jrandom
* Major SSU and router tuning to reduce contention, memory usage, and GC
      churn.  There are still issues to be worked out, but this should be a
      substantial improvement.
    * Modified the optional netDb harvester task to support choosing whether
      to use (non-anonymous) direct connections or (anonymous) exploratory
      tunnels to do the harvesting.  Harvesting itself is enabled via the
      advanced config "netDb.shouldHarvest=true" (default is false) and the
      connection type can be chosen via "netDb.harvestDirectly=false" (default
      is false).
2006-02-20 14:27:38 +00:00
4b77ddedcc 2006-02-20 jrandom
* Major SSU and router tuning to reduce contention, memory usage, and GC
      churn.  There are still issues to be worked out, but this should be a
      substantial improvement.
    * Modified the optional netDb harvester task to support choosing whether
      to use (non-anonymous) direct connections or (anonymous) exploratory
      tunnels to do the harvesting.  Harvesting itself is enabled via the
      advanced config "netDb.shouldHarvest=true" (default is false) and the
      connection type can be chosen via "netDb.harvestDirectly=false" (default
      is false).
2006-02-20 14:19:52 +00:00
222af6c090 * Added pruning of suckers history (it used to grow indefinitely). 2006-02-20 05:08:59 +00:00
8e879cb646 2006-02-19 jrandom
* Moved the current net's reseed URL to a different location than where
      the old net looks (dev.i2p.net/i2pdb2/ vs .../i2pdb/)
    * More aggressively expire inbound messages (on receive, not just on send)
    * Add in a hook for breaking backwards compatibility in the SSU wire
      protocol directly by including a version as part of the handshake.  The
      version is currently set to 0, however, so the wire protocol from this
      build is compatible with all earlier SSU implementations.
    * Increased the number of complete message readers, cutting down
      substantially on the delay processing inbound messages.
    * Delete the message history file on startup
    * Reworked the restart/shutdown display on the console (thanks bd_!)
2006-02-19 12:40:03 +00:00
65975df1be 2006-02-19 jrandom
* Moved the current net's reseed URL to a different location than where
      the old net looks (dev.i2p.net/i2pdb2/ vs .../i2pdb/)
    * More aggressively expire inbound messages (on receive, not just on send)
    * Add in a hook for breaking backwards compatibility in the SSU wire
      protocol directly by including a version as part of the handshake.  The
      version is currently set to 0, however, so the wire protocol from this
      build is compatible with all earlier SSU implementations.
    * Increased the number of complete message readers, cutting down
      substantially on the delay processing inbound messages.
    * Delete the message history file on startup
    * Reworked the restart/shutdown display on the console (thanks bd_!)
2006-02-19 12:29:57 +00:00
c94de2fbb5 2006-02-18 jrandom
* Migrate the outbound packets from a central component to the individual
      per-peer components, substantially cutting down on lock contention when
      dealing with higher degrees.
    * Load balance the outbound SSU transfers evenly across peers, rather than
      across messages (so peers with few messages won't be starved by peers
      with many).
    * Reduce the frequency of router info rebuilds (thanks bar!)
2006-02-19 03:58:08 +00:00
5aa335740a 2006-02-18 jrandom
* Migrate the outbound packets from a central component to the individual
      per-peer components, substantially cutting down on lock contention when
      dealing with higher degrees.
    * Load balance the outbound SSU transfers evenly across peers, rather than
      across messages (so peers with few messages won't be starved by peers
      with many).
    * Reduce the frequency of router info rebuilds (thanks bar!)
2006-02-19 03:22:31 +00:00
1202751359 2006-02-18 jrandom
* Add a new AIMD throttle in SSU to control the number of concurrent
      messages being sent to a given peer, in addition to the throttle on the
      number of concurrent bytes to that peer.
    * Adjust the existing SSU outbound queue to throttle based on the queue's
      lag, not an arbitrary number of packets.
2006-02-18 06:48:48 +00:00
34fcf53d87 2006-02-18 jrandom
* Add a new AIMD throttle in SSU to control the number of concurrent
      messages being sent to a given peer, in addition to the throttle on the
      number of concurrent bytes to that peer.
    * Adjust the existing SSU outbound queue to throttle based on the queue's
      lag, not an arbitrary number of packets.
2006-02-18 06:38:30 +00:00
9ddc632b9f 2006-02-17 jrandom
* Properly fix the build request queue throttling, using queue age to
      detect congestion, rather than queue size.
2006-02-17 22:29:28 +00:00
941b65eb32 2006-02-17 jrandom
* Disable the message history log file by default (duh - feel free to
      delete messageHistory.txt after upgrading.  thanks deathfatty!)
    * Limit the size of the inbound tunnel build request queue so we don't
      get an insane backlog of requests that we're bound to reject, and adjust
      the queue processing so we keep on churning through them when we've got
      a backlog.
    * Small fixes for the multiuser syndie operation (thanks Complication!)
    * Renamed modified PRNG classes that were imported from gnu-crypto so we
      don't conflict with JVMs using that as a JCE provider (thanks blx!)
2006-02-17 09:16:00 +00:00
8c9167464b 2006-02-17 jrandom
* Disable the message history log file by default (duh - feel free to
      delete messageHistory.txt after upgrading.  thanks deathfatty!)
    * Limit the size of the inbound tunnel build request queue so we don't
      get an insane backlog of requests that we're bound to reject, and adjust
      the queue processing so we keep on churning through them when we've got
      a backlog.
    * Small fixes for the multiuser syndie operation (thanks Complication!)
    * Renamed modified PRNG classes that were imported from gnu-crypto so we
      don't conflict with JVMs using that as a JCE provider (thanks blx!)
2006-02-17 09:07:53 +00:00
5b94965983 * 2006-02-16 0.6.1.10 released 2006-02-16 20:44:07 +00:00
3226ea5bf6 (1.188) added downloads.legion.i2p, politguy.i2p, ninja.i2p 2006-02-16 20:24:20 +00:00
84a24784e4 so old its not funny 2006-02-16 11:30:46 +00:00
71d3fa6b8c disable by default 2006-02-16 11:20:32 +00:00
9e00dbaafd 2006-02-16 jrandom
* Add a new toggle to the web config to enable/disable the load testing
2006-02-16 10:33:29 +00:00
2e9e0c64d4 2006-02-16 jrandom
* Dropped much of the abandonware from the apps/ directory
2006-02-16 09:45:22 +00:00
fde3f1ce7d not used 2006-02-16 09:40:12 +00:00
321c560648 drop most of the abandonware 2006-02-16 09:33:53 +00:00
d2ddca7d64 *cough* 2006-02-16 09:13:48 +00:00
fb17e70f12 2006-02-16 jrandom
* Bugfix to the I2PTunnel web config to properly accept i2cp port settings
    * Initial sucker refactoring to simplify reuse of the html parsing
    * Beginnings of hooks to push imported rss/atom out to remote syndie
      archives automatically (though not enabled currently)
    * Further SSU peer test cleanup
2006-02-16 08:36:22 +00:00
79f934fe17 2006-02-16 jrandom
* Bugfix to the I2PTunnel web config to properly accept i2cp port settings
    * Initial sucker refactoring to simplify reuse of the html parsing
    * Beginnings of hooks to push imported rss/atom out to remote syndie
      archives automatically (though not enabled currently)
    * Further SSU peer test cleanup
2006-02-16 08:24:07 +00:00
3d76df6af3 thanks zzz 2006-02-16 06:16:37 +00:00
zzz
d5c36f7f4e 2006-02-15 zzz fix release # 2006-02-15 17:56:59 +00:00
zzz
41ac628744 2006-02-15 zzz update 2006-02-15 17:49:40 +00:00
41e5e1a094 "&amp;amp;" sucks 2006-02-15 14:16:16 +00:00
74edc3fa7d 2006-02-15 jrandom
* Add in per-blog RSS feeds to Syndie
    * Upgraded sucker's ROME dependency to 0.8, bundling sucked enclosures
      with the posts, marking additional attachments as Media RSS enclosures
      (http://search.yahoo.com/mrss/), since RSS only supports one enclosure
      per item.
    * Don't allow the default syndie user to be set to something invalid if
      its in single user mode.
2006-02-15 13:42:20 +00:00
3a26218b5a just for clarity 2006-02-15 13:41:47 +00:00
687abd9427 2006-02-15 jrandom
* Add in per-blog RSS feeds to Syndie
    * Upgraded sucker's ROME dependency to 0.8, bundling sucked enclosures
      with the posts, marking additional attachments as Media RSS enclosures
      (http://search.yahoo.com/mrss/), since RSS only supports one enclosure
      per item.
    * Don't allow the default syndie user to be set to something invalid if
      its in single user mode.
2006-02-15 13:36:28 +00:00
113fbc1df3 2006-02-15 jrandom
* Merged in the i2p_0_6_1_10_PRE branch to the trunk, so CVS HEAD is no
      longer backwards compatible (and should not be used until 0.6.1.1 is
      out)
2006-02-15 05:33:17 +00:00
zzz
1374ea0ea1 2006-02-07 zzz update 2006-02-08 05:59:10 +00:00
zzz
424e55d3b2 2006-02-01 (zzz) 1-31 update 2006-02-02 02:59:43 +00:00
fde4f579f4 file BuildRequestor.java was initially added on branch i2p_0_6_1_10_PRE. 2006-02-02 01:32:33 +00:00
2d651a41f0 2006-01-25 jrandom
* Run the peer profile coalescing/reorganization outside the job queue
      (on one of the timers), to cut down on some job queue congestion.  Also,
      trim old profiles while running, not just when starting up.
    * Slightly more sane intra-floodfill-node netDb activity (only flood new
      entries)
    * Workaround in the I2PTunnelHTTPServer for some bad requests (though the
      source of the bug is not yet addressed)
    * Better I2PSnark reconnection handling
    * Further cleanup in the new tunnel build process
    * Make sure we expire old participants properly
    * Remove much of the transient overload throttling (it wasn't using a good
      metric)
2006-01-26 04:47:12 +00:00
1eebd5463f 2006-01-25 jrandom
* Run the peer profile coalescing/reorganization outside the job queue
      (on one of the timers), to cut down on some job queue congestion.  Also,
      trim old profiles while running, not just when starting up.
    * Slightly more sane intra-floodfill-node netDb activity (only flood new
      entries)
    * Workaround in the I2PTunnelHTTPServer for some bad requests (though the
      source of the bug is not yet addressed)
    * Better I2PSnark reconnection handling
    * Further cleanup in the new tunnel build process
    * Make sure we expire old participants properly
    * Remove much of the transient overload throttling (it wasn't using a good
      metric)
2006-01-26 04:41:44 +00:00
f22601b477 2006-01-25 jrandom
* Run the peer profile coalescing/reorganization outside the job queue
      (on one of the timers), to cut down on some job queue congestion.  Also,
      trim old profiles while running, not just when starting up.
    * Slightly more sane intra-floodfill-node netDb activity (only flood new
      entries)
    * Workaround in the I2PTunnelHTTPServer for some bad requests (though the
      source of the bug is not yet addressed)
    * Better I2PSnark reconnection handling
    * Further cleanup in the new tunnel build process
    * Make sure we expire old participants properly
    * Remove much of the transient overload throttling (it wasn't using a good
      metric)
2006-01-26 04:28:15 +00:00
ab8e11657f 2006-01-25 dust
* Fix IRC client proxy to use ISO-8859-1.
2006-01-25 15:34:28 +00:00
zzz
17eb7fa983 2006-1-24 zzz update 2006-01-25 07:43:02 +00:00
d1134f9704 added hidden.i2p, bk1k.i2p, antipiracyagency.i2p 2006-01-23 15:29:36 +00:00
13fe45b489 2006-01-22 jrandom
* New tunnel build process - does not use the new crypto or new peer
      selection strategies.  However, it does drop the fallback tunnel
      procedure, except for tunnels who are configured to allow them, or for
      the exploratory pool during bootstrapping or after a catastrophic
      failure.  This new process prefers to fail rather than use too-short
      tunnels, so while it can do some pretty aggressive tunnel rebuilding,
      it may expose more tunnel failures to the user.
    * Always prefer normal tunnels to fallback tunnels.
    * Potential fix for a bug while changing i2cp settings on I2PSnark (thanks
      bar!)
    * Do all of the netDb entry writing in a separate thread, avoiding
      duplicates and batching them up.
2006-01-23 00:51:54 +00:00
cd235e5902 2006-01-19 Complication
* Explain better where eepsite's destkey can be found
2006-01-20 04:40:24 +00:00
b727d868fb 2006-01-18 cervantes
* Add title attributes to all external links in Syndie, so we can rollover
      and quickly see if it's worth clicking on.
    * Fixed a minor compiler warning.
2006-01-18 06:37:52 +00:00
zzz
cd2609b34a (zzz) 1-17 update 2006-01-18 03:45:37 +00:00
a12ede096a 2006-01-17 jrandom
* First pass of the new tunnel creation crypto, specified in the new
      router/doc/tunnel-alt-creation.html (referenced in the current
      router/doc/tunnel-alt.html).  It isn't actually used anywhere yet, other
      than in the test code, but the code verifies the technical viability, so
      further scrutiny would be warranted.
2006-01-17 22:56:15 +00:00
eb3442823e 2006-01-16 cervantes
* Dragged I2P kicking and screaming into 2006 (Oops)
2006-01-16 22:00:04 +00:00
211f37c207 2005-01-14 cervantes
* Removed entirely misleading memory status from the console summary.
2006-01-14 20:14:47 +00:00
d60d0923c0 2005-01-13 cervantes
* Further Syndie layout hardening and typeface balancing.
2006-01-13 06:27:43 +00:00
zzz
0448203ede (zzz) spelling fix and tweaks 2006-01-13 02:51:27 +00:00
00c97dbf92 0.6.1.9 2006-01-13 01:13:05 +00:00
d07342e3e3 * 2005-01-12 0.6.1.9 released 2006-01-12 21:18:38 +00:00
205d8de281 2005-01-12 jrandom
* Only create the loadtest.log if requested to do so (thanks zzz!)
    * Make sure we cleanly take into consideration the appropriate data
      points when filtering out duplicate messages in the message validator,
      and report the right bloom filter false positives rate (not used for
      anything except debugging)
2006-01-12 19:35:54 +00:00
a638301b5c 2005-01-12 cervantes
* Syndie CSS tweaks to removed some redundant declarations, improve font
      scaling and layout robustness. Improved cross browser compatibility
      (in other words "kicked IE"). Tightened the look of the blog template
      a little.
2006-01-12 09:59:55 +00:00
4f51ad492b 2005-01-11 Complication
* CSS comment fixes
2006-01-11 23:19:38 +00:00
zzz
c3a9f72d41 (zzz) 1-10-06 update 2006-01-11 23:12:31 +00:00
79476d3609 2005-01-11 jrandom
* Include the attachments/blogs/etc for comments on the blog view
    * Syndie HTML fixes (thanks cervantes!)
    * Make sure we fully reset the objects going into our cache before we
      reuse them (thanks zzz!)
2006-01-11 20:32:34 +00:00
zzz
97a206fcda (zzz) add step-by-step eepsite announce instructions 2006-01-11 05:31:05 +00:00
f783e65a4c added decadence.i2p, freedomarchives.i2p, closedshop.i2p 2006-01-10 20:53:10 +00:00
dbd1f65864 2005-01-10 jrandom
* Added the per-post list of attachments/blogs/etc to the blog view in
      Syndie (though this does not yet include comments or some further
      refinements)
    * Have the I2P shortcut launch i2p.exe instead of i2psvc.exe on windows,
      removing the dox box (though also removes the restart functionality...)
    * Give the i2p.exe the correct java.library.path to support the systray
      dll (thanks Bobcat, Sugadude, anon!)
2006-01-10 06:59:07 +00:00
5c78d8108f 2005-01-09 jrandom
* Removed a longstanding bug that had caused unnecessary router identity
      churn due to clock skew
    * Temporarily sanity check within the streaming lib for long pending
      writes
    * Added support for a blog-wide logo to Syndie, and automated the pushing
      of updated extended blog info data along side the metadata.
2006-01-10 02:12:54 +00:00
1b273bdf43 2005-01-09 jrandom
* Removed a longstanding bug that had caused unnecessary router identity
      churn due to clock skew
    * Temporarily sanity check within the streaming lib for long pending
      writes
    * Added support for a blog-wide logo to Syndie, and automated the pushing
      of updated extended blog info data along side the metadata.
2006-01-09 23:18:15 +00:00
934f4082f1 2005-01-09 jrandom
* Removed a longstanding bug that had caused unnecessary router identity
      churn due to clock skew
    * Temporarily sanity check within the streaming lib for long pending
      writes
    * Added support for a blog-wide logo to Syndie, and automated the pushing
      of updated extended blog info data along side the metadata.
2006-01-09 22:22:41 +00:00
002aed145f 2005-01-09 jrandom
* Bugfix for a rare SSU error (thanks cervantes!)
    * More progress on the blog interface, allowing customizable blog-wide
      links.
2006-01-09 07:02:01 +00:00
1ca27ffd39 2005-01-09 jrandom
* Bugfix for a rare SSU error (thanks cervantes!)
    * More progress on the blog interface, allowing customizable blog-wide
      links.
2006-01-09 06:33:29 +00:00
66e6dbec33 2006-01-08 jrandom
* First pass of the new blog interface, though without much of the useful
      customization features (coming soon)
2006-01-08 21:50:54 +00:00
894caaa63c 2006-01-08 jrandom
* First pass of the new blog interface, though without much of the useful
      customization features (coming soon)
2006-01-08 20:54:36 +00:00
zzz
97dae94b46 (zzz) update 2006-01-05 06:29:55 +00:00
c00488afeb 2006-01-04 jrandom
* Rather than profile individual tunnels for throughput over their
      lifetime, do so at 1 minute intervals (allowing less frequently active
      tunnels to be more fairly measured).
    * Run the live tunnel load test across two tunnels at a time, by default.
      The load test runs for a random period from 90s to the tunnel lifetime,
      self paced.  This should help gathering data for profiling peers that
      are in exploratory tunnels.
2006-01-03  jrandom
    * Calculate the overall peer throughput across the 3 fastest one minute
      tunnel throughput values, rather than the single fastest throughput.
    * Degrade the profiled throughput data over time (cutting the profiled
      peaks in half once a day, on average)
    * Enable yet another new speed calculation for profiling peers, using the
      peak throughput from individual tunnels that a peer is participating in,
      rather than across all tunnels they are participating in.  This helps
      gather a fairer peer throughput measurement, since it won't allow a slow
      high capacity peer seem to have a higher throughput (pushing a little
      data across many tunnels at once, as opposed to lots of data across a
      single tunnel).  This degrades over time like the other.
    * Add basic OS/2 support to the jbigi code (though we do not bundle a
      precompiled OS/2 library)
2006-01-05 02:48:13 +00:00
23723b56ca 2006-01-01 jrandom
* Disable multifile torrent creation in I2PSnark's web UI for the moment
      (though it can still seed and participate in multifile swarms)
    * Enable a new speed calculation for profiling peers, using their peak
      1 minute average tunnel throughput as their speed.
2006-01-01 17:23:26 +00:00
76f89ac93c 2005-12-31 jrandom
* Include a simple torrent creator in the I2PSnark web UI
    * Further streaming lib closing improvements
    * Refactored the load test components to run off live tunnels (though,
      still not safe for normal/anonymous load testing)
2005-12-31 23:40:20 +00:00
0f8611e465 2005-12-30 jrandom
* Close streams more gracefully
2005-12-30 23:33:52 +00:00
8e87ae08fb 2005-12-30 jrandom
* Small streaming lib bugfixes for the modified timeouts
    * Minor Syndie/Sucker RSS html fix
    * Small synchronization fix in I2PSnark (thanks fsm!)
2005-12-30 20:57:53 +00:00
5b1a6391f3 2005-12-30 jrandom
* Replaced the bundled linux jcpuid (written in C++) with scintilla's
      jcpuid (written in C), removing the libg++.so.5 dependency that has bit
      some distros (e.g. mandriva)
2005-12-30 18:16:46 +00:00
728f177473 2005-12-29 jrandom
* Minor fix to the new ERR-ClockSkew to deal with people whose clocks are
      actually correct
2005-12-29 13:07:22 +00:00
1d0d0d9c69 2005-12-27 jrandom
* Add a new Status: line on the router console - "ERR-ClockSkew", in case
      the clock is too skewed to do anything useful (check the year and month,
      not just the hour and minute).
    * Fixed the read/write timeouts in the streaming lib (so that it actually
      honors them now)
    * Minor I2PSnark cleanups (no read timeout, more careful shutdown and
      torrent closing)
    * Handle an oddball tunnel creation failure (thanks Xunk)
2005-12-27 13:20:50 +00:00
9b7e5d1817 2005-12-26 Complication
* Fix some integer typecasting in I2PSnark (caused >2GB torrents to fail)
    * HTML readability cosmetics on "Peers" page
2005-12-27 04:20:29 +00:00
dc0485b526 fix ugliness in release history of help.jsp
[yes, i am still alive *g*]
2005-12-23 04:36:31 +00:00
1005 changed files with 47007 additions and 29915 deletions

View File

@ -21,11 +21,12 @@ NATIVE_DIR=native
# router.jar: full I2P router
# jbigi.jar: collection of native optimized GMP routines for crypto
JAR_BASE=i2p.jar mstreaming.jar streaming.jar
JAR_CLIENTS=i2ptunnel.jar sam.jar i2psnark.jar
JAR_CLIENTS=i2ptunnel.jar sam.jar
JAR_ROUTER=router.jar
JAR_JBIGI=jbigi.jar
JAR_XML=xml-apis.jar resolver.jar xercesImpl.jar
JAR_CONSOLE=\
i2psnark.jar \
javax.servlet.jar \
commons-el.jar \
commons-logging.jar \
@ -79,15 +80,15 @@ native_clean:
native_shared: libi2p.so
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2p_dsa --main=net.i2p.crypto.DSAEngine
@echo "* i2p_dsa is a simple test app with the DSA engine and Fortuna PRNG to make sure crypto is working"
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/prng --main=gnu.crypto.prng.Fortuna
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/prng --main=gnu.crypto.prng.FortunaStandalone
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2ptunnel --main=net.i2p.i2ptunnel.I2PTunnel
@echo "* i2ptunnel is mihi's I2PTunnel CLI"
@echo " run it as ./i2ptunnel -cli to avoid awt complaints"
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2ptunnelctl --main=net.i2p.i2ptunnel.TunnelControllerGroup
@echo "* i2ptunnelctl is a controller for I2PTunnel, reading i2ptunnel.config"
@echo " and launching the appropriate proxies"
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2psnark --main=org.klomp.snark.Snark
@echo "* i2psnark is an anonymous bittorrent client"
#@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2psnark --main=org.klomp.snark.Snark
#@echo "* i2psnark is an anonymous bittorrent client"
@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2prouter --main=net.i2p.router.Router
@echo "* i2prouter is the main I2P router"
@echo " it can be used, and while the router console won't load,"
@ -95,6 +96,6 @@ native_shared: libi2p.so
libi2p.so:
@echo "* Building libi2p.so"
@(cd build ; ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/libi2p.so ${LIBI2P_JARS} ; cd .. )
@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/libi2p.so ${LIBI2P_JARS} ; cd .. )
@ls -l ${NATIVE_DIR}/libi2p.so
@echo "* libi2p.so built"

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="echoclient" default="default" basedir=".">
<description>Builds, tests, and runs the project echoclient.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="echoclient-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View File

@ -0,0 +1,5 @@
#!/bin/bash
(
cd dist
java -jar echoclient.jar main 37338 testclient $1
)

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

View File

@ -0,0 +1,629 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- applet
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="echoclient-impl">
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!--
======================
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/config.properties"/>
<property file="nbproject/private/configs/${config}.properties"/>
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/configs/${config}.properties"/>
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<available file="${manifest.file}" property="manifest.available"/>
<condition property="manifest.available+main.class">
<and>
<isset property="manifest.available"/>
<isset property="main.class"/>
<not>
<equals arg1="${main.class}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="manifest.available+main.class+mkdist.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="libs.CopyLibs.classpath"/>
</and>
</condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<and>
<isset property="javadoc.preview"/>
<isfalse value="${javadoc.preview}"/>
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<property name="javac.debug" value="true"/>
<property name="javadoc.preview" value="true"/>
<property name="application.args" value=""/>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<property name="do.depend" value="false"/>
<condition property="do.depend.true">
<istrue value="${do.depend}"/>
</condition>
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
<and>
<isset property="jaxws.endorsed.dir"/>
<available file="nbproject/jaxws-build.xml"/>
</and>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-javac">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
<customize/>
</javac>
</sequential>
</macrodef>
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${run.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="${run.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<j2seproject1:fileset dir="${build.classes.dir}"/>
</jar>
</presetdef>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
<!--
===================
COMPILATION SECTION
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-depend">
<j2seproject3:depend/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
<j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION
====================
-->
<target depends="init" name="-pre-pre-jar">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
</target>
<target name="-pre-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
<j2seproject1:jar/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
<j2seproject1:jar manifest="${manifest.file}">
<j2seproject1:manifest>
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
</j2seproject1:manifest>
</j2seproject1:jar>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<pathconvert property="run.classpath.without.build.classes.dir">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to=""/>
</pathconvert>
<pathconvert pathsep=" " property="jar.classpath">
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</copylibs>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo>java -jar "${dist.jar.resolved}"</echo>
</target>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
=================
-->
<target depends="init,compile" description="Run a main class." name="run">
<j2seproject1:java>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject1:java>
</target>
<target name="-do-not-recompile">
<property name="javac.includes.binary" value=""/>
</target>
<target depends="init,-do-not-recompile,compile-single" name="run-single">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<j2seproject1:java classname="${run.class}"/>
</target>
<!--
=================
DEBUGGING SECTION
=================
-->
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<j2seproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile" name="-debug-start-debuggee">
<j2seproject3:debug>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
</target>
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<j2seproject3:debug classname="${debug.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<j2seproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
=======================
JUNIT DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
=========================
APPLET EXECUTION SECTION
=========================
-->
<target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject1:java classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject1:java>
</target>
<!--
=========================
APPLET DEBUGGING SECTION
=========================
-->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject3:debug classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=8ce3cee9
build.xml.script.CRC32=d1de2df3
build.xml.stylesheet.CRC32=be360661
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=8ce3cee9
nbproject/build-impl.xml.script.CRC32=22d1fbbb
nbproject/build-impl.xml.stylesheet.CRC32=487672f9

View File

@ -0,0 +1,2 @@
jaxws.endorsed.dir=/usr/local/netbeans-6.1/java2/modules/ext/jaxws21/api
user.properties.file=/root/.netbeans/6.1/build.properties

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/root/NetBeansProjects/BOB/Demos/echo/echoclient/src/net/i2p/BOB/Demos/echo/echoclient/Main.java</file>
</open-files>
</project-private>

View File

@ -0,0 +1,60 @@
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/echoclient.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.BOB.jar=../../../dist/BOB.jar
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=net.i2p.BOB.Demos.echo.echoclient.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>echoclient</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@ -0,0 +1,201 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB.Demos.echo.echoclient;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author sponge
*/
public class Main {
public static String Lread(InputStream in) throws IOException {
String S;
int b;
char c;
S = new String();
while(true) {
b = in.read();
if(b == 13) {
//skip CR
continue;
}
if(b < 20 || b > 126) {
// exit on anything not legal
break;
}
c = (char)(b & 0x7f); // We only really give a fuck about ASCII
S = new String(S + c);
}
return S;
}
/**
* Check for "ERROR" and if so, throw RuntimeException
* @param line
* @throws java.lang.RuntimeException
*/
static void checkline(String line) throws RuntimeException {
System.out.println(line); // print status
if(line.startsWith("ERROR")) {
throw new RuntimeException(line);
}
}
static void wrtxt(OutputStream CMDout, String s) throws IOException {
CMDout.write(s.getBytes());
CMDout.write('\n');
CMDout.flush();
}
static void setupconn(String[] args) throws UnknownHostException, IOException, RuntimeException {
String line;
Socket CMDsock = new Socket("localhost", 0xB0B);
InputStream CMDin = CMDsock.getInputStream();
OutputStream CMDout = CMDsock.getOutputStream();
// setup the tunnel.
line = Lread(CMDin);
System.out.println(line); // print the banner
line = Lread(CMDin);
System.out.println(line); // print initial status, should always be "OK"
try {
wrtxt(CMDout, "status " + args[2]);
line = Lread(CMDin); // get the status of this nickname, if it's an error, create it
checkline(line);
} catch(RuntimeException rte) {
wrtxt(CMDout, "setnick " + args[2]);
line = Lread(CMDin); // create a new nickname
checkline(line);
wrtxt(CMDout, "newkeys");
line = Lread(CMDin); // set up new keys
checkline(line);
wrtxt(CMDout, "inport " + args[1]);
line = Lread(CMDin); // set the port we connect in on
checkline(line);
}
wrtxt(CMDout, "getnick " + args[2]);
line = Lread(CMDin); // Set to our nick
try {
checkline(line);
} catch(RuntimeException rte) {
System.out.println("Continuing on existing tunnel..");
return;
}
wrtxt(CMDout, "start");
line = Lread(CMDin); // an error here is OK
System.out.println(line); // print status
CMDsock.close(); // we no longer need this particular socket
}
static void deleteconn(String[] args) throws UnknownHostException, IOException, RuntimeException {
String line;
// Wait for things to flush
try {
Thread.sleep(10000);
} catch(InterruptedException ex) {
// nop
}
Socket CMDsock = new Socket("localhost", 0xB0B);
InputStream CMDin = CMDsock.getInputStream();
OutputStream CMDout = CMDsock.getOutputStream();
// delete the tunnel.
line = Lread(CMDin);
System.out.println(line); // print the banner
line = Lread(CMDin);
System.out.println(line); // print initial status, should always be "OK"
wrtxt(CMDout, "getnick " + args[2]); // Set to our nick
line = Lread(CMDin);
checkline(line);
wrtxt(CMDout, "stop");
line = Lread(CMDin);
checkline(line);
try {
Thread.sleep(2000); //sleep for 2000 ms (Two seconds)
} catch(Exception e) {
// nop
}
wrtxt(CMDout, "clear");
line = Lread(CMDin);
while(line.startsWith("ERROR")) {
wrtxt(CMDout, "clear");
line = Lread(CMDin);
}
System.out.println(line); // print status
CMDsock.close(); // we no longer need this particular socket
}
static void chatter(String[] args) throws UnknownHostException, IOException, RuntimeException {
String line;
Socket sock = new Socket("localhost", Integer.parseInt(args[1]));
InputStream in = sock.getInputStream();
OutputStreamWriter out = new OutputStreamWriter(sock.getOutputStream());
out.write(args[3] + "\n"); // send out the i2p address to connect to
out.flush();
System.out.println("Connecting to " + args[3]);
line = Lread(in); // get server greeting
System.out.println("Got " + line); // show user
out.write("Test complete.\n"); // send something back
out.flush(); // make sure it's sent.
sock.close(); // done.
}
/**
*
* @param args tunnelport tunnelnickname I2Pdestkey
*/
public static void main(String[] args) {
// I'm lazy, and want to exit on any failures.
try {
setupconn(args); // talk to BOB, set up an outbound port
chatter(args); // talk over the connection
} catch(UnknownHostException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch(IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
try {
deleteconn(args);
} catch(UnknownHostException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch(IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch(RuntimeException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="echoserver" default="default" basedir=".">
<description>Builds, tests, and runs the project echoserver.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="echoserver-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

View File

@ -0,0 +1,629 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- applet
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="echoserver-impl">
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!--
======================
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/config.properties"/>
<property file="nbproject/private/configs/${config}.properties"/>
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/configs/${config}.properties"/>
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<available file="${manifest.file}" property="manifest.available"/>
<condition property="manifest.available+main.class">
<and>
<isset property="manifest.available"/>
<isset property="main.class"/>
<not>
<equals arg1="${main.class}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="manifest.available+main.class+mkdist.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="libs.CopyLibs.classpath"/>
</and>
</condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<and>
<isset property="javadoc.preview"/>
<isfalse value="${javadoc.preview}"/>
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<property name="javac.debug" value="true"/>
<property name="javadoc.preview" value="true"/>
<property name="application.args" value=""/>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<property name="do.depend" value="false"/>
<condition property="do.depend.true">
<istrue value="${do.depend}"/>
</condition>
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
<and>
<isset property="jaxws.endorsed.dir"/>
<available file="nbproject/jaxws-build.xml"/>
</and>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-javac">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
<customize/>
</javac>
</sequential>
</macrodef>
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${run.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="${run.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<j2seproject1:fileset dir="${build.classes.dir}"/>
</jar>
</presetdef>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
<!--
===================
COMPILATION SECTION
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-depend">
<j2seproject3:depend/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
<j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION
====================
-->
<target depends="init" name="-pre-pre-jar">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
</target>
<target name="-pre-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
<j2seproject1:jar/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
<j2seproject1:jar manifest="${manifest.file}">
<j2seproject1:manifest>
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
</j2seproject1:manifest>
</j2seproject1:jar>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<pathconvert property="run.classpath.without.build.classes.dir">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to=""/>
</pathconvert>
<pathconvert pathsep=" " property="jar.classpath">
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</copylibs>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo>java -jar "${dist.jar.resolved}"</echo>
</target>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
=================
-->
<target depends="init,compile" description="Run a main class." name="run">
<j2seproject1:java>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject1:java>
</target>
<target name="-do-not-recompile">
<property name="javac.includes.binary" value=""/>
</target>
<target depends="init,-do-not-recompile,compile-single" name="run-single">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<j2seproject1:java classname="${run.class}"/>
</target>
<!--
=================
DEBUGGING SECTION
=================
-->
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<j2seproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile" name="-debug-start-debuggee">
<j2seproject3:debug>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
</target>
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<j2seproject3:debug classname="${debug.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<j2seproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
=======================
JUNIT DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
=========================
APPLET EXECUTION SECTION
=========================
-->
<target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject1:java classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject1:java>
</target>
<!--
=========================
APPLET DEBUGGING SECTION
=========================
-->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject3:debug classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=4ce39738
build.xml.script.CRC32=c1deb82c
build.xml.stylesheet.CRC32=be360661
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=4ce39738
nbproject/build-impl.xml.script.CRC32=555cdd2d
nbproject/build-impl.xml.stylesheet.CRC32=487672f9

View File

@ -0,0 +1,2 @@
jaxws.endorsed.dir=/usr/local/netbeans-6.1/java2/modules/ext/jaxws21/api
user.properties.file=/root/.netbeans/6.1/build.properties

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/root/NetBeansProjects/BOB/Demos/echo/echoserver/src/net/i2p/BOB/Demos/echo/echoserver/Main.java</file>
</open-files>
</project-private>

View File

@ -0,0 +1,60 @@
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/echoserver.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.BOB.jar=../../../dist/BOB.jar
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=net.i2p.BOB.Demos.echo.echoserver.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>echoserver</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@ -0,0 +1,4 @@
(
cd dist
java -jar echoserver.jar main 37337 testserver
)

View File

@ -0,0 +1,197 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB.Demos.echo.echoserver;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author sponge
*/
public class Main {
public static String Lread(InputStream in) throws IOException {
String S;
int b;
char c;
S = new String();
while(true) {
b = in.read();
if(b < 20) {
break;
}
c = (char)(b & 0x7f); // We only really give a fuck about ASCII
S = new String(S + c);
}
return S;
}
/**
* Check for "ERROR" and if so, throw RuntimeException
* @param line
* @throws java.lang.RuntimeException
*/
static void checkline(String line) throws RuntimeException {
System.out.println(line); // print status
if(line.startsWith("ERROR")) {
throw new RuntimeException(line);
}
}
static void wrtxt(OutputStream CMDout, String s) throws IOException {
CMDout.write(s.getBytes());
CMDout.write('\n');
CMDout.flush();
}
static void setupconn(String[] args) throws UnknownHostException, IOException, RuntimeException {
String line;
Socket CMDsock = new Socket("localhost", 0xB0B);
InputStream CMDin = CMDsock.getInputStream();
OutputStream CMDout = CMDsock.getOutputStream();
// setup the tunnel.
line = Lread(CMDin);
System.out.println(line); // print the banner
line = Lread(CMDin);
System.out.println(line); // print initial status, should always be "OK"
try {
wrtxt(CMDout, "status " + args[2]);
line =Lread(CMDin); // get the status of this nickname, if it's an error, create it
checkline(line);
} catch(RuntimeException rte) {
wrtxt(CMDout, "setnick " + args[2]);
line =Lread(CMDin); // create a new nickname
checkline(line);
wrtxt(CMDout, "newkeys ");
line =Lread(CMDin); // set up new keys
checkline(line);
wrtxt(CMDout, "outport " + args[1]);
line = Lread(CMDin); // set the port we connect out on
checkline(line);
}
wrtxt(CMDout, "getnick " + args[2]);
line = Lread(CMDin); // Set to our nick
checkline(line);
wrtxt(CMDout, "start ");
line = Lread(CMDin); // an error here is OK
System.out.println(line); // print status
CMDsock.close(); // we no longer need this particular socket
}
static void deleteconn(String[] args) throws UnknownHostException, IOException, RuntimeException {
String line;
Socket CMDsock = new Socket("localhost", 0xB0B);
InputStream CMDin = CMDsock.getInputStream();
OutputStream CMDout = CMDsock.getOutputStream();
// delete the tunnel.
line = Lread(CMDin);
System.out.println(line); // print the banner
line = Lread(CMDin);
System.out.println(line); // print initial status, should always be "OK"
wrtxt(CMDout, "getnick " + args[2]); // Set to our nick
line = Lread(CMDin);
checkline(line);
wrtxt(CMDout, "stop");
line = Lread(CMDin);
checkline(line);
try {
Thread.sleep(2000); //sleep for 2000 ms (Two seconds)
} catch(Exception e) {
// nop
}
wrtxt(CMDout, "clear");
line = Lread(CMDin);
while(line.startsWith("ERROR")) {
wrtxt(CMDout, "clear");
line = Lread(CMDin);
}
System.out.println(line); // print status
CMDsock.close(); // we no longer need this particular socket
}
static void chatter(Socket sock) throws UnknownHostException, IOException, RuntimeException {
String line;
InputStream in = sock.getInputStream();
OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(sock.getOutputStream()));
line = Lread(in); // get remote I2P address
System.out.println("Connect from: " + line); // show user
out.write("Hello, You are connecting from " + line + "\n"); // send greeting
out.flush(); // make sure it's sent.
line = Lread(in); // get test text from client
System.out.println("Got "+line); // show user
sock.close(); // done.
}
private static void serverlistener(String[] args) throws UnknownHostException, IOException, RuntimeException {
ServerSocket listener = new ServerSocket(Integer.parseInt(args[1]), 10, InetAddress.getByName("localhost"));
Socket server;
while(true) {
server = listener.accept();
chatter(server);
}
}
/**
*
* @param args tunnelport tunnelnickname
*/
public static void main(String[] args) {
// I'm lazy, and want to exit on any failures.
try {
setupconn(args); // talk to BOB, set up an inbound port
serverlistener(args); // talk over the connection
} catch(UnknownHostException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch(IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
try {
deleteconn(args);
} catch(UnknownHostException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch(IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch(RuntimeException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

74
apps/BOB/build.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="BOB" default="default" basedir=".">
<description>Builds, tests, and runs the project BOB.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="BOB-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

3
apps/BOB/manifest.mf Normal file
View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

View File

@ -0,0 +1,642 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- applet
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="BOB-impl">
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!--
======================
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/config.properties"/>
<property file="nbproject/private/configs/${config}.properties"/>
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/configs/${config}.properties"/>
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<available file="${manifest.file}" property="manifest.available"/>
<condition property="manifest.available+main.class">
<and>
<isset property="manifest.available"/>
<isset property="main.class"/>
<not>
<equals arg1="${main.class}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="manifest.available+main.class+mkdist.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="libs.CopyLibs.classpath"/>
</and>
</condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<and>
<isset property="javadoc.preview"/>
<isfalse value="${javadoc.preview}"/>
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<property name="javac.debug" value="true"/>
<property name="javadoc.preview" value="true"/>
<property name="application.args" value=""/>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<property name="do.depend" value="false"/>
<condition property="do.depend.true">
<istrue value="${do.depend}"/>
</condition>
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
<and>
<isset property="jaxws.endorsed.dir"/>
<available file="nbproject/jaxws-build.xml"/>
</and>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-javac">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
<customize/>
</javac>
</sequential>
</macrodef>
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${run.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="${run.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<j2seproject1:fileset dir="${build.classes.dir}"/>
</jar>
</presetdef>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
<!--
===================
COMPILATION SECTION
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
<target depends="init" name="-check-automatic-build">
<available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
</target>
<target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
<antcall target="clean"/>
</target>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-depend">
<j2seproject3:depend/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
<j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION
====================
-->
<target depends="init" name="-pre-pre-jar">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
</target>
<target name="-pre-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
<j2seproject1:jar/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
<j2seproject1:jar manifest="${manifest.file}">
<j2seproject1:manifest>
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
</j2seproject1:manifest>
</j2seproject1:jar>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<pathconvert property="run.classpath.without.build.classes.dir">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to=""/>
</pathconvert>
<pathconvert pathsep=" " property="jar.classpath">
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</copylibs>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo>java -jar "${dist.jar.resolved}"</echo>
</target>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
=================
-->
<target depends="init,compile" description="Run a main class." name="run">
<j2seproject1:java>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject1:java>
</target>
<target name="-do-not-recompile">
<property name="javac.includes.binary" value=""/>
</target>
<target depends="init,-do-not-recompile,compile-single" name="run-single">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<j2seproject1:java classname="${run.class}"/>
</target>
<!--
=================
DEBUGGING SECTION
=================
-->
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<j2seproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile" name="-debug-start-debuggee">
<j2seproject3:debug>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
</target>
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<j2seproject3:debug classname="${debug.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<j2seproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
=======================
JUNIT DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
=========================
APPLET EXECUTION SECTION
=========================
-->
<target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject1:java classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject1:java>
</target>
<!--
=========================
APPLET DEBUGGING SECTION
=========================
-->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject3:debug classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=209349b6
build.xml.script.CRC32=403e69e6
build.xml.stylesheet.CRC32=958a1d3e
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=209349b6
nbproject/build-impl.xml.script.CRC32=75fac64c
nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5

View File

@ -0,0 +1,6 @@
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
jaxws.endorsed.dir=/usr/local/netbeans-6.5/java2/modules/ext/jaxws21/api:/usr/local/netbeans-6.5/ide10/modules/ext/jaxb/api
user.properties.file=/root/.netbeans/6.5/build.properties

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View File

@ -0,0 +1,77 @@
application.title=BOB
application.vendor=root
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/BOB.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.core.jar=../i2p.i2p/core/dist/core.jar
file.reference.i2p.jar=../../bob/i2p/i2p.i2p/build/i2p.jar
file.reference.i2p.jar-1=../../core/java/build/i2p.jar
file.reference.i2p.jar-2=../i2p.i2p/core/java/build/i2p.jar
file.reference.i2ptunnel.jar=../i2ptunnel/java/build/i2ptunnel.jar
file.reference.java-src=../i2p.i2p/core/java/src/
file.reference.jbigi.jar=../../bob/i2p/i2p.i2p/build/jbigi.jar
file.reference.mstreaming.jar=../../bob/i2p/i2p.i2p/build/mstreaming.jar
file.reference.mstreaming.jar-1=../ministreaming/java/build/mstreaming.jar
file.reference.NetBeansProjects-i2p.i2p=../i2p.i2p/
file.reference.streaming.jar=../../bob/i2p/i2p.i2p/build/streaming.jar
file.reference.streaming.jar-1=../streaming/java/build/streaming.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.i2p.jar-1}:\
${file.reference.i2ptunnel.jar}:\
${file.reference.mstreaming.jar-1}:\
${file.reference.streaming.jar-1}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=net.i2p.BOB.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>BOB</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@ -0,0 +1,227 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Properties;
import net.i2p.client.I2PClient;
import net.i2p.client.streaming.RetransmissionTimer;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer;
/**
* <span style="font-size:8px;font-family:courier;color:#EEEEEE;background-color:#000000">
* ################################################################################<br>
* ############################.#..........#..#..........##########################<br>
* #######################......................................###################<br>
* ####################...........................#.......#........################<br>
* #################..................##...................#.........##############<br>
* ###############................###...####.....#..###.....#.........#############<br>
* #############...........###..#..###...#####...###.##........#.......############<br>
* ###########................#......##...#####...##..##.......#..#........########<br>
* ##########.........................#....##.##..#...##.....................######<br>
* #########...................................#....#.........................#####<br>
* ########.........................................#...............#..........####<br>
* ########.........................................#..........#######..........###<br>
* #######.................................................############..........##<br>
* #######..........................................####################.........##<br>
* #######............####################......########################.........##<br>
* ######.............###############################################.##.........##<br>
* ######............################################################..##........##<br>
* ######............################################################..##........##<br>
* ######.............##############################################..##.........##<br>
* ######............##############################################...##..........#<br>
* ######............#..###########################################...##..........#<br>
* ######.............#############################################....#..........#<br>
* #######...........###############################################..##.........##<br>
* #######...........#####.#.#.#.########################.....#.####...##........##<br>
* ######............#..............##################.................##.........#<br>
* ######................####.........###############........#####......##........#<br>
* ######..............####..#.........############.......##.#.######...##.......##<br>
* ######.................#.####.........########...........##....###...##.......##<br>
* #######....#....###...................#######...............#...###..##.......##<br>
* #######.........###..###.....###.......######.##.#####.........####..##.......##<br>
* #######.....#...##############.........############......###########.###......##<br>
* #######....##...##########.......##...##############......#.############.....###<br>
* ########....#..########......######...##################################....####<br>
* ########....##.####################...##################################....####<br>
* ########..#.##..###################..##################################..#..####<br>
* ##########..###..#################...##################################...#.####<br>
* #########....##...##############....########..#####.################.##..#.#####<br>
* ############.##....##########.......#########.###.......###########..#.#########<br>
* ###############.....#######...#.......########.....##.....######.....###########<br>
* ###############......###....##..........##.......######....#.........#.#########<br>
* ##############............##..................##########..............##########<br>
* ##############..............................##########..#.............##########<br>
* ###############.......##..................#####..............####....###########<br>
* ###############.......#####.......#.............####.....#######.....###########<br>
* ################...#...####......##################.....########....############<br>
* ################...##..#####.........####.##.....#....##########....############<br>
* ##################..##..####...........#####.#....############.....#############<br>
* ##################......#####.................################....##############<br>
* ###################.....####..........##########..###########....###############<br>
* ####################..#..#..........................########.....###############<br>
* #####################.##.......###.................########....#################<br>
* ######################.........#.......#.##.###############....#################<br>
* #############.#######...............#####################....###################<br>
* ###..#.....##...####..........#.....####################....####################<br>
* ####......##........................##################....######################<br>
* #.##...###..............###.........###############......#######################<br>
* #...###..##............######...........................########################<br>
* ##.......###..........##########....#...#...........############################<br>
* ##.........##.......############################################################<br>
* ###........##.....##############################################################<br>
* ####.............###############################################################<br>
* ######.........#################################################################<br>
* #########....###################################################################<br>
* ################################################################################<br>
* </span>
* BOB, main command socket listener, launches the command parser engine.
*
* @author sponge
*/
public class BOB {
private final static Log _log = new Log(BOB.class);
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;
/**
* Log a warning
*
* @param arg
*/
public static void warn(String arg) {
System.out.println(arg);
_log.warn(arg);
}
/**
* Log an error
*
* @param arg
*/
public static void error(String arg) {
System.out.println(arg);
_log.error(arg);
}
/**
* Listen for incoming connections and handle them
*
* @param args
*/
public static void main(String[] args) {
database = new NamedDB();
int i = 0;
boolean save = false;
// Set up all defaults to be passed forward to other threads.
// Re-reading the config file in each thread is pretty damn stupid.
// I2PClient client = I2PClientFactory.createClient();
Properties props = new Properties();
String configLocation = System.getProperty(PROP_CONFIG_LOCATION, "bob.config");
// This is here just to ensure there is no interference with our threadgroups.
SimpleTimer Y = RetransmissionTimer.getInstance();
i = Y.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) {
warn("IOException on BOB config file " + configLocation + ", " + ioe);
}
}
try {
warn("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();
}
} catch(IOException ioe) {
warn("IOException on socket listen: " + ioe);
ioe.printStackTrace();
}
}
}

View File

@ -0,0 +1,21 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) sponge
Planet Earth
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
See...
http://sam.zoy.org/wtfpl/
and
http://en.wikipedia.org/wiki/WTFPL
...for any additional details and license questions.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,138 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import net.i2p.I2PException;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.Log;
/**
* Listen on I2P and connect to TCP
*
* @author sponge
*/
public class I2Plistener implements Runnable {
private NamedDB info, database;
private Log _log;
private int tgwatch;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
/**
* Constructor
* @param S
* @param info
* @param database
* @param _log
*/
I2Plistener(I2PSocketManager S, NamedDB info, NamedDB database, Log _log) {
this.database = database;
this.info = info;
this._log = _log;
this.socketManager = S;
serverSocket = this.socketManager.getServerSocket();
tgwatch = 1;
}
/**
* Simply listen on I2P port, and thread connections
*
*/
public void run() {
boolean g = false;
I2PSocket sessSocket = null;
serverSocket.setSoTimeout(1000);
database.getReadLock();
info.getReadLock();
if(info.exists("INPORT")) {
tgwatch = 2;
}
info.releaseReadLock();
database.releaseReadLock();
boolean spin = true;
while(spin) {
database.getReadLock();
info.getReadLock();
spin = info.get("RUNNING").equals(Boolean.TRUE);
info.releaseReadLock();
database.releaseReadLock();
try {
try {
sessSocket = serverSocket.accept();
g = true;
} catch(ConnectException ce) {
g = false;
} catch(SocketTimeoutException ste) {
g = false;
}
if(g) {
g = false;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database);
Thread t = new Thread(conn_c, "BOBI2PtoTCP");
t.start();
}
} catch(I2PException e) {
// System.out.println("Exception " + e);
}
}
try {
serverSocket.close();
} catch(I2PException e) {
// nop
}
while(Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
// System.out.println("STOP Thread count " + Thread.activeCount());
try {
Thread.sleep(1000); //sleep for 1000 ms (One second)
} catch(Exception e) {
// nop
}
}
// System.out.println("STOP Thread count " + Thread.activeCount());
// need to kill off the socket manager too.
I2PSession session = socketManager.getSession();
if(session != null) {
try {
session.destroySession();
} catch(I2PSessionException ex) {
// nop
}
// System.out.println("destroySession Thread count " + Thread.activeCount());
}
}
}

View File

@ -0,0 +1,138 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import net.i2p.client.streaming.I2PSocket;
/**
* Process I2P->TCP
*
* @author sponge
*/
public class I2PtoTCP implements Runnable {
private I2PSocket I2P;
private NamedDB info, database;
private Socket sock;
/**
* Constructor
*
* @param I2Psock
* @param info
* @param database
*/
I2PtoTCP(I2PSocket I2Psock, NamedDB info, NamedDB database) {
this.I2P = I2Psock;
this.info = info;
this.database = database;
}
private void rlock() throws Exception {
database.getReadLock();
info.getReadLock();
}
private void runlock() throws Exception {
database.releaseReadLock();
info.releaseReadLock();
}
/**
* I2P stream to TCP stream thread starter
*
*/
public void run() {
String host;
int port;
boolean tell;
die: {
try {
try {
rlock();
} catch(Exception e) {
break die;
}
try {
host = info.get("OUTHOST").toString();
port = Integer.parseInt(info.get("OUTPORT").toString());
tell = info.get("QUIET").equals(Boolean.FALSE);
} catch(Exception e) {
runlock();
break die;
}
try {
runlock();
} catch(Exception e) {
break die;
}
sock = new Socket(host, port);
// make readers/writers
InputStream in = sock.getInputStream();
OutputStream out = sock.getOutputStream();
InputStream Iin = I2P.getInputStream();
OutputStream Iout = I2P.getOutputStream();
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
if(tell) {
// tell who is connecting
out.write(I2P.getPeerDestination().toBase64().getBytes());
out.write(10); // nl
out.flush(); // not really needed, but...
}
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout, info, database); // app -> I2P
TCPio conn_a = new TCPio(Iin, out, info, database); // I2P -> app
Thread t = new Thread(conn_c, "TCPioA");
Thread q = new Thread(conn_a, "TCPioB");
// Fire!
t.start();
q.start();
while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
try {
Thread.sleep(10); //sleep for 10 ms
} catch(InterruptedException e) {
// nop
}
}
} catch(Exception e) {
break die;
}
} // die
try {
I2P.close();
} catch(Exception e) {
tell = false;
}
try {
sock.close();
} catch(Exception e) {
tell = false;
}
}
}

View File

@ -0,0 +1,242 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Properties;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.util.Log;
/**
*
* Multiplex listeners for TCP and I2P
*
* @author sponge
*/
public class MUXlisten implements Runnable {
private NamedDB database, info;
private Log _log;
private I2PSocketManager socketManager;
private ByteArrayInputStream prikey;
private ThreadGroup tg;
private String N;
private ServerSocket listener;
private int backlog = 50; // should this be more? less?
boolean go_out;
boolean come_in;
/**
* Constructor Will fail if INPORT is occupied.
*
* @param info
* @param database
* @param _log
* @throws net.i2p.I2PException
* @throws java.io.IOException
*/
MUXlisten(NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
int port = 0;
InetAddress host = null;
this.database = database;
this.info = info;
this._log = _log;
this.database.getReadLock();
this.info.getReadLock();
N = this.info.get("NICKNAME").toString();
prikey = new ByteArrayInputStream((byte[])info.get("KEYS"));
Properties Q = (Properties)info.get("PROPERTIES");
this.database.releaseReadLock();
this.info.releaseReadLock();
this.database.getReadLock();
this.info.getReadLock();
this.go_out = info.exists("OUTPORT");
this.come_in = info.exists("INPORT");
if(this.come_in) {
port = Integer.parseInt(info.get("INPORT").toString());
host = InetAddress.getByName(info.get("INHOST").toString());
}
this.database.releaseReadLock();
this.info.releaseReadLock();
socketManager = I2PSocketManagerFactory.createManager(prikey, Q);
if(this.come_in) {
this.listener = new ServerSocket(port, backlog, host);
}
// Everything is OK as far as we can tell.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", Boolean.TRUE);
this.info.releaseWriteLock();
this.database.releaseWriteLock();
}
private void rlock() throws Exception {
database.getReadLock();
info.getReadLock();
}
private void runlock() throws Exception {
database.releaseReadLock();
info.releaseReadLock();
}
private void wlock() throws Exception {
database.getWriteLock();
info.getWriteLock();
}
private void wunlock() throws Exception {
info.releaseWriteLock();
database.releaseWriteLock();
}
/**
* MUX sockets, fire off a thread to connect, get destination info, and do I/O
*
*/
public void run() {
try {
wlock();
try {
info.add("RUNNING", Boolean.TRUE);
info.add("STARTING", Boolean.FALSE);
} catch(Exception e) {
wunlock();
return;
}
} catch(Exception e) {
return;
}
try {
wunlock();
} catch(Exception e) {
return;
}
quit: {
try {
tg = new ThreadGroup(N);
die: {
// toss the connections to a new threads.
// will wrap with TCP and UDP when UDP works
if(go_out) {
// I2P -> TCP
I2Plistener conn = new I2Plistener(socketManager, info, database, _log);
Thread t = new Thread(tg, conn, "BOBI2Plistener " + N);
t.start();
}
if(come_in) {
// TCP -> I2P
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log);
Thread q = new Thread(tg, conn, "BOBTCPlistener" + N);
q.start();
}
boolean spin = true;
while(spin) {
try {
Thread.sleep(1000); //sleep for 1000 ms (One second)
} catch(InterruptedException e) {
// nop
}
try {
rlock();
try {
spin = info.get("STOPPING").equals(Boolean.FALSE);
} catch(Exception e) {
runlock();
break die;
}
} catch(Exception e) {
break die;
}
try {
runlock();
} catch(Exception e) {
break die;
}
}
try {
wlock();
try {
info.add("RUNNING", Boolean.FALSE);
} catch(Exception e) {
wunlock();
break die;
}
} catch(Exception e) {
break die;
}
try {
wunlock();
} catch(Exception e) {
break die;
}
} // die
// wait for child threads and thread groups to die
while(tg.activeCount() + tg.activeGroupCount() != 0) {
try {
Thread.sleep(1000); //sleep for 1000 ms (One second)
} catch(InterruptedException ex) {
// nop
}
}
tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it.
tg = null;
} catch(Exception e) {
break quit;
}
} // quit
socketManager.destroySocketManager();
// zero out everything, just incase.
try {
wlock();
try {
info.add("STARTING", Boolean.FALSE);
info.add("STOPPING", Boolean.FALSE);
info.add("RUNNING", Boolean.FALSE);
} catch(Exception e) {
wunlock();
return;
}
wunlock();
} catch(Exception e) {
return;
}
}
}

View File

@ -0,0 +1,46 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import net.i2p.client.streaming.RetransmissionTimer;
import net.i2p.util.SimpleTimer;
/**
* Start from command line
*
* @author sponge
*
*/
public class Main {
/**
* @param args the command line arguments, these are not used yet
*/
public static void main(String[] args) {
// THINK THINK THINK THINK THINK THINK
SimpleTimer Y = RetransmissionTimer.getInstance();
BOB.main(args);
Y.removeSimpleTimer();
}
}

View File

@ -0,0 +1,195 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
/**
* Internal database to relate nicknames to options to values
*
* @author sponge
*/
public class NamedDB {
private volatile Object[][] data;
private volatile int index, writersWaiting, readers;
/**
* make initial NULL object
*
*/
public NamedDB() {
this.data = new Object[1][2];
this.index = this.writersWaiting = this.readers = 0;
}
synchronized public void getReadLock() {
while((writersWaiting != 0)) {
try {
wait();
} catch(InterruptedException ie) {
}
}
readers++;
}
synchronized public void releaseReadLock() {
readers--;
notifyAll();
}
synchronized public void getWriteLock() {
writersWaiting++;
while(readers != 0 && writersWaiting != 1 ) {
try {
wait();
} catch(InterruptedException ie) {
}
}
}
synchronized public void releaseWriteLock() {
writersWaiting--;
notifyAll();
}
/**
* Find objects in the array, returns it's index or throws exception
* @param key
* @return an objects index
* @throws ArrayIndexOutOfBoundsException when key does not exist
*/
public int idx(Object key) throws ArrayIndexOutOfBoundsException {
for(int i = 0; i < index; i++) {
if(key.equals(data[i][0])) {
return i;
}
}
throw new ArrayIndexOutOfBoundsException("Can't locate key for index");
}
/**
* Delete an object from array if it exists
*
* @param key
*/
public void kill(Object key) {
int i, j, k, l;
Object[][] olddata;
int didsomething = 0;
try {
k = idx(key);
} catch(ArrayIndexOutOfBoundsException b) {
return;
}
olddata = new Object[index + 2][2];
// copy to olddata, skipping 'k'
for(i = 0 , l = 0; l < index; i++, l++) {
if(i == k) {
l++;
didsomething++;
}
for(j = 0; j < 2; j++) {
olddata[i][j] = data[l][j];
}
}
index -= didsomething;
data = olddata;
}
/**
* Add object to the array, deletes the old one if it exists
*
* @param key
* @param val
*/
public void add(Object key, Object val) {
Object[][] olddata;
int i, j;
i = 0;
kill(key);
olddata = new Object[index + 2][2];
// copy to olddata
for(i = 0; i < index; i++) {
for(j = 0; j < 2; j++) {
olddata[i][j] = data[i][j];
}
}
data = olddata;
data[index++] = new Object[] {key, val};
}
/**
* Get the object, and return it, throws RuntimeException
*
* @param key
* @return Object
* @throws java.lang.RuntimeException
*/
public Object get(Object key) throws RuntimeException {
for(int i = 0; i < index; i++) {
if(key.equals(data[i][0])) {
return data[i][1];
}
}
throw new RuntimeException("Key not found");
}
/**
* returns true if an object exists, else returns false
*
* @param key
* @return true if an object exists, else returns false
*/
public boolean exists(Object key) {
for(int i = 0; i < index; i++) {
if(key.equals(data[i][0])) {
return true;
}
}
return false;
}
/**
*
* @param i index
* @return an indexed Object
* @throws java.lang.RuntimeException
*/
public Object getnext(int i) throws RuntimeException {
if(i < index && i > -1) {
return data[i][1];
}
throw new RuntimeException("No more data");
}
/**
* @return the count of how many objects
*/
public int getcount() {
return index;
}
}

View File

@ -0,0 +1,102 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Shove data from one stream to the other.
*
* @author sponge
*/
public class TCPio implements Runnable {
private InputStream Ain;
private OutputStream Aout;
private NamedDB info, database;
/**
* Constructor
*
* @param Ain
* @param Aout
* @param info
* @param database
*/
TCPio(InputStream Ain, OutputStream Aout, NamedDB info, NamedDB database) {
this.Ain = Ain;
this.Aout = Aout;
this.info = info;
this.database = database;
}
/**
* Copy from source to destination...
* and yes, we are totally OK to block here on writes,
* The OS has buffers, and I intend to use them.
*
*/
public void run() {
int b;
byte a[] = new byte[1];
boolean spin = true;
try {
while(spin) {
database.getReadLock();
info.getReadLock();
spin = info.get("RUNNING").equals(Boolean.TRUE);
info.releaseReadLock();
database.releaseReadLock();
b = Ain.read(a, 0, 1);
// System.out.println(info.get("NICKNAME").toString() + " " + b);
if(b > 0) {
Aout.write(a, 0, b);
} else if(b == 0) {
Thread.yield(); // this should act like a mini sleep.
if(Ain.available() == 0) {
try {
// Thread.yield();
Thread.sleep(10);
} catch(InterruptedException ex) {
}
}
} else {
/* according to the specs:
*
* The total number of bytes read into the buffer,
* or -1 if there is no more data because the end of
* the stream has been reached.
*
*/
return;
}
}
} catch(Exception e) {
// Eject!!! Eject!!!
return;
}
}
}

View File

@ -0,0 +1,147 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.Log;
/**
* Listen on TCP port and connect to I2P
*
* @author sponge
*/
public class TCPlistener implements Runnable {
private NamedDB info, database;
private Log _log;
private int tgwatch;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private ServerSocket listener;
/**
* Constructor
* @param S
* @param info
* @param database
* @param _log
*/
TCPlistener(ServerSocket listener, I2PSocketManager S, NamedDB info, NamedDB database, Log _log) {
this.database = database;
this.info = info;
this._log = _log;
this.socketManager = S;
this.listener = listener;
tgwatch = 1;
}
/**
* Simply listen on TCP port, and thread connections
*
*/
public void run() {
boolean g = false;
boolean spin = true;
database.getReadLock();
info.getReadLock();
if(info.exists("OUTPORT")) {
tgwatch = 2;
}
try {
// System.out.println("Starting thread count " + Thread.activeCount());
Socket server = new Socket();
listener.setSoTimeout(1000);
info.releaseReadLock();
database.releaseReadLock();
while(spin) {
database.getReadLock();
info.getReadLock();
spin = info.get("RUNNING").equals(Boolean.TRUE);
info.releaseReadLock();
database.releaseReadLock();
// System.out.println("Thread count " + Thread.activeCount());
try {
server = listener.accept();
g = true;
} catch(SocketTimeoutException ste) {
g = false;
}
if(g) {
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database);
Thread t = new Thread(conn_c, "BOBTCPtoI2P");
t.start();
g = false;
}
}
listener.close();
} catch(IOException ioe) {
// Fatal failure, cause a stop event
database.getReadLock();
info.getReadLock();
spin = info.get("RUNNING").equals(Boolean.TRUE);
info.releaseReadLock();
database.releaseReadLock();
if(spin) {
database.getWriteLock();
info.getWriteLock();
info.add("STOPPING", new Boolean(true));
info.add("RUNNING", new Boolean(false));
info.releaseWriteLock();
database.releaseWriteLock();
}
}
//System.out.println("STOP!");
while(Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
// System.out.println("STOP Thread count " + Thread.activeCount());
try {
Thread.sleep(1000); //sleep for 1000 ms (One second)
} catch(Exception e) {
// nop
}
}
// System.out.println("STOP Thread count " + Thread.activeCount());
// need to kill off the socket manager too.
I2PSession session = socketManager.getSession();
if(session != null) {
try {
session.destroySession();
} catch(I2PSessionException ex) {
// nop
}
// System.out.println("destroySession Thread count " + Thread.activeCount());
}
}
}

View File

@ -0,0 +1,182 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.net.ConnectException;
import java.net.NoRouteToHostException;
import java.net.Socket;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.I2PTunnel;
/**
*
* Process TCP->I2P
*
* @author sponge
*/
public class TCPtoI2P implements Runnable {
private I2PSocket I2P;
private NamedDB info, database;
private Socket sock;
private I2PSocketManager socketManager;
/**
* This is a more forgiving readline,
* it works on unbuffered streams
*
* @param in
* @return line of text as a String
* @throws Exception
*/
private static String lnRead(InputStream in) throws Exception {
String S;
int b;
char c;
S = new String();
while(true) {
b = in.read();
if(b == 13) {
//skip CR
continue;
}
if(b < 20 || b > 126) {
// exit on anything not legal
break;
}
c = (char)(b & 0x7f); // We only really give a fuck about ASCII
S = new String(S + c);
}
return S;
}
/**
* Constructor
* @param i2p
* @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
*
* @param e
* @param out
* @throws java.io.IOException
*/
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.flush();
}
/**
* TCP stream to I2P stream thread starter
*/
public void run() {
String line, input;
try {
InputStream in = sock.getInputStream();
OutputStream 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
InputStream Iin = I2P.getInputStream();
OutputStream Iout = I2P.getOutputStream();
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout, info, database); // app -> I2P
TCPio conn_a = new TCPio(Iin, out, info, database); // I2P -> app
Thread t = new Thread(conn_c, "TCPioA");
Thread q = new Thread(conn_a, "TCPioB");
// Fire!
t.start();
q.start();
while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread
try {
Thread.sleep(10); //sleep for 10 ms
} catch(InterruptedException e) {
// nop
}
}
} catch(I2PException e) {
Emsg("ERROR " + e.toString(), out);
} catch(ConnectException e) {
Emsg("ERROR " + e.toString(), out);
} catch(NoRouteToHostException e) {
Emsg("ERROR " + e.toString(), out);
} catch(InterruptedIOException e) {
Emsg("ERROR " + e.toString(), out);
}
} catch(Exception e) {
Emsg("ERROR " + e.toString(), out);
}
} catch(IOException ioe) {
}
try {
I2P.close();
} catch(Exception e) {
}
try {
sock.close();
} catch(Exception e) {
}
}
}

View File

@ -0,0 +1,144 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.BOB;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.I2PSessionListener;
import net.i2p.data.Destination;
import net.i2p.util.Log;
/**
* UDP IO on I2P
*
* FIX ME: Untested, and incomplete!
* I have no personal need to UDP yet,
* however alot of p2p apps pretty much demand it.
* The skeletal frame is here, just needs to be finished.
*
* @author sponge
*/
public class UDPIOthread implements I2PSessionListener, Runnable {
private NamedDB info;
private Log _log;
private Socket socket;
private DataInputStream in;
private DataOutputStream out;
private I2PSession _session;
private Destination _peerDestination;
private boolean up;
/**
* Constructor
* @param info
* @param _log
* @param socket
* @param _session
*/
UDPIOthread(NamedDB info, Log _log, Socket socket, I2PSession _session) {
this.info = info;
this._log = _log;
this.socket = socket;
this._session = _session;
}
/**
*
*/
public void run() {
byte data[] = new byte[1024];
up = true;
try {
in = new DataInputStream(socket.getInputStream());
out = new DataOutputStream(socket.getOutputStream());
while(up) {
int c = in.read(data);
// Note: could do a loopback test here with a wrapper.
boolean ok = _session.sendMessage(_peerDestination, data, 0, c);
if(!ok) {
up = false; // Is this the right thing to do??
}
}
} catch(IOException ioe) {
_log.error("Error running", ioe);
} catch(I2PSessionException ise) {
_log.error("Error communicating", ise);
// } catch(DataFormatException dfe) {
// _log.error("Peer destination file is not valid", dfe);
} finally {
if(_session != null) {
try {
_session.destroySession();
} catch(I2PSessionException ise) {
// ignored
}
}
}
}
/**
*
* @param session
* @param msgId
* @param size
*/
public void messageAvailable(I2PSession session, int msgId, long size) {
// _log.debug("Message available: id = " + msgId + " size = " + size);
try {
byte msg[] = session.receiveMessage(msgId);
out.write(msg);
out.flush();
} catch(I2PSessionException ise) {
up = false;
} catch(IOException ioe) {
up = false;
}
}
// Great, can these be used to kill ourselves.
/** required by {@link I2PSessionListener I2PSessionListener} to notify of disconnect */
public void disconnected(I2PSession session) {
_log.debug("Disconnected");
// up = false;
}
/** required by {@link I2PSessionListener I2PSessionListener} to notify of error */
public void errorOccurred(I2PSession session, String message, Throwable error) {
_log.debug("Error occurred: " + message, error);
// up = false;
}
/** required by {@link I2PSessionListener I2PSessionListener} to notify of abuse */
public void reportAbuse(I2PSession session, int severity) {
_log.debug("Abuse reported of severity " + severity);
// up = false;
}
}

View File

@ -0,0 +1,5 @@
<html>
<body>
<p>BOB, the Basic Open Bridge, allows TCP applications to talk over I2P.</p>
</body>
</html>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<project name="addressbook" default="war" basedir=".">
<property name="src" value="java/src/addressbook"/>
<property name="src" value="java/src"/>
<property name="build" value="build"/>
<property name="dist" location="dist"/>
<property name="jar" value="addressbook.jar"/>
@ -19,8 +19,24 @@
<target name="distclean" depends="clean" />
<target name="compile" depends="init">
<javac debug="true" deprecation="on" source="1.3" target="1.3"
<condition property="depend.available">
<typefound name="depend" />
</condition>
<target name="depend" if="depend.available">
<depend
cache="../../build"
srcdir="${src}"
destdir="${build}" >
<!-- Depend on classes instead of jars where available -->
<classpath>
<pathelement location="../../core/java/build/obj" />
<pathelement location="../jetty/jettylib/javax.servlet.jar" />
</classpath>
</depend>
</target>
<target name="compile" depends="init, depend">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
srcdir="${src}" destdir="${build}">
<classpath>
<pathelement location="../../core/java/build/i2p.jar" />
@ -37,7 +53,7 @@
</jar>
</target>
<target name="war" depends="compile">
<target name="war" depends="compile" unless="war.uptodate">
<mkdir dir="${dist}/tmp"/>
<mkdir dir="${dist}/tmp/WEB-INF"/>
<mkdir dir="${dist}/tmp/WEB-INF/classes"/>
@ -48,4 +64,8 @@
<delete dir="${dist}/tmp"/>
</target>
<uptodate property="war.uptodate" targetfile="${dist}/${war}">
<srcfiles dir= "." includes="${build}/**/*.class, web.xml"/>
</uptodate>
</project>

View File

@ -17,6 +17,10 @@
# Contains the addresses from your master address book
# and your subscribed address books. (../userhosts.txt)
#
# private_addressbook The path to the private address book used by the router.
# This is used only by the router and SusiDNS.
# It is not published by addressbook. (../privatehosts.txt)
#
# published_addressbook The path to the copy of your address book made
# available on i2p. (../eepsite/docroot/hosts.txt)
#
@ -35,6 +39,7 @@ proxy_host=localhost
proxy_port=4444
master_addressbook=myhosts.txt
router_addressbook=../userhosts.txt
private_addressbook=../privatehosts.txt
published_addressbook=../eepsite/docroot/hosts.txt
log=log.txt
subscriptions=subscriptions.txt

View File

@ -21,11 +21,11 @@
package addressbook;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.i2p.I2PAppContext;
import net.i2p.util.EepGet;
@ -57,7 +57,7 @@ public class AddressBook {
this.addresses = addresses;
}
/**
/*
* Construct an AddressBook from the contents of the file at url. If the
* remote file cannot be read, construct an empty AddressBook
*
@ -66,6 +66,7 @@ public class AddressBook {
* where key is a human readable name, and value is a base64 i2p
* destination.
*/
/* unused
public AddressBook(String url, String proxyHost, int proxyPort) {
this.location = url;
EepGet get = new EepGet(I2PAppContext.getGlobalContext(), true,
@ -79,22 +80,28 @@ public class AddressBook {
}
new File("addressbook.tmp").delete();
}
*/
static final long MAX_SUB_SIZE = 3 * 1024 * 1024l; //about 5,000 hosts
/**
* Construct an AddressBook from the Subscription subscription. If the
* address book at subscription has not changed since the last time it was
* read or cannot be read, return an empty AddressBook.
* Set a maximum size of the remote book to make it a little harder for a malicious book-sender.
*
* @param subscription
* A Subscription instance pointing at a remote address book.
* @param proxyHost hostname of proxy
* @param proxyPort port number of proxy
*/
public AddressBook(Subscription subscription, String proxyHost, int proxyPort) {
this.location = subscription.getLocation();
EepGet get = new EepGet(I2PAppContext.getGlobalContext(), true,
proxyHost, proxyPort, 0, "addressbook.tmp",
subscription.getLocation(), true, subscription.getEtag());
get.fetch();
subscription.setEtag(get.getETag());
proxyHost, proxyPort, 0, -1l, MAX_SUB_SIZE, "addressbook.tmp", null,
subscription.getLocation(), true, subscription.getEtag(), subscription.getLastModified(), null);
if (get.fetch()) {
subscription.setEtag(get.getETag());
subscription.setLastModified(get.getLastModified());
}
try {
this.addresses = ConfigParser.parse(new File("addressbook.tmp"));
} catch (IOException exp) {
@ -147,10 +154,45 @@ public class AddressBook {
*
* @return A String representing the contents of the AddressBook.
*/
@Override
public String toString() {
return this.addresses.toString();
}
private static final int MIN_DEST_LENGTH = 516;
private static final int MAX_DEST_LENGTH = MIN_DEST_LENGTH + 100; // longer than any known cert type for now
/**
* Do basic validation of the hostname and dest
* hostname was already converted to lower case by ConfigParser.parse()
*/
private static boolean valid(String host, String dest) {
return
host.endsWith(".i2p") &&
host.length() > 4 &&
host.length() <= 67 && // 63 + ".i2p"
(! host.startsWith(".")) &&
(! host.startsWith("-")) &&
host.indexOf(".-") < 0 &&
host.indexOf("-.") < 0 &&
host.indexOf("..") < 0 &&
// IDN - basic check, not complete validation
(host.indexOf("--") < 0 || host.startsWith("xn--") || host.indexOf(".xn--") > 0) &&
host.replaceAll("[a-z0-9.-]", "").length() == 0 &&
// some reserved names that may be used for local configuration someday
(! host.equals("proxy.i2p")) &&
(! host.equals("router.i2p")) &&
(! host.equals("console.i2p")) &&
(! host.endsWith(".proxy.i2p")) &&
(! host.endsWith(".router.i2p")) &&
(! host.endsWith(".console.i2p")) &&
((dest.length() == MIN_DEST_LENGTH && dest.endsWith("AAAA")) ||
(dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) &&
dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0
;
}
/**
* Merge this AddressBook with AddressBook other, writing messages about new
* addresses or conflicts to log. Addresses in AddressBook other that are
@ -159,6 +201,7 @@ public class AddressBook {
*
* @param other
* An AddressBook to merge with.
* @param overwrite True to overwrite
* @param log
* The log to write messages about new addresses or conflicts to.
*/
@ -169,7 +212,7 @@ public class AddressBook {
String otherKey = (String) otherIter.next();
String otherValue = (String) other.addresses.get(otherKey);
if (otherKey.endsWith(".i2p") && otherValue.length() >= 516) {
if (valid(otherKey, otherValue)) {
if (this.addresses.containsKey(otherKey) && !overwrite) {
if (!this.addresses.get(otherKey).equals(otherValue)
&& log != null) {
@ -184,7 +227,7 @@ public class AddressBook {
this.modified = true;
if (log != null) {
log.append("New address " + otherKey
+ " added to address book.");
+ " added to address book. From: " + other.location);
}
}
}

View File

@ -21,12 +21,19 @@
package addressbook;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.io.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Utility class providing methods to parse and write files in config file
@ -60,6 +67,7 @@ public class ConfigParser {
* a single key, value pair on each line, in the format: key=value. Lines
* starting with '#' or ';' are considered comments, and ignored. Lines that
* are obviously not in the format key=value are also ignored.
* The key is converted to lower case.
*
* @param input
* A BufferedReader with lines in key=value format to parse into
@ -77,7 +85,7 @@ public class ConfigParser {
inputLine = ConfigParser.stripComments(inputLine);
String[] splitLine = inputLine.split("=");
if (splitLine.length == 2) {
result.put(splitLine[0].trim(), splitLine[1].trim());
result.put(splitLine[0].trim().toLowerCase(), splitLine[1].trim());
}
inputLine = input.readLine();
}
@ -99,7 +107,11 @@ public class ConfigParser {
FileInputStream fileStream = new FileInputStream(file);
BufferedReader input = new BufferedReader(new InputStreamReader(
fileStream));
return ConfigParser.parse(input);
Map rv = ConfigParser.parse(input);
try {
fileStream.close();
} catch (IOException ioe) {}
return rv;
}
/**
@ -130,7 +142,7 @@ public class ConfigParser {
* cannot be read, map.
*/
public static Map parse(File file, Map map) {
Map result = new HashMap();
Map result;
try {
result = ConfigParser.parse(file);
} catch (IOException exp) {
@ -180,7 +192,11 @@ public class ConfigParser {
FileInputStream fileStream = new FileInputStream(file);
BufferedReader input = new BufferedReader(new InputStreamReader(
fileStream));
return ConfigParser.parseSubscriptions(input);
List rv = ConfigParser.parseSubscriptions(input);
try {
fileStream.close();
} catch (IOException ioe) {}
return rv;
}
/**
@ -205,13 +221,12 @@ public class ConfigParser {
*
* @param file
* A File to attempt to parse.
* @param string
* A List to use as the default, if file fails.
* @param list list of files to parse
* @return A List consisting of one element for each line in file, or if
* file cannot be read, list.
*/
public static List parseSubscriptions(File file, List list) {
List result = new LinkedList();
List result;
try {
result = ConfigParser.parseSubscriptions(file);
} catch (IOException exp) {
@ -301,4 +316,4 @@ public class ConfigParser {
new FileWriter(file, false)));
}
}
}

View File

@ -21,12 +21,12 @@
package addressbook;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Main class of addressbook. Performs updates, and runs the main loop.
@ -98,7 +98,8 @@ public class Daemon {
AddressBook router = new AddressBook(routerFile);
List defaultSubs = new LinkedList();
defaultSubs.add("http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/hosts.txt");
// defaultSubs.add("http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/hosts.txt");
defaultSubs.add("http://www.i2p2.i2p/hosts.txt");
SubscriptionList subscriptions = new SubscriptionList(subscriptionFile,
etagsFile, lastModifiedFile, defaultSubs, (String) settings
@ -124,7 +125,6 @@ public class Daemon {
public void run(String[] args) {
String settingsLocation = "config.txt";
Map settings = new HashMap();
String home;
if (args.length > 0) {
home = args[0];
@ -156,10 +156,11 @@ public class Daemon {
File settingsFile = new File(homeFile, settingsLocation);
settings = ConfigParser.parse(settingsFile, defaultSettings);
Map settings = ConfigParser.parse(settingsFile, defaultSettings);
// wait
try {
Thread.currentThread().sleep(5*60*1000);
Thread.sleep(5*60*1000);
// Static method, and redundent Thread.currentThread().sleep(5*60*1000);
} catch (InterruptedException ie) {}
while (true) {

View File

@ -43,6 +43,7 @@ public class DaemonThread extends Thread {
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
//try {
// Thread.sleep(5 * 60 * 1000);

View File

@ -54,14 +54,17 @@ public class Log {
* A String containing a message to append to the log.
*/
public void append(String entry) {
BufferedWriter bw = null;
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(this.file,
bw = new BufferedWriter(new FileWriter(this.file,
true));
String timestamp = new Date().toString();
bw.write(timestamp + " -- " + entry);
bw.newLine();
bw.close();
} catch (IOException exp) {
} finally {
if (bw != null)
try { bw.close(); } catch (IOException ioe) {}
}
}
@ -73,4 +76,4 @@ public class Log {
public File getFile() {
return this.file;
}
}
}

View File

@ -22,10 +22,10 @@
package addressbook;
import javax.servlet.GenericServlet;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
/**
* A wrapper for addressbook to allow it to be started as a web application.
@ -44,6 +44,7 @@ public class Servlet extends GenericServlet {
/* (non-Javadoc)
* @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
*/
@Override
public void init(ServletConfig config) {
try {
super.init(config);

View File

@ -41,6 +41,8 @@ public class SubscriptionIterator implements Iterator {
*
* @param subscriptions
* List of Subscription objects that represent address books.
* @param proxyHost proxy hostname
* @param proxyPort proxt port number
*/
public SubscriptionIterator(List subscriptions, String proxyHost, int proxyPort) {
this.subIterator = subscriptions.iterator();

View File

@ -21,13 +21,13 @@
package addressbook;
import java.util.List;
import java.util.LinkedList;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* A list of Subscriptions loaded from a file.
@ -60,6 +60,9 @@ public class SubscriptionList {
* @param lastModifiedFile
* A file containg the last-modified headers used for conditional
* GET. The file is in the format "url=leastmodified".
* @param defaultSubs default subscription file
* @param proxyHost proxy hostname
* @param proxyPort proxy port number
*/
public SubscriptionList(File locationsFile, File etagsFile,
File lastModifiedFile, List defaultSubs, String proxyHost,

View File

@ -10,16 +10,14 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Properties;
import org.apache.log4j.DailyRollingFileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException;
import org.jibble.pircbot.PircBot;

View File

@ -1,39 +0,0 @@
The Heartbeat GUI loads up the stat files generated by the Heartbeat
engine and renders them visually, offering a way to drill through different
data points and take snapshots as things change (by saving particular stat
files for later). The GUI itself doesn't need to be on the same machine
as the Heartbeat engine - it pulls the stat files through any URL - even
through the EepProxy.
An example Heartbeat GUI config file follows
# how often do we want to pull new data to render
refreshFrequency=60
## for each peer test we may want to include in the GUI:
# where to find the current stat file (URL or filename)
stat.0.location=http://dev.i2p.net/stats/heartbeatStat_khWY_30s_1kb.txt
## optional entries for each peer test describing what we want shown
## (and how we want it shown)
# do we want to plot the send time (from when the ping was sent until the pong server got it)?
stat.0.plot.current.send=true
# do we want to plot the receive time (from when the pong was sent until reception)?
stat.0.plot.current.receive=true
# do we want to plot the lost messages?
stat.0.plot.current.lost=true
# what color should the current lines be rendered in?
stat.0.plot.current.color=BLUE
## optional entries for each peer test describing what averages we want
## rendered
# plot 1 minute send average?
stat.0.plot.1m.send=true
# plot 1 minute receive average?
stat.0.plot.1m.receive=true
# plot 1 minute lost message average?
stat.0.plot.1m.lost=true
# what color should the 1 minute averages be rendered as?
stat.0.plot.1m.color=GREEN
## repeated for all of the averaged periods, e.g.
## stat.0.plot.30m, .60m, 1440m (1 day)
There may be some other options, such as where to store snapshot files, whether
to generate PNG images, etc.

View File

@ -1,122 +0,0 @@
Heartbeat
Application layer tool for monitoring the long term health of the
network by periodically testing peers, generating stats, and
rendering them visually. The engine (both server and client) should
work headless and seperate from the GUI, exposing the data in a simple
to parse (and human readable) text file for each peer being tested.
The GUI then periodically refreshes itself by loading those files (
either locally or from a URL) and renders the current state accordingly,
giving users a way to check that the network is alive, devs a tool to
both monitor the state of the network and to debug different situations (by
accessing the stat file - either live or archived).
The heartbeat configuration file is organized as a standard properties
file (by default located at heartbeat.config, but that can be overridden by
passing a filename as the first argument to the Heartbeat command):
# where the router is located (default is localhost)
i2cpHost=localhost
# I2CP port for the router (default is 7654)
i2cpPort=4001
# How many hops we want the router to put in our tunnels (default is 2)
numHops=2
# where our private destination keys are located - if this doesn't exist,
# a new one will be created and saved there (by default, heartbeat.keys)
privateDestinationFile=heartbeat_r2.keys
## peer tests configured below:
# destination peer for test 0
peer.0.peer=[destination in base64]
# where will we write out the stat data?
peer.0.statFile=heartbeatStat_khWY_30s_1kb.txt
# how many minutes will we keep stats for?
peer.0.statDuration=30
# how often will we write out new stat data (in seconds)?
peer.0.statFrequency=60
# how often will we send a ping to the peer (in seconds)?
peer.0.sendFrequency=30
# how many bytes will be included in the ping?
peer.0.sendSize=1024
# take a guess...
peer.0.comment=Test with localhost sending 1KB of data every 30 seconds
# we can keep track of a few moving averages - this value includes a whitespace
# delimited list of numbers, each specifying a period to calculate the average
# over (in minutes)
peer.0.averagePeriods=1 5 30
## repeat the peer.0.* for as many tests as desired, incrementing as necessary
If there are no peer.* lines, it will simply run a pong server. If any data is
missing, it will use the defaults (though there are no defaults for peer.* lines) -
running the Heartbeat app with no heartbeat configuration file whatsoever will create
a new pong server (storing its keys at heartbeat.keys) and using the I2P router at
localhost:7654.
The stat file generated for each set of peer.n.* lines contains the current state
of the test, its averages, as well as any other interesting data points. An example
stat file follows (hopefully it is self explanatory):
peer khWYqCETu9YtPUvGV92ocsbEW5DezhKlIG7ci8RLX3g=
local u-9hlR1ik2hemXf0HvKMfeRgrS86CbNQh25e7XBhaQE=
peerDest [base 64 of the full destination]
localDest [base 64 of the full destination]
numTunnelHops 2
comment Test with localhost sending 30KB every 20 seconds
sendFrequency 20
sendSize 30720
sessionStart 20040409.22:51:10.915
currentTime 20040409.23:31:39.607
numPending 2
lifetimeSent 118
lifetimeRecv 113
#averages minutes sendMs recvMs numLost
periodAverage 1 1843 771 0
periodAverage 5 786 752 1
periodAverage 30 855 735 3
#action status date and time sent sendMs replyMs
EVENT OK 20040409.23:21:44.742 691 670
EVENT OK 20040409.23:22:05.201 671 581
EVENT OK 20040409.23:22:26.301 1182 1452
EVENT OK 20040409.23:22:47.322 24304 1723
EVENT OK 20040409.23:23:08.232 2293 1081
EVENT OK 20040409.23:23:29.332 1392 641
EVENT OK 20040409.23:23:50.262 641 761
EVENT OK 20040409.23:24:11.102 651 701
EVENT OK 20040409.23:24:31.401 841 621
EVENT OK 20040409.23:24:52.061 651 681
EVENT OK 20040409.23:25:12.480 701 1623
EVENT OK 20040409.23:25:32.990 1442 1212
EVENT OK 20040409.23:25:54.230 591 631
EVENT OK 20040409.23:26:14.620 620 691
EVENT OK 20040409.23:26:35.199 1793 1432
EVENT OK 20040409.23:26:56.570 661 641
EVENT OK 20040409.23:27:17.200 641 660
EVENT OK 20040409.23:27:38.120 611 921
EVENT OK 20040409.23:27:58.699 831 621
EVENT OK 20040409.23:28:19.559 801 661
EVENT OK 20040409.23:28:40.279 601 611
EVENT OK 20040409.23:29:00.648 601 621
EVENT OK 20040409.23:29:21.288 701 661
EVENT LOST 20040409.23:29:41.828
EVENT LOST 20040409.23:30:02.327
EVENT LOST 20040409.23:30:22.656
EVENT OK 20040409.23:31:24.305 1843 771
The actual ping and pong messages sent are formatted trivially -
ping messages contain
$from $series $type $sentOn $size $payload
while pong messages contain
$from $series $type $sentOn $receivedOn $size $payload
$series is a number describing the sending client's test (so that you can
ping the same peer with different configurations concurrently, varying things
like the frequency and size of the message, window, etc).
They are sent as raw binary messages though, so see I2PAdapter.sendPing(..)
and I2PAdapter.sendPong(..) for the details.
To get valid measurements, of course, you will want to make sure that
both the heartbeat client and pong server have synchronized clocks (even
more so than I2P requires). It is highly recommended that only NTP
synchronized peers be used for heartbeat tests.

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="heartbeat">
<target name="all" depends="clean, buildGUI" />
<target name="build" depends="builddep, jar" />
<target name="buildGUI" depends="build, jarGUI" />
<target name="builddep">
<ant dir="../../../core/java/" target="build" />
</target>
<target name="compile">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac srcdir="./src" debug="true" deprecation="on" source="1.3" target="1.3" destdir="./build/obj" includes="**/*.java" excludes="net/i2p/heartbeat/gui/**" classpath="../../../core/java/build/i2p.jar" />
</target>
<target name="compileGUI">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac debug="true" source="1.3" target="1.3" deprecation="on" destdir="./build/obj">
<src path="src/" />
<classpath path="../../../core/java/build/i2p.jar" />
<classpath path="../../jfreechart/jfreechart-0.9.17/lib/jcommon-0.9.2.jar" />
<classpath path="../../jfreechart/jfreechart-0.9.17/lib/log4j-1.2.8.jar" />
<classpath path="../../jfreechart/jfreechart-0.9.17/jfreechart-0.9.17.jar" />
</javac>
</target>
<target name="jar" depends="compile">
<jar destfile="./build/heartbeat.jar" basedir="./build/obj" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.heartbeat.Heartbeat" />
<attribute name="Class-Path" value="i2p.jar heartbeat.jar" />
</manifest>
</jar>
</target>
<target name="jarGUI" depends="compileGUI">
<copy file="../../jfreechart/jfreechart-0.9.17/jfreechart-0.9.17.jar" todir="build/" />
<copy file="../../jfreechart/jfreechart-0.9.17/lib/log4j-1.2.8.jar" todir="build/" />
<copy file="../../jfreechart/jfreechart-0.9.17/lib/jcommon-0.9.2.jar" todir="build/" />
<jar destfile="./build/heartbeatGUI.jar" basedir="./build/obj" includes="**">
<manifest>
<attribute name="Main-Class" value="net.i2p.heartbeat.gui.HeartbeatMonitor" />
<attribute name="Class-Path" value="log4j-1.2.8.jar jcommon-0.9.2.jar jfreechart-0.9.17.jar heartbeatGUI.jar i2p.jar" />
</manifest>
</jar>
<echo message="You will need to copy the log4j, jcommon, and jfreechart jar files into your lib dir" />
</target>
<target name="javadoc">
<mkdir dir="./build" />
<mkdir dir="./build/javadoc" />
<javadoc
sourcepath="./src:../../../core/java/src:../../../core/java/test" destdir="./build/javadoc"
packagenames="*"
use="true"
access="package"
splitindex="true"
windowtitle="I2P heartbeat monitor" />
</target>
<target name="clean">
<delete dir="./build" />
</target>
<target name="cleandep" depends="clean">
<ant dir="../../../core/java/" target="cleandep" />
<ant dir="../../../core/java/" target="cleandep" />
</target>
<target name="distclean" depends="clean">
<ant dir="../../../core/java/" target="distclean" />
</target>
</project>

View File

@ -1,468 +0,0 @@
package net.i2p.heartbeat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.util.Log;
/**
* Define the configuration for testing against one particular peer as a client
*/
public class ClientConfig {
private static final Log _log = new Log(ClientConfig.class);
private Destination _peer;
private Destination _us;
private String _statFile;
private int _statDuration;
private int _statFrequency;
private int _sendFrequency;
private int _sendSize;
private int _numHops;
private String _comment;
private int _averagePeriods[];
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_PREFIX = "peer.";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_PEER = ".peer";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_STATFILE = ".statFile";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_STATDURATION = ".statDuration";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_STATFREQUENCY = ".statFrequency";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_SENDFREQUENCY = ".sendFrequency";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_SENDSIZE = ".sendSize";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_COMMENT = ".comment";
/**
* @seeRoutine ClientConfig#load
* @seeRoutine ClientConfig#store
*/
public static final String PROP_AVERAGEPERIODS = ".averagePeriods";
/**
* Default constructor...
*/
public ClientConfig() {
this(null, null, null, -1, -1, -1, -1, 0, null, null);
}
/**
* Create a dummy client config to be fetched from the specified location
* @param location the location to fetch from
*/
public ClientConfig(String location) {
this(null, null, location, -1, -1, -1, -1, 0, null, null);
}
/**
* @param peer who we will test against
* @param us who we are
* @param statLocation where the stat data should be stored/fetched
* @param duration how many minutes to keep events for
* @param statFreq how often to write out stats
* @param sendFreq how often to send pings
* @param sendSize how large the pings should be
* @param numHops how many hops is the current Heartbeat app using
* @param comment describe this test
* @param averagePeriods list of minutes to summarize over
*/
public ClientConfig(Destination peer, Destination us, String statLocation, int duration, int statFreq, int sendFreq,
int sendSize, int numHops, String comment, int averagePeriods[]) {
_peer = peer;
_us = us;
_statFile = statLocation;
_statDuration = duration;
_statFrequency = statFreq;
_sendFrequency = sendFreq;
_sendSize = sendSize;
_numHops = numHops;
_comment = comment;
_averagePeriods = averagePeriods;
}
/**
* Retrieves the peer to test against
*
* @return the Destination (peer)
*/
public Destination getPeer() {
return _peer;
}
/**
* Sets the peer to test against
*
* @param peer the Destination (peer)
*/
public void setPeer(Destination peer) {
_peer = peer;
}
/**
* Retrieves who we are when we test
*
* @return the Destination (us)
*/
public Destination getUs() {
return _us;
}
/**
* Sets who we are when we test
*
* @param us the Destination (us)
*/
public void setUs(Destination us) {
_us = us;
}
/**
* Retrieves the location to write the current stats to
*
* @return the name of the file
*/
public String getStatFile() {
return _statFile;
}
/**
* Sets the name of the location we write the current stats to
*
* @param statFile the name of the file
*/
public void setStatFile(String statFile) {
_statFile = statFile;
}
/**
* Retrieves how many minutes of statistics should be maintained within the window for this client
*
* @return the number of minutes
*/
public int getStatDuration() {
return _statDuration;
}
/**
* Sets how many minutes of statistics should be maintained within the window for this client
*
* @param durationMinutes the number of minutes
*/
public void setStatDuration(int durationMinutes) {
_statDuration = durationMinutes;
}
/**
* Retrieves how frequently the stats are written out (in seconds)
*
* @return the frequency in seconds
*/
public int getStatFrequency() {
return _statFrequency;
}
/**
* Sets how frequently the stats are written out (in seconds)
*
* @param freqSeconds the frequency in seconds
*/
public void setStatFrequency(int freqSeconds) {
_statFrequency = freqSeconds;
}
/**
* Retrieves how frequenty we send messages to the peer (in seconds)
*
* @return the frequency in seconds
*/
public int getSendFrequency() {
return _sendFrequency;
}
/**
* Sets how frequenty we send messages to the peer (in seconds)
*
* @param freqSeconds the frequency in seconds
*/
public void setSendFrequency(int freqSeconds) {
_sendFrequency = freqSeconds;
}
/**
* Retrieves how many bytes the ping messages should be (min values ~700, max ~32KB)
*
* @return the size in bytes
*/
public int getSendSize() {
return _sendSize;
}
/**
* Sets how many bytes the ping messages should be (min values ~700, max ~32KB)
*
* @param numBytes the size in bytes
*/
public void setSendSize(int numBytes) {
_sendSize = numBytes;
}
/**
* Retrieves the brief, 1 line description of the test. Useful comments are along the lines of "The peer is located on a fast router and connection with 2
* hop tunnels".
*
* @return the brief comment
*/
public String getComment() {
return _comment;
}
/**
* Sets a brief, 1 line description (comment) of the test.
*
* @param comment the brief comment
*/
public void setComment(String comment) {
_comment = comment;
}
/**
* Retrieves the periods that the client's tests should be averaged over.
*
* @return list of periods (in minutes) that the data should be averaged over, or null
*/
public int[] getAveragePeriods() {
return _averagePeriods;
}
/**
* Sets the periods that the client's tests should be averaged over.
*
* @param periods the list of periods (in minutes) that the data should be averaged over, or null
*/
public void setAveragePeriods(int periods[]) {
_averagePeriods = periods;
}
/**
* Make sure we're keeping track of the average over the given time period.
*
* @param minutes how many minutes to monitor
*/
public void addAveragePeriod(int minutes) {
if (_averagePeriods != null) {
for (int i = 0; i < _averagePeriods.length; i++) {
if (_averagePeriods[i] == minutes)
return;
}
}
int numPeriods = 1;
if (_averagePeriods != null)
numPeriods += _averagePeriods.length;
int periods[] = new int[numPeriods];
if (_averagePeriods != null)
System.arraycopy(_averagePeriods, 0, periods, 0, _averagePeriods.length);
periods[periods.length-1] = minutes;
Arrays.sort(periods);
_averagePeriods = periods;
}
/**
* Retrieves how many hops this test engine is configured to use for its outbound and inbound tunnels
*
* @return the number of hops
*/
public int getNumHops() {
return _numHops;
}
/**
* Sets how many hops this test engine is configured to use for its outbound and inbound tunnels
*
* @param numHops the number of hops
*/
public void setNumHops(int numHops) {
_numHops = numHops;
}
/**
* Load the client config from the properties specified, deriving the current config entry from the peer number.
*
* @param clientConfig the properties to load from
* @param peerNum the number associated with the peer
* @return true if it was loaded correctly, false if there were errors
*/
public boolean load(Properties clientConfig, int peerNum) {
if ((clientConfig == null) || (peerNum < 0)) return false;
String peerVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_PEER);
String statFileVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATFILE);
String statDurationVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATDURATION);
String statFrequencyVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY);
String sendFrequencyVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY);
String sendSizeVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE);
String commentVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_COMMENT);
String periodsVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS);
if ((peerVal == null) || (statFileVal == null) || (statDurationVal == null) || (statFrequencyVal == null)
|| (sendFrequencyVal == null) || (sendSizeVal == null)) {
if (_log.shouldLog(Log.DEBUG)) {
_log.debug("Peer number " + peerNum + " does not exist");
}
return false;
}
try {
int duration = getInt(statDurationVal);
int statFreq = getInt(statFrequencyVal);
int sendFreq = getInt(sendFrequencyVal);
int sendSize = getInt(sendSizeVal);
if ((duration <= 0) || (statFreq <= 0) || (sendFreq < 0) || (sendSize <= 0)) {
if (_log.shouldLog(Log.WARN)) {
_log.warn("Invalid client config: duration [" + statDurationVal + "] stat frequency ["
+ statFrequencyVal + "] send frequency [" + sendFrequencyVal + "] send size ["
+ sendSizeVal + "]");
}
return false;
}
statFileVal = statFileVal.trim();
if (statFileVal.length() <= 0) {
if (_log.shouldLog(Log.WARN)) {
_log.warn("Stat file is blank for peer " + peerNum);
}
return false;
}
Destination d = new Destination();
d.fromBase64(peerVal);
if (commentVal == null) {
commentVal = "";
}
commentVal = commentVal.trim();
commentVal = commentVal.replace('\n', '_');
List periods = new ArrayList(4);
if (periodsVal != null) {
StringTokenizer tok = new StringTokenizer(periodsVal);
while (tok.hasMoreTokens()) {
String periodVal = tok.nextToken();
int minutes = getInt(periodVal);
if (minutes > 0) {
periods.add(new Integer(minutes));
}
}
}
int avgPeriods[] = new int[periods.size()];
for (int i = 0; i < periods.size(); i++) {
avgPeriods[i] = ((Integer) periods.get(i)).intValue();
}
_comment = commentVal;
_statDuration = duration;
_statFrequency = statFreq;
_sendFrequency = sendFreq;
_sendSize = sendSize;
_statFile = statFileVal;
_peer = d;
_averagePeriods = avgPeriods;
return true;
} catch (DataFormatException dfe) {
_log.error("Peer destination for " + peerNum + " was invalid: " + peerVal);
return false;
}
}
/**
* Store the client config to the properties specified, deriving the current config entry from the peer number.
*
* @param clientConfig the properties to store to
* @param peerNum the number associated with the peer
* @return true if it was stored correctly, false if there were errors
*/
public boolean store(Properties clientConfig, int peerNum) {
if ((_peer == null) || (_sendFrequency < 0) || (_sendSize <= 0) || (_statDuration <= 0)
|| (_statFrequency <= 0) || (_statFile == null)) { return false; }
String comment = _comment;
if (comment == null) {
comment = "";
}
comment = comment.trim();
comment = comment.replace('\n', '_');
StringBuffer buf = new StringBuffer(32);
if (_averagePeriods != null) {
for (int i = 0; i < _averagePeriods.length; i++) {
buf.append(_averagePeriods[i]).append(' ');
}
}
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_PEER, _peer.toBase64());
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFILE, _statFile);
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATDURATION, _statDuration + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY, _statFrequency + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY, _sendFrequency + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE, _sendSize + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_COMMENT, comment);
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS, buf.toString());
return true;
}
private static final int getInt(String val) {
if (val == null) return -1;
try {
int i = Integer.parseInt(val);
return i;
} catch (NumberFormatException nfe) {
if (_log.shouldLog(Log.DEBUG)) {
_log.debug("Value [" + val + "] is not a valid integer");
}
return -1;
}
}
}

View File

@ -1,133 +0,0 @@
package net.i2p.heartbeat;
import net.i2p.data.Destination;
import net.i2p.util.Clock;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
/**
* Responsible for actually conducting the tests, coordinating the storing of the
* stats, and the management of the rates. This has its own thread specific for
* pumping data around as well.
*
*/
class ClientEngine {
private static final Log _log = new Log(ClientEngine.class);
/** who can send our pings? */
private Heartbeat _heartbeat;
/** actual test state */
private PeerData _data;
/** have we been stopped? */
private boolean _active;
/** used to generate engine IDs */
private static int __id = 0;
/** this engine's id, unique to the {test,sendingClient,startTime} */
private int _id;
private static PeerDataWriter writer = new PeerDataWriter();
/**
* Create a new engine that will send its pings through the given heartbeat
* system, and will coordinate the test according to the configuration specified.
* @param heartbeat the Heartbeat to send pings through
* @param config the Configuration to load configuration from =p
*/
public ClientEngine(Heartbeat heartbeat, ClientConfig config) {
_heartbeat = heartbeat;
_data = new PeerData(config);
_active = false;
_id = ++__id;
}
/** stop sending any more pings or writing any more state */
public void stopEngine() {
_active = false;
if (_log.shouldLog(Log.INFO))
_log.info("Stopping engine talking to peer " + _data.getConfig().getPeer().calculateHash().toBase64());
}
/** start up the test (this does not block, as it fires up the test thread) */
public void startEngine() {
_active = true;
I2PThread t = new I2PThread(new ClientRunner());
t.setName("HeartbeatClient " + _id);
t.start();
}
/**
* Who are we testing?
* @return the Destination (peer) we're testing
*/
public Destination getPeer() {
return _data.getConfig().getPeer();
}
/**
* What is our series identifier (used to locally identify a test)
* @return the series identifier
*/
public int getSeriesNum() {
return _id;
}
/**
* receive notification from the heartbeat system that a pong was received in
* reply to a ping we have sent.
*
* @param sentOn when did we send the ping?
* @param replyOn when did the peer send the pong?
*/
public void receivePong(long sentOn, long replyOn) {
_data.pongReceived(sentOn, replyOn);
}
/** fire off a new ping */
private void doSend() {
long now = Clock.getInstance().now();
_data.addPing(now);
_heartbeat.sendPing(_data.getConfig().getPeer(), _id, now, _data.getConfig().getSendSize());
}
/** our actual heartbeat pumper - this drives the test */
private class ClientRunner implements Runnable {
/**
* @see java.lang.Runnable#run()
*/
public void run() {
if (_log.shouldLog(Log.INFO))
_log.info("Starting engine talking to peer " + _data.getConfig().getPeer().calculateHash().toBase64());
// when do we need to send the next PING?
long nextSend = Clock.getInstance().now();
// when do we need to write out the next state data?
long nextWrite = Clock.getInstance().now();
while (_active) {
if (Clock.getInstance().now() >= nextSend) {
doSend();
nextSend = Clock.getInstance().now() + _data.getConfig().getSendFrequency() * 1000;
}
if (Clock.getInstance().now() >= nextWrite) {
boolean written = writer.persist(_data);
if (!written) {
if (_log.shouldLog(Log.ERROR)) _log.error("Unable to write the client state data");
} else {
if (_log.shouldLog(Log.DEBUG)) _log.debug("Client state data written");
}
}
_data.cleanup();
long timeToWait = nextSend - Clock.getInstance().now();
if (timeToWait > 0) {
try {
Thread.sleep(timeToWait);
} catch (InterruptedException ie) {
}
}
}
}
}
}

View File

@ -1,254 +0,0 @@
package net.i2p.heartbeat;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import net.i2p.data.Destination;
import net.i2p.util.Log;
/**
* Main driver for the heartbeat engine, loading 0 or more tests, firing
* up a ClientEngine for each, and serving as a pong server. If there isn't
* a configuration file, or if the configuration file doesn't specify any tests,
* it simply sits around as a pong server, passively responding to whatever is
* sent its way. <p />
*
* The config file format is examplified below:
* <pre>
* # where the router is located (default is localhost)
* i2cpHost=localhost
* # I2CP port for the router (default is 7654)
* i2cpPort=4001
* # How many hops we want the router to put in our tunnels (default is 2)
* numHops=2
* # where our private destination keys are located - if this doesn't exist,
* # a new one will be created and saved there (by default, heartbeat.keys)
* privateDestinationFile=heartbeat_r2.keys
* # where do we want to export the plain base64 of our destination?
* publicDestinationFile=heartbeat_r2.txt
*
* ## peer tests configured below:
*
* # destination peer for test 0
* peer.0.peer=[destination in base64]
* # where will we write out the stat data?
* peer.0.statFile=heartbeatStat_khWY_30s_1kb.txt
* # how many minutes will we keep stats for?
* peer.0.statDuration=30
* # how often will we write out new stat data (in seconds)?
* peer.0.statFrequency=60
* # how often will we send a ping to the peer (in seconds)?
* peer.0.sendFrequency=30
* # how many bytes will be included in the ping?
* peer.0.sendSize=1024
* # take a guess...
* peer.0.comment=Test with localhost sending 1KB of data every 30 seconds
* # we can keep track of a few moving averages - this value includes a whitespace
* # delimited list of numbers, each specifying a period to calculate the average
* # over (in minutes)
* peer.0.averagePeriods=1 5 30
* ## repeat the peer.0.* for as many tests as desired, incrementing as necessary
* </pre>
*
*/
public class Heartbeat {
private static final Log _log = new Log(Heartbeat.class);
/** location containing this heartbeat's config */
private String _configFile;
/** clientNum (Integer) to ClientConfig mapping */
private Map _clientConfigs;
/** series num (Integer) to ClientEngine mapping */
private Map _clientEngines;
/** helper class for managing our I2P send/receive and message formatting */
private I2PAdapter _adapter;
/** our own callback that the I2PAdapter notifies on ping or pong messages */
private PingPongAdapter _eventAdapter;
/** if there are no command line arguments, load the config from "heartbeat.config" */
public static final String CONFIG_FILE_DEFAULT = "heartbeat.config";
/**
* build up a new heartbeat manager, but don't actually do anything
* @param configFile the name of the configuration file
*/
public Heartbeat(String configFile) {
_configFile = configFile;
_clientConfigs = new HashMap();
_clientEngines = new HashMap();
_eventAdapter = new PingPongAdapter();
_adapter = new I2PAdapter();
_adapter.setListener(_eventAdapter);
}
private Heartbeat() {
}
/** load up the config data (but don't build any engines or start them up) */
public void loadConfig() {
Properties props = new Properties();
FileInputStream fin = null;
File configFile = new File(_configFile);
if (configFile.exists()) {
try {
fin = new FileInputStream(_configFile);
props.load(fin);
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error reading the config data", ioe);
}
} finally {
if (fin != null) try {
fin.close();
} catch (IOException ioe) {
}
}
}
loadBaseConfig(props);
loadClientConfigs(props);
}
/**
* send a ping message to the peer
*
* @param peer peer to ping
* @param seriesNum id used to keep track of multiple pings (of different size/frequency) to a peer
* @param now current time to be sent in the ping (so we can watch for it in the pong)
* @param size total message size to send
*/
void sendPing(Destination peer, int seriesNum, long now, int size) {
if (_adapter.getIsConnected()) _adapter.sendPing(peer, seriesNum, now, size);
}
/**
* load up the base data (I2CP config, etc)
* @param props the properties to load from
*/
private void loadBaseConfig(Properties props) {
_adapter.loadConfig(props);
}
/**
* load up all of the test config data
* @param props the properties to load from
* */
private void loadClientConfigs(Properties props) {
int i = 0;
while (true) {
ClientConfig config = new ClientConfig();
if (!config.load(props, i)) {
break;
}
_clientConfigs.put(new Integer(i), config);
i++;
}
}
/** connect to the network */
private void connect() {
boolean connected = _adapter.connect();
if (!connected) _log.error("Unable to connect to the router");
}
/** disconnect from the network */
private void disconnect() { /* UNUSED */
_adapter.disconnect();
}
/** start up all of the tests */
public void startEngines() {
for (Iterator iter = _clientConfigs.values().iterator(); iter.hasNext();) {
ClientConfig config = (ClientConfig) iter.next();
ClientEngine engine = new ClientEngine(this, config);
config.setUs(_adapter.getLocalDestination());
config.setNumHops(_adapter.getNumHops());
_clientEngines.put(new Integer(engine.getSeriesNum()), engine);
engine.startEngine();
}
}
/** stop all of the tests */
public void stopEngines() {
for (Iterator iter = _clientEngines.values().iterator(); iter.hasNext();) {
ClientEngine engine = (ClientEngine) iter.next();
engine.stopEngine();
}
_clientEngines.clear();
}
/**
* Fire up a new heartbeat system, waiting until, well, forever. Builds
* a new heartbeat system, loads the config, connects to the network, starts
* the engines, and then sits back and relaxes, responding to any pings and
* running any tests. <p />
*
* <code> <b>Usage: </b> Heartbeat [<i>configFileName</i>]</code> <p />
* @param args the list of args passed to the program from the command-line
*/
public static void main(String args[]) {
String configFile = CONFIG_FILE_DEFAULT;
if (args.length == 1) {
configFile = args[0];
}
if (_log.shouldLog(Log.INFO)) {
_log.info("Starting up with config file " + configFile);
}
Heartbeat heartbeat = new Heartbeat(configFile);
heartbeat.loadConfig();
heartbeat.connect();
heartbeat.startEngines();
Object o = new Object();
while (true) {
try {
synchronized (o) {
o.wait();
}
} catch (InterruptedException ie) {
}
}
}
/**
* Receive event notification from the I2PAdapter
*
*/
private class PingPongAdapter implements I2PAdapter.PingPongEventListener {
/**
* We were pinged, so always just send a pong back.
*
* @param from who sent us the ping?
* @param seriesNum what series did the sender specify?
* @param sentOn when did the sender say they sent their ping?
* @param data arbitrary payload data
*/
public void receivePing(Destination from, int seriesNum, Date sentOn, byte[] data) {
if (_adapter.getIsConnected()) {
_adapter.sendPong(from, seriesNum, sentOn, data);
}
}
/**
* We received a pong, so find the right client engine and tell it about the pong.
*
* @param from who sent us the pong
* @param seriesNum our client ID
* @param sentOn when did we send the ping?
* @param replyOn when did they send their pong?
* @param data the arbitrary data we sent in the ping (that they sent back in the pong)
*/
public void receivePong(Destination from, int seriesNum, Date sentOn, Date replyOn, byte[] data) {
ClientEngine engine = (ClientEngine) _clientEngines.get(new Integer(seriesNum));
if (engine.getPeer().equals(from)) {
engine.receivePong(sentOn.getTime(), replyOn.getTime());
}
}
}
}

View File

@ -1,604 +0,0 @@
package net.i2p.heartbeat;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PClient;
import net.i2p.client.I2PClientFactory;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.I2PSessionListener;
import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.util.Clock;
import net.i2p.util.Log;
/**
* Tie-in to the I2P SDK for the Heartbeat system, talking to the I2PSession and
* dealing with the raw ping and pong messages.
*
*/
class I2PAdapter {
private final static Log _log = new Log(I2PAdapter.class);
/** I2CP host */
private String _i2cpHost;
/** I2CP port */
private int _i2cpPort;
/** how long do we want our tunnels to be? */
private int _numHops;
/** filename containing the heartbeat engine's private destination info */
private String _privateDestFile;
/** filename to store the heartbeat engine's public destination in base64*/
private String _publicDestFile;
/** our destination */
private Destination _localDest;
/** who do we tell? */
private PingPongEventListener _listener;
/** how do we talk to the router */
private I2PSession _session;
/** object that receives our i2cp notifications from the session and tells us */
private I2PListener _i2pListener; /* UNUSED */
/**
* This config property tells us where the private destination data for our
* connection (or if it doesn't exist, where will we save it)
*/
private static final String DEST_FILE_PROP = "privateDestinationFile";
/** by default, the private destination data is in "heartbeat.keys" */
private static final String DEST_FILE_DEFAULT = "heartbeat.keys";
/** where will we export the public destination in base 64? */
private static final String PUBLIC_DEST_FILE_PROP = "publicDestinationFile";
/** where will we export the public destination in base 64? */
private static final String PUBLIC_DEST_FILE_DEFAULT = "heartbeat.txt";
/** This config property defines where the I2P router is */
private static final String I2CP_HOST_PROP = "i2cpHost";
/** by default, the I2P host is "localhost" */
private static final String I2CP_HOST_DEFAULT = "localhost";
/** This config property defines the I2CP port on the router */
private static final String I2CP_PORT_PROP = "i2cpPort";
/** by default, the I2CP port is 7654 */
private static final int I2CP_PORT_DEFAULT = 7654;
/** This property defines how many hops we want in our tunnels. */
public static final String NUMHOPS_PROP = "numHops";
/** by default, use 2 hop tunnels */
public static final int NUMHOPS_DEFAULT = 2;
/**
* Constructs an I2PAdapter . . .
*/
public I2PAdapter() {
_privateDestFile = null;
_publicDestFile = null;
_i2cpHost = null;
_i2cpPort = -1;
_localDest = null;
_listener = null;
_session = null;
_numHops = 0;
}
/**
* who are we?
* @return the destination (us)
*/
public Destination getLocalDestination() {
return _localDest;
}
/**
* who gets notified when we receive a ping or a pong?
* @return the event listener who gets notified
*/
public PingPongEventListener getListener() {
return _listener;
}
/**
* Sets who gets notified when we receive a ping or a pong
* @param listener the event listener to get notified
*/
public void setListener(PingPongEventListener listener) {
_listener = listener;
}
/**
* how many hops do we want in our tunnels?
* @return the number of hops
*/
public int getNumHops() {
return _numHops;
}
/**
* are we connected?
* @return true or false . . .
*/
public boolean getIsConnected() {
return _session != null;
}
/**
* Read in all of the config data
* @param props the properties to load from
*/
void loadConfig(Properties props) {
String privDestFile = props.getProperty(DEST_FILE_PROP, DEST_FILE_DEFAULT);
String pubDestFile = props.getProperty(PUBLIC_DEST_FILE_PROP, PUBLIC_DEST_FILE_DEFAULT);
String host = props.getProperty(I2CP_HOST_PROP, I2CP_HOST_DEFAULT);
String port = props.getProperty(I2CP_PORT_PROP, "" + I2CP_PORT_DEFAULT);
String numHops = props.getProperty(NUMHOPS_PROP, "" + NUMHOPS_DEFAULT);
int portNum = -1;
try {
portNum = Integer.parseInt(port);
} catch (NumberFormatException nfe) {
if (_log.shouldLog(Log.WARN)) {
_log.warn("Invalid I2CP port specified [" + port + "]");
}
portNum = I2CP_PORT_DEFAULT;
}
int hops = -1;
try {
hops = Integer.parseInt(numHops);
} catch (NumberFormatException nfe) {
if (_log.shouldLog(Log.WARN)) {
_log.warn("Invalid # hops specified [" + numHops + "]");
}
hops = NUMHOPS_DEFAULT;
}
_numHops = hops;
_privateDestFile = privDestFile;
_publicDestFile = pubDestFile;
_i2cpHost = host;
_i2cpPort = portNum;
}
/**
* write out the config to the props
* @param props the properties to write to
*/
void storeConfig(Properties props) {
if (_privateDestFile != null) {
props.setProperty(DEST_FILE_PROP, _privateDestFile);
} else {
props.setProperty(DEST_FILE_PROP, DEST_FILE_DEFAULT);
}
if (_publicDestFile != null) {
props.setProperty(PUBLIC_DEST_FILE_PROP, _publicDestFile);
} else {
props.setProperty(PUBLIC_DEST_FILE_PROP, PUBLIC_DEST_FILE_DEFAULT);
}
if (_i2cpHost != null) {
props.setProperty(I2CP_HOST_PROP, _i2cpHost);
} else {
props.setProperty(I2CP_HOST_PROP, I2CP_HOST_DEFAULT);
}
if (_i2cpPort > 0) {
props.setProperty(I2CP_PORT_PROP, "" + _i2cpPort);
} else {
props.setProperty(I2CP_PORT_PROP, "" + I2CP_PORT_DEFAULT);
}
props.setProperty(NUMHOPS_PROP, "" + _numHops);
}
private static final int TYPE_PING = 0;
private static final int TYPE_PONG = 1;
/**
* send a ping message to the peer
*
* @param peer peer to ping
* @param seriesNum id used to keep track of multiple pings (of different size/frequency) to a peer
* @param now current time to be sent in the ping (so we can watch for it in the pong)
* @param size total message size to send
*
* @throws IllegalStateException if we are not connected to the router
*/
public void sendPing(Destination peer, int seriesNum, long now, int size) {
if (_session == null) throw new IllegalStateException("Not connected to the router");
ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
try {
_localDest.writeBytes(baos);
DataHelper.writeLong(baos, 2, seriesNum);
DataHelper.writeLong(baos, 1, TYPE_PING);
DataHelper.writeDate(baos, new Date(now));
int padding = size - baos.size();
byte paddingData[] = new byte[padding];
I2PAppContext.getGlobalContext().random().nextBytes(paddingData);
//Arrays.fill(paddingData, (byte) 0x2A);
DataHelper.writeLong(baos, 2, padding);
baos.write(paddingData);
boolean sent = _session.sendMessage(peer, baos.toByteArray());
if (!sent) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error sending the ping to " + peer.calculateHash().toBase64() + " for series "
+ seriesNum);
}
} else {
if (_log.shouldLog(Log.INFO)) {
_log.info("Ping sent to " + peer.calculateHash().toBase64() + " for series " + seriesNum);
}
}
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error sending the ping", ioe);
}
} catch (DataFormatException dfe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error writing out the ping message", dfe);
}
} catch (I2PSessionException ise) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error writing out the ping message", ise);
}
}
}
/**
* send a pong message to the peer
*
* @param peer peer to pong
* @param seriesNum id given to us in the ping
* @param sentOn date the peer said they sent us the message
* @param data payload the peer sent us in the ping
*
* @throws IllegalStateException if we are not connected to the router
*/
public void sendPong(Destination peer, int seriesNum, Date sentOn, byte data[]) {
if (_session == null) throw new IllegalStateException("Not connected to the router");
ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length + 768);
try {
_localDest.writeBytes(baos);
DataHelper.writeLong(baos, 2, seriesNum);
DataHelper.writeLong(baos, 1, TYPE_PONG);
DataHelper.writeDate(baos, sentOn);
DataHelper.writeDate(baos, new Date(Clock.getInstance().now()));
DataHelper.writeLong(baos, 2, data.length);
baos.write(data);
boolean sent = _session.sendMessage(peer, baos.toByteArray());
if (!sent) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error sending the pong to " + peer.calculateHash().toBase64() + " for series "
+ seriesNum + " which was sent on " + sentOn);
}
} else {
if (_log.shouldLog(Log.INFO)) {
_log.info("Pong sent to " + peer.calculateHash().toBase64() + " for series " + seriesNum
+ " which was sent on " + sentOn);
}
}
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error sending the ping", ioe);
}
} catch (DataFormatException dfe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error writing out the pong message", dfe);
}
} catch (I2PSessionException ise) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error writing out the pong message", ise);
}
}
}
/**
* We've received this data from I2P - parse it into a ping or a pong
* and notify accordingly
* @param data the data to handle
*/
private void handleMessage(byte data[]) {
ByteArrayInputStream bais = new ByteArrayInputStream(data);
try {
Destination from = new Destination();
from.readBytes(bais);
int series = (int) DataHelper.readLong(bais, 2);
long type = DataHelper.readLong(bais, 1);
Date sentOn = DataHelper.readDate(bais);
Date receivedOn = null;
if (type == TYPE_PONG) {
receivedOn = DataHelper.readDate(bais);
}
int size = (int) DataHelper.readLong(bais, 2);
byte payload[] = new byte[size];
int read = DataHelper.read(bais, payload);
if (read != size) { throw new IOException("Malformed payload - read " + read + " instead of " + size); }
if (_listener == null) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Listener isn't set, but we received a valid message of type " + type + " sent from "
+ from.calculateHash().toBase64());
}
return;
}
if (type == TYPE_PING) {
if (_log.shouldLog(Log.INFO)) {
_log.info("Ping received from " + from.calculateHash().toBase64() + " on series " + series
+ " sent on " + sentOn + " containing " + size + " bytes");
}
_listener.receivePing(from, series, sentOn, payload);
} else if (type == TYPE_PONG) {
if (_log.shouldLog(Log.INFO)) {
_log.info("Pong received from " + from.calculateHash().toBase64() + " on series " + series
+ " sent on " + sentOn + " with pong sent on " + receivedOn + " containing " + size
+ " bytes");
}
_listener.receivePong(from, series, sentOn, receivedOn, payload);
} else {
throw new IOException("Invalid message type " + type);
}
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error handling the message", ioe);
}
} catch (DataFormatException dfe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error parsing the message", dfe);
}
}
}
/**
* connect to the I2P router and either authenticate ourselves with the
* destination we're given, or create a new one and write that to the
* destination file.
*
* @return true if we connect successfully, false otherwise
*/
boolean connect() {
I2PClient client = I2PClientFactory.createClient();
Destination us = null;
File destFile = new File(_privateDestFile);
us = verifyDestination(client, destFile);
if (us == null) return false;
// if we're here, we got a destination. lets connect
FileInputStream fin = null;
try {
fin = new FileInputStream(destFile);
Properties options = getOptions();
I2PSession session = client.createSession(fin, options);
I2PListener lsnr = new I2PListener();
session.setSessionListener(lsnr);
session.connect();
_localDest = session.getMyDestination();
if (_log.shouldLog(Log.INFO)) {
_log.info("I2CP Session created and connected as " + _localDest.calculateHash().toBase64());
}
_session = session;
_i2pListener = lsnr;
} catch (I2PSessionException ise) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error connecting", ise);
}
return false;
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error loading the destionation", ioe);
}
return false;
} finally {
if (fin != null) try {
fin.close();
} catch (IOException ioe) {
}
}
return true;
}
/**
* load, verify, or create a destination
*
* @param client the client
* @param destFile the file holding the destination
* @return the destination loaded, or null if there was an error
*/
private Destination verifyDestination(I2PClient client, File destFile) {
Destination us = null;
FileInputStream fin = null;
if (destFile.exists()) {
try {
fin = new FileInputStream(destFile);
us = new Destination();
us.readBytes(fin);
if (_log.shouldLog(Log.INFO)) {
_log.info("Existing destination loaded: [" + us.toBase64() + "]");
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(_publicDestFile);
fos.write(us.toBase64().getBytes());
fos.flush();
} catch (IOException fioe) {
_log.error("Error writing out the plain destination to [" + _publicDestFile + "]", fioe);
} finally {
if (fos != null) try { fos.close(); } catch (IOException fioe) {}
}
} catch (IOException ioe) {
if (fin != null) try {
fin.close();
} catch (IOException ioe2) {
}
fin = null;
destFile.delete();
us = null;
} catch (DataFormatException dfe) {
if (fin != null) try {
fin.close();
} catch (IOException ioe2) {
}
fin = null;
destFile.delete();
us = null;
} finally {
if (fin != null) try {
fin.close();
} catch (IOException ioe2) {
}
fin = null;
}
}
if (us == null) {
// need to create a new one
FileOutputStream fos = null;
try {
fos = new FileOutputStream(destFile);
us = client.createDestination(fos);
if (_log.shouldLog(Log.INFO)) {
_log.info("New destination created: [" + us.toBase64() + "]");
}
fos.close();
try {
fos = new FileOutputStream(_publicDestFile);
fos.write(us.toBase64().getBytes());
fos.flush();
} catch (IOException fioe) {
_log.error("Error writing out the plain destination to [" + _publicDestFile + "]", fioe);
} finally {
if (fos != null) try { fos.close(); } catch (IOException fioe) {}
fos = null;
}
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error writing out the destination keys being created", ioe);
}
return null;
} catch (I2PException ie) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error creating the destination", ie);
}
return null;
} finally {
if (fos != null) try {
fos.close();
} catch (IOException ioe) {
}
}
}
return us;
}
/**
* I2PSession connect options
* @return the options as Properties
*/
private Properties getOptions() {
Properties props = new Properties();
// this should be BEST_EFFORT, but i'm too lazy to update the code to handle tracking
// sessionTags and sessionKeys, marking them as delivered on pong.
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_GUARANTEED);
props.setProperty(I2PClient.PROP_TCP_HOST, _i2cpHost);
props.setProperty(I2PClient.PROP_TCP_PORT, _i2cpPort + "");
props.setProperty("tunnels.depthInbound", "" + _numHops);
props.setProperty("tunnels.depthOutbound", "" + _numHops);
return props;
}
/** disconnect from the I2P router */
void disconnect() {
if (_session != null) {
try {
_session.destroySession();
} catch (I2PSessionException ise) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Error destroying the session", ise);
}
}
_session = null;
}
}
/**
* Defines an event notification system for receiving pings and pongs
*
*/
public interface PingPongEventListener {
/**
* receive a ping message from the peer
*
* @param from peer that sent us the ping
* @param seriesNum id the peer sent us in the ping
* @param sentOn date the peer said they sent us the message
* @param data payload from the ping
*/
void receivePing(Destination from, int seriesNum, Date sentOn, byte data[]);
/**
* receive a pong message from the peer
*
* @param from peer that sent us the pong
* @param seriesNum id the peer sent us in the pong (that we sent them in the ping)
* @param sentOn when we sent out the ping
* @param replyOn when they sent out the pong
* @param data payload from the ping/pong
*/
void receivePong(Destination from, int seriesNum, Date sentOn, Date replyOn, byte data[]);
}
/**
* Receive data from the session and pass it along to handleMessage for parsing/dispersal
*
*/
private class I2PListener implements I2PSessionListener {
/* (non-Javadoc)
* @see net.i2p.client.I2PSessionListener#disconnected(net.i2p.client.I2PSession)
*/
public void disconnected(I2PSession session) {
if (_log.shouldLog(Log.ERROR)) {
_log.error("Session disconnected");
}
disconnect();
}
/* (non-Javadoc)
* @see net.i2p.client.I2PSessionListener#errorOccurred(net.i2p.client.I2PSession, java.lang.String, java.lang.Throwable)
*/
public void errorOccurred(I2PSession session, String message, Throwable error) {
if (_log.shouldLog(Log.ERROR)) _log.error("Error occurred: " + message, error);
}
/* (non-Javadoc)
* @see net.i2p.client.I2PSessionListener#reportAbuse(net.i2p.client.I2PSession, int)
*/
public void reportAbuse(I2PSession session, int severity) {
if (_log.shouldLog(Log.ERROR)) _log.error("Abuse reported with severity " + String.valueOf(severity));
}
/* (non-Javadoc)
* @see net.i2p.client.I2PSessionListener#messageAvailable(net.i2p.client.I2PSession, int, long)
*/
public void messageAvailable(I2PSession session, int msgId, long size) {
try {
byte data[] = session.receiveMessage(msgId);
handleMessage(data);
} catch (I2PSessionException ise) {
if (_log.shouldLog(Log.ERROR)) _log.error("Error receiving the message", ise);
disconnect();
}
}
}
}

View File

@ -1,412 +0,0 @@
package net.i2p.heartbeat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import net.i2p.stat.Rate;
import net.i2p.stat.RateStat;
import net.i2p.util.Clock;
import net.i2p.util.Log;
/**
* Contain the current window of data for a particular series of ping/pong stats
* sent to a peer. This should be periodically kept clean by calling cleanup()
* to timeout expired pings and to drop data outside the window.
*
*/
public class PeerData {
private final static Log _log = new Log(PeerData.class);
/** peer / sequence / config in this data series */
private ClientConfig _peer;
/** date sent (Long) to EventDataPoint containing the datapoints sent in the current period */
private Map _dataPoints;
/** date sent (Long) to EventDataPoint containing pings that haven't yet timed out or been ponged */
private TreeMap _pendingPings;
private long _sessionStart;
private long _lifetimeSent;
private long _lifetimeReceived;
/** rate averaging the time to send over a variety of periods */
private RateStat _sendRate;
/** rate averaging the time to receive over a variety of periods */
private RateStat _receiveRate;
/** rate averaging the frequency of lost messages over a variety of periods */
private RateStat _lostRate;
/** how long we wait before timing out pending pings (30 seconds) */
private static final long TIMEOUT_PERIOD = 60 * 1000;
/** synchronize on this when updating _dataPoints or _pendingPings */
private Object _updateLock = new Object();
/**
* Creates a PeerData . . .
* @param config configuration to load from
*/
public PeerData(ClientConfig config) {
_peer = config;
_dataPoints = new TreeMap();
_pendingPings = new TreeMap();
_sessionStart = Clock.getInstance().now();
_lifetimeSent = 0;
_lifetimeReceived = 0;
_sendRate = new RateStat("sendRate", "How long it takes to send", "peer",
getPeriods(config.getAveragePeriods()));
_receiveRate = new RateStat("receiveRate", "How long it takes to receive", "peer",
getPeriods(config.getAveragePeriods()));
_lostRate = new RateStat("lostRate", "How frequently we lose messages", "peer",
getPeriods(config.getAveragePeriods()));
}
/**
* turn the periods (# minutes) into rate periods (# milliseconds)
* @param periods (in minutes)
* @return an array of periods (in milliseconds)
*/
private static long[] getPeriods(int periods[]) {
long rv[] = null;
if (periods == null) periods = new int[0];
rv = new long[periods.length];
for (int i = 0; i < periods.length; i++)
rv[i] = (long) periods[i] * 60 * 1000; // they're in minutes
Arrays.sort(rv);
return rv;
}
/**
* how many pings are still outstanding?
* @return the number of pings outstanding
*/
public int getPendingCount() {
synchronized (_updateLock) {
return _pendingPings.size();
}
}
/**
* how many data points are available in the current window?
* @return the number of datapoints available
*/
public int getDataPointCount() {
synchronized (_updateLock) {
return _dataPoints.size();
}
}
/**
* when did this test begin?
* @return when the test began
*/
public long getSessionStart() { return _sessionStart; }
/**
* sets when the test began
* @param when when it began
*/
public void setSessionStart(long when) { _sessionStart = when; }
/**
* how many pings have we sent for this test?
* @return the number of pings sent
*/
public long getLifetimeSent() { return _lifetimeSent; }
/**
* how many pongs have we received for this test?
* @return the number of pings received
*/
public long getLifetimeReceived() { return _lifetimeReceived; }
/**
* @return the client configuration
*/
public ClientConfig getConfig() {
return _peer;
}
/**
* What periods are we averaging the data over (in minutes)?
* @return the periods as an array of ints (in minutes)
*/
public int[] getAveragePeriods() {
return (_peer.getAveragePeriods() != null ? _peer.getAveragePeriods() : new int[0]);
}
/**
* average time to send over the given period.
*
* @param period number of minutes to retrieve the average for
* @return milliseconds average, or -1 if we dont track that period
*/
public double getAverageSendTime(int period) {
return getAverage(_sendRate, period);
}
/**
* average time to receive over the given period.
*
* @param period number of minutes to retrieve the average for
* @return milliseconds average, or -1 if we dont track that period
*/
public double getAverageReceiveTime(int period) {
return getAverage(_receiveRate, period);
}
/**
* number of lost messages over the given period.
*
* @param period number of minutes to retrieve the average for
* @return number of lost messages in the period, or -1 if we dont track that period
*/
public double getLostMessages(int period) {
Rate rate = _lostRate.getRate(period * 60 * 1000);
if (rate == null) return -1;
return rate.getCurrentTotalValue();
}
private double getAverage(RateStat stat, int period) {
Rate rate = stat.getRate(period * 60 * 1000);
if (rate == null) return -1;
return rate.getAverageValue();
}
/**
* Return an ordered list of data points in the current window (after doing a cleanup)
*
* @return list of EventDataPoint objects
*/
public List getDataPoints() {
cleanup();
synchronized (_updateLock) {
return new ArrayList(_dataPoints.values());
}
}
/**
* We have sent the peer a ping on this series (using the send time as given)
* @param dateSent when the ping was sent
*/
public void addPing(long dateSent) {
EventDataPoint sent = new EventDataPoint(dateSent);
synchronized (_updateLock) {
_pendingPings.put(new Long(dateSent), sent);
}
_lifetimeSent++;
}
/**
* we have received a pong from the peer on this series
*
* @param dateSent when we sent the ping
* @param pongSent when the peer received the ping and sent the pong
*/
public void pongReceived(long dateSent, long pongSent) {
long now = Clock.getInstance().now();
synchronized (_updateLock) {
if (_pendingPings.size() <= 0) {
_log.warn("Pong received (sent at " + dateSent + ", " + (now-dateSent)
+ "ms ago, pong delay " + (pongSent-dateSent) + "ms, pong receive delay "
+ (now-pongSent) + "ms)");
return;
}
Long first = (Long)_pendingPings.firstKey();
EventDataPoint data = (EventDataPoint)_pendingPings.remove(new Long(dateSent));
if (data != null) {
data.setPongReceived(now);
data.setPongSent(pongSent);
data.setWasPonged(true);
locked_addDataPoint(data);
if (dateSent != first.longValue()) {
_log.error("Out of order delivery: received " + dateSent
+ " but the first pending is " + first.longValue()
+ " (delta " + (dateSent - first.longValue()) + ")");
} else {
_log.info("In order delivery for " + dateSent + " in ping "
+ _peer.getComment());
}
} else {
_log.warn("Pong received, but no matching ping? ping sent at = " + dateSent);
return;
}
}
_sendRate.addData(pongSent - dateSent, 0);
_receiveRate.addData(now - pongSent, 0);
_lifetimeReceived++;
}
protected void addDataPoint(EventDataPoint data) {
synchronized (_updateLock) {
locked_addDataPoint(data);
}
}
private void locked_addDataPoint(EventDataPoint data) {
Object val = _dataPoints.put(new Long(data.getPingSent()), data);
if (val != null) {
if (_log.shouldLog(Log.WARN))
_log.warn("Duplicate data point received: " + data);
}
}
/**
* drop all datapoints outside the window we're watching, and timeout all
* pending pings not ponged in the TIMEOUT_PERIOD, both updating the lost message
* rate and coallescing all of the rates.
*
*/
public void cleanup() {
long dropBefore = Clock.getInstance().now() - _peer.getStatDuration() * 60 * 1000;
long timeoutBefore = Clock.getInstance().now() - TIMEOUT_PERIOD;
long numDropped = 0;
long numTimedOut = 0;
synchronized (_updateLock) {
numDropped = locked_dropExpired(dropBefore);
numTimedOut = locked_timeoutPending(timeoutBefore);
}
_lostRate.addData(numTimedOut, 0);
_receiveRate.coalesceStats();
_sendRate.coalesceStats();
_lostRate.coalesceStats();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Peer data cleaned up " + numTimedOut + " timed out pings and removed " + numDropped
+ " old entries");
}
/**
* Drop all data points that are already too old for us to be interested in
*
* @param when the earliest ping send time we care about
* @return number of data points dropped
*/
private int locked_dropExpired(long when) {
Set toDrop = new HashSet(4);
// drop the failed and really old
for (Iterator iter = _dataPoints.keySet().iterator(); iter.hasNext(); ) {
Long pingTime = (Long)iter.next();
if (pingTime.longValue() < when)
toDrop.add(pingTime);
}
for (Iterator iter = toDrop.iterator(); iter.hasNext(); ) {
_dataPoints.remove(iter.next());
}
return toDrop.size();
}
/**
* timeout and remove all pings that were sent before the given time,
* moving them from the set of pending pings to the set of data points
*
* @param when the earliest ping send time we care about
* @return number of pings timed out
*/
private int locked_timeoutPending(long when) {
Set toDrop = new HashSet(4);
for (Iterator iter = _pendingPings.keySet().iterator(); iter.hasNext(); ) {
Long pingTime = (Long)iter.next();
if (pingTime.longValue() < when) {
toDrop.add(pingTime);
EventDataPoint point = (EventDataPoint)_pendingPings.get(pingTime);
point.setWasPonged(false);
locked_addDataPoint(point);
}
}
for (Iterator iter = toDrop.iterator(); iter.hasNext(); ) {
_pendingPings.remove(iter.next());
}
return toDrop.size();
}
/** actual data point for the peer */
public class EventDataPoint {
private boolean _wasPonged;
private long _pingSent;
private long _pongSent;
private long _pongReceived;
/**
* Creates an EventDataPoint
*/
public EventDataPoint() { this(-1); }
/**
* Creates an EventDataPoint with pingtime associated with it =)
* @param pingSentOn the time a ping was sent
*/
public EventDataPoint(long pingSentOn) {
_wasPonged = false;
_pingSent = pingSentOn;
_pongSent = -1;
_pongReceived = -1;
}
/**
* when did we send this ping?
* @return the time the ping was sent
*/
public long getPingSent() { return _pingSent; }
/**
* sets when we sent this ping
* @param when when we sent the ping
*/
public void setPingSent(long when) { _pingSent = when; }
/**
* when did the peer receive the ping?
* @return the time the ping was receieved
*/
public long getPongSent() {
return _pongSent;
}
/**
* Set the time the peer received the ping
* @param when the time to set
*/
public void setPongSent(long when) {
_pongSent = when;
}
/**
* when did we receive the peer's pong?
* @return the time we receieved the pong
*/
public long getPongReceived() {
return _pongReceived;
}
/**
* Set the time the peer's pong was receieved
* @param when the time to set
*/
public void setPongReceived(long when) {
_pongReceived = when;
}
/**
* did the peer reply in time?
* @return true or false, whether we got a reply in time */
public boolean getWasPonged() {
return _wasPonged;
}
/**
* Set whether we receieved the peer's reply in time
* @param pong true or false
*/
public void setWasPonged(boolean pong) {
_wasPonged = pong;
}
}
}

View File

@ -1,142 +0,0 @@
package net.i2p.heartbeat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import net.i2p.util.Clock;
import net.i2p.util.Log;
/**
* Actually write out the stats for peer test
*
*/
public class PeerDataWriter {
private final static Log _log = new Log(PeerDataWriter.class);
/**
* persist the peer state to the location specified in the peer config
*
* @param data the peer data to persist
* @return true if it was persisted correctly, false on error
*/
public boolean persist(PeerData data) {
String filename = data.getConfig().getStatFile();
File statFile = new File(filename);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(statFile);
persist(data, fos);
} catch (IOException ioe) {
if (_log.shouldLog(Log.ERROR))
_log.error("Error persisting the peer data for "
+ data.getConfig().getPeer().calculateHash().toBase64(), ioe);
return false;
} finally {
if (fos != null) try {
fos.close();
} catch (IOException ioe) {
}
}
return true;
}
/**
* persists the peer state to the output stream
* @param data the peer data to persist
* @param out where to persist the data
* @return true if it was persisted correctly [always (as implemented)], false on error
* @throws IOException
*/
public boolean persist(PeerData data, OutputStream out) throws IOException {
String header = getHeader(data);
out.write(header.getBytes());
out.write("#action\tstatus\tdate and time sent \tsendMs\treplyMs\troundTrip\n".getBytes());
for (Iterator iter = data.getDataPoints().iterator(); iter.hasNext();) {
PeerData.EventDataPoint point = (PeerData.EventDataPoint) iter.next();
String line = getEvent(point);
out.write(line.getBytes());
}
return true;
}
private String getHeader(PeerData data) {
StringBuffer buf = new StringBuffer(1024);
buf.append("peer \t").append(data.getConfig().getPeer().calculateHash().toBase64()).append('\n');
buf.append("local \t").append(data.getConfig().getUs().calculateHash().toBase64()).append('\n');
buf.append("peerDest \t").append(data.getConfig().getPeer().toBase64()).append('\n');
buf.append("localDest \t").append(data.getConfig().getUs().toBase64()).append('\n');
buf.append("numTunnelHops\t").append(data.getConfig().getNumHops()).append('\n');
buf.append("comment \t").append(data.getConfig().getComment()).append('\n');
buf.append("sendFrequency\t").append(data.getConfig().getSendFrequency()).append('\n');
buf.append("sendSize \t").append(data.getConfig().getSendSize()).append('\n');
buf.append("sessionStart \t").append(getTime(data.getSessionStart())).append('\n');
buf.append("currentTime \t").append(getTime(Clock.getInstance().now())).append('\n');
buf.append("numPending \t").append(data.getPendingCount()).append('\n');
buf.append("lifetimeSent \t").append(data.getLifetimeSent()).append('\n');
buf.append("lifetimeRecv \t").append(data.getLifetimeReceived()).append('\n');
int periods[] = data.getAveragePeriods();
buf.append("#averages\tminutes\tsendMs\trecvMs\tnumLost\troundTrip\n");
for (int i = 0; i < periods.length; i++) {
buf.append("periodAverage\t").append(periods[i]).append('\t');
buf.append(getNum(data.getAverageSendTime(periods[i]))).append('\t');
buf.append(getNum(data.getAverageReceiveTime(periods[i]))).append('\t');
buf.append(getNum(data.getLostMessages(periods[i]))).append('\t');
double rtt = data.getAverageSendTime(periods[i])
+ data.getAverageReceiveTime(periods[i]);
buf.append(getNum(rtt)).append('\n');
}
return buf.toString();
}
private String getEvent(PeerData.EventDataPoint point) {
StringBuffer buf = new StringBuffer(128);
buf.append("EVENT\t");
if (point.getWasPonged())
buf.append("OK\t");
else
buf.append("LOST\t");
buf.append(getTime(point.getPingSent())).append('\t');
if (point.getWasPonged()) {
buf.append(point.getPongSent() - point.getPingSent()).append('\t');
buf.append(point.getPongReceived() - point.getPongSent()).append('\t');
buf.append(point.getPongReceived() - point.getPingSent()).append('\t');
}
buf.append('\n');
return buf.toString();
}
private final SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd.HH:mm:ss.SSS", Locale.UK);
/**
* Converts a time (long) to text
* @param when the time to convert
* @return the textual representation
*/
public String getTime(long when) {
synchronized (_fmt) {
return _fmt.format(new Date(when));
}
}
private final DecimalFormat _numFmt = new DecimalFormat("#0", new DecimalFormatSymbols(Locale.UK));
/**
* Converts a number (double) to text
* @param val the number to convert
* @return the textual representation
*/
public String getNum(double val) {
synchronized (_numFmt) {
return _numFmt.format(val);
}
}
}

View File

@ -1,108 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import net.i2p.util.Log;
/**
* Render the control widgets (refresh/load/snapshot and the
* tabbed panel with the plot config data)
*
*/
class HeartbeatControlPane extends JPanel {
private final static Log _log = new Log(HeartbeatControlPane.class);
private HeartbeatMonitorGUI _gui;
private JTabbedPane _configPane;
private final static Color WHITE = new Color(255, 255, 255);
private final static Color LIGHT_BLUE = new Color(180, 180, 255); /* UNUSED */
private final static Color BLACK = new Color(0, 0, 0);
private Color _background = WHITE;
private Color _foreground = BLACK;
/**
* Constructs a control panel onto the gui
* @param gui the gui the panel is associated with
*/
public HeartbeatControlPane(HeartbeatMonitorGUI gui) {
_gui = gui;
initializeComponents();
}
/**
* Adds a test to the panel
* @param config the configuration for the test
*/
public void addTest(PeerPlotConfig config) {
_configPane.addTab(config.getTitle(), null, new JScrollPane(new PeerPlotConfigPane(config, this)), config.getSummary());
_configPane.setBackgroundAt(_configPane.getTabCount()-1, _background);
_configPane.setForegroundAt(_configPane.getTabCount()-1, _foreground);
_gui.pack();
}
/**
* Removes a test from the panel
* @param config the configuration for the test
*/
public void removeTest(PeerPlotConfig config) {
_gui.getMonitor().getState().removeTest(config);
int index = _configPane.indexOfTab(config.getTitle());
if (index >= 0)
_configPane.removeTabAt(index);
}
/**
* Callback: when tests have changed
*/
public void testsUpdated() {
List knownNames = new ArrayList(8);
for (int i = 0; i < _gui.getMonitor().getState().getTestCount(); i++) {
PeerPlotState state = _gui.getMonitor().getState().getTest(i);
String title = state.getPlotConfig().getTitle();
knownNames.add(state.getPlotConfig().getTitle());
if (_configPane.indexOfTab(title) >= 0) {
_log.debug("We already know about [" + title + "]");
} else {
_log.info("The test [" + title + "] is new to us");
PeerPlotConfigPane pane = new PeerPlotConfigPane(state.getPlotConfig(), this);
_configPane.addTab(state.getPlotConfig().getTitle(), null, new JScrollPane(pane), state.getPlotConfig().getSummary());
_configPane.setBackgroundAt(_configPane.getTabCount()-1, _background);
_configPane.setForegroundAt(_configPane.getTabCount()-1, _foreground);
}
}
List toRemove = new ArrayList(4);
for (int i = 0; i < _configPane.getTabCount(); i++) {
if (knownNames.contains(_configPane.getTitleAt(i))) {
// noop
} else {
toRemove.add(_configPane.getTitleAt(i));
}
}
for (int i = 0; i < toRemove.size(); i++) {
String title = (String)toRemove.get(i);
_log.info("Removing test [" + title + "]");
_configPane.removeTabAt(_configPane.indexOfTab(title));
}
}
private void initializeComponents() {
if (_gui != null)
setBackground(_gui.getBackground());
else
setBackground(_background);
setLayout(new BorderLayout());
HeartbeatMonitorCommandBar bar = new HeartbeatMonitorCommandBar(_gui);
bar.setBackground(getBackground());
add(bar, BorderLayout.NORTH);
_configPane = new JTabbedPane(JTabbedPane.LEFT);
_configPane.setBackground(_background);
//add(_configPane, BorderLayout.CENTER);
add(_configPane, BorderLayout.SOUTH);
}
}

View File

@ -1,116 +0,0 @@
package net.i2p.heartbeat.gui;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
/**
* The HeartbeatMonitor, complete with main()! Act now, and it's only 5 easy
* payments of $19.95 (plus shipping and handling)! You heard me, only _5_
* easy payments of $19.95 (plus shipping and handling)! <p />
*
* (fine print: something about some states in the US requiring the addition
* of sales tax... or something) <p />
*
* (finer print: Satan owns you. Deal with it.) <p />
*
* (even finer print: usage: <code>HeartbeatMonitor [configFilename]</code>)
*/
public class HeartbeatMonitor implements PeerPlotStateFetcher.FetchStateReceptor, PeerPlotConfig.UpdateListener {
private final static Log _log = new Log(HeartbeatMonitor.class);
private HeartbeatMonitorState _state;
private HeartbeatMonitorGUI _gui;
/**
* Delegating constructor.
* @see HeartbeatMonitor#HeartbeatMonitor(String)
*/
public HeartbeatMonitor() { this(null); }
/**
* Creates a HeartbeatMonitor . . .
* @param configFilename the configuration file to read from
*/
public HeartbeatMonitor(String configFilename) {
_state = new HeartbeatMonitorState(configFilename);
_gui = new HeartbeatMonitorGUI(this);
}
/**
* Starts the game rollin'
*/
public void runMonitor() {
loadConfig();
I2PThread t = new I2PThread(new HeartbeatMonitorRunner(this));
t.setName("HeartbeatMonitor");
t.setDaemon(false);
t.start();
_log.debug("Monitor started");
}
/**
* give us all the data/config available
* @return the current state (data/config)
*/
HeartbeatMonitorState getState() {
return _state;
}
/** for all of the peer tests being monitored, refetch the data and rerender */
void refetchData() {
_log.debug("Refetching data");
for (int i = 0; i < _state.getTestCount(); i++)
PeerPlotStateFetcher.fetchPeerPlotState(this, _state.getTest(i));
}
/** (re)load the config defining what peer tests we are monitoring (and how to render) */
void loadConfig() {
//for (int i = 0; i < 10; i++) {
// load("fake" + i);
//}
}
/**
* Loads config data
* @param location the name of the location to load data from
*/
public void load(String location) {
PeerPlotConfig cfg = new PeerPlotConfig(location);
cfg.addListener(this);
PeerPlotState state = new PeerPlotState(cfg);
PeerPlotStateFetcher.fetchPeerPlotState(this, state);
}
/* (non-Javadoc)
* @see PeerPlotStateFetcher.FetchStateReceptor#peerPlotStateFetched
*/
public synchronized void peerPlotStateFetched(PeerPlotState state) {
_state.addTest(state);
_gui.stateUpdated();
}
/**
* store the config defining what peer tests we are monitoring (and how to render)
*/
void storeConfig() {}
/**
* And now, the main function, the one you've all been waiting for! . . .
* @param args da args. Should take 1, which is the location to load config data from
*/
public static void main(String args[]) {
Thread.currentThread().setName("HeartbeatMonitor.main");
if (args.length == 1)
new HeartbeatMonitor(args[0]).runMonitor();
else
new HeartbeatMonitor().runMonitor();
}
/**
* Called when the config is updated
* @param config the updated config
*/
public void configUpdated(PeerPlotConfig config) {
_log.debug("Config updated, revamping the gui");
_gui.stateUpdated();
}
}

View File

@ -1,67 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
class HeartbeatMonitorCommandBar extends JPanel {
private HeartbeatMonitorGUI _gui;
private JComboBox _refreshRate;
private JTextField _location;
/**
* Constructs a command bar onto the gui
* @param gui the gui the command bar is associated with
*/
public HeartbeatMonitorCommandBar(HeartbeatMonitorGUI gui) {
_gui = gui;
initializeComponents();
}
private void refreshChanged(ItemEvent evt) {}
private void loadCalled() {
_gui.getMonitor().load(_location.getText());
}
private void browseCalled() {
JFileChooser chooser = new JFileChooser(_location.getText());
chooser.setBackground(_gui.getBackground());
chooser.setMultiSelectionEnabled(false);
int rv = chooser.showDialog(this, "Load");
if (rv == JFileChooser.APPROVE_OPTION)
_gui.getMonitor().load(chooser.getSelectedFile().getAbsolutePath());
}
private void initializeComponents() {
_refreshRate = new JComboBox(new DefaultComboBoxModel(new Object[] {"10 second refresh", "30 second refresh", "1 minute refresh", "5 minute refresh"}));
_refreshRate.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { refreshChanged(evt); } });
_refreshRate.setEnabled(false);
_refreshRate.setBackground(_gui.getBackground());
//add(_refreshRate);
JLabel loadLabel = new JLabel("Load from: ");
loadLabel.setBackground(_gui.getBackground());
add(loadLabel);
_location = new JTextField(20);
_location.setToolTipText("Either specify a local filename or a fully qualified URL");
_location.setBackground(_gui.getBackground());
add(_location);
JButton browse = new JButton("Browse...");
browse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { browseCalled(); } });
browse.setBackground(_gui.getBackground());
add(browse);
JButton load = new JButton("Load");
load.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { loadCalled(); } });
load.setBackground(_gui.getBackground());
add(load);
setBackground(_gui.getBackground());
}
}

View File

@ -1,98 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
class HeartbeatMonitorGUI extends JFrame {
private HeartbeatMonitor _monitor;
private HeartbeatPlotPane _plotPane;
private HeartbeatControlPane _controlPane;
private final static Color WHITE = new Color(255, 255, 255);
private Color _background = WHITE;
/**
* Creates the GUI for all youz who be too shoopid for text based shitz
* @param monitor the monitor the gui operates over
*/
public HeartbeatMonitorGUI(HeartbeatMonitor monitor) {
super("Heartbeat Monitor");
_monitor = monitor;
initializeComponents();
pack();
//setResizable(false);
setVisible(true);
}
HeartbeatMonitor getMonitor() { return _monitor; }
/** build up all our widgets */
private void initializeComponents() {
getContentPane().setLayout(new BorderLayout());
setBackground(_background);
_plotPane = new JFreeChartHeartbeatPlotPane(this); // new HeartbeatPlotPane(this);
_plotPane.setBackground(_background);
//JScrollPane pane = new JScrollPane(_plotPane);
//pane.setBackground(_background);
getContentPane().add(new JScrollPane(_plotPane), BorderLayout.CENTER);
_controlPane = new HeartbeatControlPane(this);
_controlPane.setBackground(_background);
getContentPane().add(_controlPane, BorderLayout.SOUTH);
//JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(_plotPane), new JScrollPane(_controlPane));
//getContentPane().add(pane, BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
initializeMenus();
}
/**
* Callback: when the state of the world changes . . .
*/
public void stateUpdated() {
_controlPane.testsUpdated();
_plotPane.stateUpdated();
}
private void exitCalled() {
_monitor.getState().setWasKilled(true);
setVisible(false);
System.exit(0);
}
private void loadConfigCalled() {}
private void saveConfigCalled() {}
private void loadSnapshotCalled() {}
private void saveSnapshotCalled() {}
private void initializeMenus() {
JMenuBar bar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
JMenuItem loadConfig = new JMenuItem("Load config");
loadConfig.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { loadConfigCalled(); } });
JMenuItem saveConfig = new JMenuItem("Save config");
saveConfig.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveConfigCalled(); } });
JMenuItem saveSnapshot = new JMenuItem("Save snapshot");
saveSnapshot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveSnapshotCalled(); } });
JMenuItem loadSnapshot = new JMenuItem("Load snapshot");
loadSnapshot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { loadSnapshotCalled(); } });
JMenuItem exit = new JMenuItem("Exit");
exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitCalled(); } });
fileMenu.add(loadConfig);
fileMenu.add(saveConfig);
fileMenu.add(loadSnapshot);
fileMenu.add(saveSnapshot);
fileMenu.add(exit);
bar.add(fileMenu);
setJMenuBar(bar);
}
}

View File

@ -1,32 +0,0 @@
package net.i2p.heartbeat.gui;
import net.i2p.util.Log;
/**
* Periodically fire off necessary events (instructing the heartbeat monitor when
* to refetch the data, etc). This is the only active thread in the heartbeat
* monitor (outside the swing/jvm threads)
*/
class HeartbeatMonitorRunner implements Runnable {
private final static Log _log = new Log(HeartbeatMonitorRunner.class);
private HeartbeatMonitor _monitor;
/**
* Creates the thread . . .
* @param monitor the monitor the thread runs over
*/
public HeartbeatMonitorRunner(HeartbeatMonitor monitor) {
_monitor = monitor;
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
while (!_monitor.getState().getWasKilled()) {
_monitor.refetchData();
try { Thread.sleep(_monitor.getState().getRefreshRateMs()); } catch (InterruptedException ie) {}
}
_log.info("Stopping the heartbeat monitor runner");
}
}

View File

@ -1,129 +0,0 @@
package net.i2p.heartbeat.gui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* manage the current state of the GUI - all data points, as well as any
* rendering or configuration options.
*/
class HeartbeatMonitorState {
private String _configFile;
private List _peerPlotState;
private int _currentPeerPlotConfig;
private int _refreshRateMs;
private boolean _killed;
/** by default, refresh every 30 seconds */
private final static int DEFAULT_REFRESH_RATE = 30*1000;
/** where do we load/store config info from? */
private final static String DEFAULT_CONFIG_FILE = "heartbeatMonitor.config";
/**
* A delegating constructor.
* @see HeartbeatMonitorState#HeartbeatMonitorState(String)
*/
public HeartbeatMonitorState() { this(DEFAULT_CONFIG_FILE); }
/**
* Constructs the state, loading from the specified location
* @param configFile the name of the file to load info from
*/
public HeartbeatMonitorState(String configFile) {
_peerPlotState = Collections.synchronizedList(new ArrayList());
_refreshRateMs = DEFAULT_REFRESH_RATE;
_configFile = configFile;
_killed = false;
_currentPeerPlotConfig = 0;
}
/**
* how many tests are we monitoring?
* @return the number of tests
*/
public int getTestCount() { return _peerPlotState.size(); }
/**
* Retrieves the current info of a test for a certain peer . . .
* @param peer a number associated with a certain peer
* @return the test data
*/
public PeerPlotState getTest(int peer) { return (PeerPlotState)_peerPlotState.get(peer); }
/**
* Adds a test . . .
* @param peerState the test (by state) to add . . .
*/
public void addTest(PeerPlotState peerState) {
if (!_peerPlotState.contains(peerState))
_peerPlotState.add(peerState);
}
/**
* Removes a test . . .
* @param peerState the test (by state) to remove . . .
*/
public void removeTest(PeerPlotState peerState) { _peerPlotState.remove(peerState); }
/**
* Removes a test . . .
* @param peerConfig the test (by config) to remove . . .
*/
public void removeTest(PeerPlotConfig peerConfig) {
for (int i = 0; i < getTestCount(); i++) {
PeerPlotState state = getTest(i);
if (state.getPlotConfig() == peerConfig) {
removeTest(state);
return;
}
}
}
/**
* which of the tests are we currently editing/viewing?
* @return the number associated with the test
*/
public int getPeerPlotConfig() { return _currentPeerPlotConfig; }
/**
* Sets the test we are currently editting/viewing
* @param whichTest the number associated with the test
*/
public void setPeerPlotConfig(int whichTest) { _currentPeerPlotConfig = whichTest; }
/**
* how frequently should we update the data?
* @return the current frequency (in milliseconds)
*/
public int getRefreshRateMs() { return _refreshRateMs; }
/**
* Sets how frequently we should update data
* @param ms the frequency (in milliseconds)
*/
public void setRefreshRateMs(int ms) { _refreshRateMs = ms; }
/**
* where is our config stored?
* @return the name of the config file
*/
public String getConfigFile() { return _configFile; }
/**
* Sets where our config is stored
* @param filename the name of the config file
*/
public void setConfigFile(String filename) { _configFile = filename; }
/**
* have we been shut down?
* @return true if we have, false otherwise
*/
public boolean getWasKilled() { return _killed; }
/**
* Sets if we have been shutdown or not
* @param killed true if we've been shutdown, false otherwise
*/
public void setWasKilled(boolean killed) { _killed = killed; }
}

View File

@ -1,62 +0,0 @@
package net.i2p.heartbeat.gui;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import net.i2p.heartbeat.PeerDataWriter;
import net.i2p.util.Log;
/**
* Render the graph and legend
*/
class HeartbeatPlotPane extends JPanel {
private final static Log _log = new Log(HeartbeatPlotPane.class);
protected HeartbeatMonitorGUI _gui;
private JTextArea _text;
/**
* Constructs the plot pane
* @param gui the gui the pane is attached to
*/
public HeartbeatPlotPane(HeartbeatMonitorGUI gui) {
_gui = gui;
initializeComponents();
}
/**
* Callback: when things change . . .
*/
public void stateUpdated() {
StringBuffer buf = new StringBuffer(32*1024);
PeerDataWriter writer = new PeerDataWriter();
for (int i = 0; i < _gui.getMonitor().getState().getTestCount(); i++) {
StaticPeerData data = _gui.getMonitor().getState().getTest(i).getCurrentData();
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
try {
writer.persist(data, baos);
} catch (IOException ioe) {
_log.error("wtf, error writing to a byte array?", ioe);
}
buf.append(new String(baos.toByteArray())).append("\n\n\n");
}
_text.setText(buf.toString());
}
protected void initializeComponents() {
setBackground(_gui.getBackground());
//Dimension size = new Dimension(800, 600);
_text = new JTextArea("",30,80); // 16, 60);
_text.setAutoscrolls(true);
_text.setEditable(false);
// _text.setLineWrap(true);
// add(new JScrollPane(_text));
add(_text);
// add(new JScrollPane(_text, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS));
// setPreferredSize(size);
}
}

View File

@ -1,233 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.Color;
import java.awt.Font;
import java.util.List;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.XYItemRenderer;
import org.jfree.chart.renderer.XYLineAndShapeRenderer;
import org.jfree.data.XYSeries;
import org.jfree.data.XYSeriesCollection;
import net.i2p.heartbeat.PeerData;
import net.i2p.util.Log;
class JFreeChartAdapter {
private final static Log _log = new Log(JFreeChartAdapter.class); /* UNUSED */
private final static Color WHITE = new Color(255, 255, 255);
ChartPanel createPanel(HeartbeatMonitorState state) {
ChartPanel panel = new ChartPanel(createChart(state));
panel.setDisplayToolTips(true);
panel.setEnforceFileExtensions(true);
panel.setHorizontalZoom(true);
panel.setVerticalZoom(true);
panel.setMouseZoomable(true, true);
panel.getChart().setBackgroundPaint(WHITE);
return panel;
}
JFreeChart createChart(HeartbeatMonitorState state) {
Plot plot = createPlot(state);
JFreeChart chart = new JFreeChart("I2P Heartbeat performance", Font.getFont("arial"), plot, true);
return chart;
}
void updateChart(ChartPanel panel, HeartbeatMonitorState state) {
XYPlot plot = (XYPlot)panel.getChart().getPlot();
plot.setDataset(getCollection(state));
updateLines(plot, state);
}
private long getFirst(HeartbeatMonitorState state) { /* UNUSED */
long first = -1;
for (int i = 0; i < state.getTestCount(); i++) {
List dataPoints = state.getTest(i).getCurrentData().getDataPoints();
if ( (dataPoints != null) && (dataPoints.size() > 0) ) {
PeerData.EventDataPoint data = (PeerData.EventDataPoint)dataPoints.get(0);
if ( (first < 0) || (first > data.getPingSent()) )
first = data.getPingSent();
}
}
return first;
}
Plot createPlot(HeartbeatMonitorState state) {
XYItemRenderer renderer = new XYLineAndShapeRenderer(); // new XYDotRenderer(); //
XYPlot plot = new XYPlot(getCollection(state), new DateAxis(), new NumberAxis("ms"), renderer);
updateLines(plot, state);
return plot;
}
private void updateLines(XYPlot plot, HeartbeatMonitorState state) {
if (true) return;
if (state == null) return;
for (int i = 0; i < state.getTestCount(); i++) {
PeerPlotConfig config = state.getTest(i).getPlotConfig();
PeerPlotConfig.PlotSeriesConfig curConfig = config.getCurrentSeriesConfig();
XYSeriesCollection col = ((XYSeriesCollection)plot.getDataset());
for (int j = 0; j < col.getSeriesCount(); j++) {
//XYItemRenderer renderer = plot.getRendererForDataset(col.getSeries(j));
XYItemRenderer renderer = plot.getRendererForDataset(col);
if (col.getSeriesName(j).startsWith(config.getTitle() + " send")) {
if (curConfig.getPlotSendTime()) {
//renderer.setPaint(curConfig.getPlotLineColor());
}
}
if (col.getSeriesName(j).startsWith(config.getTitle() + " receive")) {
if (curConfig.getPlotReceiveTime()) {
//renderer.setPaint(curConfig.getPlotLineColor());
}
}
if (col.getSeriesName(j).startsWith(config.getTitle() + " lost")) {
if (curConfig.getPlotLostMessages()) {
//renderer.setPaint(curConfig.getPlotLineColor());
}
}
}
}
}
XYSeriesCollection getCollection(HeartbeatMonitorState state) {
XYSeriesCollection col = new XYSeriesCollection();
if (state != null) {
for (int i = 0; i < state.getTestCount(); i++) {
addTest(col, state.getTest(i));
}
} else {
XYSeries series = new XYSeries("latency", false, false);
series.add(System.currentTimeMillis(), 0);
col.addSeries(series);
}
return col;
}
void addTest(XYSeriesCollection col, PeerPlotState state) {
PeerPlotConfig config = state.getPlotConfig();
PeerPlotConfig.PlotSeriesConfig curConfig = config.getCurrentSeriesConfig();
addLines(col, curConfig, config.getTitle(), state.getCurrentData().getDataPoints());
addAverageLines(col, config, config.getTitle(), state.getCurrentData());
}
/**
* @param col the collection of xy series to add to
* @param config preferences for how to display this test
* @param lineName minimal name of the test (e.g. "jxHa.32KB.60s")
* @param data List of PeerData.EventDataPoint describing all of the events in the test
*/
void addLines(XYSeriesCollection col, PeerPlotConfig.PlotSeriesConfig config, String lineName, List data) {
if (config.getPlotSendTime()) {
XYSeries sendSeries = getSendSeries(data);
sendSeries.setName(lineName + " send");
sendSeries.setDescription("milliseconds for the ping to reach the peer");
col.addSeries(sendSeries);
}
if (config.getPlotReceiveTime()) {
XYSeries recvSeries = getReceiveSeries(data);
recvSeries.setName(lineName + " receive");
recvSeries.setDescription("milliseconds for the peer's pong to reach the sender");
col.addSeries(recvSeries);
}
if (config.getPlotLostMessages()) {
XYSeries lostSeries = getLostSeries(data);
lostSeries.setName(lineName + " lost");
lostSeries.setDescription("number of ping/pong messages lost");
col.addSeries(lostSeries);
}
}
/**
* Add a data series for each average that we're configured to render
*
* @param col the collection of xy series to add to
* @param config preferences for how to display this test
* @param lineName minimal name of the test (e.g. "jxHa.32KB.60s")
* @param data List of PeerData.EventDataPoint describing all of the events in the test
*/
void addAverageLines(XYSeriesCollection col, PeerPlotConfig config, String lineName, StaticPeerData data) {
if (data.getDataPointCount() <= 0) return;
PeerData.EventDataPoint start = (PeerData.EventDataPoint)data.getDataPoints().get(0);
PeerData.EventDataPoint finish = (PeerData.EventDataPoint)data.getDataPoints().get(data.getDataPointCount()-1);
List configs = config.getAverageSeriesConfigs();
for (int i = 0; i < configs.size(); i++) {
PeerPlotConfig.PlotSeriesConfig cfg = (PeerPlotConfig.PlotSeriesConfig)configs.get(i);
int minutes = (int)cfg.getPeriod()/(60*1000);
if (cfg.getPlotSendTime()) {
double time = data.getAverageSendTime(minutes);
if (time > 0) {
XYSeries series = new XYSeries(lineName + " send " + minutes + "m avg [" + time + "]", false, false);
series.add(start.getPingSent(), time);
series.add(finish.getPingSent(), time);
series.setDescription("send time, averaged over the last " + minutes + " minutes");
col.addSeries(series);
}
}
if (cfg.getPlotReceiveTime()) {
double time = data.getAverageReceiveTime(minutes);
if (time > 0) {
XYSeries series = new XYSeries(lineName + " receive " + minutes + "m avg[" + time + "]", false, false);
series.add(start.getPingSent(), time);
series.add(finish.getPingSent(), time);
series.setDescription("receive time, averaged over the last " + minutes + " minutes");
col.addSeries(series);
}
}
if (cfg.getPlotLostMessages()) {
double num = data.getLostMessages(minutes);
if (num > 0) {
XYSeries series = new XYSeries(lineName + " lost messages (" + num + " in " + minutes + "m)", false, false);
series.add(start.getPingSent(), num);
series.add(finish.getPingSent(), num);
series.setDescription("number of messages lost in the last " + minutes + " minutes");
col.addSeries(series);
}
}
}
}
XYSeries getSendSeries(List data) {
XYSeries series = new XYSeries("sent", false, false);
for (int i = 0; i < data.size(); i++) {
PeerData.EventDataPoint point = (PeerData.EventDataPoint)data.get(i);
if (point.getWasPonged()) {
series.add(point.getPingSent(), point.getPongSent()-point.getPingSent());
} else {
// series.add(data.getPingSent(), 0);
}
}
return series;
}
XYSeries getReceiveSeries(List data) {
XYSeries series = new XYSeries("receive", false, false);
for (int i = 0; i < data.size(); i++) {
PeerData.EventDataPoint point = (PeerData.EventDataPoint)data.get(i);
if (point.getWasPonged()) {
series.add(point.getPingSent(), point.getPongReceived()-point.getPongSent());
} else {
// series.add(data.getPingSent(), 0);
}
}
return series;
}
XYSeries getLostSeries(List data) {
XYSeries series = new XYSeries("lost", false, false);
for (int i = 0; i < data.size(); i++) {
PeerData.EventDataPoint point = (PeerData.EventDataPoint)data.get(i);
if (point.getWasPonged()) {
//series.add(point.getPingSent(), 0);
} else {
series.add(point.getPingSent(), 1);
}
}
return series;
}
}

View File

@ -1,58 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import org.jfree.chart.ChartPanel;
import net.i2p.util.Log;
/**
* Render the graph and legend
*
*/
class JFreeChartHeartbeatPlotPane extends HeartbeatPlotPane {
private final static Log _log = new Log(JFreeChartHeartbeatPlotPane.class); /* UNUSED */
private ChartPanel _panel;
private JFreeChartAdapter _adapter;
/**
* Creates a JFreeChart plot pane for the given gui
* @param gui the heartbeat monitor gui
*/
public JFreeChartHeartbeatPlotPane(HeartbeatMonitorGUI gui) {
super(gui);
}
/**
* Called when the state is updated
*/
public void stateUpdated() {
if (_panel == null) {
remove(0); // remove the dummy
_adapter = new JFreeChartAdapter();
_panel = _adapter.createPanel(_gui.getMonitor().getState());
_panel.setBackground(_gui.getBackground());
add(new JScrollPane(_panel), BorderLayout.CENTER);
_gui.pack();
} else {
_adapter.updateChart(_panel, _gui.getMonitor().getState());
//_gui.pack();
}
}
protected void initializeComponents() {
// noop
setLayout(new BorderLayout());
add(new JLabel(), BorderLayout.CENTER);
//dummy.setBackground(_gui.getBackground());
//dummy.setPreferredSize(new Dimension(800,600));
//add(dummy);
//add(_panel);
}
}

View File

@ -1,367 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
import net.i2p.data.Destination;
import net.i2p.heartbeat.ClientConfig;
import net.i2p.util.Log;
/**
* Configure how we want to render a particular clientConfig in the GUI
*/
class PeerPlotConfig {
private final static Log _log = new Log(PeerPlotConfig.class); /* UNUSED */
/** where can we find the current state/data (either as a filename or a URL)? */
private String _location;
/** what test are we defining the plot data for? */
private ClientConfig _config;
/** how should we render the current data set? */
private PlotSeriesConfig _currentSeriesConfig;
/** how should we render the various averages available? */
private List _averageSeriesConfigs;
private Set _listeners;
private boolean _disabled;
/**
* Delegating constructor . . .
* @param location the name of the file/URL to get the data from
*/
public PeerPlotConfig(String location) {
this(location, null, null, null);
}
/**
* Constructs a config =)
* @param location the location of the file/URL to get the data from
* @param config the client's configuration
* @param currentSeriesConfig the series config
* @param averageSeriesConfigs the average
*/
public PeerPlotConfig(String location, ClientConfig config, PlotSeriesConfig currentSeriesConfig, List averageSeriesConfigs) {
_location = location;
if (config == null)
config = new ClientConfig(location);
_config = config;
if (currentSeriesConfig != null)
_currentSeriesConfig = currentSeriesConfig;
else
_currentSeriesConfig = new PlotSeriesConfig(0);
if (averageSeriesConfigs != null) {
_averageSeriesConfigs = averageSeriesConfigs;
} else {
rebuildAverageSeriesConfigs();
}
_listeners = Collections.synchronizedSet(new HashSet(2));
_disabled = false;
}
/**
* 'Rebuilds' the average series stuff from the client configuration
*/
public void rebuildAverageSeriesConfigs() {
int periods[] = _config.getAveragePeriods();
if (periods == null) {
_averageSeriesConfigs = Collections.synchronizedList(new ArrayList(0));
} else {
Arrays.sort(periods);
_averageSeriesConfigs = Collections.synchronizedList(new ArrayList(periods.length));
for (int i = 0; i < periods.length; i++) {
_averageSeriesConfigs.add(new PlotSeriesConfig(periods[i]*60*1000));
}
}
}
/**
* Adds an average period
* @param minutes the number of minutes averaged over
*/
public void addAverage(int minutes) {
_config.addAveragePeriod(minutes);
TreeMap ordered = new TreeMap();
for (int i = 0; i < _averageSeriesConfigs.size(); i++) {
PlotSeriesConfig cfg = (PlotSeriesConfig)_averageSeriesConfigs.get(i);
ordered.put(new Long(cfg.getPeriod()), cfg);
}
Long period = new Long(minutes*60*1000);
if (!ordered.containsKey(period))
ordered.put(period, new PlotSeriesConfig(minutes*60*1000));
List cfgs = Collections.synchronizedList(new ArrayList(ordered.size()));
for (Iterator iter = ordered.values().iterator(); iter.hasNext(); )
cfgs.add(iter.next());
_averageSeriesConfigs = cfgs;
}
/**
* Where is the current state data supposed to be found? This must either be a
* local file path or a URL
* @return the current location
*/
public String getLocation() { return _location; }
/**
* The location the current state data is supposed to be found. This must either be
* a local file path or a URL
* @param location the location
*/
public void setLocation(String location) {
_location = location;
fireUpdate();
}
/**
* What are we configuring?
* @return the client configuration
*/
public ClientConfig getClientConfig() { return _config; }
/**
* Sets what we are currently configuring
* @param config the new config
*/
public void setClientConfig(ClientConfig config) {
_config = config;
fireUpdate();
}
/**
* How do we want to render the current data set?
* @return the way we currently render the data
*/
public PlotSeriesConfig getCurrentSeriesConfig() { return _currentSeriesConfig; }
/**
* Sets how we want to render the current data set.
* @param config the new config
*/
public void setCurrentSeriesConfig(PlotSeriesConfig config) {
_currentSeriesConfig = config;
fireUpdate();
}
/**
* How do we want to render the averages?
* @return the way we currently render the averages
*/
public List getAverageSeriesConfigs() { return _averageSeriesConfigs; }
/**
* Sets how we want to render the averages
* @param configs the new configs
*/
public void setAverageSeriesConfigs(List configs) { _averageSeriesConfigs = configs; }
/**
* four char description of the peer
* @return the name
*/
public String getPeerName() {
Destination peer = getClientConfig().getPeer();
if (peer == null)
return "????";
return peer.calculateHash().toBase64().substring(0, 4);
}
/**
* title: name.packetsize.sendfrequency
* @return the title
*/
public String getTitle() {
return getPeerName() + '.' + getSize() + '.' + getClientConfig().getSendFrequency();
}
/**
* summary. includes:name, size, sendfrequency, and # of hops
* @return the summary
*/
public String getSummary() {
return "Send peer " + getPeerName() + ' ' + getSize() + " every " +
getClientConfig().getSendFrequency() + " seconds through " +
getClientConfig().getNumHops() + "-hop tunnels";
}
private String getSize() {
int bytes = getClientConfig().getSendSize();
if (bytes < 1024)
return bytes + "b";
return bytes/1024 + "kb";
}
/**
* we've got someone who wants to be notified of changes to the plot config
* @param lsnr the listener to be added
*/
public void addListener(UpdateListener lsnr) { _listeners.add(lsnr); }
/**
* remove a listener
* @param lsnr the listener to remove
*/
public void removeListener(UpdateListener lsnr) { _listeners.remove(lsnr); }
void fireUpdate() {
if (_disabled) return;
for (Iterator iter = _listeners.iterator(); iter.hasNext(); ) {
((UpdateListener)iter.next()).configUpdated(this);
}
}
/**
* Disables notification of events listeners
* @see PeerPlotConfig#fireUpdate()
*/
public void disableEvents() { _disabled = true; }
/**
* Enables notification of events listeners
* @see PeerPlotConfig#fireUpdate()
*/
public void enableEvents() { _disabled = false; }
/**
* How do we want to render a particular dataset (either the current or the averaged values)?
*/
public class PlotSeriesConfig {
private long _period;
private boolean _plotSendTime;
private boolean _plotReceiveTime;
private boolean _plotLostMessages;
private Color _plotLineColor;
/**
* Delegating constructor . . .
* @param period the period for the config
* (0 for current, otherwise # of milliseconds being averaged over)
*/
public PlotSeriesConfig(long period) {
this(period, false, false, false, null);
if (period <= 0) {
_plotSendTime = true;
_plotReceiveTime = true;
_plotLostMessages = true;
}
}
/**
* Creates a config for the rendering of a particular dataset)
* @param period the period for the config
* (0 for current, otherwise # of milliseconds being averaged over)
* @param plotSend do we plot send times?
* @param plotReceive do we plot receive times?
* @param plotLost do we plot lost packets?
* @param plotColor in what color?
*/
public PlotSeriesConfig(long period, boolean plotSend, boolean plotReceive, boolean plotLost, Color plotColor) {
_period = period;
_plotSendTime = plotSend;
_plotReceiveTime = plotReceive;
_plotLostMessages = plotLost;
_plotLineColor = plotColor;
}
/**
* Retrieves the plot config this plot series config is a part of
* @return the plot config
*/
public PeerPlotConfig getPlotConfig() { return PeerPlotConfig.this; }
/**
* What period is this series config describing?
* @return 0 for current, otherwise # milliseconds that are being averaged over
*/
public long getPeriod() { return _period; }
/**
* Sets the period this series config is describing
* @param period the period
* (0 for current, otherwise # milliseconds that are being averaged over)
*/
public void setPeriod(long period) {
_period = period;
fireUpdate();
}
/**
* Should we render the time to send (ping to peer)?
* @return true or false . . .
*/
public boolean getPlotSendTime() { return _plotSendTime; }
/**
* Sets whether we render the time to send (ping to peer) or not
* @param shouldPlot true or false
*/
public void setPlotSendTime(boolean shouldPlot) {
_plotSendTime = shouldPlot;
fireUpdate();
}
/**
* Should we render the time to receive (peer pong to us)?
* @return true or false . . .
*/
public boolean getPlotReceiveTime() { return _plotReceiveTime; }
/**
* Sets whether we render the time to receive (peer pong to us)
* @param shouldPlot true or false
*/
public void setPlotReceiveTime(boolean shouldPlot) {
_plotReceiveTime = shouldPlot;
fireUpdate();
}
/**
* Should we render the number of messages lost (ping sent, no pong received in time)?
* @return true or false . . .
*/
public boolean getPlotLostMessages() { return _plotLostMessages; }
/**
* Sets whether we render the number of messages lost (ping sent, no pong received in time) or not
* @param shouldPlot true or false
*/
public void setPlotLostMessages(boolean shouldPlot) {
_plotLostMessages = shouldPlot;
fireUpdate();
}
/**
* What color should we plot the data with?
* @return the color
*/
public Color getPlotLineColor() { return _plotLineColor; }
/**
* Sets the color we should plot the data with
* @param color the color to use
*/
public void setPlotLineColor(Color color) {
_plotLineColor = color;
fireUpdate();
}
}
/**
* An interface for listening to updates . . .
*/
public interface UpdateListener {
/**
* @param config the peer plot config that changes
* @see PeerPlotConfig#fireUpdate()
*/
void configUpdated(PeerPlotConfig config);
}
}

View File

@ -1,371 +0,0 @@
package net.i2p.heartbeat.gui;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Random;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import net.i2p.util.Log;
class PeerPlotConfigPane extends JPanel implements PeerPlotConfig.UpdateListener {
private final static Log _log = new Log(PeerPlotConfigPane.class);
private PeerPlotConfig _config;
private HeartbeatControlPane _parent;
private JLabel _title;
private JButton _delete;
private JLabel _fromLabel;
private JTextField _from;
private JTextArea _comments;
private JLabel _peerLabel;
private JTextField _peerKey;
private JLabel _localLabel;
private JTextField _localKey;
private OptionLine _options[];
private Random _rnd = new Random();
private final static Color WHITE = new Color(255, 255, 255);
private Color _background = WHITE;
/**
* Constructs a pane
* @param config the plot config it represents
* @param pane the pane this one is attached to
*/
public PeerPlotConfigPane(PeerPlotConfig config, HeartbeatControlPane pane) {
_config = config;
_parent = pane;
if (_parent != null)
_background = _parent.getBackground();
_config.addListener(this);
initializeComponents();
}
/** called when the user wants to stop monitoring this test */
private void delete() {
_parent.removeTest(_config);
}
private void initializeComponents() {
buildComponents();
placeComponents(this);
refreshView();
//setBorder(new BevelBorder(BevelBorder.RAISED));
setBackground(_background);
}
/**
* place all the gui components onto the given panel
* @param body the panel to place the components on
*/
private void placeComponents(JPanel body) {
body.setLayout(new GridBagLayout());
GridBagConstraints cts = new GridBagConstraints();
// row 0: title + delete
cts.gridx = 0;
cts.gridy = 0;
cts.gridwidth = 5;
cts.anchor = GridBagConstraints.WEST;
cts.fill = GridBagConstraints.NONE;
body.add(_title, cts);
cts.gridx = 5;
cts.gridwidth = 1;
cts.anchor = GridBagConstraints.NORTHWEST;
cts.fill = GridBagConstraints.BOTH;
body.add(_delete, cts);
// row 1: from + location
cts.gridx = 0;
cts.gridy = 1;
cts.gridwidth = 1;
cts.fill = GridBagConstraints.NONE;
body.add(_fromLabel, cts);
cts.gridx = 1;
cts.gridwidth = 5;
cts.fill = GridBagConstraints.BOTH;
body.add(_from, cts);
// row 2: comment
cts.gridx = 0;
cts.gridy = 2;
cts.gridwidth = 6;
cts.fill = GridBagConstraints.BOTH;
body.add(_comments, cts);
// row 3: peer + peerKey
cts.gridx = 0;
cts.gridy = 3;
cts.gridwidth = 1;
cts.fill = GridBagConstraints.NONE;
body.add(_peerLabel, cts);
cts.gridx = 1;
cts.gridwidth = 5;
cts.fill = GridBagConstraints.BOTH;
body.add(_peerKey, cts);
// row 4: local + localKey
cts.gridx = 0;
cts.gridy = 4;
cts.gridwidth = 1;
cts.fill = GridBagConstraints.NONE;
body.add(_localLabel, cts);
cts.gridx = 1;
cts.gridwidth = 5;
cts.fill = GridBagConstraints.BOTH;
body.add(_localKey, cts);
// row 5-N: data row
for (int i = 0; i < _options.length; i++) {
cts.gridx = 0;
cts.gridy = 5 + i;
cts.gridwidth = 1;
cts.fill = GridBagConstraints.NONE;
cts.anchor = GridBagConstraints.WEST;
if (_options[i]._durationMinutes <= 0)
body.add(new JLabel("Data: "), cts);
else
body.add(new JLabel(_options[i]._durationMinutes + "m avg: "), cts);
cts.gridx = 1;
body.add(_options[i]._send, cts);
cts.gridx = 2;
body.add(_options[i]._recv, cts);
cts.gridx = 3;
body.add(_options[i]._lost, cts);
cts.gridx = 4;
body.add(_options[i]._all, cts);
cts.gridx = 5;
body.add(_options[i]._color, cts);
}
}
/** build all of the gui components */
private void buildComponents() {
_title = new JLabel(_config.getSummary());
_title.setBackground(_background);
_delete = new JButton("Delete");
_delete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delete(); } });
_delete.setEnabled(false);
_delete.setBackground(_background);
_fromLabel = new JLabel("Location: ");
_fromLabel.setBackground(_background);
_from = new JTextField(_config.getLocation());
_from.setEditable(false);
_from.setBackground(_background);
_comments = new JTextArea(_config.getClientConfig().getComment(), 2, 20);
// _comments = new JTextArea(_config.getClientConfig().getComment(), 2, 40);
_comments.setEditable(false);
_comments.setBackground(_background);
_peerLabel = new JLabel("Peer: ");
_peerLabel.setBackground(_background);
_peerKey = new JTextField(_config.getClientConfig().getPeer().toBase64(), 8);
_peerKey.setBackground(_background);
_localLabel = new JLabel("Local: ");
_localLabel.setBackground(_background);
_localKey = new JTextField(_config.getClientConfig().getUs().toBase64(), 8);
_localKey.setBackground(_background);
int averagedPeriods[] = _config.getClientConfig().getAveragePeriods();
if (averagedPeriods == null)
averagedPeriods = new int[0];
_options = new OptionLine[1 + averagedPeriods.length];
_options[0] = new OptionLine(0);
for (int i = 0; i < averagedPeriods.length; i++) {
_options[1+i] = new OptionLine(averagedPeriods[i]);
}
}
/** the settings have changed - revise */
private void refreshView() {
for (int i = 0; i < _options.length; i++) {
PeerPlotConfig.PlotSeriesConfig cfg = getConfig(_options[i]._durationMinutes);
if (cfg == null) {
_log.warn("Config for minutes " + _options[i]._durationMinutes + " was not found?");
continue;
}
//_log.debug("Refreshing view for minutes ["+ _options[i]._durationMinutes + "]: send [" +
// _options[i]._send.isSelected() + "/" + cfg.getPlotSendTime() + "] recv [" +
// _options[i]._recv.isSelected() + "/" + cfg.getPlotReceiveTime() + "] lost [" +
// _options[i]._lost.isSelected() + "/" + cfg.getPlotLostMessages() + "]");
_options[i]._send.setSelected(cfg.getPlotSendTime());
_options[i]._recv.setSelected(cfg.getPlotReceiveTime());
_options[i]._lost.setSelected(cfg.getPlotLostMessages());
if (cfg.getPlotLineColor() != null)
_options[i]._color.setBackground(cfg.getPlotLineColor());
}
}
/**
* find the right config for the given period
* @param minutes the minutes to locate the config by
* @return the config for the given period, or null
*/
private PeerPlotConfig.PlotSeriesConfig getConfig(int minutes) {
if (minutes <= 0)
return _config.getCurrentSeriesConfig();
List configs = _config.getAverageSeriesConfigs();
for (int i = 0; i < configs.size(); i++) {
PeerPlotConfig.PlotSeriesConfig cfg = (PeerPlotConfig.PlotSeriesConfig)configs.get(i);
if (cfg.getPeriod() == minutes * 60*1000)
return cfg;
}
return null;
}
/**
* notified that the config has been updated
* @param config the config that was been updated
*/
public void configUpdated(PeerPlotConfig config) { refreshView(); }
private class ChooseColor implements ActionListener {
private int _minutes;
private JButton _button;
/**
* @param minutes the minutes (line) to change the color of...
* @param button the associated button
*/
public ChooseColor(int minutes, JButton button) {
_minutes = minutes;
_button = button;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent evt) {
PeerPlotConfig.PlotSeriesConfig cfg = getConfig(_minutes);
Color origColor = null;
if (cfg != null)
origColor = cfg.getPlotLineColor();
Color color = JColorChooser.showDialog(PeerPlotConfigPane.this, "What color should this line be?", origColor);
if (color != null) {
if (cfg != null)
cfg.setPlotLineColor(color);
_button.setBackground(color);
}
}
}
private class OptionLine {
int _durationMinutes;
JCheckBox _send;
JCheckBox _recv;
JCheckBox _lost;
JCheckBox _all;
JButton _color;
/**
* Creates an OptionLine.
* @param durationMinutes the minutes =)
*/
public OptionLine(int durationMinutes) {
_durationMinutes = durationMinutes;
_send = new JCheckBox("send time");
_send.setBackground(_background);
_recv = new JCheckBox("receive time");
_recv.setBackground(_background);
_lost = new JCheckBox("lost messages");
_lost.setBackground(_background);
_all = new JCheckBox("all");
_all.setBackground(_background);
_color = new JButton("color");
int r = _rnd.nextInt(255);
if (r < 0) r = -r;
int g = _rnd.nextInt(255);
if (g < 0) g = -g;
int b = _rnd.nextInt(255);
if (b < 0) b = -b;
//_color.setBackground(new Color(r, g, b));
_color.setBackground(_background);
_send.addActionListener(new UpdateListener(OptionLine.this, _durationMinutes));
_recv.addActionListener(new UpdateListener(OptionLine.this, _durationMinutes));
_lost.addActionListener(new UpdateListener(OptionLine.this, _durationMinutes));
_all.addActionListener(new UpdateListener(OptionLine.this, _durationMinutes));
_color.addActionListener(new ChooseColor(durationMinutes, _color));
_color.setEnabled(false);
}
}
private class UpdateListener implements ActionListener {
private OptionLine _line;
private int _minutes;
/**
* Update Listener constructor . . .
* @param line the line
* @param minutes the minutes
*/
public UpdateListener(OptionLine line, int minutes) {
_line = line;
_minutes = minutes;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent evt) {
PeerPlotConfig.PlotSeriesConfig cfg = getConfig(_minutes);
cfg.getPlotConfig().disableEvents();
_log.debug("Updating data for minutes ["+ _line._durationMinutes + "]: send [" +
_line._send.isSelected() + "/" + cfg.getPlotSendTime() + "] recv [" +
_line._recv.isSelected() + "/" + cfg.getPlotReceiveTime() + "] lost [" +
_line._lost.isSelected() + "/" + cfg.getPlotLostMessages() + "]: config = " + cfg);
boolean force = _line._all.isSelected();
cfg.setPlotSendTime(_line._send.isSelected() || force);
cfg.setPlotReceiveTime(_line._recv.isSelected() || force);
cfg.setPlotLostMessages(_line._lost.isSelected() || force);
cfg.getPlotConfig().enableEvents();
cfg.getPlotConfig().fireUpdate();
}
}
/**
* Unit test stuff
* @param args da arsg
*/
public final static void main(String args[]) {
Test t = new Test();
t.runTest();
}
private final static class Test implements PeerPlotStateFetcher.FetchStateReceptor {
/**
* Runs da test
*/
public void runTest() {
PeerPlotConfig cfg = new PeerPlotConfig("C:\\testnet\\r2\\heartbeatStat_10s_30kb.txt");
PeerPlotState state = new PeerPlotState(cfg);
PeerPlotStateFetcher.fetchPeerPlotState(this, state);
try { Thread.sleep(60*1000); } catch (InterruptedException ie) {}
System.exit(-1);
}
/* (non-Javadoc)
* @see net.i2p.heartbeat.gui.PeerPlotStateFetcher.FetchStateReceptor#peerPlotStateFetched(net.i2p.heartbeat.gui.PeerPlotState)
*/
public void peerPlotStateFetched(PeerPlotState state) {
javax.swing.JFrame f = new javax.swing.JFrame("Test");
f.getContentPane().add(new JScrollPane(new PeerPlotConfigPane(state.getPlotConfig(), null)));
f.pack();
f.setVisible(true);
}
}
}

View File

@ -1,95 +0,0 @@
package net.i2p.heartbeat.gui;
/**
* Current data + plot config for a particular test
*
*/
class PeerPlotState {
private StaticPeerData _currentData;
private PeerPlotConfig _plotConfig;
/**
* Delegating constructor . . .
* @see PeerPlotState#PeerPlotState(PeerPlotConfig, StaticPeerData)
*/
public PeerPlotState() {
this(null, null);
}
/**
* Delegating constructor . . .
* @param config plot config
* @see PeerPlotState#PeerPlotState(PeerPlotConfig, StaticPeerData)
*/
public PeerPlotState(PeerPlotConfig config) {
this(config, new StaticPeerData(config.getClientConfig()));
}
/**
* Creates a PeerPlotState
* @param config plot config
* @param data peer data
*/
public PeerPlotState(PeerPlotConfig config, StaticPeerData data) {
_plotConfig = config;
_currentData = data;
}
/**
* Add an average
* @param minutes mins averaged over
* @param sendMs how much later did the peer receieve
* @param recvMs how much later did we receieve
* @param lost how many were lost
*/
public void addAverage(int minutes, int sendMs, int recvMs, int lost) {
// make sure we've got the config entry for the average
_plotConfig.addAverage(minutes);
// add the data point...
_currentData.addAverage(minutes, sendMs, recvMs, lost);
}
/**
* we successfully got a ping/pong through
*
* @param sendTime when did the ping get sent?
* @param sendMs how much later did the peer receive the ping?
* @param recvMs how much later than that did we receive the pong?
*/
public void addSuccess(long sendTime, int sendMs, int recvMs) {
_currentData.addData(sendTime, sendMs, recvMs);
}
/**
* we lost a ping/pong
*
* @param sendTime when did we send the ping?
*/
public void addLost(long sendTime) {
_currentData.addData(sendTime);
}
/**
* data set to render
* @return the data set
*/
public StaticPeerData getCurrentData() { return _currentData; }
/**
* Sets the data set to render
* @param data the data set
*/
public void setCurrentData(StaticPeerData data) { _currentData = data; }
/**
* configuration options on how to render the data set
* @return the config options
*/
public PeerPlotConfig getPlotConfig() { return _plotConfig; }
/**
* Sets the configuration options on how to render the data
* @param config the config options
*/
public void setPlotConfig(PeerPlotConfig config) { _plotConfig = config; }
}

View File

@ -1,363 +0,0 @@
package net.i2p.heartbeat.gui;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.StringTokenizer;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
class PeerPlotStateFetcher {
private final static Log _log = new Log(PeerPlotStateFetcher.class);
/**
* Fetch and fill the specified state structure
* @param receptor the 'receptor' (callbacks)
* @param state the state
*/
public static void fetchPeerPlotState(FetchStateReceptor receptor, PeerPlotState state) {
I2PThread t = new I2PThread(new Fetcher(receptor, state));
t.setDaemon(true);
t.setName("Fetch state from " + state.getPlotConfig().getLocation());
t.start();
}
/**
* Callback stuff . . .
*/
public interface FetchStateReceptor {
/**
* Called when a peer plot state is fetched
* @param state state that was fetched
*/
void peerPlotStateFetched(PeerPlotState state);
}
private static class Fetcher implements Runnable {
private PeerPlotState _state;
private FetchStateReceptor _receptor;
/**
* Creates a Fetcher thread
* @param receptor the 'receptor' (callbacks)
* @param state the state
*/
public Fetcher(FetchStateReceptor receptor, PeerPlotState state) {
_state = state;
_receptor = receptor;
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
String loc = _state.getPlotConfig().getLocation();
_log.debug("Load called [" + loc + "]");
InputStream in = null;
try {
try {
URL location = new URL(loc);
in = location.openStream();
} catch (MalformedURLException mue) {
_log.debug("Not a url [" + loc + "]");
in = null;
}
if (in == null)
in = new FileInputStream(loc);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = null;
while ( (line = reader.readLine()) != null) {
handleLine(line);
}
if (valid())
_receptor.peerPlotStateFetched(_state);
} catch (IOException ioe) {
_log.error("Error retrieving from the location [" + loc + "]", ioe);
} finally {
if (in != null) try { in.close(); } catch (IOException ioe) {}
}
}
/**
* check to make sure we've got everything we need
* @return true [always]
*/
boolean valid() {
return true;
}
/**
* handle a line from the data set - these can be formatted in one of the
* following ways. <p />
*
* <pre>
* peer khWYqCETu9YtPUvGV92ocsbEW5DezhKlIG7ci8RLX3g=
* local u-9hlR1ik2hemXf0HvKMfeRgrS86CbNQh25e7XBhaQE=
* peerDest [base 64 of the full destination]
* localDest [base 64 of the full destination]
* numTunnelHops 2
* comment Test with localhost sending 30KB every 20 seconds
* sendFrequency 20
* sendSize 30720
* sessionStart 20040409.22:51:10.915
* currentTime 20040409.23:31:39.607
* numPending 2
* lifetimeSent 118
* lifetimeRecv 113
* #averages minutes sendMs recvMs numLost
* periodAverage 1 1843 771 0
* periodAverage 5 786 752 1
* periodAverage 30 855 735 3
* #action status date and time sent sendMs replyMs
* EVENT OK 20040409.23:21:44.742 691 670
* EVENT OK 20040409.23:22:05.201 671 581
* EVENT OK 20040409.23:22:26.301 1182 1452
* EVENT OK 20040409.23:22:47.322 24304 1723
* EVENT OK 20040409.23:23:08.232 2293 1081
* EVENT OK 20040409.23:23:29.332 1392 641
* EVENT OK 20040409.23:23:50.262 641 761
* EVENT OK 20040409.23:24:11.102 651 701
* EVENT OK 20040409.23:24:31.401 841 621
* EVENT OK 20040409.23:24:52.061 651 681
* EVENT OK 20040409.23:25:12.480 701 1623
* EVENT OK 20040409.23:25:32.990 1442 1212
* EVENT OK 20040409.23:25:54.230 591 631
* EVENT OK 20040409.23:26:14.620 620 691
* EVENT OK 20040409.23:26:35.199 1793 1432
* EVENT OK 20040409.23:26:56.570 661 641
* EVENT OK 20040409.23:27:17.200 641 660
* EVENT OK 20040409.23:27:38.120 611 921
* EVENT OK 20040409.23:27:58.699 831 621
* EVENT OK 20040409.23:28:19.559 801 661
* EVENT OK 20040409.23:28:40.279 601 611
* EVENT OK 20040409.23:29:00.648 601 621
* EVENT OK 20040409.23:29:21.288 701 661
* EVENT LOST 20040409.23:29:41.828
* EVENT LOST 20040409.23:30:02.327
* EVENT LOST 20040409.23:30:22.656
* EVENT OK 20040409.23:31:24.305 1843 771
* </pre>
*
* @param line (see above)
*/
private void handleLine(String line) {
if (line.startsWith("peerDest"))
handlePeerDest(line);
else if (line.startsWith("localDest"))
handleLocalDest(line);
else if (line.startsWith("numTunnelHops"))
handleNumTunnelHops(line);
else if (line.startsWith("comment"))
handleComment(line);
else if (line.startsWith("sendFrequency"))
handleSendFrequency(line);
else if (line.startsWith("sendSize"))
handleSendSize(line);
else if (line.startsWith("periodAverage"))
handlePeriodAverage(line);
else if (line.startsWith("EVENT"))
handleEvent(line);
else if (line.startsWith("numPending"))
handleNumPending(line);
else if (line.startsWith("sessionStart"))
handleSessionStart(line);
else
_log.debug("Not handled: " + line);
}
private void handlePeerDest(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String destKey = tok.nextToken();
try {
Destination d = new Destination();
d.fromBase64(destKey);
_state.getPlotConfig().getClientConfig().setPeer(d);
_log.debug("Setting the peer to " + d.calculateHash().toBase64());
} catch (DataFormatException dfe) {
_log.error("Unable to parse the peerDest line: [" + line + "]", dfe);
}
}
private void handleLocalDest(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String destKey = tok.nextToken();
try {
Destination d = new Destination();
d.fromBase64(destKey);
_state.getPlotConfig().getClientConfig().setUs(d);
} catch (DataFormatException dfe) {
_log.error("Unable to parse the localDest line: [" + line + "]", dfe);
}
}
private void handleComment(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
StringBuffer buf = new StringBuffer(line.length()-32);
while (tok.hasMoreTokens())
buf.append(tok.nextToken()).append(' ');
_state.getPlotConfig().getClientConfig().setComment(buf.toString());
}
private void handleNumTunnelHops(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String num = tok.nextToken();
try {
int val = Integer.parseInt(num);
_state.getPlotConfig().getClientConfig().setNumHops(val);
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the numTunnelHops line: [" + line + "]", nfe);
}
}
private void handleNumPending(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String num = tok.nextToken();
try {
int val = Integer.parseInt(num);
_state.getCurrentData().setPendingCount(val);
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the numPending line: [" + line + "]", nfe);
}
}
private void handleSendFrequency(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String num = tok.nextToken();
try {
int val = Integer.parseInt(num);
_state.getPlotConfig().getClientConfig().setSendFrequency(val);
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the sendFrequency line: [" + line + "]", nfe);
}
}
private void handleSendSize(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String num = tok.nextToken();
try {
int val = Integer.parseInt(num);
_state.getPlotConfig().getClientConfig().setSendSize(val);
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the sendSize line: [" + line + "]", nfe);
}
}
private void handleSessionStart(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
String date = tok.nextToken();
try {
long when = getDate(date);
_state.getCurrentData().setSessionStart(when);
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the sessionStart line: [" + line + "]", nfe);
}
}
private void handlePeriodAverage(String line) {
StringTokenizer tok = new StringTokenizer(line);
tok.nextToken(); // ignore;
try {
// periodAverage minutes sendMs recvMs numLost
int min = Integer.parseInt(tok.nextToken());
int send = Integer.parseInt(tok.nextToken());
int recv = Integer.parseInt(tok.nextToken());
int lost = Integer.parseInt(tok.nextToken());
_state.addAverage(min, send, recv, lost);
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the sendSize line: [" + line + "]", nfe);
}
}
private void handleEvent(String line) {
StringTokenizer tok = new StringTokenizer(line);
// * EVENT OK 20040409.23:29:21.288 701 661
// * EVENT LOST 20040409.23:29:41.828
tok.nextToken(); // ignore first two
tok.nextToken();
try {
long when = getDate(tok.nextToken());
if (when < 0) {
_log.error("Invalid EVENT line: [" + line + "]");
return;
}
if (tok.hasMoreTokens()) {
int sendMs = Integer.parseInt(tok.nextToken());
int recvMs = Integer.parseInt(tok.nextToken());
_state.addSuccess(when, sendMs, recvMs);
} else {
_state.addLost(when);
}
} catch (NumberFormatException nfe) {
_log.error("Unable to parse the EVENT line: [" + line + "]", nfe);
}
}
private static final SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd.HH:mm:ss.SSS", Locale.UK);
private long getDate(String date) {
synchronized (_fmt) {
try {
return _fmt.parse(date).getTime();
} catch (ParseException pe) {
_log.error("Unable to parse the date [" + date + "]", pe);
return -1;
}
}
}
private void fakeRun() { /* UNUSED */
try {
Destination peer = new Destination();
Destination us = new Destination();
peer.fromBase64("3RPLOkQGlq8anNyNWhjbMyHxpAvUyUJKbiUejI80DnPR59T3blc7-XrBhQ2iPbf-BRAR~v1j34Kpba1eDyhPk2gevsE6ULO1irarJ3~C9WcQH2wAbNiVwfWqbh6onQ~YmkSpGNwGHD6ytwbvTyXeBJ" +
"cS8e6gmfNN-sYLn1aQu8UqWB3D6BmTfLtyS3eqWVk66Nrzmwy8E1Hvq5z~1lukYb~cyiDO1oZHAOLyUQtd9eN16yJY~2SRG8LiscpPMl9nSJUr6fmXMUubW-M7QGFH82Om-735PJUk6WMy1Hi9Vgh4Pxhdl7g" +
"fqGRWioFABdhcypb7p1Ca77p73uabLDFK-SjIYmdj7TwSdbNa6PCmzEvCEW~IZeZmnZC5B6pK30AdmD9vc641wUGce9xTJVfNRupf5L7pSsVIISix6FkKQk-FTW2RsZKLbuMCYMaPzLEx5gzODEqtI6Jf2teM" +
"d5xCz51RPayDJl~lJ-W0IWYfosnjM~KxYaqc4agviBuF5ZWeAAAA");
us.fromBase64("W~JFpqSH8uopylox2V5hMbpcHSsb-dJkSKvdJ1vj~KQcUFJWXFyfbetBAukcGH5S559aK9oslU0qbVoMDlJITVC4OXfXSnVbJBP1IhsK8SvjSYicjmIi2fA~k4HvSh9Wxu~bg8yo~jgfHA8tjYpp" +
"K9QKc56BpkJb~hx0nNGy4Ny9eW~6A5AwAmHvwdt5NqcREYRMjRd63dMGm8BcEe-6FbOyMo3dnIFcETWAe8TCeoMxm~S1n~6Jlinw3ETxv-L6lQkhFFWnC5zyzQ~4JhVxxT3taTMYXg8td4CBGmrS078jcjW63" +
"rlSiQgZBlYfN3iEYmurhuIEV9NXRcmnMrBOQUAoXPpVuRIxJbaQNDL71FO2iv424n4YjKs84suAho34GGQKq7WoL5V5KQgihfcl0f~xne-qP3FtpoPFeyA9x-sA2JWDAsxoZlfvgkiP5eyOn23prT9TJK47HC" +
"VilHSV11uTVaC4Jc5YsjoBCZadWbgQnMCKlZ4jk-bLE1PSWLg7AAAA");
_state.getPlotConfig().getClientConfig().setPeer(peer);
_state.getPlotConfig().getClientConfig().setUs(us);
_state.getPlotConfig().getClientConfig().setNumHops(2);
_state.getPlotConfig().getClientConfig().setComment("we do stuff\nreally nifty stuff. really");
_state.getPlotConfig().getClientConfig().setAveragePeriods(new int[] { 1, 5, 30, 60 });
int rnd = new java.util.Random().nextInt();
if (rnd > 0)
rnd = rnd % 10;
else
rnd = (-rnd) % 10;
_state.getPlotConfig().getClientConfig().setSendFrequency(rnd);
_state.getPlotConfig().getClientConfig().setSendSize(16*1024);
_state.getPlotConfig().getClientConfig().setStatDuration(10);
_state.getPlotConfig().rebuildAverageSeriesConfigs();
_state.setCurrentData(new StaticPeerData(_state.getPlotConfig().getClientConfig()));
_receptor.peerPlotStateFetched(_state);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@ -1,134 +0,0 @@
package net.i2p.heartbeat.gui;
import java.util.HashMap;
import java.util.Map;
import net.i2p.heartbeat.ClientConfig;
import net.i2p.heartbeat.PeerData;
/**
* Raw data points for a test
*/
class StaticPeerData extends PeerData {
private int _pending;
/** Integer (period, in minutes) to Integer (milliseconds) for sending a ping */
private Map _averageSendTimes;
/** Integer (period, in minutes) to Integer (milliseconds) for receiving a pong */
private Map _averageReceiveTimes;
/** Integer (period, in minutes) to Integer (num messages) of how many messages were lost on average */
private Map _lostMessages;
/**
* Creates a static peer data with a specified client config ... duh
* @param config the client config
*/
public StaticPeerData(ClientConfig config) {
super(config);
_averageSendTimes = new HashMap(4);
_averageReceiveTimes = new HashMap(4);
_lostMessages = new HashMap(4);
}
/**
* Adds averaged data
* @param minutes the minutes (averaged over)
* @param sendMs the send time (ping) in milliseconds
* @param recvMs the receive time (pong) in milliseconds
* @param lost the number lost
*/
public void addAverage(int minutes, int sendMs, int recvMs, int lost) {
_averageSendTimes.put(new Integer(minutes), new Integer(sendMs));
_averageReceiveTimes.put(new Integer(minutes), new Integer(recvMs));
_lostMessages.put(new Integer(minutes), new Integer(lost));
}
/**
* Sets the number pending
* @param numPending the number pending
*/
public void setPendingCount(int numPending) { _pending = numPending; }
/* (non-Javadoc)
* @see net.i2p.heartbeat.PeerData#setSessionStart(long)
*/
public void setSessionStart(long when) { super.setSessionStart(when); }
/**
* Adds data
* @param sendTime the time it was sent
* @param sendMs the send time (ping) in milliseconds
* @param recvMs the receive time (pong) in milliseconds
*/
public void addData(long sendTime, int sendMs, int recvMs) {
PeerData.EventDataPoint dataPoint = new PeerData.EventDataPoint(sendTime);
dataPoint.setPongSent(sendTime + sendMs);
dataPoint.setPongReceived(sendTime + sendMs + recvMs);
dataPoint.setWasPonged(true);
addDataPoint(dataPoint);
}
/**
* Adds data
* @param sendTime the time it was sent
*/
public void addData(long sendTime) {
PeerData.EventDataPoint dataPoint = new PeerData.EventDataPoint(sendTime);
dataPoint.setWasPonged(false);
addDataPoint(dataPoint);
}
/**
* how many pings are still outstanding?
* @return the number of pings outstanding
*/
public int getPendingCount() { return _pending; }
/**
* average time to send over the given period.
*
* @param period number of minutes to retrieve the average for
* @return milliseconds average, or -1 if we dont track that period
*/
public double getAverageSendTime(int period) {
Integer i = (Integer)_averageSendTimes.get(new Integer(period));
if (i == null)
return -1;
return i.doubleValue();
}
/**
* average time to receive over the given period.
*
* @param period number of minutes to retrieve the average for
* @return milliseconds average, or -1 if we dont track that period
*/
public double getAverageReceiveTime(int period) {
Integer i = (Integer)_averageReceiveTimes.get(new Integer(period));
if (i == null)
return -1;
return i.doubleValue();
}
/**
* number of lost messages over the given period.
*
* @param period number of minutes to retrieve the average for
* @return number of lost messages in the period, or -1 if we dont track that period
*/
public double getLostMessages(int period) {
Integer i = (Integer)_lostMessages.get(new Integer(period));
if (i == null)
return -1;
return i.doubleValue();
}
/* (non-Javadoc)
* @see net.i2p.heartbeat.PeerData#cleanup()
*/
public void cleanup() {}
}

View File

@ -1,278 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

View File

@ -1,11 +0,0 @@
$Id$
the i2p/apps/httptunnel module is the root of the
HTTPTunnel application, and everything within it
is released according to the terms of the I2P
license policy. That means everything contained
within the i2p/apps/httptunnel module is released
under the GPL plus the java exception unless
otherwise marked. Alternate licenses that may be
used include BSD, Cryptix, and MIT, as well as
code granted into the public domain.

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="httptunnel">
<target name="all" depends="clean, build" />
<target name="build" depends="builddep, jar" />
<target name="builddep">
<ant dir="../../ministreaming/java/" target="build" />
<!-- ministreaming will build core -->
</target>
<target name="compile">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac
srcdir="./src"
debug="true" deprecation="on" source="1.3" target="1.3"
destdir="./build/obj"
classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" />
</target>
<target name="jar" depends="compile">
<jar destfile="./build/httptunnel.jar" basedir="./build/obj" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.httptunnel.HTTPTunnel" />
<attribute name="Class-Path" value="i2p.jar mstreaming.jar" />
</manifest>
</jar>
</target>
<target name="javadoc">
<mkdir dir="./build" />
<mkdir dir="./build/javadoc" />
<javadoc
sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc"
packagenames="*"
use="true"
splitindex="true"
windowtitle="HTTPTunnel" />
</target>
<target name="clean">
<delete dir="./build" />
</target>
<target name="cleandep" depends="clean">
<!-- ministreaming will clean core -->
<ant dir="../../ministreaming/java/" target="distclean" />
</target>
<target name="distclean" depends="clean">
<!-- ministreaming will clean core -->
<ant dir="../../ministreaming/java/" target="distclean" />
</target>
</project>

View File

@ -1,87 +0,0 @@
package net.i2p.httptunnel;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import net.i2p.util.Log;
/**
* Listens on a port for HTTP connections.
*/
public class HTTPListener extends Thread {
private static final Log _log = new Log(HTTPListener.class);
private int port;
private String listenHost;
private SocketManagerProducer smp;
/**
* A public constructor. It contstructs things. In this case,
* it constructs a nice HTTPListener, for all your listening on
* HTTP needs. Yep. That's right.
* @param smp A SocketManagerProducer, producing Sockets, no doubt
* @param port A port, to connect to.
* @param listenHost A host, to connect to.
*/
public HTTPListener(SocketManagerProducer smp, int port, String listenHost) {
this.smp = smp;
this.port = port;
start();
}
/* (non-Javadoc)
* @see java.lang.Thread#run()
*/
public void run() {
try {
InetAddress lh = listenHost == null ? null : InetAddress.getByName(listenHost);
ServerSocket ss = new ServerSocket(port, 0, lh);
while (true) {
Socket s = ss.accept();
new HTTPSocketHandler(this, s);
}
} catch (IOException ex) {
_log.error("Error while accepting connections", ex);
}
}
private boolean proxyUsed = false;
/**
* Query whether this is the first use of the proxy or not
* @return Whether this is the first proxy use, no doubt.
*/
public boolean firstProxyUse() {
if (true) return false; // FIXME: check a config option here
if (proxyUsed) {
return false;
}
proxyUsed = true;
return true;
}
/**
* @return The SocketManagerProducer being used.
*/
public SocketManagerProducer getSMP() {
return smp;
}
/**
* Outputs with HTTP 1.1 flair that a feature isn't implemented.
* @param out The stream the text goes to.
* @deprecated
* @throws IOException
*/
public void handleNotImplemented(OutputStream out) throws IOException {
out.write(("HTTP/1.1 200 Document following\n\n" + "<h1>Feature not implemented</h1>").getBytes("ISO-8859-1"));
out.flush();
}
}

View File

@ -1,62 +0,0 @@
package net.i2p.httptunnel;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import net.i2p.httptunnel.handler.RootHandler;
import net.i2p.util.Log;
/**
* Handles a single HTTP socket connection.
*/
public class HTTPSocketHandler extends Thread {
private static final Log _log = new Log(HTTPSocketHandler.class);
private Socket s;
private HTTPListener httpl;
private RootHandler h;
/**
* A public constructor.
* @param httpl An HTTPListener, to listen for HTTP, no doubt
* @param s A socket.
*/
public HTTPSocketHandler(HTTPListener httpl, Socket s) {
this.httpl = httpl;
this.s = s;
h = RootHandler.getInstance();
start();
}
/* (non-Javadoc)
* @see java.lang.Thread#run()
*/
public void run() {
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(s.getInputStream());
out = new BufferedOutputStream(s.getOutputStream());
Request req = new Request(in);
h.handle(req, httpl, out);
} catch (IOException ex) {
_log.error("Error while handling data", ex);
} finally {
try {
if (in != null) in.close();
if (out != null) {
out.flush();
out.close();
}
s.close();
} catch (IOException ex) {
_log.error("IOException in finalizer", ex);
}
}
}
}

View File

@ -1,108 +0,0 @@
/*
* HTTPTunnel
* (c) 2003 - 2004 mihi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, mihi gives permission to link
* the code of this program with the proprietary Java implementation
* provided by Sun (or other vendors as well), and distribute linked
* combinations including the two. You must obey the GNU General
* Public License in all respects for all of the code used other than
* the proprietary Java implementation. If you modify this file, you
* may extend this exception to your version of the file, but you are
* not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
package net.i2p.httptunnel;
import net.i2p.client.streaming.I2PSocketManager;
/**
* HTTPTunnel main class.
*/
public class HTTPTunnel {
/**
* Create a HTTPTunnel instance.
*
* @param initialManagers a list of socket managers to use
* @param maxManagers how many managers to have in the cache
* @param shouldThrowAwayManagers whether to throw away a manager after use
* @param listenPort which port to listen on
*/
public HTTPTunnel(I2PSocketManager[] initialManagers, int maxManagers, boolean shouldThrowAwayManagers,
int listenPort) {
this(initialManagers, maxManagers, shouldThrowAwayManagers, listenPort, "127.0.0.1", 7654);
}
/**
* Create a HTTPTunnel instance.
*
* @param initialManagers a list of socket managers to use
* @param maxManagers how many managers to have in the cache
* @param shouldThrowAwayManagers whether to throw away a manager after use
* @param listenPort which port to listen on
* @param i2cpAddress the I2CP address
* @param i2cpPort the I2CP port
*/
public HTTPTunnel(I2PSocketManager[] initialManagers, int maxManagers, boolean shouldThrowAwayManagers,
int listenPort, String i2cpAddress, int i2cpPort) {
SocketManagerProducer smp = new SocketManagerProducer(initialManagers, maxManagers, shouldThrowAwayManagers,
i2cpAddress, i2cpPort);
new HTTPListener(smp, listenPort, "127.0.0.1");
}
/**
* The all important main function, allowing HTTPTunnel to be
* stand-alone, a program in it's own right, and all that jazz.
* @param args A list of String passed to the program
*/
public static void main(String[] args) {
String host = "127.0.0.1";
int port = 7654, max = 1;
boolean throwAwayManagers = false;
if (args.length > 1) {
if (args.length == 4) {
host = args[2];
port = Integer.parseInt(args[3]);
} else if (args.length != 2) {
showInfo();
return;
}
max = Integer.parseInt(args[1]);
} else if (args.length != 1) {
showInfo();
return;
}
if (max == 0) {
max = 1;
} else if (max < 0) {
max = -max;
throwAwayManagers = true;
}
new HTTPTunnel(null, max, throwAwayManagers, Integer.parseInt(args[0]), host, port);
}
private static void showInfo() {
System.out.println("Usage: java HTTPTunnel <listenPort> [<max> " + "[<i2cphost> <i2cpport>]]\n"
+ " <listenPort> port to listen for browsers\n"
+ " <max> max number of SocketMangers in pool, " + "use neg. number\n"
+ " to use each SocketManager only once " + "(default: 1)\n"
+ " <i2cphost> host to connect to the router " + "(default: 127.0.0.1)\n"
+ " <i2cpport> port to connect to the router " + "(default: 7654)");
}
}

View File

@ -1,153 +0,0 @@
package net.i2p.httptunnel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import net.i2p.util.Log;
/**
* A HTTP request (GET or POST). This will be passed to a hander for
* handling it.
*/
public class Request {
private static final Log _log = new Log(Request.class);
// all strings are forced to be ISO-8859-1 encoding
private String method;
private String url;
private String proto;
private String params;
private String postData;
/**
* A constructor, creating a request from an InputStream
* @param in InputStream from which we "read-in" a Request
* @throws IOException
*/
public Request(InputStream in) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(in, "ISO-8859-1"));
String line = br.readLine();
if (line == null) { // no data at all
method = null;
_log.error("Connection but no data");
return;
}
int pos = line.indexOf(" ");
if (pos == -1) {
method = line;
url = "";
_log.error("Malformed HTTP request: " + line);
} else {
method = line.substring(0, pos);
url = line.substring(pos + 1);
}
proto = "";
pos = url.indexOf(" ");
if (pos != -1) {
proto = url.substring(pos); // leading space intended
url = url.substring(0, pos);
}
StringBuffer sb = new StringBuffer(512);
while ((line = br.readLine()) != null) {
if (line.length() == 0) break;
sb.append(line).append("\r\n");
}
params = sb.toString(); // no leading empty line!
sb = new StringBuffer();
// hack for POST requests, ripped from HttpClient
// this won't work for large POSTDATA
// FIXME: do this better, please.
if (!method.equals("GET")) {
while (br.ready()) { // empty the buffer (POST requests)
int i = br.read();
if (i != -1) {
sb.append((char) i);
}
}
postData = sb.toString();
} else {
postData = "";
}
}
/**
* @return A Request as an array of bytes of a String in ISO-8859-1 format
* @throws IOException
*/
public byte[] toByteArray() throws IOException {
if (method == null) return null;
return toISO8859_1String().getBytes("ISO-8859-1");
}
private String toISO8859_1String() throws IOException {
if (method == null) return null;
return method + " " + url + proto + "\r\n" + params + "\r\n" + postData;
}
/**
* @return the URL of the request
*/
public String getURL() {
return url;
}
/**
* Sets the URL of the Request
* @param newURL the new URL
*/
public void setURL(String newURL) {
url = newURL;
}
/**
* Retrieves the value of a param.
* @param name The name of the param
* @return The value of the param, or null
*/
public String getParam(String name) {
try {
BufferedReader br = new BufferedReader(new StringReader(params));
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith(name)) { return line.substring(name.length()); }
}
return null;
} catch (IOException ex) {
_log.error("Error getting parameter", ex);
return null;
}
}
/**
* Sets the value of a param.
* @param name the name of the param
* @param value the value to be set
*/
public void setParam(String name, String value) {
try {
StringBuffer sb = new StringBuffer(params.length() + value.length());
BufferedReader br = new BufferedReader(new StringReader(params));
String line;
boolean replaced = false;
while ((line = br.readLine()) != null) {
if (line.startsWith(name)) {
replaced = true;
if (value == null) continue; // kill param
line = name + value;
}
sb.append(line).append("\r\n");
}
if (!replaced && value != null) {
sb.append(name).append(value).append("\r\n");
}
params = sb.toString();
} catch (IOException ex) {
_log.error("Error getting parameter", ex);
}
}
}

View File

@ -1,120 +0,0 @@
package net.i2p.httptunnel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Properties;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
/**
* Produces SocketManagers in a thread and gives them to those who
* need them.
*/
public class SocketManagerProducer extends Thread {
private ArrayList myManagers = new ArrayList();
private HashMap usedManagers = new HashMap();
private int port;
private String host;
private int maxManagers;
private boolean shouldThrowAwayManagers;
/**
* Public constructor creating a SocketManagerProducer
* @param initialManagers a list of socket managers to use
* @param maxManagers how many managers to have in the cache
* @param shouldThrowAwayManagers whether to throw away a manager after use
* @param host which host to listen on
* @param port which port to listen on
*/
public SocketManagerProducer(I2PSocketManager[] initialManagers, int maxManagers, boolean shouldThrowAwayManagers,
String host, int port) {
if (maxManagers < 1) { throw new IllegalArgumentException("maxManagers < 1"); }
this.host = host;
this.port = port;
this.shouldThrowAwayManagers = shouldThrowAwayManagers;
if (initialManagers != null) {
myManagers.addAll(Arrays.asList(initialManagers));
}
this.maxManagers = maxManagers;
this.shouldThrowAwayManagers = shouldThrowAwayManagers;
setDaemon(true);
start();
}
/**
* Thread producing new SocketManagers.
*/
public void run() {
while (true) {
synchronized (this) {
// without mcDonalds mode, we most probably need no
// new managers.
while (!shouldThrowAwayManagers && myManagers.size() == maxManagers) {
myWait();
}
}
// produce a new manager, regardless whether it is needed
// or not. Do not synchronized this part, since it can be
// quite time-consuming.
I2PSocketManager newManager = I2PSocketManagerFactory.createManager(host, port, new Properties());
// when done, check if it is needed.
synchronized (this) {
while (myManagers.size() == maxManagers) {
myWait();
}
myManagers.add(newManager);
notifyAll();
}
}
}
/**
* Get a manager for connecting to a given destination. Each
* destination will always get the same manager.
*
* @param dest the destination to connect to
* @return the SocketManager to use
*/
public synchronized I2PSocketManager getManager(String dest) {
I2PSocketManager result = (I2PSocketManager) usedManagers.get(dest);
if (result == null) {
result = getManager();
usedManagers.put(dest, result);
}
return result;
}
/**
* Get a "new" SocketManager. Depending on the anonymity settings,
* this can be a completely new one or one randomly selected from
* a pool.
*
* @return the SocketManager to use
*/
public synchronized I2PSocketManager getManager() {
while (myManagers.size() == 0) {
myWait(); // no manager here, so wait until one is produced
}
int which = (int) (Math.random() * myManagers.size());
I2PSocketManager result = (I2PSocketManager) myManagers.get(which);
if (shouldThrowAwayManagers) {
myManagers.remove(which);
notifyAll();
}
return result;
}
/**
* Wait until InterruptedException
*/
public void myWait() {
try {
wait();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}

View File

@ -1,61 +0,0 @@
package net.i2p.httptunnel.filter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import net.i2p.util.Log;
/**
* Chain multiple filters. Decorator pattern...
*/
public class ChainFilter implements Filter {
private static final Log _log = new Log(ChainFilter.class);
private Collection filters; // perhaps protected?
/**
* @param filters A collection (list) of filters to chain to
*/
public ChainFilter(Collection filters) {
this.filters = filters;
}
/* (non-Javadoc)
* @see net.i2p.httptunnel.filter.Filter#filter(byte[])
*/
public byte[] filter(byte[] toFilter) {
byte[] buf = toFilter;
for (Iterator it = filters.iterator(); it.hasNext();) {
Filter f = (Filter) it.next();
buf = f.filter(buf);
}
return buf;
}
/* (non-Javadoc)
* @see net.i2p.httptunnel.filter.Filter#finish()
*/
public byte[] finish() {
// this is a bit complicated. Think about it...
try {
byte[] buf = EMPTY;
for (Iterator it = filters.iterator(); it.hasNext();) {
Filter f = (Filter) it.next();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (buf.length != 0) {
baos.write(f.filter(buf));
}
baos.write(f.finish());
buf = baos.toByteArray();
}
return buf;
} catch (IOException ex) {
_log.error("Error chaining filters", ex);
return EMPTY;
}
}
}

View File

@ -1,25 +0,0 @@
package net.i2p.httptunnel.filter;
/**
* A generic filtering interface.
*/
public interface Filter {
/**
* An empty byte array.
*/
public static final byte[] EMPTY = new byte[0];
/**
* Filter some data. Not all filtered data need to be returned.
* @param toFilter the bytes that are to be filtered.
* @return the filtered data
*/
public byte[] filter(byte[] toFilter);
/**
* Data stream has finished. Return all of the rest data.
* @return the rest of the data
*/
public byte[] finish();
}

View File

@ -1,21 +0,0 @@
package net.i2p.httptunnel.filter;
/**
* A filter letting everything pass as is.
*/
public class NullFilter implements Filter {
/* (non-Javadoc)
* @see net.i2p.httptunnel.filter.Filter#filter(byte[])
*/
public byte[] filter(byte[] toFilter) {
return toFilter;
}
/* (non-Javadoc)
* @see net.i2p.httptunnel.filter.Filter#finish()
*/
public byte[] finish() {
return EMPTY;
}
}

View File

@ -1,113 +0,0 @@
package net.i2p.httptunnel.handler;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.SocketException;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketOptions;
import net.i2p.data.Destination;
import net.i2p.httptunnel.HTTPListener;
import net.i2p.httptunnel.Request;
import net.i2p.httptunnel.SocketManagerProducer;
import net.i2p.httptunnel.filter.Filter;
import net.i2p.httptunnel.filter.NullFilter;
import net.i2p.util.Log;
/**
* Handler for browsing Eepsites.
*/
public class EepHandler {
private static final Log _log = new Log(EepHandler.class);
private static I2PAppContext _context = new I2PAppContext();
protected ErrorHandler errorHandler;
/* package private */EepHandler(ErrorHandler eh) {
errorHandler = eh;
}
/**
* @param req the Request
* @param httpl an HTTPListener
* @param out where to write the results
* @param destination destination as a string, (subject to naming
* service lookup)
* @throws IOException
*/
public void handle(Request req, HTTPListener httpl, OutputStream out,
/* boolean fromProxy, */String destination) throws IOException {
SocketManagerProducer smp = httpl.getSMP();
Destination dest = _context.namingService().lookup(destination);
if (dest == null) {
errorHandler.handle(req, httpl, out, "Could not lookup host: " + destination);
return;
}
I2PSocketManager sm = smp.getManager(destination);
Filter f = new NullFilter(); //FIXME: use other filter
req.setParam("Host: ", dest.toBase64());
if (!handle(req, f, out, dest, sm)) {
errorHandler.handle(req, httpl, out, "Unable to reach peer");
}
}
/**
* @param req the Request to send out
* @param f a Filter to apply to the bytes retrieved from the Destination
* @param out where to write the results
* @param dest the Destination of the Request
* @param sm an I2PSocketManager, to get a socket for the Destination
* @return boolean, true if something was written, false otherwise.
* @throws IOException
*/
public boolean handle(Request req, Filter f, OutputStream out, Destination dest,
I2PSocketManager sm) throws IOException {
I2PSocket s = null;
boolean written = false;
try {
synchronized (sm) {
s = sm.connect(dest, new I2PSocketOptions());
}
InputStream in = new BufferedInputStream(s.getInputStream());
OutputStream sout = new BufferedOutputStream(s.getOutputStream());
sout.write(req.toByteArray());
sout.flush();
byte[] buffer = new byte[16384], filtered;
int len;
while ((len = in.read(buffer)) != -1) {
if (len != buffer.length) {
byte[] b2 = new byte[len];
System.arraycopy(buffer, 0, b2, 0, len);
filtered = f.filter(b2);
} else {
filtered = f.filter(buffer);
}
written = true;
out.write(filtered);
}
filtered = f.finish();
written = true;
out.write(filtered);
out.flush();
} catch (SocketException ex) {
_log.error("Error while handling eepsite request");
return written;
} catch (IOException ex) {
_log.error("Error while handling eepsite request");
return written;
} catch (I2PException ex) {
_log.error("Error while handling eepsite request");
return written;
} finally {
if (s != null) s.close();
}
return true;
}
}

View File

@ -1,41 +0,0 @@
package net.i2p.httptunnel.handler;
import java.io.IOException;
import java.io.OutputStream;
import net.i2p.httptunnel.HTTPListener;
import net.i2p.httptunnel.Request;
import net.i2p.util.Log;
/**
* Handler for general error messages.
*/
public class ErrorHandler {
private static final Log _log = new Log(ErrorHandler.class); /* UNUSED */
/* package private */ErrorHandler() {
}
/**
* @param req the Request
* @param httpl an HTTPListener
* @param out where to write the results
* @param error the error that happened
* @throws IOException
*/
public void handle(Request req, HTTPListener httpl, OutputStream out, String error) throws IOException {
// FIXME: Make nicer messages for more likely errors.
out
.write(("HTTP/1.1 500 Internal Server Error\r\n" + "Content-Type: text/html; charset=iso-8859-1\r\n\r\n")
.getBytes("ISO-8859-1"));
out
.write(("<html><head><title>" + error + "</title></head><body><h1>" + error
+ "</h1>An internal error occurred while " + "handling a request by HTTPTunnel:<br><b>" + error + "</b><h2>Complete request:</h2><b>---</b><br><i><pre>\r\n")
.getBytes("ISO-8859-1"));
out.write(req.toByteArray());
out.write(("</pre></i><br><b>---</b></body></html>").getBytes("ISO-8859-1"));
out.flush();
}
}

View File

@ -1,67 +0,0 @@
package net.i2p.httptunnel.handler;
import java.io.IOException;
import java.io.OutputStream;
import net.i2p.httptunnel.HTTPListener;
import net.i2p.httptunnel.Request;
import net.i2p.util.Log;
/**
* Handler for requests that do not require any connection to anyone
* (except errors).
*/
public class LocalHandler {
private static final Log _log = new Log(LocalHandler.class); /* UNUSED */
/* package private */LocalHandler() {
}
/**
* @param req the Request
* @param httpl an HTTPListener
* @param out where to write the results
* @throws IOException
*/
public void handle(Request req, HTTPListener httpl, OutputStream out
/*, boolean fromProxy */) throws IOException {
//FIXME: separate multiple pages, not only a start page
//FIXME: provide some info on this page
out
.write(("HTTP/1.1 200 Document following\r\n" + "Content-Type: text/html; charset=iso-8859-1\r\n\r\n"
+ "<html><head><title>Welcome to I2P HTTPTunnel</title>"
+ "</head><body><h1>Welcome to I2P HTTPTunnel</h1>You can "
+ "browse Eepsites by adding an eepsite name to the request." + "</body></html>")
.getBytes("ISO-8859-1"));
out.flush();
}
/**
* Currently always throws an IO Exception
* @param req the Request
* @param httpl an HTTPListener
* @param out where to write the results
* @throws IOException
*/
public void handleProxyConfWarning(Request req, HTTPListener httpl, OutputStream out) throws IOException {
//FIXME
throw new IOException("jrandom ate the deprecated method. mooo");
//httpl.handleNotImplemented(out);
}
/**
* Currently always throws an IO Exception
* @param req the Request
* @param httpl an HTTPListener
* @param out where to write the results
* @throws IOException
*/
public void handleHTTPWarning(Request req, HTTPListener httpl, OutputStream out /*, boolean fromProxy */)
throws IOException {
// FIXME
throw new IOException("jrandom ate the deprecated method. mooo");
//httpl.handleNotImplemented(out);
}
}

View File

@ -1,54 +0,0 @@
package net.i2p.httptunnel.handler;
import java.io.IOException;
import java.io.OutputStream;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.Destination;
import net.i2p.httptunnel.HTTPListener;
import net.i2p.httptunnel.Request;
import net.i2p.httptunnel.SocketManagerProducer;
import net.i2p.httptunnel.filter.Filter;
import net.i2p.httptunnel.filter.NullFilter;
import net.i2p.util.Log;
/**
* Handler for proxying "normal" HTTP requests.
*/
public class ProxyHandler extends EepHandler {
private static final Log _log = new Log(ErrorHandler.class); /* UNUSED */
private static I2PAppContext _context = new I2PAppContext();
/* package private */ProxyHandler(ErrorHandler eh) {
super(eh);
}
/**
* @param req a Request
* @param httpl an HTTPListener
* @param out where to write the results
* @throws IOException
*/
public void handle(Request req, HTTPListener httpl, OutputStream out
/*, boolean fromProxy */) throws IOException {
SocketManagerProducer smp = httpl.getSMP();
Destination dest = findProxy();
if (dest == null) {
errorHandler.handle(req, httpl, out, "Could not find proxy");
return;
}
// one manager for all proxy requests
I2PSocketManager sm = smp.getManager("--proxy--");
Filter f = new NullFilter(); //FIXME: use other filter
if (!handle(req, f, out, dest, sm)) {
errorHandler.handle(req, httpl, out, "Unable to reach peer");
}
}
private Destination findProxy() {
//FIXME!
return _context.namingService().lookup("squid.i2p");
}
}

View File

@ -1,116 +0,0 @@
package net.i2p.httptunnel.handler;
import java.io.IOException;
import java.io.OutputStream;
import net.i2p.httptunnel.HTTPListener;
import net.i2p.httptunnel.Request;
import net.i2p.util.Log;
/**
* Main handler for all requests. Dispatches requests to other handlers.
*/
public class RootHandler {
private static final Log _log = new Log(RootHandler.class); /* UNUSED */
private RootHandler() {
errorHandler = new ErrorHandler();
localHandler = new LocalHandler();
proxyHandler = new ProxyHandler(errorHandler);
eepHandler = new EepHandler(errorHandler);
}
private ErrorHandler errorHandler;
private ProxyHandler proxyHandler;
private LocalHandler localHandler;
private EepHandler eepHandler;
private static RootHandler instance;
/**
* Singleton stuff
* @return the one and only instance, yay!
*/
public static synchronized RootHandler getInstance() {
if (instance == null) {
instance = new RootHandler();
}
return instance;
}
/**
* The _ROOT_ handler: it passes its workload off to the other handlers.
* @param req a Request
* @param httpl an HTTPListener
* @param out where to write the results
* @throws IOException
*/
public void handle(Request req, HTTPListener httpl, OutputStream out) throws IOException {
String url = req.getURL();
System.out.println(url);
/* boolean byProxy = false; */
int pos;
if (url.startsWith("http://")) { // access via proxy
/* byProxy=true; */
if (httpl.firstProxyUse()) {
localHandler.handleProxyConfWarning(req, httpl, out);
return;
}
url = url.substring(7);
pos = url.indexOf("/");
String host;
if (pos == -1) {
errorHandler.handle(req, httpl, out, "No host end in URL");
return;
}
host = url.substring(0, pos);
url = url.substring(pos);
if ("i2p".equals(host) || "i2p.i2p".equals(host)) {
// normal request; go on below...
} else if (host.endsWith(".i2p")) {
// "old" service request, send a redirect...
out.write(("HTTP/1.1 302 Moved\r\nLocation: " + "http://i2p.i2p/" + host + url + "\r\n\r\n").getBytes("ISO-8859-1"));
return;
} else {
// this is for proxying to the real web
proxyHandler.handle(req, httpl, out /*, true */);
return;
}
}
if (url.equals("/")) { // main page
url = "/_/local/index";
} else if (!url.startsWith("/")) {
errorHandler.handle(req, httpl, out, "No leading slash in URL: " + url);
return;
}
String dest;
url = url.substring(1);
pos = url.indexOf("/");
if (pos == -1) {
dest = url;
url = "/";
} else {
dest = url.substring(0, pos);
url = url.substring(pos);
}
req.setURL(url);
if (dest.equals("_")) { // no eepsite
if (url.startsWith("/local/")) { // local request
req.setURL(url.substring(6));
localHandler.handle(req, httpl, out /*, byProxy */);
} else if (url.startsWith("/http/")) { // http warning
localHandler.handleHTTPWarning(req, httpl, out /*, byProxy */);
} else if (url.startsWith("/proxy/")) { // http proxying
req.setURL("http://" + url.substring(7));
proxyHandler.handle(req, httpl, out /*, byProxy */);
} else {
errorHandler.handle(req, httpl, out, "No local handler for this URL: " + url);
}
} else {
eepHandler.handle(req, httpl, out, /* byProxy, */dest);
}
}
}

View File

@ -7,14 +7,32 @@
<ant dir="../../streaming/java/" target="build" />
<!-- streaming will build ministreaming and core -->
</target>
<target name="compile">
<condition property="depend.available">
<typefound name="depend" />
</condition>
<target name="depend" if="depend.available">
<depend
cache="../../../build"
srcdir="./src"
destdir="./build/obj" >
<!-- Depend on classes instead of jars where available -->
<classpath>
<pathelement location="../../../core/java/build/obj" />
<pathelement location="../../../router/java/build/obj" />
<pathelement location="../../ministreaming/java/build/obj" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
</classpath>
</depend>
</target>
<target name="compile" depends="depend">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac
srcdir="./src"
debug="true" deprecation="on" source="1.3" target="1.3"
debug="true" deprecation="on" source="1.5" target="1.5"
destdir="./build/obj"
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" />
classpath="../../../core/java/build/i2p.jar:../../../router/java/build/router.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" />
</target>
<target name="jar" depends="builddep, compile">
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/*Servlet.class">
@ -36,7 +54,7 @@
</zip>
</target>
<target name="standalone_prep" depends="war">
<javac debug="true" deprecation="on" source="1.3" target="1.3"
<javac debug="true" deprecation="on" source="1.5" target="1.5"
destdir="./build" srcdir="src/" includes="org/klomp/snark/web/RunStandalone.java" >
<classpath>
<pathelement location="../../jetty/jettylib/commons-logging.jar" />

View File

@ -20,9 +20,6 @@
package org.klomp.snark;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;
/**
* Container of a byte array representing set and unset bits.
@ -32,6 +29,7 @@ public class BitField
private final byte[] bitfield;
private final int size;
private int count;
/**
* Creates a new BitField that represents <code>size</code> unset bits.
@ -41,6 +39,7 @@ public class BitField
this.size = size;
int arraysize = ((size-1)/8)+1;
bitfield = new byte[arraysize];
this.count = 0;
}
/**
@ -60,6 +59,11 @@ public class BitField
// XXX - More correct would be to check that unused bits are
// cleared or clear them explicitly ourselves.
System.arraycopy(bitfield, 0, this.bitfield, 0, arraysize);
this.count = 0;
for (int i = 0; i < size; i++)
if (get(i))
this.count++;
}
/**
@ -95,7 +99,10 @@ public class BitField
throw new IndexOutOfBoundsException(Integer.toString(bit));
int index = bit/8;
int mask = 128 >> (bit % 8);
bitfield[index] |= mask;
if ((bitfield[index] & mask) == 0) {
count++;
bitfield[index] |= mask;
}
}
/**
@ -114,10 +121,27 @@ public class BitField
return (bitfield[index] & mask) != 0;
}
/**
* Return the number of set bits.
*/
public int count()
{
return count;
}
/**
* Return true if all bits are set.
*/
public boolean complete()
{
return count >= size;
}
public String toString()
{
// Not very efficient
StringBuffer sb = new StringBuffer("BitField[");
StringBuffer sb = new StringBuffer("BitField(");
sb.append(size).append(")[");
for (int i = 0; i < size; i++)
if (get(i))
{
@ -128,4 +152,5 @@ public class BitField
return sb.toString();
}
}

View File

@ -20,8 +20,10 @@
package org.klomp.snark;
import java.io.*;
import java.net.*;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PServerSocket;
@ -113,11 +115,13 @@ public class ConnectionAcceptor implements Runnable
// ok, already updated
socketChanged = false;
}
if (serverSocket == null) {
Snark.debug("Server socket went away.. boo hiss", Snark.ERROR);
stop = true;
return;
while ( (serverSocket == null) && (!stop)) {
serverSocket = I2PSnarkUtil.instance().getServerSocket();
if (serverSocket == null)
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
}
if(stop)
break;
try
{
I2PSocket socket = serverSocket.accept();
@ -125,7 +129,11 @@ public class ConnectionAcceptor implements Runnable
if (socketChanged) {
continue;
} else {
Snark.debug("Null socket accepted, but socket wasn't changed?", Snark.ERROR);
I2PServerSocket ss = I2PSnarkUtil.instance().getServerSocket();
if (ss != serverSocket) {
serverSocket = ss;
socketChanged = true;
}
}
} else {
Thread t = new I2PThread(new Handler(socket), "Connection-" + socket);
@ -148,7 +156,8 @@ public class ConnectionAcceptor implements Runnable
try
{
serverSocket.close();
if (serverSocket != null)
serverSocket.close();
}
catch (I2PException ignored) { }

View File

@ -1,18 +1,27 @@
package org.klomp.snark;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.util.EepGet;
import net.i2p.client.I2PSession;
import net.i2p.data.*;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.data.Hash;
import net.i2p.util.EepGet;
import net.i2p.util.Log;
import java.io.*;
import java.util.*;
import net.i2p.util.SimpleTimer;
/**
* I2P specific helpers for I2PSnark
@ -31,6 +40,9 @@ public class I2PSnarkUtil {
private Map _opts;
private I2PSocketManager _manager;
private boolean _configured;
private Set _shitlist;
private int _maxUploaders;
private int _maxUpBW;
private I2PSnarkUtil() {
_context = I2PAppContext.getGlobalContext();
@ -38,7 +50,9 @@ public class I2PSnarkUtil {
_opts = new HashMap();
setProxy("127.0.0.1", 4444);
setI2CPConfig("127.0.0.1", 7654, null);
_shitlist = new HashSet(64);
_configured = false;
_maxUploaders = Snark.MAX_TOTAL_UPLOADERS;
}
/**
@ -69,17 +83,29 @@ public class I2PSnarkUtil {
_configured = true;
}
public void setMaxUploaders(int limit) {
_maxUploaders = limit;
_configured = true;
}
public void setMaxUpBW(int limit) {
_maxUpBW = limit;
_configured = true;
}
public String getI2CPHost() { return _i2cpHost; }
public int getI2CPPort() { return _i2cpPort; }
public Map getI2CPOptions() { return _opts; }
public String getEepProxyHost() { return _proxyHost; }
public int getEepProxyPort() { return _proxyPort; }
public boolean getEepProxySet() { return _shouldProxy; }
public int getMaxUploaders() { return _maxUploaders; }
public int getMaxUpBW() { return _maxUpBW; }
/**
* Connect to the router, if we aren't already
*/
public boolean connect() {
synchronized public boolean connect() {
if (_manager == null) {
Properties opts = new Properties();
if (_opts != null) {
@ -90,14 +116,20 @@ public class I2PSnarkUtil {
}
if (opts.getProperty("inbound.nickname") == null)
opts.setProperty("inbound.nickname", "I2PSnark");
if (opts.getProperty("outbound.nickname") == null)
opts.setProperty("outbound.nickname", "I2PSnark");
if (opts.getProperty("i2p.streaming.inactivityTimeout") == null)
opts.setProperty("i2p.streaming.inactivityTimeout", "90000");
opts.setProperty("i2p.streaming.inactivityTimeout", "240000");
if (opts.getProperty("i2p.streaming.inactivityAction") == null)
opts.setProperty("i2p.streaming.inactivityAction", "1");
if (opts.getProperty("i2p.streaming.writeTimeout") == null)
opts.setProperty("i2p.streaming.writeTimeout", "90000");
if (opts.getProperty("i2p.streaming.readTimeout") == null)
opts.setProperty("i2p.streaming.readTimeout", "90000");
opts.setProperty("i2p.streaming.inactivityAction", "1"); // 1 == disconnect, 2 == ping
if (opts.getProperty("i2p.streaming.initialWindowSize") == null)
opts.setProperty("i2p.streaming.initialWindowSize", "1");
if (opts.getProperty("i2p.streaming.slowStartGrowthRateFactor") == null)
opts.setProperty("i2p.streaming.slowStartGrowthRateFactor", "1");
//if (opts.getProperty("i2p.streaming.writeTimeout") == null)
// opts.setProperty("i2p.streaming.writeTimeout", "90000");
//if (opts.getProperty("i2p.streaming.readTimeout") == null)
// opts.setProperty("i2p.streaming.readTimeout", "120000");
_manager = I2PSocketManagerFactory.createManager(_i2cpHost, _i2cpPort, opts);
}
return (_manager != null);
@ -110,37 +142,58 @@ public class I2PSnarkUtil {
public void disconnect() {
I2PSocketManager mgr = _manager;
_manager = null;
_shitlist.clear();
mgr.destroySocketManager();
}
/** connect to the given destination */
I2PSocket connect(PeerID peer) throws IOException {
Hash dest = peer.getAddress().calculateHash();
synchronized (_shitlist) {
if (_shitlist.contains(dest))
throw new IOException("Not trying to contact " + dest.toBase64() + ", as they are shitlisted");
}
try {
return _manager.connect(peer.getAddress());
I2PSocket rv = _manager.connect(peer.getAddress());
if (rv != null) synchronized (_shitlist) { _shitlist.remove(dest); }
return rv;
} catch (I2PException ie) {
synchronized (_shitlist) {
_shitlist.add(dest);
}
SimpleTimer.getInstance().addEvent(new Unshitlist(dest), 10*60*1000);
throw new IOException("Unable to reach the peer " + peer + ": " + ie.getMessage());
}
}
private class Unshitlist implements SimpleTimer.TimedEvent {
private Hash _dest;
public Unshitlist(Hash dest) { _dest = dest; }
public void timeReached() { synchronized (_shitlist) { _shitlist.remove(_dest); } }
}
/**
* fetch the given URL, returning the file it is stored in, or null on error
*/
public File get(String url) { return get(url, true); }
public File get(String url, boolean rewrite) {
public File get(String url) { return get(url, true, 0); }
public File get(String url, boolean rewrite) { return get(url, rewrite, 0); }
public File get(String url, int retries) { return get(url, true, retries); }
public File get(String url, boolean rewrite, int retries) {
_log.debug("Fetching [" + url + "] proxy=" + _proxyHost + ":" + _proxyPort + ": " + _shouldProxy);
File out = null;
try {
out = File.createTempFile("i2psnark", "url");
out = File.createTempFile("i2psnark", "url", new File("."));
} catch (IOException ioe) {
ioe.printStackTrace();
out.delete();
if (out != null)
out.delete();
return null;
}
String fetchURL = url;
if (rewrite)
fetchURL = rewriteAnnounce(url);
//_log.debug("Rewritten url [" + fetchURL + "]");
EepGet get = new EepGet(_context, _shouldProxy, _proxyHost, _proxyPort, 1, out.getAbsolutePath(), fetchURL);
EepGet get = new EepGet(_context, _shouldProxy, _proxyHost, _proxyPort, retries, out.getAbsolutePath(), fetchURL);
if (get.fetch()) {
_log.debug("Fetch successful [" + url + "]: size=" + out.length());
return out;
@ -152,10 +205,16 @@ public class I2PSnarkUtil {
}
public I2PServerSocket getServerSocket() {
return _manager.getServerSocket();
I2PSocketManager mgr = _manager;
if (mgr != null)
return mgr.getServerSocket();
else
return null;
}
String getOurIPString() {
if (_manager == null)
return "unknown";
I2PSession sess = _manager.getSession();
if (sess != null) {
Destination dest = sess.getMyDestination();
@ -167,15 +226,15 @@ public class I2PSnarkUtil {
Destination getDestination(String ip) {
if (ip == null) return null;
if (ip.endsWith(".i2p")) {
Destination dest = _context.namingService().lookup(ip);
if (dest != null) {
return dest;
} else {
try {
return new Destination(ip.substring(0, ip.length()-4)); // sans .i2p
} catch (DataFormatException dfe) {
return null;
}
if (ip.length() < 520) { // key + ".i2p"
Destination dest = _context.namingService().lookup(ip);
if (dest != null)
return dest;
}
try {
return new Destination(ip.substring(0, ip.length()-4)); // sans .i2p
} catch (DataFormatException dfe) {
return null;
}
} else {
try {
@ -186,12 +245,22 @@ public class I2PSnarkUtil {
}
}
public String lookup(String name) {
Destination dest = getDestination(name);
if (dest == null)
return null;
return dest.toBase64();
}
/**
* Given http://blah.i2p/foo/announce turn it into http://i2p/blah/foo/announce
* Given http://KEY.i2p/foo/announce turn it into http://i2p/KEY/foo/announce
* Given http://tracker.blah.i2p/foo/announce leave it alone
*/
String rewriteAnnounce(String origAnnounce) {
int destStart = "http://".length();
int destEnd = origAnnounce.indexOf(".i2p");
if (destEnd < destStart + 516)
return origAnnounce;
int pathStart = origAnnounce.indexOf('/', destEnd);
String rv = "http://i2p/" + origAnnounce.substring(destStart, destEnd) + origAnnounce.substring(pathStart);
//_log.debug("Rewriting [" + origAnnounce + "] as [" + rv + "]");

View File

@ -22,20 +22,22 @@ package org.klomp.snark;
import java.io.IOException;
import java.io.InputStream;
import java.io.File;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import org.klomp.snark.bencode.*;
import net.i2p.crypto.SHA1;
import net.i2p.data.Base64;
import net.i2p.util.Log;
import net.i2p.crypto.SHA1;
import org.klomp.snark.bencode.BDecoder;
import org.klomp.snark.bencode.BEValue;
import org.klomp.snark.bencode.BEncoder;
import org.klomp.snark.bencode.InvalidBEncodingException;
/**
* Note: this class is buggy, as it doesn't propogate custom meta fields into the bencoded
@ -406,7 +408,7 @@ public class MetaInfo
info.put("name", name);
if (name_utf8 != null)
info.put("name.utf-8", name_utf8);
info.put("piece length", new Integer(piece_length));
info.put("piece length", Integer.valueOf(piece_length));
info.put("pieces", piece_hashes);
if (files == null)
info.put("length", new Long(length));
@ -432,9 +434,10 @@ public class MetaInfo
Map info = createInfoMap();
StringBuffer buf = new StringBuffer(128);
buf.append("info: ");
for (Iterator iter = info.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next();
Object val = info.get(key);
for (Iterator iter = info.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();
String key = (String)entry.getKey();
Object val = entry.getValue();
buf.append(key).append('=');
if (val instanceof byte[])
buf.append(Base64.encode((byte[])val, true));

View File

@ -20,15 +20,15 @@
package org.klomp.snark;
import java.io.*;
import java.net.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Map;
import org.klomp.snark.bencode.*;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.data.DataHelper;
import net.i2p.util.Log;
public class Peer implements Comparable
@ -54,6 +54,10 @@ public class Peer implements Comparable
private boolean deregister = true;
private static long __id;
private long _id;
final static long CHECK_PERIOD = PeerCoordinator.CHECK_PERIOD; // 40 seconds
final static int RATE_DEPTH = PeerCoordinator.RATE_DEPTH; // make following arrays RATE_DEPTH long
private long uploaded_old[] = {-1,-1,-1,-1,-1,-1};
private long downloaded_old[] = {-1,-1,-1,-1,-1,-1};
/**
* Creates a disconnected peer given a PeerID, your own id and the
@ -110,6 +114,14 @@ public class Peer implements Comparable
return "[unknown id] " + _id;
}
/**
* Returns socket (for debug printing)
*/
public String getSocket()
{
return sock.toString();
}
/**
* The hash code of a Peer is the hash code of the peerID.
*/
@ -318,6 +330,14 @@ public class Peer implements Comparable
PeerState s = state;
if (s != null)
{
// try to save partial piece
if (this.deregister) {
PeerListener p = s.listener;
if (p != null) {
p.savePeerPartial(s);
p.markUnrequested(this);
}
}
state = null;
PeerConnectionIn in = s.in;
@ -449,13 +469,105 @@ public class Peer implements Comparable
public long getInactiveTime() {
PeerState s = state;
if (s != null) {
PeerConnectionIn in = s.in;
PeerConnectionOut out = s.out;
if (out != null)
return System.currentTimeMillis() - out.lastSent;
else
if (in != null && out != null) {
long now = System.currentTimeMillis();
return Math.max(now - out.lastSent, now - in.lastRcvd);
} else
return -1; //"state, no out";
} else {
return -1; //"no state";
}
}
/**
* Send keepalive
*/
public void keepAlive()
{
PeerState s = state;
if (s != null)
s.keepAlive();
}
/**
* Retransmit outstanding requests if necessary
*/
public void retransmitRequests()
{
PeerState s = state;
if (s != null)
s.retransmitRequests();
}
/**
* Return how much the peer has
*/
public int completed()
{
PeerState s = state;
if (s == null || s.bitfield == null)
return 0;
return s.bitfield.count();
}
/**
* Return if a peer is a seeder
*/
public boolean isCompleted()
{
PeerState s = state;
if (s == null || s.bitfield == null)
return false;
return s.bitfield.complete();
}
/**
* Push the total uploaded/downloaded onto a RATE_DEPTH deep stack
*/
public void setRateHistory(long up, long down)
{
setRate(up, uploaded_old);
setRate(down, downloaded_old);
}
private void setRate(long val, long array[])
{
synchronized(array) {
for (int i = RATE_DEPTH-1; i > 0; i--)
array[i] = array[i-1];
array[0] = val;
}
}
/**
* Returns the 4-minute-average rate in Bps
*/
public long getUploadRate()
{
return getRate(uploaded_old);
}
public long getDownloadRate()
{
return getRate(downloaded_old);
}
private long getRate(long array[])
{
long rate = 0;
int i = 0;
synchronized(array) {
for ( ; i < RATE_DEPTH; i++){
if (array[i] < 0)
break;
rate += array[i];
}
}
if (i == 0)
return 0;
return rate / (i * CHECK_PERIOD / 1000);
}
}

View File

@ -20,8 +20,12 @@
package org.klomp.snark;
import java.io.*;
import java.net.*;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.SequenceInputStream;
import java.util.Iterator;
import net.i2p.client.streaming.I2PSocket;

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