Compare commits

...

1291 Commits

Author SHA1 Message Date
zzz
90cd68900e 0.9.12 2014-03-31 12:43:15 +00:00
zzz
3f865edb4f Convert pt_BR getopt translation from ISO-8859-15 to escaped UTF-8 2014-03-31 12:36:50 +00:00
2e8681de2c getopt translations 2014-03-28 20:23:53 +00:00
zzz
2d85b98c20 * i2ptunnel.config: Remove irc.freshcoffee.i2p
* NetDbRenderer: Adjust debug floodfill estimate
 * StatManager: Don't start thread for an empty config
 * StatisticsManager: Don't publish client tunnel stats
 * Log tweaks
2014-03-28 14:01:39 +00:00
d28d6efb79 geoip updates 2014-03-28 12:21:52 +00:00
43d84a5f07 fr, nb, and ru translation updates 2014-03-28 12:21:32 +00:00
e4d57f62bb merge of '1202f5d3645add930a96dfa77cd2b2ebfb56ca95'
and '5c131297d763f8953029fea257681d55f2103aaa'
2014-03-24 11:57:46 +00:00
a974268e7b postinstall: fix freebsd x86 wrapper path
Spotted in the FreeBSD Port (http://svnweb.freebsd.org/ports/head/security/i2p/files/patch-installer__resources__postinstall.sh?view=markup)
2014-03-24 11:57:04 +00:00
zzz
1695af7011 belated jisko.i2p 2014-03-23 20:44:47 +00:00
682c4cd0b8 remove extraneous '>' from editServer 2014-03-23 18:33:29 +00:00
0f6d039391 Console: Handle stopping plugin ClientApps 2014-03-23 10:55:00 +00:00
d6233a8798 add *.torrent to .gitignore 2014-03-21 11:35:37 +00:00
4f12e81dbb build: add -pre-release target, add addt'l files to distclean
Moving the pre-release checks to a new target (to be run at the very start of
"release")
2014-03-21 11:35:04 +00:00
ab612d0088 cleanup of *clean targets, remove more generated files in distclean 2014-03-19 22:00:43 +00:00
3fa7bb9dc5 mtn-ignore: ignore .torrent 2014-03-19 21:59:27 +00:00
22b3d4d70b translation updates 2014-03-16 23:56:43 +00:00
zzz
bd6c588c74 * SSU: Fix corruption of introducer keys 2014-03-16 18:27:46 +00:00
zzz
6c202e8f1d fix router identity test broken by previous checkin 2014-03-15 19:40:41 +00:00
zzz
24e6750529 * Certificate: Fix null cert hash code
* Hash: Cleanup of cached hash
* NetDB: Randomize returned DSM timestamp
2014-03-15 18:43:42 +00:00
af7ce8e18e remove extraneous <a> tag
(fixing my mistake)
2014-03-15 13:47:53 +00:00
zzz
c73f0eeeb5 more Jetty classpath cleanup 2014-03-13 13:58:50 +00:00
zzz
c68769cf7f MultiMap: Cleanups, javadocs after review 2014-03-13 13:57:10 +00:00
zzz
3e639a319d SAM:
- Classes static/private
 - Fields private/final
 - Remove unused fields
 - Remove shadowing fields
 - Remove dup method overrides
 - Remove static Logs
 - Remove unnecessary field initialization
 - Atomics
 - Findbugs
2014-03-13 12:22:04 +00:00
zzz
1bbb79f5b1 log tweaks 2014-03-13 12:17:34 +00:00
84e6991374 Add .su3 to .mtn-ignore, create new .gitignore file 2014-03-13 11:27:37 +00:00
5d1796bb6f Debian: Remove service directory when package is purged
This was in the 0.9.11 packages but not checked into mtn.
2014-03-13 02:31:23 +00:00
bfba732f76 Debian: Add systemd support (ticket #1208)
Currently just for Debian unstable and Ubuntu Saucy and newer.
2014-03-13 02:29:41 +00:00
zzz
738c5ed14e Streaming: Workaround for jwebcache and i2phex (ticket #1231) 2014-03-12 16:02:23 +00:00
zzz
beed080390 anoncoin.i2p 2014-03-12 15:21:17 +00:00
zzz
3624d66c12 send message on HTTP Server OOM 2014-03-12 15:18:41 +00:00
zzz
2cca2781fd * Streaming: Track recently closed connections (ticket #1161)
Consolidate and synchronize code for selecting a random stream ID
2014-03-12 12:39:53 +00:00
zzz
31d485299c log tweak 2014-03-12 12:36:00 +00:00
zzz
a39f667c2f set BAOS size 2014-03-12 12:35:29 +00:00
zzz
5283fc923e * Wrapper: Fix failed restarts on ARM (ticket #1230);
extend shutdown timeouts for all archs.
2014-03-12 12:33:36 +00:00
zzz
c57552f4e9 * Console: Handle ISO-639-2 language codes (ticket #1229) 2014-03-12 12:29:38 +00:00
zzz
96b4c6b219 findbugs sam/bob 2014-03-12 12:27:23 +00:00
zzz
51911bd9a8 fix jetty deprecations 2014-03-12 12:25:30 +00:00
zzz
1f5926e4e9 * PeerManager: Restore profileOrganizer.sameCountryBonus advanced config,
inadvertently removed in 0.9.10
2014-03-08 16:03:35 +00:00
zzz
d6a02a13ad * Router:
- Look for DeliveryStatusMessages beyond the message expiration,
     so we don't throw out a tagset that gets acked late
   - Allow re-adding of a "failed" tagset to the SKM
   - Extend max message age in MessageValidator
   - Remove unused and confusing timeout param when registering a selector
   - Log tweaks, javadocs, cleanups
2014-03-07 14:17:11 +00:00
e282491798 merge of '10a291d2283174a7527515a7448d220d5023ffc0'
and '6ace0f7ffbda402db7e1af21a74ca29ad54829c2'
2014-03-07 08:35:12 +00:00
2b0dfed012 Fixed Android API version detection, load cacerts dir for API >= 14 2014-03-07 08:27:14 +00:00
zzz
9d80aff977 * GarlicClove, CloveSet, GarlicMessageParser:
- Cleanup, reduce object churn, comment out unused code
   - Limit max cloves to 32
2014-03-06 19:31:09 +00:00
zzz
a0724dc009 * Router: Encrypt DeliveryStatusMessages sent in garlics (ticket #1217) 2014-03-06 16:21:36 +00:00
zzz
8c820bb237 clean up build classpath (ticket #1165) 2014-03-06 06:03:58 +00:00
zzz
3fdc964eac javadoc fixes 2014-03-05 16:53:04 +00:00
zzz
597662d0dc * Transports: Don't send a duplicate store of our RI at
start of a connection (ticket #1187)
 * NTCP:
   - Lower send priority of the RI at exchange
   - Bob will now send his RI even if he doesn't have Alice's
   - Send RI again sooner on long-lived connections
2014-03-05 16:32:04 +00:00
17c80c29e6 Updated history.txt 2014-03-05 03:35:52 +00:00
5d0bfc63fa Updated readme.html files for new website paths 2014-03-05 03:34:53 +00:00
0c449f8b8e susimail: Removed remaining Jetty dependencies in susimail (ticket #1165)
Thanks for the patch, wockenfuss!
2014-03-05 03:02:08 +00:00
36b6baa33e Updated .mtn-ignore 2014-03-05 02:58:07 +00:00
2c049878c6 Enable addressbook.jar building (for I2P-Android) 2014-03-03 03:49:48 +00:00
zzz
81c58c1796 log tweak 2014-03-01 13:13:52 +00:00
zzz
36a3edf612 - DatabaseStoreMessage: Don't instantiate an ArrayList unless we need it
- Overrides in GarlicConfig/PGC for efficiency and clarity
 - Check for valid ID in DeliveryStatusMessage
 - Misc. log tweaks, javadocs, cleanups
2014-02-27 13:37:11 +00:00
zzz
4b6fd3d387 format tweak 2014-02-24 14:06:24 +00:00
zzz
f777696e14 finals, volatiles, cleanups 2014-02-24 14:02:48 +00:00
zzz
c9c181c14a * NetDB: Slow down router refresh after startup to reduce load
on exploratory tunnels
2014-02-24 14:01:35 +00:00
zzz
a62b7a4374 * Tunnels: Rate-limit connections at the OBEP (ticket #1134) 2014-02-24 14:00:39 +00:00
zzz
9d7a9c9895 * NTCP:
- Add check for replayed session requests (ticket #1212)
   - Disable inbound check connection
   - Reduce object churn in EstablishmentManager
   - Don't pollute Hash cache in EstablishmentManager
   - addRateData() cleanup
2014-02-24 13:54:52 +00:00
zzz
5d6a1c5e35 reduce log level 2014-02-24 13:52:44 +00:00
zzz
c48266fdc4 * Transports: Use SigUtil.rectify() in DH 2014-02-24 13:51:20 +00:00
zzz
895d54d36d minor cleanup 2014-02-24 13:46:07 +00:00
ba0e1a3aa9 * I2PTunnel: add 'irc.dg.i2p' to the default IRC2P tunnel (for more information, see http://echelon.i2p/docs/IRC2p/irc2p_userguide.txt) 2014-02-23 21:38:12 +00:00
6ec665db50 Br. Portugese, French, Japanese, Polish translation updates 2014-02-23 16:54:49 +00:00
7f4c52cf42 remove #i2p-help from initialNews 2014-02-23 16:40:28 +00:00
37728e38c9 (hopefully) langbox fixes 2014-02-22 23:58:25 +00:00
zzz
18b4a2427b * I2CP Client: Generate revocation key of same type as signing key
* i2ptunnel: Only offer Sig options that are available in the JVM
 * LeaseSet: Add check for SigTYpe mismatch
 * SigType: Add isAvailable()
2014-02-21 17:47:30 +00:00
zzz
3102970540 * RouterAddress: Restore storage of expiration and use in signature
calculation, broken in 0.9.3, in anticipation of using it someday
2014-02-21 14:57:28 +00:00
zzz
c679091afd target build property 2014-02-21 13:59:27 +00:00
zzz
91cdf85772 * Router: Allow null args to main() (broke Android) 2014-02-20 14:08:05 +00:00
zzz
aab8b10adf * i2ptunnel: Add inproxy block option to HTTP server 2014-02-20 14:07:02 +00:00
5bcfe1ec72 don't link to docs.i2p2.de in the router console
docs.i2p2.de was last updated in October of 2010!
2014-02-18 19:51:35 +00:00
zzz
4209c291ba * history for prop, -9 (ticket #1090) 2014-02-17 14:18:18 +00:00
zzz
7c5dc7fa55 propagate from branch 'i2p.i2p.zzz.jetty8' (head 0a03ce60906c508b08cc84b3044954844a6ee157)
to branch 'i2p.i2p' (head d99392e09883a92b99a316b4deed0586dcf4ea5b)
2014-02-17 14:01:13 +00:00
zzz
c6dfb8744a Jetty 8.1.14 jars 2014-02-17 13:58:19 +00:00
zzz
6e0ca92041 * getopt fix for PrivateKeyFile -t sigtype, busted in prop
* history for prop, -8
2014-02-17 13:39:32 +00:00
zzz
2f7eb56790 propagate from branch 'i2p.i2p.zzz.ecdsa' (head e83bcdc842f5995d310a4295147f9326a993e010)
to branch 'i2p.i2p' (head 4983f716f8740bc7ddfae5561a562a0d42a815ae)
2014-02-17 13:29:41 +00:00
zzz
8c98ef7328 update version 2014-02-17 13:14:23 +00:00
zzz
45997fd1d5 * SSU:
- Restrict authentication with Bob's intro key to session created packet
2014-02-17 13:05:17 +00:00
zzz
6a3e5ec620 * SSU:
- Use session key for relay request/response if available (ticket #1206)
   - Remove packetAuthTime stats
   - Misc. cleanups and logging
2014-02-17 12:56:08 +00:00
zzz
18cbf3d253 * HMAC:
- Replace BC MD5 with JVM version, refactor I2PHMAC to use
     MessageDigest instead of BC Digest (ticket #1189)
   - Use JVM HmacSHA256 instead of I2PHMAC for Syndie since it is standard
2014-02-17 12:03:22 +00:00
zzz
4df6a6f47b min java version for izpack 2014-02-16 22:31:17 +00:00
5542406f3d Merge pull request from https://github.com/i2p/i2p.i2p/pull/1 2014-02-16 11:28:48 +00:00
zzz
a9fceae181 * I2CP:
- Add session limit, add new status code for refused
   - Ramdomize session ID, prevent dups
   - Make session IDs immutable
2014-02-14 17:05:32 +00:00
zzz
c79ff0dc09 minor cleanups 2014-02-14 17:02:14 +00:00
zzz
e2fc5c6957 * Tunnels: Change expl. OB default to 3+0 2014-02-13 15:46:34 +00:00
zzz
5667a6647f * Router: Convert to getopt (ticket #1173) 2014-02-13 14:43:23 +00:00
zzz
b70d616083 update links 2014-02-12 23:06:30 +00:00
75fa2b1809 typo fix 2014-02-12 21:38:42 +00:00
zzz
66d9017d58 fix PingTest 2014-02-11 19:45:52 +00:00
53efb7119a merge of '12c51adcf9862cc57488b27ec00002b1bb399294'
and 'b870e2fda1291f95ae4e6e35cc5ded300578d92b'
2014-02-11 14:15:35 +00:00
8b946bb56b Remove mention of Pebble in the router console for reasons noted in ticket #865 2014-02-11 14:15:04 +00:00
zzz
8ed34e3edf * HTTP client proxy: Don't flush after headers for a POST,
so the POST data is included in the SYN packet,
   to improve speed and reliability of small POSTs
2014-02-11 13:44:37 +00:00
d8fef53aef i2prouter: - note FBSD10 workaround in ticket #1118
- remove tanuki's script version checks
2014-02-11 01:54:45 +00:00
zzz
6af82f2a9a history for prop, -2 2014-02-10 20:32:20 +00:00
zzz
36b2547ca4 propagate from branch 'i2p.i2p.zzz.test2' (head 7db2f2b73bc7c44b4be1077185314201c5b0bfe6)
to branch 'i2p.i2p' (head ea9844ecc27e816a09cf5d9b36c10ee2c3d1bcc9)
2014-02-10 18:46:38 +00:00
zzz
72e96cdd23 remove concatentation within appends 2014-02-10 18:33:32 +00:00
zzz
a2ba9bbdb1 * Checklist updates
* Console:
   - Don't reset graph settings when clicking restart or shutdown on graphs page
   - Don't recommend guest login on trac, it's disabled
   - Catch and remove corrupt jrb file (ticket #1186)
   - Always set default language on /configui
 * Readme: Update links
 * Transports: Reduce target connection count again to reduce
               tunnel reject rate further
2014-02-10 14:22:43 +00:00
f6d9a6917f Removed a comment line from french translation 2014-02-09 20:27:42 +00:00
zzz
2e91890401 Javadoc fixes to correct release number
Remove unused lock object
 Add irc.dg.i2p
 0.9.11
2014-02-08 18:09:46 +00:00
zzz
1956068698 * Addressbook:
- Rewrite subscriptions.txt to convert to new default URL
   - Static method call cleanups
2014-02-08 16:02:50 +00:00
zzz
855cae0a45 propagate from branch 'i2p.i2p' (head eac6caabd2ea6731ee27111f0dbadf5afcd3695b)
to branch 'i2p.i2p.zzz.test2' (head 911a8782667d878dd7a2976c7fb10d481d80e023)
2014-02-07 16:33:59 +00:00
zzz
ef3a12f01a * UpdateManager:
- Convert to RouterApp and remove update hooks from context
     (ticket #1185)
2014-02-07 15:40:23 +00:00
zzz
37bf750ab9 * I2PTunnel:
- Convert to getopt (ticket #1173)
   - Add more argument sanity checking
   - Add a usage output
2014-02-07 14:24:09 +00:00
zzz
090a790a9d * Services:
- Move backup news to psi.i2p
   - Move default addressbook subscription to i2p-projekt.i2p
   - Remove www.i2p2.i2p from default update lists
   - Add psi.i2p to hosts.txt
   - Update links on help pages to avoid redirects on new website
     and select the correct language
 * SusiDNS: Fix whitespace issues
2014-02-07 12:52:54 +00:00
8ef3bb3d82 version number fix 2014-02-06 18:50:54 +00:00
388019249d -10-rc
Debian changelog update, Korean debconf translation, history.txt update
2014-02-06 18:45:11 +00:00
91d1364832 February 2014 geoip db updates 2014-02-06 18:43:45 +00:00
2ec1d8484f Brazilian Portuguese, Danish, French, Japanese, Polish, Russian, Ukrainian 2014-02-06 18:32:23 +00:00
zzz
9a01fdf57c * PrivateKeyFile:
- Convert to getopt (ticket #1173)
   - New option -e for hashcash effort, instead of -h with optional arg
   - Stub out -t option, to be propped from ecdsa branch
   Will require manual merge with ecdsa branch...
2014-02-06 15:30:03 +00:00
zzz
deec84713f * EepHead, PartialEepGet, SSLEepGet:
- Convert to getopt (ticket #1173)
 * EepHead, PartialEepGet:
   - New option -c for clearnet (no proxy), same as -p:0
   - New option -o, same as EepGet
   - Proxy option -p with host name arg only (no ':') now allowed
   - Add proxy auth support with -u and -x options (ticket #1173)
 * EepGet:
   - Catch error in -h option
   - Cleanups
2014-02-06 14:18:51 +00:00
zzz
0d028122a6 * EepGet:
- Support Digest proxy authentication(ticket #1173)
   - Move authentication parsing method from I2PTunnelHTTPClientBase
2014-02-06 01:29:46 +00:00
zzz
4998f86efe * EepGet:
- Convert to getopt (ticket #1173)
   - New option -c for clearnet (no proxy), same as -p:0
   - Proxy option -p with host name arg only (no ':') now allowed
   - Proxy password option is now -x, not the second arg to -u
   - Prompt for proxy password if not supplied in options
   - Line length option is now -l, not the second arg to -m
   - Error on nonproxied .onion hosts
   - Update man page, sort options (ticket #1173)
2014-02-05 16:10:56 +00:00
zzz
839bd51bc8 javadoc fix 2014-02-05 14:46:23 +00:00
zzz
936f2bb317 combine help strings 2014-02-04 14:32:36 +00:00
zzz
0cd774273c * I2Ping:
- Convert to getopt (ticket #1173)
   - Add support for from/to ports
2014-02-04 14:11:09 +00:00
zzz
fe391ff29f Convert all jars and wars to compile to 1.6 target,
except for the following which are used by android,
to maintain compatibility with very old phones, for now:

	addressbook.war
	BOB.jar
	i2p.jar
	i2ptunnel.jar
	mstreaming.jar
	router.jar
	streaming.jar
2014-02-03 23:59:48 +00:00
zzz
001b127258 * Jetty:
- Update to Jetty 8.x, Servlet 3.0, JSP 2.2
   - Require Java 6
   - Use Servlet and JSP jars from Jetty instead of Tomcat
   - Tomcat remains at 6.0.37 supporting Servlet 2.5 / JSP 2.1
   - Remove Jetty dependency in console error pages
   - Build files for Jetty 8.1.14
   - Doc updates
   - Delete Jetty 7.6.14
   - Jetty 8.1.14 not yet checked in,
     waiting to see if a new version is released soon,
     but build will download it for testing
2014-02-03 23:24:45 +00:00
zzz
7c00a5165f Build: Honor require.gettext=false for i2prouter translations 2014-02-03 20:43:02 +00:00
zzz
e1c3e2c1c7 * Getopt bundle fixes for Java Properties standard:
Fix comment lines
   Encoding conversion to UTF-8 with escapes
   Add unicode escapes for all chars over 0x7f
   Change Transifex type to PROPERTIES
   Also:
    - Remove BOMs
    - Remove \r
    - Remove blank lines
   Encodings were as follows:
     cs: marked ISO-8859-2
     pl: marked ISO-8859-2, possibly corrupt, ?? in two strings
     de, es, fr: marked ISO-8859-1
     hu: detected as ISO-8859-2
     it: apparently ISO-8859-1
     ja: Unicode escaped already
     nb, nl: ASCII
     ro: marked ISO-8859-2 but actually UTF-8
     zh: detected as GB2312 w/ CRLF
     zh_TW: UTF-8 w/ BOM w/ CRLF
2014-02-02 21:05:14 +00:00
zzz
e9b3577eec snark: cache PeerID.toString() 2014-02-02 17:19:06 +00:00
zzz
3622501471 * Streaming:
- Set ports on many packets that were missing them
   - Use connection throttling methods on pings too (ticket #1142)
   - Add methods to set ports on pings
   - Argument checking on ping methods
2014-02-02 16:47:29 +00:00
zzz
b7207fd29f Use getopt lib in SU3File (ticket #1173) 2014-02-02 15:14:00 +00:00
zzz
4dc1241d2f Add lightweight getopt command line parsing lib
(ticket #1173)
This is Java getopt 1.0.14 (released 2012/02/08)
Source was retrieved from https://github.com/arenn/java-getopt
Previous version 1.0.13 (released 2006/08/29)
is available at http://www.urbanophile.com/arenn/hacking/getopt/
Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com),
LGPL v2.
Include the small translation files, add to build.xml and to .tx/config
Fixes:
  Simplified Chinese
    MessagesBundle_chs.properties renamed to MessagesBundle_zh.properties
  Traditional Chinese
    MessagesBundle_cht.properties renamed to MessagesBundle_zh_TW.properties
  Norwegian Bokmaal
    MessagesBundle_no.properties renamed to MessagesBundle_nb.properties
2014-02-02 15:12:44 +00:00
zzz
c59603d31b fix swapped Dutch and Norwegian on /configui 2014-02-02 14:39:41 +00:00
zzz
3ab149a399 streaming javadoc fixes 2014-02-01 12:37:45 +00:00
zzz
99f28519fb * SOCKS: Remove static logs 2014-01-31 18:38:15 +00:00
zzz
05aa88b4e8 * /logs: Fix encoding of wrapper log section (ticket #1193)
- remove a cast in FileUtil
2014-01-31 18:34:27 +00:00
zzz
887f953efb * NetDB: Fix cases where corrupt RouterInfo files were not deleted (ticket #1190) 2014-01-31 18:32:22 +00:00
zzz
5e16c42e4e * InboundMessageDistributor: Set reply flag on LeaseSets 2014-01-30 13:02:16 +00:00
2cea7cdb30 fix 2014-01-29 21:41:52 +00:00
e60da8e8ff Added new https reseed, i2p-netdb.innovatio.no (Sindu) 2014-01-29 19:45:10 +00:00
zzz
be12995753 * Tunnels: Change expl. IB default to 2 + 0-1 2014-01-28 22:50:51 +00:00
zzz
c30419107f * /configclients: Add link to plugins.i2p; don't show delete button for console 2014-01-28 22:48:52 +00:00
zzz
2cacded182 datagram sigtype bugfix 2014-01-28 22:40:36 +00:00
zzz
ec22a1dafc - Only store LS with more than 6 leases to routers that support it 2014-01-28 22:35:33 +00:00
434bf13be9 * I2PSnark: Make 'kitty.png' transparent. 2014-01-28 21:11:39 +00:00
236df32f30 volatiles 2014-01-28 17:42:14 +00:00
zzz
28575dbdae * Key certs:
- Hide setting in i2ptunnel edit pages unless advanced user
  - Only store LS with key certs to routers that support it
2014-01-28 14:21:54 +00:00
zzz
5b9d669d79 * I2CP: Use client tunnels for b32 lookups (ticket #1166)
- convert some calls to use getDestHash()
   - javadocs
2014-01-28 13:27:44 +00:00
zzz
b2f4fde7e5 history for prop, -6 2014-01-27 18:50:44 +00:00
zzz
9eefe1e935 propagate from branch 'i2p.i2p.zzz.i2cp' (head d4ac8162a4ba299ac912640f19076c3c90afdc67)
to branch 'i2p.i2p' (head adc5102c93383e01c74b87f04449dc9c307f6e75)
2014-01-27 16:47:22 +00:00
zzz
b91f041ad7 I2CP:
- Add missing session ID assignments in HostLookup/Reply constructors
2014-01-27 16:38:00 +00:00
zzz
ba96f72899 help tweak 2014-01-27 16:37:39 +00:00
5d322245d8 Ticket #1183 - move message serialization later in the SSU pipeline 2014-01-27 14:47:58 +00:00
zzz
6b16907e40 * i2ptunnel HTTP Proxy: Fix default enable for outproxy plugin 2014-01-27 13:32:24 +00:00
zzz
0c326f989e Remove outproxy hook vestiges in context, history for prop, -3 2014-01-25 18:23:46 +00:00
zzz
e0a499dd0f propagate from branch 'i2p.i2p.zzz.outproxy' (head 02da481346e0bf35b289f00b32f50871da202afb)
to branch 'i2p.i2p' (head eb2820957208e17c76e8c10a2c36e59e0da61895)
2014-01-25 18:16:38 +00:00
zzz
0f862124fe - Tweak display name of HTTP client tunnel
- Show outproxy plugin status on i2ptunnel index page
2014-01-25 17:56:35 +00:00
zzz
d00be4ceee update error pages for HTTPS 2014-01-25 15:52:04 +00:00
zzz
ec8354860e * NetDB: Fix NPE after client shutdown (ticket #1174) 2014-01-25 15:08:56 +00:00
zzz
f9144f2fbf * StatisticsManager: Lower frequency for publishing stats again 2014-01-25 15:07:57 +00:00
zzz
5d2ff5e648 * Installer: Update links
* Update release checklist
2014-01-25 15:06:51 +00:00
zzz
ce475d2cd6 sort imports 2014-01-25 15:05:43 +00:00
zzz
72bd1fe91b * i2psnark: Lower threshold for auto-stop
* Update: All updates via torrent
2014-01-25 14:58:34 +00:00
747d833392 Fix 2014-01-25 00:59:42 +00:00
3427464de6 Move OutNetMessage buffer preparation to the Writer threads
(Ticket #1184)
 Up version to -1
2014-01-25 00:46:30 +00:00
zzz
9ca625a64e - Fix up the header processing for SSL thru HTTP proxy
- Fix the CONNECT line output
- Set use-plugin default to true
- Log tweaks
- rename a variable
2014-01-24 16:52:29 +00:00
9e87fd9b13 Sync fix for NTCPConnection._currentOutbound 2014-01-24 15:35:55 +00:00
zzz
5b6ed48ec0 0.9.10 2014-01-22 01:30:33 +00:00
zzz
96f6865835 bump for review 2014-01-21 00:51:08 +00:00
fa50f9f246 * Adding http(s) uk.reseed.i2p2.no (Meeh)
* Adding http i2p-netdb.innovatio.no (Sindu)
2014-01-21 00:00:27 +00:00
538b4b10d7 Translation updates from Transifex 2014-01-20 17:00:24 +00:00
bdb3e26d07 geoip (v4 and v6) updates 2014-01-20 16:17:32 +00:00
ec87600e80 Chinese language update 2014-01-20 16:13:31 +00:00
zzz
0624f46e67 * Console: Change www.i2p2.i2p links to i2p-projekt.i2p
* Reseed: Remove netdb.i2p2.de
2014-01-20 15:52:14 +00:00
ece1198dd4 Fixed NPE 2014-01-15 02:31:07 +00:00
zzz
8bbab31872 * NetDB: Fix handling of DSM down client tunnels 2014-01-12 19:21:52 +00:00
zzz
8c6922ac5f * NetDB: Fix handling of DSRM down client tunnels
ISJ log tweak
2014-01-12 15:24:13 +00:00
zzz
6b67f399f6 * NetDB:
- Reduce min part tunnels for ffs to 35
   - Use client tunnels for LS lookups from OCMOSJ (ticket #1166)
2014-01-12 01:10:38 +00:00
a9598633b3 Missing file from BOB logging fix 2014-01-11 17:14:09 +00:00
1fb2672b67 BOB: Pass through I2CP host/port (ticket #827) 2014-01-11 04:30:59 +00:00
4308ce6347 Fixed logging for BOB-one.jar 2014-01-11 01:56:47 +00:00
32b095efbd BOB: Implement ClientApp interface (ticket #347) 2014-01-10 21:11:55 +00:00
zzz
eb4bdfcefb add i2pjump 2014-01-10 16:31:39 +00:00
fc6554cabc typo fix (a03adeb0, part 2) 2014-01-10 11:44:37 +00:00
058590f69b Fixed language names in routerconsole 2014-01-10 06:15:17 +00:00
zzz
576984badc I2CP:
- Add SessionID to HostLookup/Reply messages, for future
    use when we have multiple sessions
  - New SessionID constructor w/ value
  - Throw IAE on invalid SessionID values
  - Bump all comments from 0.9.10 to 0.9.11
2014-01-10 02:24:15 +00:00
9825fcf97b update of en source files, bump build 2014-01-09 19:33:54 +00:00
1ed96d72b2 i2prouter translation updates 2014-01-09 19:24:45 +00:00
a29935abb3 New Brazilian Portuguese translation
- New translation from Transifex
- Update langbox widths
2014-01-09 19:24:11 +00:00
e92a5da5a5 tx: update hostname in config, add pt_BR 2014-01-09 19:21:38 +00:00
f08e0299ef Updated translations from Transifex 2014-01-09 19:17:38 +00:00
zzz
9757435b09 NewsFetcher: Delay news fetch on new installs (ticket #1153) 2014-01-09 14:03:49 +00:00
zzz
80fadb4580 Kad: Fix NPE when removing yourself 2014-01-09 12:27:18 +00:00
8658c23974 susimail: Fixed pagination with zero entries (ticket #1168) 2014-01-09 04:31:30 +00:00
0264cc9030 susimail: UTF-8 support from wockenfuss (ticket #508) 2014-01-09 03:34:45 +00:00
bd5b6b32b5 Updated history 2014-01-09 03:33:57 +00:00
dc0a1281bf Migrated overlap fix from Fux (ticket #773) 2014-01-09 03:10:50 +00:00
zzz
c20c697126 RouterAppManager: Allow registration of untracked ClientApps,
required for orchid plugin
2014-01-08 15:17:09 +00:00
zzz
44e7110c9a Fix StandardServerSocket.isClosed() and close()
thx cacapo
ref: http://zzz.i2p/topics/1547
2014-01-08 00:32:51 +00:00
zzz
c860c49c6b Add jisko.i2p to home page
Icon source: http://jisko.i2p/wiki/File:Jisko_console_icon.png
Icon license: Copyleft: This work of art is free; you can redistribute it and/or modify it.
ref: http://zzz.i2p/topics/1539
2014-01-08 00:30:28 +00:00
zzz
b16e66d39a Add GUI outproxy plugin enable setting for all tunnel proxies
(only implemented in HTTP)
More SSL support in I2PTunnelHTTPClient
  - Add separate config for SSL outproxy
2014-01-06 16:56:00 +00:00
3b06f0b83c Change the test url to www.i2p-projekt.i2p 2014-01-06 16:06:20 +00:00
zzz
0bc6c23ac9 Remove outproxy hook in context, use ClientAppManager:
- Add clientAppManager() to I2PAppContext so it can be used there
  - Add routerAppManager() to RouterContext for convenience inside router

Start of SSL support in I2PTunnelHTTPClient
  - Add initialSocketData support back to I2PTunnelOutproxyRunner
  - Works for orchid (and in-net?)
  - TODO Doesn't work for in-net proxy
  - Need separate config for SSL proxy
2014-01-06 13:57:45 +00:00
zzz
17e63b054c add sigtype to i2ptunnel client gui too 2014-01-05 16:38:39 +00:00
zzz
0fae0640d6 missing file 2014-01-05 02:55:46 +00:00
zzz
d054e12952 New interface and context hooks for in-jvm outproxy
Support in HTTP client proxy
All preliminary, maybe better to use ClientAppManager?
2014-01-05 00:52:00 +00:00
dc60c2b478 * Console: Change /configclients 'advanced warning' to include 'toopie, no red 2014-01-04 23:40:41 +00:00
zzz
b59aa1fb69 move I2PSocketOptionsImpl from mini to impl 2014-01-04 22:10:10 +00:00
54a21bfa7b Fix compilation of non-JUnit tests (disabled by default) 2014-01-04 19:57:47 +00:00
50f55877f8 make public method protected 2014-01-04 19:56:55 +00:00
f9ff262318 Fix junit tests for streaming, thank you zab (and thank you zzz) for helping out. 2014-01-04 19:45:52 +00:00
91ba76f2a6 merge of '1fd43bf251a91d33bb1ea9b06f2b35a40be3b9c9'
and '766a92b57cdf82d3b1d1e3a71ef2a3109e883add'
2014-01-04 17:41:15 +00:00
ec97bc2f81 Stab at fixing streaming tests.
Add javadoc package.html
Fix import order
2014-01-04 17:39:32 +00:00
zzz
fba209ca7d restore method used by bote 2014-01-04 17:32:38 +00:00
zzz
b91b242a1a bump 2014-01-04 16:54:12 +00:00
zzz
38186c8f75 TunnelPoolSettings:
Split out the defaults for expl/client IB/OB.
  Client default now 3 hops.
  Expl default still 2 hops, with OB Expl + 0-1,
  en route to 3+0.
2014-01-04 16:48:45 +00:00
zzz
1b3aefbbce PeerManager: Remove small same-country bonus
This was done back when we were desperate for
 build improvement but it's bad for anonymity
 and probably a little slow also
2014-01-04 16:43:54 +00:00
zzz
c03511b971 exception causes 2014-01-04 16:40:06 +00:00
zzz
78e7599a8a better wording 2014-01-04 16:39:10 +00:00
zzz
dc871cf1eb XSS 2014-01-04 16:38:05 +00:00
e98b9d0af5 bump for testing 2014-01-04 14:27:51 +00:00
2a09d5baa6 * Streaming: Move streaming to new package (ticket #1135) 2014-01-04 14:09:33 +00:00
zzz
41e071efe5 * Key cert GUI support:
- Add setting in i2ptunnel server edit page
  - Comment out cert setting on i2ptunnel server edit page
  - Show key type on susidns details page
  - Show key type on LS debug page
2014-01-03 15:31:08 +00:00
zzz
e8e239616f * Crypto: More implementation for key certs
- Support i2cp.destination.sigType option in TunnelController and
    I2PSocketManagerFactory
  - Fixup of Destination.create() and Destination.size()
  - Add generic off/len methods in DSAEngine, needed for streaming
  - Fixup of sign/verify in streaming Packet
  - Javadocs
2014-01-03 00:22:44 +00:00
1feb317f8b typo 2013-12-25 09:39:19 +00:00
09668453d0 * Console: Add 'advanced warning' to /confgiclients
* SOCKS5Server: Remove redundant, commented out line from my previous findbugs
2013-12-25 09:37:46 +00:00
zzz
5842e25205 Initial support for key certificates and arbitrary types and lengths
of signing keys and signatures in RouterIdentities and Destinations.
Untested, not even for regressions, except with command line
using PrivateKeyFile.
Based on preliminary spec at http://zzz.i2p/topics/1442?page=1#p7524
Not done:
 - Transport handshake signing
 - Configuration of default type
 - Specification of type in options to I2PSocketManagerFactory
 - Specification of type in i2ptunnel
 - Fix up caching of SigningPublicKey and P256 key cert
 - Any non-default crypto type in the key cert
 - Documentation
2013-12-24 16:41:05 +00:00
zzz
5219791673 I2CP:
- Add support for b64 conversion in destLookup()
  - Catch invalid message length sooner
I2Ping:
  - Extend I2PTunnelClientBase so non-shared-client,
    I2CP options, and other features will work
  - Fixes for fields and threading
Streaming:
  - Send LS with ping (broken since 0.9.2)
  - Set the NO_ACK flag on pings and pongs
2013-12-21 18:10:59 +00:00
zzz
bf485d8bce history update and date fixes 2013-12-21 18:01:04 +00:00
zzz
cc97a19d3c I2CP:
- Add support for hostname lookups over I2CP with new
    HostLookup and HostReply messages.
  - Move username / password from CreateSession
    to GetDate for early authentication;
    this is an incompatible chage.
    Outside router context with authentication enabled,
    new clients will not work with old routers.
    Early authentication is not yet enforced, enable with
    i2cp.strictAuth=true. Will change default to true in a later release.
  - Block all actions before authentication.
  - Better disconnect messages to clients for diagnostics
  - Improve lookup command, add auth command in i2ptunnel CLI for testing
  - Don't start ClientWriterRunner thread in constructor
  - Don't flush in ClientWriterRunner unless necessary
  - Send GetDate even in SimpleSession outside of RouterContext
  - Improve SetDate wait logic to reduce locks and break out when
    Disconnect received
  - Add Disconnect handler to SimpleSession
  - I2Ping cleanups
  - Javadocs
2013-12-21 00:21:48 +00:00
zzz
38c02b44b9 Streaming: final, volatile, logging 2013-12-19 12:24:51 +00:00
zzz
04a596899a NetDB: Fixes for ExpireRoutersJob
- Don't expire if too few routers
  - Don't expire if net is disconnected
  - Don't run in VMCommSystem
2013-12-19 12:23:29 +00:00
zzz
ee1ed1bb82 Nice message during graceful shutdown
May need to tweak the wording
2013-12-19 12:20:32 +00:00
zzz
2b39d28e99 fix comment 2013-12-19 12:16:39 +00:00
zzz
8cb503d8bb EepGet: Allow override of the User-Agent
i2psnark: Set User-Agent
2013-12-15 15:16:54 +00:00
zzz
efff25a87c NetDB:
- Just before midnight, flood to new location too so lookups
   don't fail after keyspace rotation (ticket #510)
 - Refactor RoutingKeyGenerator and UpdateRoutingKeyModifierJob
   in support of the above
 - Display next key on LS debug page
2013-12-14 14:38:00 +00:00
zzz
6e2583ad92 NetDB:
- Increase new kad size to K=24, B=4
 - Fix router count by counting in the data store, not the kbuckets
 - Randomize the order we load router infos at startup so we
   don't bias the kbuckets
2013-12-13 17:50:39 +00:00
zzz
af84bcf945 i2ptunnel:
- Show destination for persistent client key only if available;
   show b32 for the key as well
2013-12-13 17:45:35 +00:00
zzz
3dc429415b use advanced setting to show LS debug 2013-12-13 17:31:13 +00:00
zzz
ec9dd25631 sort i2ptunnel CLI help for sanity 2013-12-13 17:30:18 +00:00
zzz
2bda87d5a7 comment out main 2013-12-13 17:29:43 +00:00
a7a816e0a7 wrapper: 3.5.23 updates for win64 2013-12-10 23:23:06 +00:00
zzz
3d9d722cee history for props, -1 2013-12-10 11:39:45 +00:00
zzz
289a8e7b40 merge of '3f93d2c09c89b5c68487c33fd700ef7c2feeeb61'
and 'b2c58f8462ab5c08682b711436c387b421bdd0c2'
2013-12-10 11:11:08 +00:00
7d3aa33c25 Fixed type argument problem causing infinite recursion 2013-12-10 05:55:19 +00:00
zzz
0db1314595 propagate from branch 'i2p.i2p.zzz.netdbkad' (head bc7310e940f01e68bd6be0ed0681eb624dada332)
to branch 'i2p.i2p' (head 98569f30891693e6888913f50b88d1f37969fe45)
2013-12-10 02:31:08 +00:00
zzz
68641626aa propagate from branch 'i2p.i2p.zzz.test2' (head ec8e362ce8b93280b518c599a3cc075b89085d2b)
to branch 'i2p.i2p' (head c9b1eef91f61f4482ad11c4f2b2d01be67a17ad2)
2013-12-10 02:26:32 +00:00
zzz
5b9fb403c9 Jetty 7.6.14.v20131031 2013-12-10 02:26:00 +00:00
a4114b96fd Deprecation warning fixes 2013-12-09 20:45:11 +00:00
de184ed139 propagate from branch 'i2p.i2p.str4d.cleanup' (head 736423cc308e964bab55068e625f8a1852932ec5)
to branch 'i2p.i2p' (head 0ac335d5dc4ccaeb113af4fb5c0e993a6f42fdbe)
2013-12-09 19:51:39 +00:00
zzz
04c342ec6a PrivateKeyFile: Fix ISE (ticket #1145)
broken in 0.9.9
2013-12-09 16:38:00 +00:00
zzz
27ce28027d i2ptunnel: Disable streaming pings for clients (ticket #1142)
i2psnark: Disable streaming pings (ticket #1142)
2013-12-09 16:11:53 +00:00
zzz
f8a54bde19 0.9.9 2013-12-07 15:30:29 +00:00
zzz
3acfdbe8f7 i2ptunnel IRC client: Do not filter server PING or client PONG (ticket #1141) 2013-12-06 15:26:12 +00:00
zzz
d9fed57c89 more finals 2013-12-05 16:25:16 +00:00
zzz
46e7e9be82 finals 2013-12-05 16:21:36 +00:00
zzz
d87d4eb232 I2CP: Disconnect client on attempt to publish invalid leaseset 2013-12-05 16:14:51 +00:00
zzz
88ea451f81 propagate from branch 'i2p.i2p' (head 2634e424f06e58231c47f1ec318e9ae21c94a8b3)
to branch 'i2p.i2p.zzz.test2' (head 68ca880caf69a06c0fd01fc70675df795aef1de2)
2013-12-05 16:07:32 +00:00
822ec4aa53 Debian: patch refresh 2013-12-04 18:46:28 +00:00
zzz
7b0b07933f finals 2013-12-04 14:21:03 +00:00
zzz
7fe8573df4 i2psnark ConnectionAcceptor:
- Fix ConnectionAcceptor not restarting after tunnel
    restart, preventing incoming connections
  - locking tweaks
  - cleaner reschedule tweaks
  - don't store server socket locally
  - constructor tweaks / finals
  - Stop acceptor when tunnel disconnects
  - javadocs
2013-12-04 14:17:38 +00:00
c180292358 Style fix: leave brackets around for() one-liners 2013-12-04 03:51:02 +00:00
a3fa48dcbe Removed dead code 2013-12-04 03:50:26 +00:00
zzz
445e4301d5 bump for review 2013-12-01 21:27:43 +00:00
736da22bba update geoip from maxmind's 2013-11-05 db 2013-12-01 20:15:32 +00:00
f29c64cd70 merge of '37bb29ce149260c55fb90ec8e56262262382fd9d'
and 'c4f7358a50c9982c5d63e9e5201f4e3f9562422f'
2013-12-01 20:13:49 +00:00
aa4b4b9d2b French, Italian, Romanian, Spanish, and Swedish translation updates 2013-12-01 20:09:16 +00:00
1112fc8544 Yes it's deprecated, it should still use proper generics 2013-11-30 12:52:50 +00:00
9b361ac445 Fixed history. Last commit was actually blocking "X-Powered-By". Oops. 2013-11-28 21:12:35 +00:00
0ff423fc57 I2PTunnel: Don't send 'X-Forwarded-For' on HTTP server tunnels for anonymity reasons (reported by 'trixie' on IRC). 2013-11-28 21:03:19 +00:00
efe3bd2c05 Use for each when Iterator not needed 2013-11-28 11:56:54 +00:00
f112baac48 propagate from branch 'i2p.i2p' (head cbfe85d22c4d0b05c901db3fa751b57889d9b2d6)
to branch 'i2p.i2p.str4d.cleanup' (head 94fe1764f50b459da18222434034ad46d604c7a1)
2013-11-28 11:12:41 +00:00
707f616498 Changes from -rc diff review 2013-11-28 11:10:57 +00:00
ed2feb3ff7 Core: findbugs 2013-11-27 23:22:49 +00:00
a17b1b99c0 Moved StatLogSplitter to i2p.scripts/java-utils 2013-11-27 22:48:46 +00:00
27bc32f2f3 Core: findbugs exclusions (for use in Eclipse or Jenkins) 2013-11-27 11:17:17 +00:00
b535054e13 generics 2013-11-27 11:14:16 +00:00
97a9a6090a Use copy constructor instead of clone() 2013-11-27 01:55:29 +00:00
8b8e2c88c1 type argument 2013-11-27 01:55:14 +00:00
9d7ee30c15 More cleanups 2013-11-27 01:42:34 +00:00
4ee144533a Another warning suppression to be removed at Java6 2013-11-27 01:25:20 +00:00
0f2a983bb7 i2psnark: type arguments, warning suppression (to be removed at Java6) 2013-11-27 01:11:48 +00:00
8fd2f9090e propagate from branch 'i2p.i2p' (head 7903431c2a396fceb1e0428b2be3dde03ba24635)
to branch 'i2p.i2p.str4d.cleanup' (head cfbae7380c3fa106f578d5de399701cfb72d5747)
2013-11-27 00:57:19 +00:00
8770d7eae0 i2psnark: Comparable type arguments 2013-11-26 21:09:36 +00:00
c59ef24acf i2psnark: more type arguments 2013-11-26 20:16:45 +00:00
85aa2fb083 i2psnark: MetaInfo type arguments (thx zzz) 2013-11-26 19:54:53 +00:00
zzz
434b9fa0d1 GeoIP: Thread the periodic lookup so it doesn't clog the timer queue 2013-11-26 16:28:24 +00:00
zzz
56116ad8c2 PeerManager: Thread the periodic reorg so it doesn't clog the timer queue 2013-11-26 15:51:00 +00:00
zzz
c0ef19a281 i2psnark: Fix mixed public/private tracker detection
(thx str4d)
2013-11-26 03:07:21 +00:00
9804e5b7d9 i2psnark: more type arguments 2013-11-26 01:34:08 +00:00
2f33186e58 i2psnark: type arguments, unused imports, for each 2013-11-26 00:20:03 +00:00
0347c56c96 Deprecation fixes 2013-11-25 23:29:48 +00:00
e77409e57a Close resources 2013-11-25 23:14:09 +00:00
615ba94559 propagate from branch 'i2p.i2p' (head d12a1fd746cd9314de5de5e1000c02cf4c59100d)
to branch 'i2p.i2p.str4d.cleanup' (head e20c143dd50a9c802999068a95e12198b07e4c36)
2013-11-25 22:36:27 +00:00
ce0596d5b1 Reseed: Listen to "Require SSL" config option 2013-11-25 21:11:56 +00:00
35b6926e4f Ticket #1047 : Do not adjust window on receiving dups. 2013-11-25 19:21:27 +00:00
zzz
76925fa3bd console: add debug link if advanced config is set 2013-11-25 15:59:34 +00:00
zzz
dbdf36d85c Update: Increase torrent from 30% to 60% 2013-11-25 15:34:49 +00:00
zzz
60aa8c57a4 I2PTunnel: Fix a shared client configured with i2cp.newDestOnResume
not restarting correctly, caused by previous checkin
2013-11-24 23:42:53 +00:00
zzz
001070f677 fix setting of BC_AVAILABLE thx str4d 2013-11-24 23:42:13 +00:00
c6f2d4948b Class generics 2013-11-24 23:41:06 +00:00
zzz
8699c82614 Kad unit tests:
- Port KBSTest from i2p.zzz.kademlia branch
  - Fix RandomTrimmer so it always returns true, so it may be used
    as the trimmer in the unit tests
2013-11-24 23:39:47 +00:00
zzz
1d7eedd463 Kad unit tests:
- Move KBucketSetTest to new directory
  - Fix testSelf() as new implementation will never include myself
  - Delete KBucketImplTest, not applicable/useful now
  Next todo: port KBSTest from i2p.zzz.kademlia branch
2013-11-24 21:58:42 +00:00
zzz
796a231f54 NetDB:
- Move net.i2p.kademlia package from i2psnark to core, and convert
    netdb to use it.
  - Delete old implementation in netdb
  - Fixups in netdb for generics
  - Add debug output to /debug

  This is the next step in the development plan, in which we previously:
    - Copied the code from netdb to the i2p.zzz.kademlia branch, fixed it,
      and made it generic for hash size (June 2012);
    - Moved it from the i2p.zzz.kademlia branch to the i2p.i2p.zzz.dhtsnark
      branch, and implemented KRPC with it (June 2012);
    - Propped it from i2p.i2p.zzz.dhtsnark to trunk for 0.9.2 (July-Sept. 2012);
    - Proved it out in 0.9.2 - 0.9.9 (Oct. 2012 - Nov. 2013)

  The plan was to maintain the KBucketSet public methods throughout the development
  so we could drop the new version back into netdb, so here we drop it in.

  Setting of K=16, B=3 is just an initial guess, to be reviewed.
  This moves about 18 KB from i2psnark.jar to i2p.jar and removes about 12 KB from router.jar.
  Unit test fixup: todo.
2013-11-24 16:38:51 +00:00
e1fcad686c propagate from branch 'i2p.i2p' (head 72c44737466e553fec443a79fffa7636894fe383)
to branch 'i2p.i2p.str4d.cleanup' (head 5a2425d7523b732840e55039f88cea5699f1aa83)
2013-11-24 01:20:11 +00:00
zzz
ffa03f2b83 IterativeSearchJob:
- Recheck completion status just before sending out a wrapped message
 - log tweaks
2013-11-23 17:56:40 +00:00
zzz
54fb91ba8e I2PTunnel: Call destroySocketManager() when replacing
a client socket manager configured with i2cp.newDestOnResume,
  or a shared client.
  This prevents lots of orphaned StreamingTimer threads.
  There are still cases where these threads may stick around,
  when a tunnel is stopped but not restarted. We don't know in
  some cases when a tunnel could be restarted and when it can't.
  destroySocketManager() should always be called when discarding a
  SocketManager but i2ptunnel doesn't do that now. More to do,
  but this fixes the most common case of leaked threads.
  Related tickets: ##642 #961
2013-11-23 17:54:01 +00:00
zzz
e498e2113f Snark: make a set of the default trackers so the config array
can be private and the lookup for the form is more efficient.
2013-11-23 14:45:38 +00:00
zzz
f42ac71fe0 UDP PeerState findbugs volatile/atomic/synch 2013-11-23 14:37:33 +00:00
zzz
74f2fd06cc Deprecate Signature.FAKE_SIGNATURE 2013-11-23 14:33:58 +00:00
zzz
143a0dfc47 Transport: Reduce target connections from 60% to 45% of limit.
This will improve network capacity.
   Apparent problems with lower limits were actually due to
   unrelated bugs that were fixed by 0.9.8.1-22.
   This can go lower still; I've been testing 33% without issues.
2013-11-23 14:29:23 +00:00
fdb0097934 Temporarily moved old help.jsp translations back 2013-11-23 11:44:07 +00:00
0dde4162e6 susimail: Fix NPE when deleting last message (ticket #414) 2013-11-23 04:24:30 +00:00
zzz
844bae18ba fixup after prop 2013-11-22 22:19:06 +00:00
zzz
9e4d5c0e61 propagate from branch 'i2p.i2p' (head da40262a8b7685de3877c1d7d6d16a155caa9e7c)
to branch 'i2p.i2p.zzz.test2' (head 6263bb149b8301059d0471bcc1d47caeca660f4e)
2013-11-22 17:29:45 +00:00
zzz
9b8d3eb688 Startup:
Wait a while and recheck if a recent ping file is there,
    so that a crashed router doesn't prevent a restart (ticket #633)
2013-11-22 17:27:49 +00:00
8478bfbddc BOB: for each 2013-11-22 11:46:39 +00:00
d6bb5f6a4d i2ptunnel: type arguments 2013-11-22 11:41:12 +00:00
e9fec9354b ministreaming: type arguments 2013-11-22 11:37:44 +00:00
f9f0e6d0a2 SAM: for each 2013-11-22 11:36:26 +00:00
3bc0be1cbe susidns: type arguments, for each 2013-11-22 11:25:22 +00:00
8d826cee93 susimail:
- Generics in Folder
- for each
- type arguments
2013-11-22 11:18:41 +00:00
e853d9a40b Router: more type arguments, for each 2013-11-22 10:16:34 +00:00
15bf94b479 Core: type arguments 2013-11-22 09:34:42 +00:00
6314f33d8f desktopgui: unused imports 2013-11-22 04:25:48 +00:00
5fa0376f58 SAM: type arguments, unused imports 2013-11-22 04:22:14 +00:00
552dd189a5 streaming: type arguments, unused imports 2013-11-22 04:18:26 +00:00
57144f3e6a Added Eclipse projects for SAM and streaming 2013-11-22 03:58:02 +00:00
zzz
0454639db8 bump -30-rc 2013-11-21 23:02:21 +00:00
c32b451733 i2psnark: type arguments, unused imports 2013-11-21 12:43:45 +00:00
2f4765665d routerconsole: type arguments, unused imports 2013-11-21 11:31:50 +00:00
bff79cdae8 susimail: type arguments 2013-11-21 10:49:15 +00:00
4bddf8ae0b susidns: type arguments, unused imports 2013-11-21 10:17:35 +00:00
ae79deff39 net.i2p.jetty.*: type arguments, unused imports 2013-11-21 10:13:34 +00:00
e3aeb267f8 Eclipse classpath consolidation 2013-11-21 09:38:09 +00:00
c5c26c440d Eclipse Ant builders for core, router and jettylib 2013-11-21 09:11:42 +00:00
77971624b4 Created Eclipse project for installer/resources
Reverts a change in 7fe82070
This project can be added to the classpath of a JUnit runner
2013-11-21 08:54:42 +00:00
f5621c5082 Converted lib Eclipse project to standard folder 2013-11-21 08:52:04 +00:00
3fa7fe9733 Updated routerconsole Eclipse classpath 2013-11-21 08:40:05 +00:00
c97d07e10a org.cybergarage.*: more type arguments 2013-11-21 06:08:41 +00:00
567c328331 org.cybergarage.*: type arguments, unused imports 2013-11-21 05:58:54 +00:00
3aa982529e org.xlattice.crypto.*: type arguments 2013-11-21 05:56:14 +00:00
0c07f9ff96 More type arguments in UDPTransport 2013-11-21 05:23:35 +00:00
f0055ccbfe Made type argument for Transport.getClockSkews() consistent 2013-11-21 02:27:53 +00:00
693cc828c2 Type arguments in OutNetMessage 2013-11-21 02:27:03 +00:00
688dd23111 gnu.crypto.prng.*: type arguments 2013-11-21 02:18:59 +00:00
e38db5eb44 i2ptunnel: type arguments, unused imports 2013-11-20 23:36:39 +00:00
817f531619 merge of '743aa294fa15c3243bb6ad56d4de64f5eff15051'
and '85fa37bf6c3090c0d4c10f4b7b2d679549090c37'
2013-11-20 23:15:31 +00:00
53623da2eb addressbook: type arguments, unused imports 2013-11-20 23:14:40 +00:00
4910266d9b merge of '63ea1d70b3fd3886a050d7b196cd7ae261844164'
and '6a57f7039fe5697b9770d642ac1d4653e4b9878c'
2013-11-20 23:10:52 +00:00
24ae66df6d Core JUnit tests: type arguments, unused imports 2013-11-20 23:06:17 +00:00
228bd980db Router JUnit tests: type arguments, unused imports 2013-11-20 22:47:14 +00:00
f161a2dfc9 BOB: NamedDB accesses are synchronized, correct findbugs fix is to remove volatile 2013-11-20 22:12:44 +00:00
abe1dc676e Dead code, type arguments 2013-11-20 22:05:37 +00:00
zzz
9de57a5d5a log tweak; bump -29-rc 2013-11-20 21:16:13 +00:00
2cc742c3ed Fixed stupid pasting bug 2013-11-20 19:54:10 +00:00
5bcfe025d5 fix build 2013-11-20 15:40:21 +00:00
6dc6ca7713 avoid <? extends Object> generics 2013-11-20 15:11:35 +00:00
eabcc96a99 remove useless string 2013-11-20 14:52:44 +00:00
28b6675979 findbugs BOB/SAM. more to do. 2013-11-20 12:02:44 +00:00
413ad6b0e6 BOB findbugs 2013-11-20 09:56:57 +00:00
a7a7e96188 Findbugs in imported core code 2013-11-20 09:15:12 +00:00
796dbc5d2e Fixed bug hidden by Set<RouterInfo> -> Set -> Set<Hash> unchecked conversion 2013-11-20 04:18:15 +00:00
c86845078c Reverted change in net.i2p.router.Router 2013-11-20 04:06:59 +00:00
89dcceefee Core: type arguments, unused imports 2013-11-20 04:02:28 +00:00
bacce17990 Router: type arguments, unused imports 2013-11-20 02:46:24 +00:00
e61e950713 update patch / update debian changelog 2013-11-20 00:50:39 +00:00
244209d3b7 Translation updates, addition of Japanese language
-28
2013-11-19 23:59:46 +00:00
zzz
dbe0a8240e Translations:
- Add support for country variants (ticket #1133)
  - Refactor data in ConfigUIHelper
Config files: Allow empty values
2013-11-18 23:18:46 +00:00
zzz
7e3e08532f more static atomics 2013-11-17 15:03:10 +00:00
zzz
1d4190734d Findbugs all over
- volatile -> atomic
 - unused code and fields
 - closing streams
 - hashCode / equals
 - known non-null
 - Number.valueOf
 - new String
 Still avoiding SAM, BOB, SusiMail
2013-11-16 13:22:05 +00:00
zzz
96cf1d60c2 * Jetty: Fix eepsite and webapp cache control directives.
Eepsite fix for new installs only.
  Fix i2psnark BasicServlet javadoc about param prefix.
  (ticket #1128)
2013-11-15 18:51:14 +00:00
3aa33378c1 i2prouter: s/3\.5\.20/3.5.22/g 2013-11-15 01:02:37 +00:00
747bd0c5a3 Update Java Service Wrapper to v3.5.22
- Windows: Self-compiled with VS2010 in Windows 7. The icon has been
  changed from Tanuki's default to Itoopie.
- Linux ARMv6: Compiled on a RaspberryPi using gcc 4.6.3-14+rpi1,
  Icedtea6 6b27-1.12.5-1+rpi1 and stripped
- All other binaries are from the "community edition" deltapack offered by
  Tanuki.
2013-11-15 01:01:49 +00:00
zzz
ea7b42810f * InboundMessageDistributor:
- Put garlicked DSM messages in the InNetMessagePool instead of handling directly,
     so the IterativeSearchJob will see the response and declare success.
     Only affected LS lookups as we do not request encrypted replies for RI lookups.
     Similar to the fix for verifies 6dc5bed94321ae2b290cfe351511d18465e08f91
     This bug was causing initial lookups to fail but subsequent ones to succeed.
     Broken since 0.9.7 when encrypted replies was introduced.
     Ticket #1125
2013-11-14 17:39:31 +00:00
zzz
19022baa27 log tweaks, final 2013-11-14 17:36:57 +00:00
e8248f5005 volatile 2013-11-14 15:18:46 +00:00
f8178b7165 ticket #1125: revert previous change as it is not relevant
to test failure
2013-11-13 11:43:24 +00:00
79b5d9748d patch refresh 2013-11-13 01:03:19 +00:00
zzz
b53ed94e8f Findbugs:
- Fix several 'increment of volatile is not atomic' all over
    Remaining: UDP PeerState.java, to be checked in separately
  - Comment out all of unused MessageStateMonitor
2013-11-12 19:28:23 +00:00
zzz
df84a2fcd0 save server status text to return to user 2013-11-12 19:19:21 +00:00
25e7dea370 merge of '4f6d64a50c7c5c27682914984831fc581724659d'
and 'e5def490e4eba793ca0d2bcb739771dcdf8c0242'
2013-11-11 23:49:02 +00:00
90919ebf6b Make ObjectCounter Serializable 2013-11-11 23:48:15 +00:00
zzz
76078deb3f handle numeric private value in metainfo 2013-11-11 23:24:14 +00:00
1b95a03d2e merge of '3a7591d75dacb165b1b1d26c6bdd94184076fb03'
and 'ba02b6daf2d660339ff05cfe0479344391e6e34f'
2013-11-10 23:27:39 +00:00
108039de08 partial revert of 6df9f4e154d148867ee158cbe9e9acf3fb73d680 2013-11-10 23:00:57 +00:00
addd2e6d6a merge of '3f85581f65aedde0f96729d197aaab223174f2e4'
and '6df9f4e154d148867ee158cbe9e9acf3fb73d680'
2013-11-10 22:22:10 +00:00
5c38d5a6c9 Findbugs: More findbugs fixes. Including but not limited to: null check fixes and some synchronization 2013-11-10 22:20:13 +00:00
zzz
69489dd19e use DataHelper.skip() in a few more places 2013-11-10 22:20:06 +00:00
zzz
3fce0e8e45 xlattice findbugs 2013-11-10 22:19:45 +00:00
35fb332c2c moar test cases 2013-11-10 21:13:42 +00:00
zzz
1b5309be05 junit test for new DataHelper.skip() 2013-11-10 20:42:24 +00:00
zzz
d2a1025b3f about 20 findbugs fixes all over 2013-11-10 20:07:46 +00:00
0a8f79f0e3 Findbugs: A stab at squashing some issues across the board. Probably more to follow. 2013-11-10 19:04:57 +00:00
zzz
18e4c2ac63 log tweak 2013-11-10 15:34:44 +00:00
zzz
90c2e08489 Streaming:
- Fix uncaught exception when log level = WARN, broken in -23
2013-11-10 15:32:54 +00:00
zzz
598ef67c4e Tunnel fragments:
- more checks, don't allow fragment #0 in follow-on fragment
  - Set message ID in constructor
2013-11-10 15:27:28 +00:00
zzz
1b9d870b91 i2psnark: Don't announce more than torrent size as downloaded amount 2013-11-10 15:20:07 +00:00
zzz
68f67b7c8e UPnP:
(ticket #1123)
 - Add new config i2np.upnp.ignore to specify UDNs of ignored devices
 - Add display of ignored devices on /peers
2013-11-10 15:17:42 +00:00
d2f0c251c0 use four digit umask in wrapper.config
According to http://wrapper.tanukisoftware.com/doc/english/prop-umask.html the
umask is a four digit number.
2013-11-09 16:19:33 +00:00
zzz
2b2f34b3f1 A better killyourtv.i2p icon
New icon from FatCow, licensed as specified in our docs.
   ref: http://zzz.i2p/topics/1492
2013-11-08 18:28:35 +00:00
zzz
4e680479da Home page: replace all default eepsite icons.
New icons from FatCow, licensed as specified in our docs.
   ref: http://zzz.i2p/topics/1492
2013-11-08 15:26:32 +00:00
zzz
d1b93e0705 DeliveryInstructions:
- Comment out unused encryption fields to save space
  - New static immutable LOCAL instruction to reduce object churn
2013-11-08 14:39:43 +00:00
zzz
4382def62f log tweak 2013-11-08 14:35:28 +00:00
zzz
952a56c537 JobQueue: Log a warning if a job is scheduled too far in the future,
to catch bugs like the one in -7 where requeue() is called
          with an absolute time instead of a delay
2013-11-08 14:34:33 +00:00
zzz
67aead214b Tunnel Endpoints:
- Reject type 3 (undefined) delivery instructions at both OBEP and IBEP,
     would be treated as LOCAL
   - Reject type 0 (LOCAL) delivery instructions at OBEP, no current usage,
     would cause NPE if handled
2013-11-08 14:31:14 +00:00
zzz
50f45a50a7 minor optimization 2013-11-08 14:24:06 +00:00
6b326c3705 merge of '15e16e2fd4c5be75a63b28616b413a8d1e13e1d6'
and '2449ac4142097e34b7ad4c4c4cb16c163a786a16'
2013-11-07 20:39:59 +00:00
919ec3af01 work on failing JUnit test 2013-11-07 20:38:52 +00:00
ca5a301a4f i2prouter: create i2p.dir.config with umask from wrapper.config 2013-11-07 19:56:01 +00:00
zzz
ae76a6ee1a findbugs correctness fixes, all over the place 2013-11-07 19:20:25 +00:00
zzz
5cbecb3599 log IP change in event log 2013-11-07 13:13:21 +00:00
zzz
5a34e1de4f * NetDB: Fix RI publish interval, broken in -7 2013-11-07 12:31:46 +00:00
zzz
c810694e07 * i2psnark: Fix file links, broken in -12 (ticket #1114) 2013-11-07 12:29:05 +00:00
zzz
ca866d48e6 * Logging: Track duplicates across flush interval (ticket #1110) 2013-11-07 12:23:37 +00:00
f1e77499e2 allow webapps.config to be 'preseeded' with values 2013-11-04 22:05:22 +00:00
zzz
9007db1485 Expire wasUnreachable entries, so inbound tunnel build failures don't escalate
and the peer doesn't have a severe penalty in the CapacityCalculator forever.
This may fix the tunnel build problems that started in -10. Or not.
2013-11-03 15:26:21 +00:00
zzz
85c998e500 HTTP proxy: Fix addressbook name on redirect page 2013-11-03 15:04:37 +00:00
zzz
8296f8229e + * NetDB: Allow store of leaseset as long as one lease has not expired 2013-11-03 15:01:31 +00:00
zzz
059ae3a80e - Add network status to event log 2013-11-03 15:00:00 +00:00
67e242c441 Debian patch refresh and readme file update 2013-11-02 17:31:31 +00:00
zzz
e23f3b4875 comments 2013-11-02 14:10:06 +00:00
zzz
06ea9af733 i2psnark: Log name of offending file causing IOException (ticket #1099) 2013-11-02 14:09:00 +00:00
zzz
884818f518 log tweaks, generics 2013-11-02 13:58:12 +00:00
zzz
3f39bd0f7b remove unused static log 2013-11-02 13:53:42 +00:00
48cce6435b routerconsole war dies with .jsp files in a subdir 2013-11-01 11:00:37 +00:00
zzz
777e08c8b6 * Transport: Fix GeoIPv6 (ticket #1096)
due to int/long problem, they were being corrupted
   and then looked up as IPv4
2013-11-01 01:44:29 +00:00
zzz
8c4b0b7c00 merge of '0af9bde8ae97c3b08f2c934236532121ce135817'
and 'b324a96172089b549e53fb1c0c2a01807fe64699'
2013-10-31 21:30:02 +00:00
zzz
dae8b25374 Transports:
- Increase threshold for idle timeout reduction from 33% to 60%.
   This was reduced from 75% to 33% in -10 and it caused significant
   tunnel build problems, for reasons that aren't entirely clear.
 - Don't change the SSU idle timeout quicker when firewalled.
 - log tweaks
2013-10-31 21:27:26 +00:00
2ae293444e Split routerconsole help into several files (no frontend change)
The old full-page translations of help.jsp are deprecated. The help text will
be tagged for translation on Transifex.
2013-10-31 21:22:24 +00:00
zzz
0f11d3566a log tweaks 2013-10-31 21:15:09 +00:00
zzz
fa70d439c3 minor optimization 2013-10-31 21:08:02 +00:00
zzz
0010581405 TunnelPoolSettings:
- Make dest hash final
 - Ensure allowZeroHop is always true for exploratory
2013-10-31 21:07:11 +00:00
zzz
1d659e4f8a i2psnark: Always verify file lengths at startup (ticket #1099) 2013-10-31 21:02:59 +00:00
509f00c5e2 Override toString() 2013-10-30 18:09:40 +00:00
aeb3241abb * i2psnark: Start torrents by default (ticket #1072) 2013-10-29 23:05:50 +00:00
zzz
8909df3c88 * i2psnark: Fix start and start-all buttons on text-mode browsers
and Opera (ticket #1093)
2013-10-29 21:49:20 +00:00
zzz
1cffcae36b merge of '2c288e0ac5d4a6039b3f08e6bbae9439bb038955'
and 'fa8975b2dbcb60d5f181bc21fc1245d5f82baef0'
2013-10-29 21:04:40 +00:00
zzz
d2ee5b96ad Log tweaks and minor cleanups, -15 2013-10-29 21:03:20 +00:00
zzz
0506a5915b * Tunnels:
- Build a new exploratory fallback tunnel in the BuildExecutor
     loop if we run out.
   - Don't use closest expl. tunnel as the paired tunnel for a build,
     use a random one instead (partially back out change from -12)
   - Log tweaks
2013-10-29 21:01:53 +00:00
zzz
91ef3fd0bc * InboundMessageDistributor:
- Don't discard an encrypted DSRM received
     down a tunnel, just strip the hashes like we do for unencrypted
   - Send a store of our own encrypted LS received down a tunnel to
     the InNetMessagePool so the FloodfillVerifyStoreJob will see it.
 * NetDB: Fix LS store verifies with encrypted replies
   by storing the tagset with the correct SKM for the inbound tunnel used.
   Broken since 0.9.7 when it was introduced.
2013-10-29 20:57:00 +00:00
79f5484f87 Fix history. 2013-10-29 20:38:32 +00:00
6afd2c4b97 * Adding no.i2p registrar 2013-10-29 00:05:06 +00:00
zzz
06b09f89de add SU3File bulksign CLI 2013-10-28 23:22:17 +00:00
zzz
bd0eee6aa9 * configstats: Page will now always reflect results of a previous
change, by querying the config instead of StatSummarizer to
   determine if a stat is graphed.
  - Don't append to a string in a loop
  - parseConfig() return a Set instead of List to avoid O(n**2) behavior
    when deteriming config changes
2013-10-28 21:48:02 +00:00
5bc13c16dc merge of '40e39576b76cc1261e0eda2c63a052544021f2e3' and '81c0ce21efaae02bbc2b5d3ce4e25b2d315dc2eb' 2013-10-28 20:09:57 +00:00
626daeb86e * I2PTunnel: Enable persistent keying for SOCKS tunnels (ticket #1088) 2013-10-28 19:15:46 +00:00
zzz
a92913da4c * Streaming:
- Ensure minimum randomized initial conn throttle period
   - Change order of throttle checks again
   - Don't continue throttle checks if throttled
2013-10-28 17:59:50 +00:00
zzz
f0f363e8c3 * Streaming: Fix instantiation failure with blacklist entries,
caused by bad fix for ticket #1070
2013-10-27 17:09:29 +00:00
zzz
7839c0fec3 * Tunnels:
- Don't use fallback expl. tunnels as the paired tunnel
     for a client tunnel build.
     This will cause more client tunnel breakage but it's
     really bad to use a zero-hop for this.
   - Fix selection of an expl. tunnel close to a hash
   - Don't update build generation stat if the generation failed
   - log tweaks
2013-10-26 20:52:56 +00:00
zzz
4d24d65c1f * Profiles: Ensure we select random peers even before the first reorganization -
we were picking the not-failing peers in-order for early expl. tunnel builds
2013-10-26 20:47:41 +00:00
zzz
ddf761b1f8 * Streaming: Randomize end of first conn limit period
to prevent correlation
2013-10-26 20:45:30 +00:00
zzz
2814fe75b1 sort custom options 2013-10-26 20:44:19 +00:00
zzz
7316c82ef3 * i2psnark: Display base name, not torrent file name (ticket #985) 2013-10-26 20:42:16 +00:00
zzz
e04646bd37 finals 2013-10-26 14:21:53 +00:00
zzz
8f8022347d * I2PTunnel HTTPServer:
New POST limiter
2013-10-26 14:21:26 +00:00
acc0ab66a3 My RSA 4096 pubkey for update signing 2013-10-26 11:25:07 +00:00
zzz
5a6acf1d85 * Router: Only log pingfile error once (ticket #1086) 2013-10-25 19:55:09 +00:00
zzz
ca45194c30 * Streaming:
- Check blacklist/whitelist before connection limits, so
     a blacklisted peer does not increment the counters
   - Don't increment total throttle if peer is throttled
   - Fix blacklist NPE after config change (ticket #1070)
2013-10-25 14:09:02 +00:00
zzz
102506ebe8 * Transports: Reduce connection idle time sooner 2013-10-25 14:05:50 +00:00
zzz
d06f1c4a30 /confighome: Remove config when restoring default so user will again see changes from updates 2013-10-24 21:46:03 +00:00
zzz
c732c1c038 I2PTunnel: Catch unchecked exceptions in server accept loop (ticket #1070) 2013-10-24 20:56:37 +00:00
zzz
4aa1bba575 * NetDB:
- We don't verify RI stores any more, so save RI-last-published time when we store it.
2013-10-24 20:54:21 +00:00
zzz
9d3925eb20 * i2psnark:
- Drop incoming connections on HTTP port
   - Define port 6881 in one place
   - Don't let random DHT port be 6881
   - Exception tweak
2013-10-24 20:52:37 +00:00
zzz
80fdf4e917 * I2PTunnel - fix anonymity characterization in dropdowns
(2 hops is not high anonymity)
2013-10-24 19:18:53 +00:00
zzz
35a86e603b * I2PTunnel standard, HTTP, and IRC servers:
Route connections to specific targets based on incoming I2P port
   with custom option targetForPort.xxxx=myserver:yyyy
   This allows multiple services on a single server tunnel (ticket #1066)
2013-10-24 11:38:28 +00:00
zzz
8f7b31aed3 * I2PTunnel standard and IRC clients:
- Allow host:port targets; set defaults in i2ptunnel.config (ticket #1066)
   - Don't fail start if hostname is unresolvable; retry at connect time (ticket #946)
   - Output IRC message on connect fail
   - Update target list on-the-fly when configuration changes
2013-10-23 20:20:54 +00:00
zzz
0f5a0b6b1b * NetDB:
- Increase RI publish interval to reduce the connection load on ffs
   - Save RI-last-published time; check it before publishing
   - Minor cleanups
2013-10-23 14:56:27 +00:00
zzz
4cf3906ed2 * Home page:
- Add salt.i2p. Icon from efkt, free to use.
   - Change icon for stats.i2p. Icon from Fat Cow, see license info in LICENSES.txt
2013-10-23 12:41:36 +00:00
zzz
57875586cf reduce same-country bonus, less countries 2013-10-19 22:10:03 +00:00
zzz
ad8ec011d0 more transport categories 2013-10-19 22:09:23 +00:00
zzz
0d93b86a56 sfv mime type 2013-10-19 22:09:07 +00:00
zzz
63712002e2 merge of '4eee3780cfb882747ad68e39ac08b721f91c48a7'
and 'cca89ae05036ab7a2fe0080fdd1cfac19968246a'
2013-10-19 21:27:59 +00:00
zzz
67af1a17c1 - Don't display UPnP info on peers page in Android
to prevent crash
2013-10-19 21:26:23 +00:00
zzz
9cac546547 add IPv6 categories to /netdb transport chart 2013-10-19 16:37:13 +00:00
zzz
3ffb321f46 * NetDB: Reinstate ExpireRoutersJob 2013-10-19 14:51:11 +00:00
zzz
14ea6d8d0a delay multiple ExploreJobs slightly 2013-10-19 14:47:27 +00:00
zzz
8e0dbf31ba * NetDB (ticket #1076)
- Reduce flood redundancy from 4 to 3
   - Reduce min part. tunnels for ff from 100 to 50
2013-10-19 14:45:52 +00:00
zzz
5187bf1eae * I2PTunnelHTTPServer: Start timer before reading the first line (ticket #1071) 2013-10-19 14:40:34 +00:00
zzz
99471d8e1b css tweak to fix i2ptunnel ssl box layout on firefox 2013-10-19 14:37:28 +00:00
zzz
012e999354 fix unit tests broken by previous checkin 2013-10-18 19:58:39 +00:00
zzz
bdd9900d0d * OutNetMessage: Remove setters, make fields final 2013-10-18 18:42:48 +00:00
zzz
c71b485083 mark ipv6 only as experimental on /confignet 2013-10-18 18:38:39 +00:00
zzz
a78d34ab4b * I2PTunnel SSL cleanup, log SSL exceptions as errors to help find cert problems 2013-10-18 18:37:25 +00:00
zzz
255ebe7efb * Streaming: Throw IOE if socket is closed (ticket #1077),
never return null from stream getters
2013-10-17 13:39:00 +00:00
zzz
5f7a761e42 * I2CP: Move SSL client socket code to util,
move cert location to certificates/i2cp.
 * I2PTunnel: Support SSL for connection to local server
   for Standard, HTTP, and IRC server tunnels.
   Put server cert in certificates/i2ptunnel if necessary.
2013-10-17 13:22:17 +00:00
zzz
09548358fa increase translate initial map size, clear on exit 2013-10-17 11:17:58 +00:00
zzz
df381c37ff 3gp mime type 2013-10-17 11:15:20 +00:00
31e96b416d Update Trac links: s|http://trac\.i2p2\.de|https://trac.i2p2.de|g 2013-10-16 23:12:11 +00:00
53b0f7b579 french updates 2013-10-16 23:11:06 +00:00
zzz
45deaa3a87 * open4you icon and text
from hosting@mail.i2p
   image free to use
2013-10-14 20:06:57 +00:00
zzz
0c8eabcdf6 merge of '2bb222d33ec817b78fcf506c32da44d10b1eff3b'
and '59e86e3176465259a67927b042c1307cd0a94aa4'
2013-10-14 17:10:55 +00:00
zzz
f9571740ae address check cleanup 2013-10-14 17:02:08 +00:00
zzz
eb2af2b5fd * ClientManager: Remove setters, make all fields final 2013-10-14 17:01:32 +00:00
zzz
ded00300b4 javadoc fixes 2013-10-14 17:00:14 +00:00
zzz
811819af69 * Tests:
- Fix LogSettingsTest broken by recent LogManager changes
   - Remove empty LogSettings.java
2013-10-14 16:58:50 +00:00
1804c852bb French language translation updates from Transifex 2013-10-14 15:43:39 +00:00
zzz
3ec602865d * Translations: Move country names to a new resource bundle 2013-10-14 15:29:12 +00:00
zzz
0c0a25b038 merge of 'ad0ab5020bb253c5233ac2f036c0cf4f40001d51'
and 'bc7c0fa32e955a7d8185456815652d4baab500ae'
2013-10-13 19:38:48 +00:00
zzz
208192f445 * I2CP: Fix bug in handling external I2CP clients, introduced in -2
by the immutable destination patch
2013-10-13 19:33:04 +00:00
d0f635e30c ticket #1062 - count duplicate packets towards RTT if we have
never sampled it
2013-10-13 17:05:59 +00:00
zzz
20b2f7dcb1 fix date, restore tunnel length changed in previous checkin 2013-10-13 12:03:57 +00:00
zzz
cf66951818 cleanup after prop, history for prop, -2 2013-10-13 11:55:23 +00:00
zzz
c6f41cc8fa crypto cleanup 2013-10-13 11:53:43 +00:00
zzz
45a579403a propagate from branch 'i2p.i2p.zzz.test2' (head 5c1b78bd78845b0c8b90fbb60412c68e7dc4f3e6)
to branch 'i2p.i2p' (head 8bdc25c8e6f40491f20b533d94eacab012adba35)
2013-10-13 11:48:12 +00:00
zzz
74a57abfb4 Streaming:
- Make I2PSocketFull.close() nonblocking; it will now cause any user-side
     writes blocked in I/O (Connection.packetSendChoke()) to throw
     an exception (tickets #629, #1041)
   - Don't ignore InterruptedExceptions; throw InterruptedIOException
   - Back out static disconnect exception
   - MessageInputStream locking fixes
   - Cleanups
 I2PSnark:
   - Close socket before closing output stream to avoid blocking in
     Peer.disconnect(), and prevent Peer.disconnect() loop
2013-10-12 17:39:49 +00:00
zzz
380783c1ba Snark DHT:
- Combine getPeers and announce into a single method, as we must announce to
     the closest from the getPeers, not the closest from the kbuckets
   - Stop getPeers when nothing closer is found
2013-10-09 21:09:34 +00:00
c8843a736d make _ackSinceCongestion atomic 2013-10-09 14:08:44 +00:00
e69fefda62 cleanup: remove boolean parameter that is always true 2013-10-09 14:06:16 +00:00
513da3b743 cleanup: remove no-op invocation 2013-10-09 14:04:34 +00:00
zzz
7513d42e9e Snark DHT:
- Increase dest lookup and search timeouts
   - Increase max search depth
   - Loop tracker client faster when in magnet mode
   - Loop tracker client faster if DHT announce fails
   - Don't return an empty peers list if we only know about the requestor
   - volatiles, log tweaks
   - Major fixes of getPeers() to follow
2013-10-09 13:06:47 +00:00
zzz
8872437caf Another snark refactoring bug, log tweaks 2013-10-08 01:17:36 +00:00
712c77a4b6 add my "su3" certificate 2013-10-08 00:17:41 +00:00
zzz
38cef14cf4 synch cleanup thx zab 2013-10-07 19:26:33 +00:00
zzz
05c3b0d391 Fix bug causing writes past end of file, introduced in refactoring, not in trunk 2013-10-07 15:47:44 +00:00
zzz
854090e9d8 - Console: Set per-connector acceptors back to 1, Jetty default changed to 2? 2013-10-07 14:51:49 +00:00
zzz
f035815f7a - Don't truncate initial news header if it appears in summary bar
(unlikely as we don't show the "hide news" button for initial news)
     Also prevent string IOOBE
2013-10-07 14:45:11 +00:00
zzz
df4302dda0 * Update:
- Thread news fetcher so it doesn't clog the scheduler
2013-10-07 14:43:18 +00:00
zzz
31f117e74c * Data Structures:
- Make Destination and RouterIdentity keys and cert immutable
   - Add Destination cache
2013-10-07 13:04:01 +00:00
zzz
890f40b2ac more log tweaks 2013-10-07 12:11:42 +00:00
zzz
3ac8083faf log tweaks 2013-10-07 12:10:10 +00:00
zzz
249319f76f * Disallow 2001:db8::/32 (RFC 3849) addresses 2013-10-07 11:22:54 +00:00
zzz
efe87060b4 add missing start.jar thx kytv 2013-10-06 22:55:59 +00:00
zzz
afe3ff57cf history for prop, -1 2013-10-06 17:13:29 +00:00
zzz
6bb1505d3b propagate from branch 'i2p.i2p.zzz.ecdsa' (head 1dd9522809f801ca68dd331cfba1c5c914dc1481)
to branch 'i2p.i2p' (head a1c2ba4663abc7470f427c6a14854707d58b486a)


 Prop from branch i2p.i2p.zzz.ecdsa:
 * Build:
   - Generate su3 file in release target
   - Add zzz's new RSA 4096 pubkey cert for updates
   - Fix checkcerts.sh
 * Console: Move advanced setting to HelperBase
 * DSAEngine changes:
   - Implement raw sign/verify for other SigTypes
   - Add sign/verify methods using Java keys
 * ECDSA Support:
   - Add ECConstants which looks for named curves and falls back to
     explicitly defining the curves
   - Add support for ECDSA to SigType, DSAEngine and KeyGenerator
   - Attempt to add BC as a Provider
   - genSpec: fallback to BC provider
 * EepGet:
   - Fix non-proxied PartialEepGet
   - Prevent non-proxied eepget for an I2P host
 * KeyGenerator changes:
   - Generate key pairs for all supported SigTypes
   - KeyPairGen: Catch ProviderException, fallback to BC provider
   - Add KeyGenerator main() tests
 * KeyRing and DirKeyRing added: simple backend for storing X.509 certs
 * KeyStoreUtil added:
   - Consolidate KeyStore code from SSLEepGet, I2CPSSLSocketFactory,
     SSLClientListenerRunner, and RouterConsoleRunner into new
     KeyStoreUtil and CertUtil classes in net.i2p.crypto (ticket #744)
   - Change default to RSA 2048 (ticket #1017)
   - Set file modes on written keys
   - Overwrite check in createKeys()
   - New getCert(), getKey()
   - Extend keygen max wait
   - Read back private key to verify after keygen
   - Validate cert after reading from file
   - Validate CN in cert
   - Specify cert signature algorithm when generating keys
 * NativeBigInteger: Tweak to prevent early context instantiation
 * RSA support added: constants, parameters, sig types, support in DSAEngine, KeyGenerator, SigUtil
 * SHA1Hash: Add no-arg constructor
 * SigType changes:
   - Add parameters (curve specs) to SigTypes
   - Add getHashInstance()
   - Add RSA, fix ECDSA
   - Renumber, rename, comment out types that are too short.
 * SigUtil added:
   - Converters from Java formats (ASN.1, X.509, PKCS#8)
     to I2P formats for Signatures and SigningKeys
   - Move ASN.1 converter from DSAEngine to SigUtil, generalize
     for variable length, add support for longer sequences,
     add more sanity checks, add more exceptions
   - Move I2P-to-Java DSA key conversion from DSAEngine to SigUtil
   - Add Java-to-I2P DSA key conversion
   - Add Java key import
   - New split() and combine() methods
 * SSLEepGet: Move all certificates to certificates/ssl, in preparation
   for other certificate uses by SU3File
 * SU3File changes:
   - Support all SigTypes
   - Implement keygen
   - Readahead to get sigtype on verify, as we need the hash type
   - Enum for content type
   - Add unknown content type, make default
   - Fix NPE if private key not found or sign fails
   - Store generated keys in keystore, and get private key from keystore
     for signing, in Java format
   - Use Java keys to sign and verify so we don't
     lose the key parameters in the conversion to I2P keys
   - Type checking of Java private key vs. type when signing
   - Use certs instead of public keys for verification
   - Fix arg processing
   - Improve validate-without-extract
   - New extract command
   - Change static fields to avoid early context init
   - Reduce PRNG buffer size for faster signing
 * Update: Preliminary work for su3 router updates:
   - New ROUTER_SIGNED_SU3 UpdateType
   - Add support for torrent and HTTP
   - Refactor UpdateRunners to return actual UpdateType
   - Deal with signed/su3 conflicts
   - Verify and extract su3 files.
   - Stub out support for clearnet su3 updating
   - New config for proxying news, separate from proxying update
   - PartialEepGet and SSLEepGet tweaks to support clearnet update
   - Remove proxy, key, and url config from /configupdate
   - More URI checks in UpdateRunner
   - Add https support for news fetch
   - Add su3 mime type
   - Reset found version in update loop so we don't fetch from
     the next host too.
   - Prevent NPE on version after SSL fetch
2013-10-06 17:09:56 +00:00
zzz
a1c8e3eae3 reduce search limit 2013-10-06 17:08:51 +00:00
zzz
aa171bbaa6 less scary message 2013-10-06 17:07:56 +00:00
zzz
845b70fe0c add missing sidebar 2013-10-06 17:07:27 +00:00
zzz
82b1eb7c18 * Update:
- Check proxy setting before calling runner for method
2013-10-06 16:39:30 +00:00
zzz
4bd27ea1d3 * Update:
- Reset found version in update loop so we don't fetch from
     the next host too.
   - Prevent NPE on version after SSL fetch
   - Fix su3 version check
 * EepGet:
   - Fix non-proxied PartialEepGet
   - Prevent non-proxied eepget for an I2P host
   - Fail if no hostname in URL
2013-10-06 16:02:33 +00:00
zzz
d0f6be3161 fix cert dir 2013-10-06 01:15:40 +00:00
zzz
7764257e41 more synching for coherence 2013-10-06 00:43:12 +00:00
zzz
af0e72ac4d * SSU: More efficient ImboundMessageState
(reduce ByteArray[] size where possible)
2013-10-05 18:38:55 +00:00
zzz
0534440695 - Treat 6bone 3ffe::/16 as local 2013-10-05 14:04:40 +00:00
zzz
c2fa2d0c5b * Logging:
- Require strict match of class name component
   - parseLimits() cleanup
2013-10-05 13:07:33 +00:00
zzz
887017b54c * Transport: Treat more IPs as local
25/8 - Hamachi (moved from 5/8 Nov. 2012)
   2620:9b::/32 - Hamachi
   0::/8 - Includes IPv4 compatibility addresses ::xxxx:xxxx
2013-10-05 12:56:39 +00:00
zzz
3a4f5a2f1b jetty 7.6.13.v20130916 2013-10-04 23:43:38 +00:00
zzz
3fb4643742 - Add https support for news fetch 2013-10-04 20:28:43 +00:00
zzz
a5e3bc9b85 Update:
- New config for proxying news, separate from proxying update
 - Default logic cleanup
2013-10-04 20:21:54 +00:00
zzz
8a0c3f10f4 Update:
- Stub out support for clearnet su3 updating
 - PartialEepGet and SSLEepGet tweaks to support clearnet update
 - Remove proxy, key, and url config from /configupdate
 - More URI checks in UpdateRunner
 - Add su3 mime type
 - Move advanced setting to HelperBase
2013-10-04 19:06:39 +00:00
zzz
e1d808a284 add msg when stopping tunnel on idle 2013-10-04 16:50:37 +00:00
zzz
e755051ebe * i2psnark:
- Add torrent auto-stop support; enable for update file
   - Add tunnel auto-close when no torrents are running
   - Log/msg tweaks on add/create failures
2013-10-04 16:40:14 +00:00
zzz
d7c3ffa4de 0.9.8.1 2013-10-02 14:14:18 +00:00
zzz
cba3b249dd * Startup: Fix rekeying on Windows (tickets #1056, 1057) 2013-10-01 14:22:17 +00:00
zzz
32f250003e NBI: Tweak to prevent early context instantiation 2013-09-30 19:25:21 +00:00
zzz
e004b0e6e9 Build:
- Generate su3 file in release target
  - Add my new RSA 4096 pubkey cert for updates
  - Fix checkcerts.sh
2013-09-30 19:21:25 +00:00
zzz
a5c5917a5f add key length to RSA SigType names 2013-09-30 17:13:35 +00:00
cbd24946b6 refresh patch, en po 2013-09-30 16:33:01 +00:00
zzz
9b4842931a 0.9.8 2013-09-30 12:57:13 +00:00
zzz
e04cf132cc HTTPServer: Log tweak for better diagnosis of delays 2013-09-29 16:40:50 +00:00
zzz
7d237b4cf6 Watchdog: Format messages better 2013-09-29 16:38:57 +00:00
zzz
3cbfd09722 Console: Tag strings on /jobs (ticket #969) 2013-09-29 16:36:32 +00:00
zzz
0ae774dd68 bump for review 2013-09-28 12:00:20 +00:00
zzz
2884df873e * Streaming: Major rework of connection disconnect process. Tickets 1040-1042.
- Prevent multiple calls or reentrancy in disconnect() (ticket #1041)
   - Implement processing of close to skip TIME-WAIT, and
     wait for all packets to be acked (not just the CLOSE) before
     doing so, if possible (ticket #1042)
   - Don't call disconnect() or disconnectComplete() from I2PSocketFull.destroy()
     so retransmissions and acks can still happen (removes some close loops)
   - Don't call disconnect() until we have both sent and received a CLOSE (ticket #1040)
   - Don't reset the connection from CPH just because we sent a CLOSE
     and it was acked (ticket #1040)
   - Ack packets even if we sent a CLOSE  (ticket #1040)
   - Retransmit CLOSE if not acked (ticket #1040)
   - Send received packets to the MessageInputStream even if we haven't received a SYN
   - Don't call MessageInputStream.messageReceived() for ack-only packets, that was pointless
   - Don't send a RESET after timeout of an outbound connection
   - Work around bugs on other end by limiting retransmission of CLOSE packets
   - Make _isInbound final
   - More cleanups, javadocs, log tweaks
2013-09-28 11:47:47 +00:00
d4d1424c4f update debian changelog 2013-09-27 20:15:02 +00:00
33827f9aaf switch from elipsis to three "."s 2013-09-27 20:14:36 +00:00
zzz
30a666c833 Streaming: Don't queue a message for an unknown connection on the SYN queue
if it has a send ID set, it must be for a recently closed connection
2013-09-27 01:50:38 +00:00
zzz
9a00621fa4 log tweaks 2013-09-27 01:48:12 +00:00
46bc479884 update geoip based on Maxmind GeoLite Country database from 2013-09-03 2013-09-26 21:47:53 +00:00
6ab6abf4dd French, German, Russian, and Swedish translation updates from Transifex 2013-09-26 21:47:06 +00:00
zzz
0c6a9ff2a0 proof delimiter tweak 2013-09-25 23:13:42 +00:00
zzz
aefc5b5317 javadoc fix 2013-09-25 17:42:37 +00:00
zzz
25682fdea7 log tweaks, javadoc 2013-09-25 17:42:13 +00:00
zzz
9318099845 * Streaming:
- Cleanups
   - Remove setCloseReceivedOn(), unused outside Connection
   - OR the isFlagSet parameter instead of multiple calls
   - Remove acked packets from _outboundPackets inside synced iterator
   - Short-circuit _outboundPackets iterator if empty
   - Small optimization if not logging in ConnectionPacketHandler
   - Stub out processing of close ack (ticket #1042)
2013-09-24 16:01:20 +00:00
zzz
fdf38a952d atomic default value cleanup 2013-09-24 14:45:30 +00:00
zzz
fb40ab1f00 * Streaming: Atomics for close/reset send/receive
so we only do things once. (Ticket #1041)
2013-09-24 14:01:48 +00:00
zzz
3499ed7bb0 * Streaming: Consolidate scheduling of DisconnectEvent, and ensure
we only do it once. (Ticket #1041)
2013-09-24 13:22:46 +00:00
zzz
b05906a3c2 SigType: Renumber, comment out all the types that are
too short or for testing. Turn off debug logging.
2013-09-24 12:55:22 +00:00
zzz
61d5f46295 * Streaming: Fix active stream counting so it doesn't count streams
that are closed and in TIME-WAIT state. Also, break out of the
   counting loop as soon as we know the answer. (Ticket #1039)
2013-09-24 12:40:35 +00:00
zzz
9ebfccd8f6 * Console: Add /proof page which can copied to prove you run a router 2013-09-23 16:39:40 +00:00
zzz
4fb3e86e4d Truncate and linkify magnet link in summary bar update message 2013-09-23 12:13:44 +00:00
zzz
837517e94e Update: Verify and extract su3 files.
untested...
2013-09-22 19:19:36 +00:00
zzz
f47ec65b8f Update: Preliminary work for su3 router updates:
- new ROUTER_SIGNED_SU3 UpdateType
   - Add support for torrent and HTTP
   - Refactor UpdateRunners to return actual UpdateType
   - Deal with signed/su3 conflicts
   - unpack/verify stubbed only
2013-09-22 18:03:56 +00:00
zzz
6fede7f524 log tweaks 2013-09-22 14:13:50 +00:00
zzz
bd0c18b2e3 * Console: Implement webapp state detection and stop button for webapps
on /configclients (Ticket #1025)
2013-09-21 16:11:55 +00:00
zzz
fba596c78c geoipv6 Sept 19 2013 from Maxmind 2013-09-21 12:30:06 +00:00
61f2b49022 another extraneous script name 2013-09-20 23:09:27 +00:00
e71a1a5c4d remove extraneous script name 2013-09-20 23:07:11 +00:00
683ce3254f testscripts build target: check shell scripts for validity
(also adding missing shebang lines)
2013-09-20 22:32:05 +00:00
df555731c4 minor script changes
- mbuild.sh: don't require bash
- Slackware/i2p/doinst.sh: add bash shebang
2013-09-20 22:17:48 +00:00
641fc0cae9 fix langbox alignment, bump build number 2013-09-20 21:06:57 +00:00
5ab1d6896a jbigi scripts: look in /usr/local (for *BSD) 2013-09-20 19:39:25 +00:00
zzz
0ae2d92fcd * Update: Support notification of updates that cannot be downloaded
due to "constraints". Add constraint checks for java version,
   router version, configuration, and base permissions. (ticket #1024)
2013-09-20 18:56:54 +00:00
zzz
26c8201e03 spellcheck off 2013-09-20 18:42:51 +00:00
37521c69a2 look for openjdk6 in OpenBSD if v7 isn't available 2013-09-20 18:33:11 +00:00
43383a5b3c changes to fix compilation on OpenBSD 2013-09-20 10:44:56 +00:00
bfea3e4dd6 translation updates from Transifex 2013-09-20 10:43:13 +00:00
35b02a52e1 redirect output of which command to /dev/null 2013-09-20 02:00:41 +00:00
8e3e566915 typo fix 2013-09-20 01:45:09 +00:00
968b9a0304 fix previous check-in 2013-09-20 01:38:20 +00:00
c97f0f3d22 OpenBSD compilation fix: set JAVAC in bundle targets if javac not found and require.gettext is set to true
This solves the following problem which was found on OpenBSD:

bundle:
     [exec] Generating net.i2p.desktopgui.messages_ar ResourceBundle...
     [exec] ERROR - msgfmt failed on locale/messages_ar.po, not updating translations
     [exec] msgfmt: Java compiler not found, try installing gcj or set $JAVAC
     [exec] msgfmt: compilation of Java class failed, please try --verbose or set $JAVAC
     [exec] 9 translated messages.


In OpenBSD 5.4, neither java nor javac are in the PATH.
2013-09-20 01:21:43 +00:00
65b1124d81 various updates to i2prouter
- check status of i2psvc with ldd
- only warn about libiconv in FreeBSD if the package isn't installed. In recent
  versions of FreeBSD, OpenJDK depends on libiconv so it should always be
  available.
2013-09-19 20:56:56 +00:00
zzz
89034e1f9d SU3File:
- Fix arg processing again
   - Change static fields to avoid early context init
   - Reduce PRNG buffer size for faster signing
2013-09-19 15:21:53 +00:00
zzz
9f2fa6a8be fix arg processing 2013-09-19 13:59:39 +00:00
zzz
19cf8787d8 - Allow getRawAlgo() for public keys
- SU3File better arg processing, implement content type arg
   - Type checking of Java private key vs. type when signing
   - Add unknown content type, make default
2013-09-18 16:53:38 +00:00
zzz
a80c34c1df * i2psnark:
- Refactor Storage file data structures
   - Sort files when creating torrents
2013-09-18 15:41:10 +00:00
zzz
ab8900f910 * I2PTunnelHTTPServer: Don't thread a receiver for GET or HEAD 2013-09-18 15:39:12 +00:00
zzz
ce2d0b0e12 - Revert expl. default back to 2 hops, wait for next release
- Eepsite index.html better help on redirects
   - Remove exotrack (again)
2013-09-17 13:53:20 +00:00
zzz
87d98781a9 Read back private key to verify after keygen
Validate cert after reading from file
   Validate CN in cert
   Javadoc fixes
2013-09-16 15:48:54 +00:00
zzz
79dc95dd66 Fix RSA_SHA384
Fix DSAEngine for RSA
   Fix KeyGenerator for RSA
   New split() and combine() methods in SigUtil
   Fix private key conversions for RSA
2013-09-15 16:49:59 +00:00
zzz
c6533202f7 Add RSAConstants
Specify RSA parameters
  Add RSA sig types
  Specify cert signature algorithm when generating keys
  Extend keygen max wait
  Catch NPE if sign fails in SU3File
  Fix signature conversion for RSA
  Fix public key conversion for RSA
2013-09-15 15:12:07 +00:00
zzz
b5dc9bc0ba DSAEngine: Add sign/verify methods using Java keys
SU3File: Use Java keys to sign and verify so we don't
           lose the key parameters in the conversion to I2P keys
2013-09-14 15:53:08 +00:00
zzz
79891c6677 open4you.i2p 2013-09-14 15:28:36 +00:00
zzz
68aa1aea8e stub out RSA 2013-09-13 15:26:38 +00:00
zzz
4ffaf4128e SU3File:
- enum for content type
  - fix NPE if private key not found
  - use certs instead of public keys for verification
  - improve validate-without-extract
  - new extract command
2013-09-13 13:02:37 +00:00
zzz
801ca47a0c add Koblitz curves for testing 2013-09-13 00:49:10 +00:00
zzz
43f5062169 SSLEepGet: Move all certificates to certificates/ssl, in preparation
for other certificate uses by SU3File
2013-09-12 21:47:25 +00:00
zzz
7ab4dd7f4b KeyStoreUtil:
- Overwrite check in createKeys()
  - New getCert(), getKey()
  SU3File:
  - Store generated keys in keystore
  - Get private key for signing from keystore
2013-09-12 20:22:30 +00:00
zzz
71c0104236 Add base algorithm type in prep for RSA 2013-09-12 18:23:28 +00:00
zzz
a608d21571 KeyStore: change keygen default to RSA 2048 (ticket #1017)
fix key length setting
2013-09-12 14:55:16 +00:00
zzz
935ddaa0b2 fix default expiration 2013-09-12 14:41:25 +00:00
zzz
945e7b75fd Crypto - prep for using certificates in SU3File:
Consolidate KeyStore code from SSLEepGet, I2CPSSLSocketFactory,
  SSLClientListenerRunner, and RouterConsoleRunner into new
  KeyStoreUtil and CertUtil classes in net.i2p.crypto (ticket #744)
2013-09-12 14:27:16 +00:00
5e90780590 jbigi/jcpuid build scripts: Look for OpenJDK7 in kFreeBSD (it has landed in Debian testing) 2013-09-11 14:04:58 +00:00
zzz
a8a21ea7ce propagate from branch 'i2p.i2p' (head 6667c4a9f9fcc0705e407006d1933dd31942ffb2)
to branch 'i2p.i2p.zzz.ecdsa' (head bf746450400fc5ffa0e727ed0cd6a3966f6ce51f)
2013-09-10 13:03:40 +00:00
zzz
23444e4b81 * Router: Log new router hash in event log after rekeying 2013-09-10 12:25:24 +00:00
zzz
a3ea1f9429 remove static log 2013-09-10 12:23:45 +00:00
zzz
78d4b6d8a7 - Simple DirKeyRing backend for testing 2013-09-09 19:46:24 +00:00
zzz
3e3399adc6 - Add Java key import to SigUtil
- Import priv key to SU3File in Java encoded format instead of I2P format
  - New KeyRing stub
2013-09-09 00:49:14 +00:00
zzz
1e554dd0fe - Move I2P-to-Java DSA key conversion from DSAEngine to SigUtil
- Add Java-to-I2P DSA key conversion to SigUtil
  - Export keys from SU3File in Java encoded format instead of I2P format
2013-09-08 21:47:48 +00:00
388e7088e1 Updating cert for reseed.info 2013-09-08 16:14:53 +00:00
e65289cd0d Document logCloseLoop() methods 2013-09-08 15:23:09 +00:00
c4d68a8352 minor cleanup 2013-09-08 15:21:25 +00:00
7be0a93251 Use AtomicBoolean to prevent multiple close()-s 2013-09-08 13:18:47 +00:00
175f47293a Ticket #1012 - remove nested locking on close() and
finishInboundEstablishment()
2013-09-08 13:13:14 +00:00
zzz
27936fce04 cache key conversion 2013-09-08 13:06:30 +00:00
592680302f make the logCloseLoop() methods members of the Log class
so they can be used everywhere
2013-09-08 12:55:05 +00:00
zzz
55318cf14b Crypto: Set file modes on written keys; don't overwrite existing files 2013-09-08 11:57:15 +00:00
zzz
83ead0c304 - SU3File: Readahead to get sigtype on verify, as we need the hash type 2013-09-07 20:24:40 +00:00
zzz
38ec55bc72 - DSAEngine: Implement raw ECDSA sign/verify
- SU3File: Implement keygen
2013-09-07 19:37:02 +00:00
zzz
c4f97ed65e - DSAEngine: Start of support for signing hashes with other SigTypes
- KeyGenerator: Measure sign and verify separately in test
 - SU3File: Start to support other SigTypes
 - SigType: Add getHashInstance(), fix hash length for ECDSA_SHA256_P192
 - SHA1Hash: Add no-arg constructor
2013-09-07 18:12:19 +00:00
zzz
78a426e9ac * Crypto: Don't use "short exponent" on faster platforms.
Rebuild router identity if key length doesn't match setting.
   This affects RI and LS encryption keys, and DH and YK.
   Faster = 64 bit with working jbigi, non-ARM, non-GNU (for now)
   Override default with crypto.elGamal.useLongKey=true/false
   LS key is built at client startup (Dest key unused)
   This will churn most of the RIs at the release.
 * SystemVersion: Add isARM()
2013-09-07 13:43:28 +00:00
zzz
928b4bbbe5 - genSpec: fallback to BC provider 2013-09-06 13:53:15 +00:00
zzz
d27c465371 - KeyPairGen: Catch ProviderException, fallback to BC provider 2013-09-06 13:30:47 +00:00
zzz
4d62f63c71 * Start of ECDSA branch:
- Add ECConstants which looks for named curves and falls back to
     explicitly defining the curves
   - Add SigUtil with converters from Java formats (ASN.1, X.509,
     PKCS#8) to I2P formats for Signatures and SigningKeys
   - Move ASN.1 converter from DSAEngine to SigUtil, generalize
     for variable length, add support for longer sequences,
     add more sanity checks, add more exceptions
   - Attempt to add BC as a Provider
   - Add parameters (curve specs) to SigTypes
   - Add support for ECDSA to DSAEngine and KeyGenerator
   - Add KeyGenerator main() tests
   - More javadocs

  All is Java 1.5 compatible but the actual algorithms, curves,
  and other support aren't necessarily present in any JVM.
  Todo: More tests, more fallbacks for various JVMs
2013-09-06 12:04:22 +00:00
zzz
f4039b085a * Crypto: SigType tweaks, prep for parameters, show type in toString()
* NativeBigInteger: Don't use native for negative arguments, which aren't supported in jbigi.c
2013-09-06 11:40:50 +00:00
53ed10cfc8 typo fix (s/lt/le/) 2013-09-04 01:42:12 +00:00
zzz
0859dbe57f * i2ptunnel: Reduce buffer size and use cache in HTTPServer
* Jetty: Increase maxIdleTime
2013-09-04 00:46:43 +00:00
zzz
42bc4bb1f4 reduce log level 2013-09-03 12:13:07 +00:00
zzz
caead8a3a4 consolidate maxMemory() calls 2013-09-03 11:37:36 +00:00
zzz
7394c7997b change pw restart warning to error so people dont miss it 2013-09-03 10:25:18 +00:00
zzz
0298e4ab4c use different sort for floodfill profiles display 2013-09-01 12:12:40 +00:00
zzz
e3a5cdbbc2 deprecate most of LeaseSetKeys 2013-09-01 12:12:05 +00:00
6ae46abac0 fix ticket number 2013-08-31 18:42:07 +00:00
615a5f3c39 update history 2013-08-31 18:40:39 +00:00
6812dc1db8 Ticket #1007 use only non-retransmitted packets in RTT
sampling.  (RFC 6298)
2013-08-31 18:39:29 +00:00
zzz
41595cafce * Addressbook: Don't write to log file on Android (ticket #859) 2013-08-31 15:35:57 +00:00
zzz
d6c4e411be highlight snark table rows on hover 2013-08-31 15:19:00 +00:00
zzz
6ca797ec1f * Console: Display "accepting tunnels" instead of "rejecting tunnels" after 20 minutes (ticket #902) 2013-08-30 12:07:42 +00:00
zzz
8655988c66 * NTCP: Handle race where peer's NTCP address goes away 2013-08-30 12:01:51 +00:00
zzz
de5f2940ce * SSU, confignet: Add support for specifiying multiple addresses 2013-08-30 10:27:22 +00:00
zzz
1933e6239b * SusiDNS: Don't require last subscription to be terminated by newline (ticket #1000) 2013-08-30 10:21:57 +00:00
zzz
8aec1e2eb6 * Addresses: Treat Teredo addresses 2001:0::/32 as local 2013-08-30 10:20:43 +00:00
def30c5903 javadoc update 2013-08-14 20:29:40 +00:00
193f0bbc42 More elegant 2013-08-11 20:21:06 +00:00
b7a3b7bf05 debian: add missing timestamp to changelog 2013-08-11 17:00:26 +00:00
a2bd45fa9b * Translation updates from Transifex
- French, Portugeuse, Russian, Spanish, and Turkish updates from Transifex
   - Start of Romanian translation from Transifex
   - Update English POs for sending to TX
 * Debian: Update changelog
2013-08-11 16:58:19 +00:00
fd297118f9 fix NPE if stats are not enabled 2013-08-11 11:58:51 +00:00
zzz
7171edad24 Jetty 7.6.12.v20130726 2013-08-11 11:28:33 +00:00
zzz
d8466333f3 more snark mime types 2013-08-11 11:26:57 +00:00
zzz
a5e4d586eb dont display jump server msg if we dont know any 2013-08-11 11:26:40 +00:00
28a1c22438 Update Java Service Wrapper to v3.5.20
- Windows: Self-compiled with VS2010 in Windows 7. The icon has been
      changed from Tanuki's default to Itoopie.
    - Linux ARMv6: Compiled on a RaspberryPi using gcc 4.6.3-14+rpi1,
      Icedtea6 6b27-1.12.5-1+rpi1 and stripped
    - All other binaries are from the "community edition" deltapack offered by
      Tanuki.
2013-08-11 01:26:19 +00:00
74e238322d bump version for testing 2013-08-10 21:53:47 +00:00
1f3227409b Reduce initial ack delay to 1000
Rework the logic for acking duplicate packets
2013-08-10 21:03:05 +00:00
afda1da9c3 volatile 2013-08-10 21:00:09 +00:00
zzz
f2857e8f97 bump after prop 2013-08-10 17:16:50 +00:00
zzz
4802b1e2cd propagate from branch 'i2p.i2p.0971' (head 6cb629b61e0177deda1e539b2f85a2473f3af7fb)
to branch 'i2p.i2p' (head 8e86ef70afbbbbdc2db06cec34f17dedd528c7e7)
2013-08-10 17:06:17 +00:00
zzz
0328304f04 dont specify i2p.i2p branch so we can release from a different branch 2013-08-10 16:23:23 +00:00
zzz
06d2db0046 0.9.7.1 2013-08-10 16:00:46 +00:00
0539610219 volatile 2013-08-09 21:06:39 +00:00
zzz
170be8f033 Extend IB tunnel expiration
applied changes from 2f2fc980d396aa295ce972afc4298e8f2e763fea
             through c2bc3b29484ec8a689c72f2ab4e823a2a72f6430

New update hosts, thx Meeh and dg
2013-08-08 22:13:38 +00:00
zzz
ca0bb1ab76 Plucks from trunk for 0.9.7.1:
Streaming RTO changes:
 apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java
 apps/streaming/java/src/net/i2p/client/streaming/TCBShare.java
 apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java

new reseed:
 applied changes from dbfea0ca35dbf9df85b5703db6f97a9579beb364
             through 325a9ed6f0f47eeabb33710073edf973671c63c9

disable RI verifies:
 applied changes from 4ef48b93946923e3371ab62719a474d869520697
             through a77990850b3534101571c88db4704676645914df

i2prouter bashism fix:
 applied changes from b5a0148f96728466561ece9be0e50ac9ad3f1468
             through e301d0499f4c688ed3a5febe30bf8098c7f2cdf9

i2psnark increase max piece size, mime type updates:
 apps/i2psnark/java/src/org/klomp/snark/Storage.java
 apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
 apps/i2psnark/mime.properties

UPnP fix:
 applied changes from 3d4a5cd3d933f75fdff7696f560c569f4674bd73
             through 75e5f5d4e0f0dd44140908bb6e73830e3448bdde
2013-08-08 12:07:16 +00:00
zzz
cdccb51456 * Start of 0.9.7.1 branch
* i2psnark: Increase update-via-torrent to 30%
2013-08-07 17:36:55 +00:00
870ecb847f Updated Eclipse files 2013-08-04 00:02:22 +00:00
8ba493c60e debian: compress package with xz
All currently supported distros support this format.
2013-08-01 23:29:34 +00:00
f3affff5be Atomic 2013-07-31 16:01:26 +00:00
zzz
5941a52a0d * Tunnels: Extend local expiration of IB tunnels, to allow for
more clock skew and not drop valid messages at their destination
2013-07-30 22:10:02 +00:00
zzz
04e6beb43c javadoc, log, comment, and su3file help tweaks 2013-07-30 22:05:46 +00:00
zzz
1284c7ace0 * i2psnark: Increase max piece size to 4 MB (ticket #993) 2013-07-30 21:50:07 +00:00
63414f0348 Override prepareOutbound() in VerifiedEstablishState 2013-07-30 17:13:34 +00:00
c8f22fdfd0 Adding new reseed host. Thanks to isdf! 2013-07-29 23:01:04 +00:00
zzz
7737bf5212 * GeoIPv6: Fix NPE (ticket #992) 2013-07-29 14:02:08 +00:00
zzz
4340f70d72 * Signatures:
- Prep for new signature algorithms; new SigType enum;
     Signature, SigningPublicKey, SigningPrivateKey store type
   - New Hash384 and Hash512 classes
   - Remove length field in SimpleDataStructure
   - New SU3File generator/verifier/extractor
2013-07-29 13:49:05 +00:00
zzz
6dbd8a6d1a add mobi mime type 2013-07-28 13:21:01 +00:00
zzz
076871fe44 * NetDB: Disable RI verifies for now 2013-07-28 13:02:12 +00:00
zzz
be753d7a1a * Addresses: Treat RFC 4193 addresses fc00::/7 as local 2013-07-28 12:52:41 +00:00
zzz
e3f02553fd javadoc 2013-07-28 12:52:10 +00:00
zzz
767ef8c489 add webm mime type 2013-07-28 12:52:00 +00:00
zzz
482787fbc3 * Transports:
- Really fix IPv6-only option
   - Treat RFC 4193 addresses fc00::/7 as local
   - Log tweaks, javadocs
2013-07-26 22:39:35 +00:00
b2d72f90ce merge of '5ad8235a14f2f52799755969e5c877f4f1c159cc'
and 'f5d75b2ebc648c43182d685f30e96242e43caa69'
2013-07-25 20:08:31 +00:00
dd181a90e1 Fix NPE when cancelling PacketLocal's 2013-07-25 20:07:12 +00:00
zzz
19faa352e3 * Transports:
- Prefer IPv6 by default
   - Fix IPv6-only option
   - Don't try NTCP IPv6 addresses unless we have one
   - Fix non-%16 SSU padding in data and session confirmed packets; enable by default
   - Log tweaks
2013-07-25 18:52:45 +00:00
zzz
ffda7f6326 * Tunnels:
- Make expl. default 3 hops  (ticket #966)
   - Allow expl. fallback up to -2 hops
2013-07-25 18:49:22 +00:00
zzz
8ebacf4c10 log tweak 2013-07-25 18:47:47 +00:00
zzz
a02cc25844 UPnP Fix for devices that return base URLs with trailing '/' (ticket #986) 2013-07-24 18:03:50 +00:00
zzz
8aeca5b433 catch NPE in main when no state table available 2013-07-24 14:24:29 +00:00
zzz
7b4855d7cf * UPnP: main() tweaks for debugging 2013-07-24 12:38:15 +00:00
zzz
803d7ff282 * GeoIP: Fix lookups, broken in IPv6 branch 2013-07-24 12:36:36 +00:00
a1c724f866 reduce initialRTO to 9000 2013-07-23 14:18:51 +00:00
96609e9173 change default loglevel for duplicate close()s to INFO 2013-07-23 14:17:26 +00:00
zzz
f5518739e2 javadoc fixes 2013-07-23 00:49:37 +00:00
zzz
e7c8d28b99 * HashComparator:
- Don't pollute Hash cache with hashes
   - cleanups, less object churn
2013-07-22 23:07:37 +00:00
zzz
dff357a658 unit test compile fix 2013-07-22 15:14:58 +00:00
zzz
cc271de7df * BuildReplyHandler:
- Make non-static
   - Don't pollute Hash cache with build response record hashes
   - Use SimpleByteCache
   - cleanups
2013-07-22 14:25:30 +00:00
zzz
a7485ab5a3 * I2CP:
- Oops, must enforce property length limits even when inside router JVM
     as the properties are serialized for signing.
2013-07-21 20:17:42 +00:00
7133736702 Fix more NPEs ticket #984 2013-07-21 19:41:48 +00:00
2313d82369 toclet #984 : fix deadlock introduced in -4 (ticket #972) 2013-07-21 14:54:36 +00:00
zzz
1b42d99e66 * Console: Fix /peers table summary alignment
* I2CP:
   - Don't NPE when loglevel=warn
   - Don't enforce property length limits when inside router JVM
 * I2PSnark: Log uncaught error in ThreadedStarter to router log
 * I2PThread: Log uncaught error to wrapper log
2013-07-21 14:04:27 +00:00
d709f46183 Update unit test 2013-07-20 18:45:19 +00:00
97c1676bcb Rework locking and state management of NTCP connections
trac ticket #972
	up version to -4
2013-07-20 17:37:46 +00:00
zzz
02b92ac3fe fix compile for test 2013-07-20 13:46:50 +00:00
zzz
29eb1d5dc5 fixup after prop; history for prop; -3 2013-07-20 13:41:31 +00:00
zzz
a87fc68cfd propagate from branch 'i2p.i2p.zzz.ipv6' (head 5c147c6e394fae03752dcf497923a90e3f2db529)
to branch 'i2p.i2p' (head 7af6987d5546664f76589afe0cbeeb780f4b5d58)
2013-07-20 12:59:03 +00:00
zzz
bc1cf64df4 remove extra 2013-07-20 12:35:38 +00:00
zzz
b607d7b223 generic 2013-07-20 12:34:24 +00:00
zzz
4e00eaf9a3 checkpo fix; history for prop; -2 2013-07-20 12:25:31 +00:00
zzz
90cc71d14d propagate from branch 'i2p.i2p.zzz.test2' (head d80f8632ef0a2aa350eee9a38ba6a4c56471f5bc)
to branch 'i2p.i2p' (head e8b712c826e44211217f06eb3a4da2703323a42f)
2013-07-20 11:53:41 +00:00
zzz
554a3a6b0e * PRNG:
- Don't delay the refiller if we need more (don't limit max output)
   - Add FortunaRandomSource.main() to output to stdout for testing e.g. with dieharder
2013-07-19 21:31:25 +00:00
zzz
8505e8a1ca fix streaming property 2013-07-19 21:28:14 +00:00
54ec878698 merge of '90720c051863f44c6386493f3d5df546d988a663'
and 'fa509893effa9445a0833115160aed8fe6fed268'
2013-07-19 00:18:08 +00:00
ea4606fe79 Prepare for merge 2013-07-18 22:45:11 +00:00
96de87fdde compute rttDev in updateRTT 2013-07-18 22:33:23 +00:00
55d571ffec Hardcode TCP constants
Various suggestions by zzz
2013-07-18 22:25:10 +00:00
ae347c4fa1 sync getters 2013-07-18 15:52:40 +00:00
e93beb7c63 Updated .mtn-ignore 2013-07-18 13:48:36 +00:00
018098b8ef better loading from cache 2013-07-18 01:52:46 +00:00
1e2fb4bea5 propagate from branch 'i2p.i2p' (head e301d0499f4c688ed3a5febe30bf8098c7f2cdf9)
to branch 'i2p.i2p.979' (head 2dfdeb022c9495461b2ec1d90f28ef9cd0bd9e22)
2013-07-17 23:04:04 +00:00
171f0d2671 Implement RTT update on first ack 2013-07-17 21:13:19 +00:00
175cb0817e fix bashim in i2prouter 2013-07-17 19:45:43 +00:00
zzz
3b46acc285 * I2CP client session - improvements after review:
- Move more cleanups to finally block
   - Bounded wait
   - Don't ignore InterruptedExceptions, wrap in I2PSessionException and throw
   - More finals
   - Synch tweaks
2013-07-17 18:56:26 +00:00
zzz
d31ce49e77 change resource name 2013-07-17 18:55:12 +00:00
8937c4bf2a Store stdev of rtt in the TCB cache as per RFC 2140 2013-07-17 18:13:42 +00:00
2902a708f9 debian updates
- check script validity in build target
- refresh patch
- changelog update
2013-07-16 22:17:50 +00:00
zzz
20e152e79a 0.9.7 2013-07-15 14:15:43 +00:00
zzz
c1210b1c04 * Translations:
- Tag initialNews.xml for TranslateReader
   - Drop static translated initialNews pages
   - Add new routerconsole bundle for the news alone, shipped in the jar
   - Use TranslateReader in HTTP proxy for initial news
   - Initial translations created manually from translated xml filesx
   - Add translated proxy error pages and initial news to deletelist.txt
   TODO: ar translation fails checkpo.sh
2013-07-13 23:38:11 +00:00
zzz
71038c311f * Translations:
- New varargs method in Translate
   - New TranslateReader to translate static files on-the-fly using _("") tagging
   - Tag proxy error pages for TranslateReader
   - Drop static translated proxy error pages
   - Add new i2ptunnel bundle for the proxy alone, shipped in the jar
   - Use TranslateReader in HTTP proxy for error pages
   - Move HTTP proxy strings from the web *war) to proxy (jar) bundle so they will be loaded
   - Initial translations created by msgmerge from i2ptunnel and routerconsole po files, un-fuzzied
2013-07-13 19:58:11 +00:00
zzz
1cf9ae381d bump for review 2013-07-13 18:23:09 +00:00
4cb5a27a05 geoip update from 02-JUL-13 2013-07-11 21:52:00 +00:00
b0b0124138 Chinese, Russian, Spanish, and Turkish language updates from Transifex 2013-07-11 21:48:05 +00:00
9e12801503 susimail: Improvements to layout in mobile browsers 2013-07-11 00:19:31 +00:00
zzz
70a8ab1d1a * DHSessionKeyBuilder: Fix for session and mac keys if DH key is between 32 and 63 bytes.
Was: NPE. Now: mac key is hash of ssession key. Won't ever happen. (Ticket #963)
   javadocs
2013-07-10 18:59:46 +00:00
zzz
f3c4a26483 * I2CP/I2PTunnel locking fixes (partial fixes for tickets 650. 815, 946, 947, 953):
- I2PSocketManagerFactory: New createDisconnectedManager(), javadocs
   - I2PSessionImpl: Rewrite state management and locking, prevent multiple
     connect() calls, but allow disconnect() to interrupt connect()
   - I2PSimpleSession: Changes to match I2PSessionImpl
   - I2PTunnelServer: Don't connect in constructor, use createDisconnectedManager()
     for a final manager, finals and cleanups
   Lightly tested.
   Todo: I2PTunnelClientBase
2013-07-10 18:54:25 +00:00
zzz
9a1e1a92ca dont use == on doubles 2013-07-10 18:42:13 +00:00
zzz
732eddd1b9 toString() fix (NO_ACK) 2013-07-10 18:14:18 +00:00
zzz
2caa6ad975 * Router I2CP:
- Make classes extensible for router-side test stubs
   - Add router-side local-only test implementation, no full router required.
     Only tested with external clients, probably doesn't work in-JVM.
   - Don't start threads in ClientManager constructor
   - Remove unused Reader param in ClientMessageEventListener methods
   - Cleanups, volatiles, finals, javadocs
2013-07-10 18:12:47 +00:00
zzz
d3e0161a6b * Transports: Consolidate translation methods in super,
ngettext fix for "peers" string
2013-07-10 17:59:10 +00:00
67859f67b0 Make activeResends field atomic 2013-07-09 13:55:09 +00:00
b486ae5c26 bump for moar testin' 2013-07-07 20:13:42 +00:00
aab4a3ab44 Change criteria for resending on NACK to match comment 2013-07-07 20:13:11 +00:00
e9e550fb55 cleanup, sync, more logging 2013-07-07 19:15:08 +00:00
f80ea386a0 Log errors to logger if available 2013-07-07 17:20:06 +00:00
7429762d2e bump i2prouter-script version 2013-07-06 23:30:25 +00:00
zzz
aabbdc1c1b Hopefully fix SSU NPE (ticket #967) 2013-07-06 13:25:11 +00:00
zzz
3af766bd6e * TunnelPool: Don't reuse peers for exploratory tunnels 2013-07-06 13:18:19 +00:00
614b8b4cdd Russian and Portuguese translation updates 2013-07-05 22:42:34 +00:00
bec62c1be7 Remove unused field
Use atomics to manage closed state and IOExceptions
2013-07-05 19:48:31 +00:00
7f8efca0ba minor cleanup, more to follow 2013-07-05 19:05:54 +00:00
76de4faf62 better sync 2013-07-05 18:29:00 +00:00
dfc4948a6f cleanup & sync 2013-07-05 18:21:42 +00:00
ba0e58e66a fix compilation 2013-07-05 12:53:13 +00:00
18531f0c09 Log close() loops 2013-07-05 12:43:58 +00:00
93df048bd6 Cleanups, make I2PSocket a Closeable 2013-07-05 11:54:18 +00:00
2927382a2b refresh patch 2013-07-04 17:01:42 +00:00
b4780d16eb updated en (before pushing to tx) & ru (pulled from tx) pofiles 2013-07-04 16:52:00 +00:00
zzz
6f5f4d179b * Streaming:
- Don't stop timers when session disconnects (tickets #644, #810)
   - Throw exception on attempt to use destroyed socket manager
   - Clear TCBShare cache when stopped
   - Javadocs
2013-07-04 14:54:46 +00:00
zzz
b9a5dd48f6 Console: Hide dead tunnel pools on /tunnels 2013-07-03 19:14:21 +00:00
zzz
0db7e2873c * Updater: Fix plugin update checker (ticket #897)
* Utils: Reduce logging in wrapper log when extracting zip files
2013-07-03 17:12:32 +00:00
zzz
b84bfd575f bump 2013-07-03 12:44:19 +00:00
70bb81bcc3 merge of '3dbb3a0ff30032f71e1ef6dd6d90f3b8117f3cd1'
and 'ccdac8f0911b798c42e9079d47e07c0e7c652815'
2013-07-02 20:08:28 +00:00
7ebb26b734 refresh patch
This change is required after de-parameterizing the i2prouter script.  I
hardcoded the file name because the $0 variable isn't expanded (because of
single quotes). When using double-quotes (and escaping with back-slashes), the
strings weren't translated. I've decided to de-parameterize until I figure out
what the problem is.
2013-07-02 18:38:35 +00:00
fb93609d8b merge of '7d480c0749394d3ee1b10c1f714a1be3091596f8'
and '9cb464ed9b358b1e9807792b37f703977d6f5f96'
2013-07-02 18:17:02 +00:00
eb051d64c7 disapproval of revision 'fd10b04ca3a6cf66e669bfad32d3011ed9f7e33c' 2013-07-02 18:08:52 +00:00
58bb94a960 French, German, Portuguese, Russian, and Turkish translation updates from transifex 2013-07-02 17:41:27 +00:00
98d932a0f5 build.xml: minor tweak for jenkins
Jenkins' cobertura plugin wasn't finding the streaming source. This change
should correct that.
2013-07-02 16:58:40 +00:00
zzz
de4b0198b7 javadoc fixes 2013-06-30 17:13:53 +00:00
zzz
570f8526b0 getSession() cannot be null 2013-06-30 17:00:14 +00:00
zzz
d173b79949 drop build request with bad flags 2013-06-30 16:58:57 +00:00
67f73d7198 wip 2013-06-29 21:22:28 +00:00
6e36d374ea wip 2013-06-29 21:12:11 +00:00
740b37b70c wait until client thread finishes before declaring victory 2013-06-29 21:03:19 +00:00
782e38bdcf add TODO, make server thread daemon 2013-06-29 21:02:30 +00:00
937404b39c test seems to be hopelessly out of date 2013-06-29 20:35:27 +00:00
a0bf223031 return the Thread object for join()-ing 2013-06-29 20:34:57 +00:00
zzz
6b15caab4b drop ancient ministreaming doc 2013-06-29 15:14:04 +00:00
zzz
3aafea0d98 add ipv6 to /confignet 2013-06-29 15:13:05 +00:00
1c68852f45 Finish rename 2013-06-28 22:32:05 +00:00
4f6065b4fa refactoring most tests
remove standalone test from junit wildcard
2013-06-28 22:27:31 +00:00
14944982fb Trying to fix the Jenkins build.. 2013-06-28 20:50:38 +00:00
10bf74e045 add streaming lib tests to the top-level ant targets 2013-06-28 18:48:39 +00:00
a9d9e6b572 work on test 2013-06-28 18:43:36 +00:00
zzz
79f8e88e5f propagate from branch 'i2p.i2p' (head 2a2c708bf9fee43e69469bdf896dfe489c32bdea)
to branch 'i2p.i2p.zzz.ipv6' (head c33552d7026b0a445d1dd7e138bf454144130eb2)
2013-06-28 16:10:49 +00:00
bddfe3ed86 Convert most streaming tests to JUnit4 2013-06-28 16:00:47 +00:00
a308179d81 Fix and junit-ify tests 2013-06-28 15:21:02 +00:00
f8648ff4c4 Explicitly check the type of I2PSocketManager 2013-06-28 14:56:55 +00:00
zzz
552f91b6b8 dont start thread in constructor 2013-06-28 12:40:09 +00:00
zzz
726eb58724 * i2psnark:
- Show comment metadata on details page
   - Fix rar icon
   - Escape [] in URLs, chrome doesn't do it for us
   - Tweak column spacing
2013-06-28 12:19:56 +00:00
zzz
eb5a23fc5b finals, remove static log 2013-06-28 12:17:19 +00:00
zzz
d4c8e03f86 remove static log 2013-06-28 12:12:37 +00:00
zzz
46d13d2b08 divide by zero check 2013-06-28 12:10:34 +00:00
zzz
003dc37817 merge of 'bde6736c06f94ff24285aeff0a64ec7dc3a52a4b'
and 'f4b18bbf4329a48a182a57db594a58d4a32a9da7'
2013-06-28 12:06:22 +00:00
zzz
847a441d59 disapproval of revision '8611baad56e8e18941721b156256783ba996a3cd'
Revert 8611baad56e8e18941721b156256783ba996a3cd
Don't use intern() on externally-supplied strings
as it could be used to exhaust memory
2013-06-28 12:01:13 +00:00
a5f3220df0 merge of '6844f955ddd2febe54ce677ef19309712f55113c'
and '8611baad56e8e18941721b156256783ba996a3cd'
2013-06-27 19:23:54 +00:00
a5df6d419d use String.intern() instead of a homebrew equivalent 2013-06-27 19:04:28 +00:00
78a25f0b17 Updating certificate on 193.150.121.66. Will reload server to use
the new certificate on the next I2P release day.
2013-06-27 18:42:15 +00:00
dc7ea9c126 Removing the self-signed certificate. cowpuncher.drollette.com uses
a certificate signed by GlobalSign now.
2013-06-27 18:29:14 +00:00
70adc4df32 debug log the criteria for FF 2013-06-27 16:16:55 +00:00
c47f491e2f fail if cert expires within 60 days 2013-06-27 09:53:38 +00:00
1d9b89db23 volatiles, generics warning cleanup 2013-06-26 21:38:00 +00:00
ec70f2420c more volatiles 2013-06-26 21:03:18 +00:00
f525685765 volatiles, finals 2013-06-26 20:43:34 +00:00
zzz
4970fd22dc save a little space by avoiding BigInteger when possible 2013-06-23 17:52:36 +00:00
zzz
ac9392b9e6 * i2psnark: When receiving a metainfo via magnet and saving it to disk,
preserve all non-standard fields (such as those created by Robert) so the
   infohash doesn't change on restart, splitting the swarm.
   (http://zzz.i2p/topics/1327 thx 'backup')
2013-06-23 15:21:40 +00:00
zzz
5ba86ca254 * SSU:
- Pad all messages with random data instead of zeros
   - Implement non-mod-16 padding, disabled for now
2013-06-22 19:09:55 +00:00
zzz
87826daae9 mac static, final 2013-06-22 19:02:59 +00:00
7df52a155e Run the FloodfillMonitorJob more frequently 2013-06-22 17:17:17 +00:00
zzz
d2184f418f * NetDB: Increase upper limit on ffs again
* SSU: Pad session created message with random data instead of zeros
2013-06-22 13:51:50 +00:00
f91f81158f * Changing the default connect proxy after h2ik's AWOL. (Last seen 6th March 2013) 2013-06-22 12:05:34 +00:00
zzz
bb100de702 * SSU:
- Ignore padding beyond last multiple of 16 (prep for obfuscation)
  - Comment out xor with 0 (version)
  - Don't need to zero IV buf before overwriting
* AES:
  - Decrypt speedup by XOR in place
  - Log if decrypt not mod 16
2013-06-21 19:21:02 +00:00
zzz
322e76d2a9 speed up XORComparators 2013-06-21 15:13:37 +00:00
zzz
1444f1239f lookup stat tweak 2013-06-21 15:13:16 +00:00
zzz
5bd028bff5 i2psnark: Show start-all button even if tunnel is open,
if at least one torrent is stopped (ticket #808)
2013-06-20 21:21:07 +00:00
25feb745bc Volatil-ize some fields 2013-06-18 17:09:05 +00:00
zzz
7e0654ae0a * I2CP: Don't send SendMessageEndMessages from client to router if
in fast receive mode and the router doesn't require them.
2013-06-17 19:57:59 +00:00
zzz
00d1b7519f * Streaming: Flush debug pcap stream after closing connection 2013-06-17 19:54:22 +00:00
zzz
faadbf700d debug log tweak 2013-06-17 19:53:01 +00:00
zzz
180d42541a * NetDB:
- Don't instantiate unused success job for republish LS
   - Add debug setting to encrypt RI lookups
2013-06-17 19:47:04 +00:00
zzz
bdc4eff1c4 * NTCP: Extend interval for sending time sync messages,
might help expire idle conns
2013-06-17 19:45:46 +00:00
zzz
fa0b52fc3a * Console: Don't display 'unsupported' message on some config pages when restart/shutdown buttons clicked 2013-06-17 19:43:32 +00:00
zzz
f9f1391057 * SusiMail: Fix classpath problem when started manually (ticket #957)
- Remove a couple of dependencies
   - Add jetty-util.jar to console classpath just in case
2013-06-17 19:39:21 +00:00
zzz
34b7081303 change congestion cost increment back to 1 for now 2013-06-14 16:13:20 +00:00
zzz
e0cd71069f propagate from branch 'i2p.i2p' (head 1acb4077a56ccb4079538caa28648e27f0bf5b8b)
to branch 'i2p.i2p.zzz.ipv6' (head f87d396c445dc58e677a56d8ed69544c7f5ecab1)
2013-06-14 14:46:08 +00:00
zzz
36e898d668 * I2CP: Fix deserialization of new RVLSM; enable by default 2013-06-14 13:34:36 +00:00
zzz
a90827c9b2 * i2psnark: Fix bug creating torrent with a single file in a directory
(thx oskar/Nightweb)
2013-06-14 13:33:49 +00:00
dd451d3ccd po file fix / add i2prouter script's po files to checkpo.sh 2013-06-14 01:27:58 +00:00
937f4f2f40 parameterize & refresh patch 2013-06-13 18:48:58 +00:00
dev
e7718b1fba Threaded the calling of runRouter() to improve startup times. 2013-06-13 17:02:53 +00:00
dev
29b599bc8d merge of '80aa8cd653ef7ee96cd6603b9646c53b2ff84760'
and 'da25b770e65a36f3056b905cc6b96be431076a6b'
2013-06-13 15:05:54 +00:00
dev
6bbd34eed9 Fixed MultiRouter. Removed MultiRouterBuilder as it no longer serves any purpose. Added the router.rejectStartupTime property to allow for quicker testing with MultiRouter. 2013-06-13 14:38:13 +00:00
f939f689fc fix flag alignment 2013-06-13 01:01:08 +00:00
zzz
a48fba0102 * I2PTunnel: Add advanced quantity options 2013-06-12 15:07:39 +00:00
zzz
02923138d0 boom bye bye bad bwoy 2013-06-12 13:45:27 +00:00
zzz
87d142bace comment out main 2013-06-12 13:44:54 +00:00
zzz
933ad52398 * Console: Add missing jetty jars to classpath (ticket #952)
(tested with classpath from 0.7.4 wrapper.config)
 * JettyStart: ditto
 * Remove references to now-unused jars in build.xml files
2013-06-12 13:42:38 +00:00
9d52ef5fbe Explicit check for empty values 2013-06-11 13:21:49 +00:00
34748d23be Make TUnnelCreatorConfig._expiration volatile 2013-06-11 12:25:00 +00:00
15dae0fd92 *REALLY* add the Turkish language 2013-06-10 22:46:56 +00:00
ccf6cf5e20 TR & FR translation updates from Transifex 2013-06-10 22:22:24 +00:00
zzz
36d4b20bdc * NetDB:
- Let class N routers become floodfill
   - Scale max connections for non-O floodfills
2013-06-10 14:45:45 +00:00
zzz
a70810ffae log tweak 2013-06-10 14:20:33 +00:00
zzz
526df43233 * Transports: Reduce idle timeouts to mitigate conn limit issues 2013-06-10 14:06:43 +00:00
zzz
660be7d579 Installer: Don't install Windows service by default
Causes confusion and multiple instances when users start their own copy too.
2013-06-10 14:04:58 +00:00
zzz
876109d3a5 Fix bug in unused off/len version of siphash 2013-06-10 14:02:39 +00:00
zzz
39493e0f24 final and null check 2013-06-10 14:01:52 +00:00
zzz
62413331da Fix bug in last checkin in unused code
(thx zab)
2013-06-10 14:01:06 +00:00
zzz
68d25afcba * NetDB: Prep for leasesets with different expire times
- Add new I2CP RequestVariableLeaseSetMessage
   - Send RVLSM if client supports it; handle on client side;
     disabled by default for the moment.
   - Add LeaseSet.getLatestLeaseDate()
   - Check latest, not earliest, date too far in future in KNDF.validate()
   - Check latest date too far in past in KNDF.validate()
   - Only check gateway and tunnel ID for equality in OCMOSJ lease caching to reduce churn
   - Split up KNDF.validate(RI) for efficiency, don't need to check
     signature, netid, etc. before lookups, only on store
   - Remove enforeNetID config
   - Fix major bug causing newer leasesets to be treated as older, and not stored or published
   - Increase max adjustment time of earliest lease
   - TransientDataStore cleanups
   - RouterInfo and LeaseSet equals() speedups
2013-06-09 14:42:51 +00:00
zzz
182fe900b8 * BlockfileNamingService:
- Fix bug that kept reverse index from being updated
   - Bump DB version to 3 to trigger repopulation of the reverse index
   - Make metaindex final
   - Add freelist check to the main() test
2013-06-07 17:26:20 +00:00
zzz
0fb4f6ab6a javadocs 2013-06-07 02:03:36 +00:00
zzz
ebc5e72908 remove commented out setter not supported in jetty 7 2013-06-07 02:00:17 +00:00
081b692736 debian: refresh patch 2013-06-06 17:14:44 +00:00
zzz
e1c68d22a3 - Correct errors in the specification of the BuildResponseRecord.
The first 32 bytes are not random; they are the hash of the following 496 bytes.
- Don't waste entropy on bytes we are going to overwrite in the BRR
2013-06-06 15:24:01 +00:00
zzz
b7dc8f425e * DatabaseLookupMessage: Change format for encrypted reply request
to allow multiple bundled reply tags
2013-06-05 16:44:59 +00:00
zzz
4a65676738 throw ISE if LS changed after being signed 2013-06-05 16:39:50 +00:00
zzz
000ca7c7b7 finals, javadoc fixes 2013-06-05 16:36:23 +00:00
zzz
9386270b57 Save I2CP client version for future reference 2013-06-05 16:33:38 +00:00
zzz
f0886c5f6e drop unused netdb classes 2013-06-05 16:29:49 +00:00
zzz
239cd2b744 debug setting 2013-06-05 16:28:54 +00:00
zzz
db9827779e minor improvement 2013-06-05 16:28:10 +00:00
zzz
905eed6643 cleanups 2013-06-05 16:27:29 +00:00
5711d96744 propagate from branch 'i2p.i2p' (head a89e68077114f79902a76649affe78e8ab709787)
to branch 'i2p.i2p.729' (head 11fde36281469d5ac8757bca1d7f93f679e0cb74)
2013-06-02 12:41:02 +00:00
zzz
fc2734c484 compile fix 2013-06-01 17:10:32 +00:00
zzz
75261a0ce4 * EepGet: Used cached byte array in uncompressor 2013-06-01 17:00:33 +00:00
zzz
7fc2cd9cde javadoc 2013-06-01 16:59:06 +00:00
zzz
e72a763019 volatile 2013-06-01 16:58:21 +00:00
zzz
ff20174572 * i2psnark:
- Add idle detector, reduce tunnel count when idle (prep for torrent updates)
   - Cancel CoordinatorAcceptor cleaner when halted
   - Make PeerCoordinatorSet an Iterable
   - Reduce max protocol errors to 1
   - Disable unused PeerMonitorTask
2013-06-01 16:57:50 +00:00
zzz
7d08183334 doc fixes 2013-05-31 23:30:12 +00:00
zzz
66f7505baa * configclients.jsp: Allow more hops and tunnels when routerconsole.advanced=true 2013-05-31 23:28:41 +00:00
zzz
e54465b226 * i2psnark: Fix details page on Windows 2013-05-31 23:19:43 +00:00
zzz
78c17ba353 propagate from branch 'i2p.i2p.zzz.test2' (head 4af6fe141f9ba20b1b13fc5f3417146bc96aa035)
to branch 'i2p.i2p' (head 6edfb2af359351aeb5cf198b9ec4524b2b4a45e6)
2013-05-31 22:18:00 +00:00
zzz
bfac9e398d default the wizard to 3 hops also 2013-05-31 22:16:15 +00:00
zzz
eef5661008 * NetDB:
- Fix debug netDb.alwaysQuery setting so it works again, and always
    sends to that router first (move from FNDF to IterativeSearchJob)
  - Don't reuse DLM reply key/tag
  - FloodfillPeerSelector: Note unused kbucket param in javadocs
  - Debug logging for encrypted DSRM/DSM
2013-05-31 16:51:58 +00:00
zzz
4b9a7323ad propagate from branch 'i2p.i2p' (head 04337e47a38298a4035f48b830f6a2532767bd50)
to branch 'i2p.i2p.zzz.test2' (head 052c3194bd75846075a6b64a1f96cdca6eae33b4)
2013-05-30 19:11:02 +00:00
429ccf21b6 merge of '11286a0edca5afcb38a106793f52422247ae66aa'
and 'ac917c8e012d4f9917afce11433faaf1e6f12c10'
2013-05-30 12:15:47 +00:00
4805a77d40 -2 2013-05-30 12:06:31 +00:00
3a707a143d update wrapper to 3.5.19
- Windows: Self-compiled with VS2010 in Windows 7. The icon has been
  changed from Tanuki's default to Itoopie.
- Linux ARMv6: Compiled on a RaspberryPi using gcc 4.6.3-14+rpi1,
  Icedtea6 6b27-1.12.5-1+rpi1 and stripped
- All other binaries are from the "community edition" deltapack offered by
  Tanuki.
2013-05-30 12:04:42 +00:00
b4264063f4 merge of '57c27fdf450960a6379681666a721f09aadcfbf8'
and 'f99ead1ae78724f35d845623468e9b561d36bf3b'
2013-05-30 05:07:26 +00:00
535c782b7c Allow normal themes to be used with IE >= 10 2013-05-30 01:39:07 +00:00
zzz
3833ad534f restore exotrack 2013-05-29 19:48:45 +00:00
zzz
3d42946ff5 * Console: Remove I2PDigestAuthenticator workaround, as Jetty 7.6.11 has the fix
* Jetty 7.6.11
 * Tomcat 6.0.37
2013-05-29 16:30:00 +00:00
zzz
a1afa1c1b0 * i2ptunnel: Default to 3 hops (ticket #936) 2013-05-29 16:28:28 +00:00
8fb65292cf merge of '3adba0cec6f0291ae90747ab22535290e64e6606'
and 'fd10b04ca3a6cf66e669bfad32d3011ed9f7e33c'
2013-05-29 12:49:29 +00:00
29ce84ff33 disapproval of revision '2fccba5dbe1b538679f15727fd95295842ed8839' 2013-05-29 12:48:11 +00:00
zzz
378c5a0d4e propagate from branch 'i2p.i2p' (head fd10b04ca3a6cf66e669bfad32d3011ed9f7e33c)
to branch 'i2p.i2p.zzz.ipv6' (head 6f6e16f14691f359322e665a7ad5ab65cbe1ca5e)
2013-05-29 00:22:15 +00:00
ca569038e8 parameterize 2013-05-28 10:50:51 +00:00
4092eba606 checkcerts: look for both *.cert and *.crt 2013-05-28 10:46:41 +00:00
63e71d8a3d nbi: Add override for x86 Solaris
The jbigi binaries for Pentium II and Pentium III are identical on x86 Solaris.
2013-05-28 10:46:04 +00:00
278caf72e0 propagate from branch 'i2p.i2p' (head 138d50ea0e969564bef41201439c6a99e2a45fbb)
to branch 'i2p.i2p.729' (head 74c7169e5d428b5aeaf33a401b27c33d3d37907e)
2013-05-28 08:24:22 +00:00
zzz
ff5abfb4b7 0.9.6 2013-05-27 18:17:53 +00:00
4d6b7556c3 propagate from branch 'i2p.i2p' (head dddff6de3cdc4595886d57b5eceb63747b68c7d7)
to branch 'i2p.i2p.729' (head b0eb76504d798a791853a6d269795018c853eff9)
2013-05-27 10:34:53 +00:00
zzz
e5e7dbbb58 * TunnelPeerSelector: Cleanups 2013-05-26 20:38:31 +00:00
zzz
e394d3d4c5 * DatabaseLookupmessage:
- Add support for requesting an encrypted reply
* NetDB:
  - Add support for encrypted DatabaseSearchReplyMessage and DatabaseStoreMessage
    in response to a DatabaseLookupMessage
* PRNG: Cleanups using Collections.singletonMap()
* Router utils: New RemovableSingletonSet
* TransientSessionKeyManager:
  - Support variable expiration for inbound tag sets
  - Several efficiency improvements
* VersionComparator: Add static method, use most places
2013-05-26 17:25:02 +00:00
zzz
370d9dfea1 -24 2013-05-25 12:12:46 +00:00
2a00272efe debian: read /etc/default/i2p in /usr/bin/i2prouter
This will allow overrides to be set without editing /usr/bin/i2prouter.

i2prouter may be replaced during upgrades. /etc/default/i2p will only be
changed by debconf (e.g. "dpkg-reconfigure i2p").
2013-05-24 21:30:46 +00:00
zzz
6c62c1f362 enable IPv6 geoip lookup 2013-05-24 14:11:35 +00:00
zzz
3daf287de8 GeoIPv6:
- Handle gzipped input data in merge tool
  - Add script to generate compressed data
  - Add local additions
  - Add compressed data file, generated from Maxmind data fetched 2013-05-24
  - Include data in installer and updater
  - Update Maxmind license info, now CC-SA 3.0
2013-05-24 13:46:17 +00:00
5c4c02161c propagate from branch 'i2p.i2p' (head fd0e22a44acf6b018c394cdd42d75e2d1bdb4986)
to branch 'i2p.i2p.729' (head b5c7b5601c0b0e810ca6d93c1d249fe4e330a352)
2013-05-24 12:20:50 +00:00
1bd4937a4b geoip.txt update
Based on Maxmind GeoLite Country database from 2013-05-08
2013-05-24 09:13:46 +00:00
0ac2abd5eb debian: bump changelog version to 0.9.6 2013-05-24 09:10:00 +00:00
efe5098f24 Disabling HH's server for this version because it's down and I haven't got in contact with him. 2013-05-23 20:03:09 +00:00
ba859fc9ad propagate from branch 'i2p.i2p' (head e91e8d2eb4c76d5be04e48de9b678cb39b3d0694)
to branch 'i2p.i2p.729' (head c1bf6bf9381192395513aca841d6db507384a9a8)
2013-05-23 09:14:48 +00:00
c73163f525 merge of '56506455244b72ac03b5a5cb832496e367f454b2'
and '6aeeb6555b2fb4e69f167487ca20b143939c809c'
2013-05-22 19:51:04 +00:00
bf317f61c5 Updating the certificate for reseed.info 2013-05-22 19:50:02 +00:00
zzz
9a4cd11748 * SSU: "rectify" IPv4/v6 MTUs differently due to different header size (mod 16)
* Penalize addresses w/o IP in sort
2013-05-21 21:10:23 +00:00
b1b13c41f0 merge of '9f901bf6cca59e5a24595ef80a2fbb586e259281'
and 'e31714127884dc817acde4cf97cb9c7d8cebc92b'
2013-05-21 19:04:55 +00:00
47c3a56aca Ticket 928 - prevent a CKE during write 2013-05-21 19:03:58 +00:00
8acf5f3079 propagate from branch 'i2p.i2p' (head 879c55c825160c979491a99169a173145cf1d7ad)
to branch 'i2p.i2p.729' (head a0ba4c4c989ba71043b9671a56891688be41b50d)
2013-05-21 13:45:26 +00:00
zzz
2f39574123 log tweaks 2013-05-21 13:39:43 +00:00
8b1ab4b8d2 create ./build when "ant jbigi" is run by itself 2013-05-20 20:31:18 +00:00
zzz
c0350702fd * RouterAddress:
- Deprecate some setters
  - Add warning about setCost()
  - Change cost storage from int to short
  - Cost range checks
* NTCP:
  - Republish even if only changing cost
* Transports:
  - Sort multiple peer addresses by cost, with adjustment for local IPv6 preference
  - Add default IPv6Config for ease of changing later
2013-05-19 18:36:29 +00:00
zzz
55880844a5 * SSUDemo: Adapt for NTCP testing too
* RouterAddress and RouterInfo toString() cleanups; don't cache RI in _stringified
* NTCP: Fix publishing address when host specified but interface is not
* log tweaks
2013-05-19 15:18:45 +00:00
zzz
729282c0c4 * UDPAddress: Remove dependency in console; make package private 2013-05-18 20:10:10 +00:00
zzz
d603c3b5cd - UDPAddress reduce object churn, check intro key length,
don't look for ihost3, reject ports < 1024, cleanups
2013-05-18 19:58:10 +00:00
zzz
5cda1ec703 - Handle IPv6 in too-close checks 2013-05-18 19:24:16 +00:00
zzz
ec3756a69f * SSUDemo: Use IPv6; don't use System properties 2013-05-18 18:30:38 +00:00
zzz
0b49fa98f9 * SSU: Fixes for i2np.udp.allowLocal, log tweaks, sender/receiver thread name tweaks
* Limit tunnel GW pumper threads when testing
2013-05-18 18:00:17 +00:00
zzz
226c7eb8e3 * SSUDemo: configuration fixes, delete RI on exit, log tweaks 2013-05-18 14:27:11 +00:00
addffcffcb propagate from branch 'i2p.i2p' (head 27ab673e76ed77c38d22c06c807695f792473fb0)
to branch 'i2p.i2p.729' (head d03f39c7afc2214ef8c2f81486d4abc64049e825)
2013-05-17 16:10:34 +00:00
zzz
be262c6a70 * NetDb:
- Add floodfillEnabled() to NetworkDatabaseFacade so callers don't
    have to cast to FNDF, and Dummy NDF will work
  - Remove static FNDF.floodfillEnabled()
* SSUDemo: cleanups
2013-05-17 15:11:23 +00:00
zzz
a374f00613 * Fix UDPEndpointTestStandalone:
- init context
  - Add unit test buildPacket() method to PacketBuilder
  - Fix NPE in MessageHistory
* Minor PacketPusher optimization
2013-05-16 23:08:06 +00:00
zzz
fcdf837f33 * New buildTest and prepTest targets
* Fix UDPEndpoint usage in unit tests:
  - Restore receive()
  - Handle null UDPTransport
* Fix UDPEndpointTestStandalone compilation
2013-05-16 17:57:33 +00:00
zzz
febc0a5237 RouterContext: Fix disabling client manager with i2p.dummyClientFacade=true 2013-05-16 15:35:23 +00:00
2e0a1b9a0e German translation updates from tx, updated en po files for pushing to tx 2013-05-15 22:04:43 +00:00
zzz
4fae18a719 * UPnP: Detect devices without port forwarding capability (ticket #930) 2013-05-15 14:21:15 +00:00
zzz
d9beaa7591 * NetDB: Increase floodfill count for good 2013-05-15 14:19:01 +00:00
zzz
2ba5ad558b * i2psnark:
- Adjust target piece size calculation
   - Tweak to make it easier for new peers to connect
2013-05-15 14:18:24 +00:00
de6bb12b95 debian: refresh patches 2013-05-15 13:39:24 +00:00
aa2715cced i2prouter: abort immediately if I2P_CONFIG_DIR cannot be created 2013-05-15 13:38:34 +00:00
b096834a54 installer/resources/i2prouter: various bugfixes
- Explicitly specify shell when RUN_AS_USER is set. This allows I2P to start
  under limited accounts that do not have a defined shell.
- When installing as a service, point out that I2P_CONFIG_DIR may need to be
  set. I2P_CONFIG_DIR defaults to $HOME/.i2p for the user that installed I2P
  and when running as a service this may not be desired.
  (e.g., RUN_AS_USER=i2p & I2P_CONFIG_DIR=/root/.i2p)

(The RUN_AS_USER shell problem was spotted at https://github.com/mattias-ohlsson/i2p/blob/master/i2p.spec)
2013-05-15 13:04:46 +00:00
zzz
a19140e186 GeoIPv6 2013-05-13 20:43:30 +00:00
zzz
e0b25cdcf9 remove unused method 2013-05-13 20:39:32 +00:00
zzz
e332c8bc27 FloodfillPeerSelector, ProfileOrganizer: Use 8 bytes for IPv6 check
Transports:
- Add IPv6 column on /peers
- Other minor /peers cleanup
2013-05-13 13:57:15 +00:00
zzz
7318632db9 strip scope from returned address strings 2013-05-12 15:23:02 +00:00
zzz
1b38a6478b UPnP:
- Pass device IP back in forward port callback
 - Only declare success if forwarded IP is public

NTCP: Bad bind config not fatal

GeoIP:
 - Use cached IP in RouterAddresses
 - Use both NTCP and SSU addresses
 - Skip IPv6 for now

Blocklist:
 - Add IPv6 in-memory single list
 - Limit in-memory single list size
 - Fix dup check in getAddresses()
2013-05-12 14:44:42 +00:00
zzz
6ceea60c92 addresses:
- blocklist 192.88.88.0/24 6to4 anycast
- invalidate 2002::/16
2013-05-12 00:24:01 +00:00
c1da7f778b improvements to jbigi scripts
support for Solaris (tested with Solaris 11 x86)

mbuild-all.sh:
- output correctly formatted file names (tested in Solaris x86, FreeBSD (x86 and x64) and Linux (x86 & x64))
- switch from echo -e to the more portable printf
- more error checking, comments

debian/patches: refreshed based on changes to core/c/*
libjcpuid-x86_64-solaris.so: built in solaris 11 x86 with
                             java 1.7.0_07 and gcc 4.5.2, stripped
2013-05-12 00:08:52 +00:00
zzz
fcaebb4416 * Fix UPnP address received before startListening(),
broken by isAlive() check
* log tweakws
2013-05-11 22:11:02 +00:00
zzz
0be3beb30e * SSU fixes for per-address and IPv6 MTU
* MTU.main() print all interfaces
2013-05-11 21:39:25 +00:00
3210dd8d3e propagate from branch 'i2p.i2p' (head ea73fc80c4f4d89238aaa52a9189378e40db0b32)
to branch 'i2p.i2p.729' (head 148b359103beb356be4dd6833d4e6325703917d3)
2013-05-11 20:54:22 +00:00
zzz
5e51c6abef * CSFI compile fix
* Start transports in a standard order to make testing easier
* When transports learn of interface addresses before being started, save them
  and use them at startup
* Pick SSU random port before startListening() and have the TransportManager
  pass it to NTCP before starting
* Only restart NTCP after changing addresses when necessary;
  prevent thrashing at startup (ticket #459)
* Only call rebuildRouterInfo() once at startup
* More checking of min/max SSU port config
* Invalid SSU bind config no longer fatal
* Allow "true" for ipv6 config
* log tweaks
* javadocs
2013-05-11 19:22:20 +00:00
zzz
5e953b0857 * Fixes for IPv4 and other breakage after basic testing
* Catch exception from UPnP callback
* Log tweaks
2013-05-10 18:34:02 +00:00
zzz
c76c80043f * NTCP:
- Drop NTCPAddress, just use RouterAddress
  - Drop _myAddress field, use super's currentAddress
2013-05-09 17:32:29 +00:00
zzz
3a49d6d28f * NTCP:
Move SSU address notification handling from CSFI to NTCPTransport
2013-05-09 16:18:58 +00:00
zzz
94e34ff366 RouterAddress:
- Add new constructor
 - Add add getHost() and deepEquals()
 - Compare host string, not IP, in equals()

SSU:
 - Remove all _external* fields; use _currentAddresses in super
 - Big rework of externalAddressReceived(), rebuildExternalAddress(),
   needsRebuild(), and replaceAddress() for multiple addresses and IPv6
 - Add caching in UDPAddress
 - More IPv6 flavors of utility methods
 - Remove two-art replaceAddress()
2013-05-08 16:48:39 +00:00
zzz
af27c76b2c * Only treat IPv6 addresses as valid if we have a public IPv6 address
* SSU Introduction:
 - Document that Alice-Bob RelayRequest/RelayResponse may be IPv4 or IPv6,
   but don't implement IPv6 yet.
   Changes required in IntroductionManager and PacketBuilder to send Alice's
   IPv4 address in the RelayRequest packet over IPv6, and to publish
   IPv6 introducer IPs.
 - Bob-Charlie RelayIntro must be IPv4
 - Only offer/accept relay tags as Bob or Charlie if the Bob-Charlie session is IPv4
 - Alice-Charlie communication must be IPv4
 - javadocs
2013-05-07 22:46:55 +00:00
zzz
60336c9555 - Shuffle SSU addresses before picking one
- Change address sources to enum
2013-05-07 19:49:13 +00:00
zzz
a85b7aa9f8 - Hash IPv6 addresses in IPThrottler
- CSFI: Pass TransportManager instead of CSFI to GetBidsJob;
        remove unused methods
- Add i2np.disable property for testing
2013-05-07 18:22:20 +00:00
zzz
dca5e9889a finals 2013-05-07 13:49:31 +00:00
zzz
67beebf859 * HandleDatabaseLookupMessageJob: Improve efficiency by only looking up
Hash in the netDb once, then casting to correct type.
   Log cleanups.
2013-05-07 13:37:18 +00:00
zzz
16c8a19be8 * Streaming: Throw chained IOE from streams to get correct location 2013-05-07 13:09:03 +00:00
zzz
0c03b6ba82 i2psnark: More details page fixups;
List directories first
2013-05-06 15:11:02 +00:00
zzz
228e6d7d03 fixup after prop 2013-05-06 13:30:11 +00:00
zzz
cd6376e368 remove DOS line endings in jsps 2013-05-06 13:14:44 +00:00
zzz
c26eba9693 * Console: Fix Jetty thread pool policy and thread name 2013-05-06 12:29:18 +00:00
zzz
31531ee882 propagate from branch 'i2p.i2p' (head 17371fd6f9ef94bbb60a66c6bacb6828d6a4cde5)
to branch 'i2p.i2p.zzz.ipv6' (head 065a076899a2581b4196e626f2b0654c3d39518a)
2013-05-06 11:27:10 +00:00
zzz
b7fca3af42 * Transports: Clean up internal/external port confusion (ticket #873)
- Bind SSU to configured internal, not external, port at startup
   - Use only internal ports for UPnP (getRequestedPort() fixups)
   - Don't have NTCP follow frequent SSU port changes
   - Don't use external SSU port for internal NTCP port
   - Display internal SSU port on /confignet
2013-05-06 11:24:02 +00:00
zzz
368c2073b2 - Fix multiple-detection code in externalAddressReceived()
- Synchronize tracking of last IP/port
- Don't accept IPv6 address changes from peers
- Remove unused getLocalAddress()
- Pkg private getLocalPort()

Peer tests:
 - Use only IPv4 peer for Alice and Bob in peer tests; Charlie may be an IPv6 peer.
 - Enforce IPv4 (Alice's) address inside PeerTest packet
2013-05-05 12:08:28 +00:00
7527a02c60 build.xml: refactor "noExe check" to remove duplication 2013-05-04 19:00:39 +00:00
zzz
757df8c726 prep for multiple address discovery 2013-05-03 16:34:02 +00:00
zzz
c6121cb31e Prep for multiple SSU sockets:
- Change from single UDPEndpoint to a List of UDPEndpoints
 - Move (single) receive queue from UDPReceiver to PacketHandler
 - Multiple transmit queues (one for each UDPEndpoint/UDPSender),
   select queue in PacketPusher
 - Throw exception on UDPEndpoint.startup() failure
2013-05-03 15:03:55 +00:00
5e734088e3 reduce severity of CancelledKeyExceptions
trac ticket 928
2013-05-03 13:47:10 +00:00
zzz
eecab472eb IPv6 SSU MTU adjustments 2013-05-03 11:27:21 +00:00
zzz
b71631d2ec Fixes to isPubliclyRoutable() based on IPv6 config 2013-05-02 14:12:53 +00:00
zzz
3ec78e27b4 Start new IPv6 branch
- Add new TransportUtil for getting/setting IPv6 config
- Prep for supporting multiple RouterAddresses per-transport
- RouterAddress hashCode/equals tweaks
2013-05-02 12:55:35 +00:00
6265bdf026 merge of '00acf6715c7e3d5519672b335bb833f2f88f5ca1'
and '4790dff566ce61cb8a5bfefa0c423df44a784fa5'
2013-05-02 10:19:17 +00:00
0d78ddf872 HTML fixes in readme_ar.html 2013-05-01 22:23:42 +00:00
zzz
10efecaa9c * IRC Server tunnel: Reject bad protocols immediately 2013-05-01 20:52:50 +00:00
689b045a9b html validation fixes
xmllint didn't find these problems (but tidy did).
2013-05-01 19:52:21 +00:00
7692905ba5 fix viewmtn url
(*sigh*)
2013-05-01 18:07:20 +00:00
0ef3bb1deb debian: s/UNRELEASED/unstable/ due to updated packages being built 2013-05-01 17:51:17 +00:00
4c279a192a Switch viewmtn links from zzz's to mine 2013-05-01 17:48:14 +00:00
zzz
af7eaf1f05 * BuildRequestor: Slow down build loop if we have no exploratory tunnels
(ticket #926)
2013-05-01 17:26:07 +00:00
zzz
c198e216fd susidns css tweak 2013-05-01 17:24:09 +00:00
zzz
2325bffbcb enhance main() for debugging 2013-05-01 17:23:50 +00:00
3d3e05d43d debian: don't ship jasper-compiler.jar anymore
I didn't realize that non-existent jars specified in a classpath is not an
error.
2013-05-01 13:37:15 +00:00
c62ae69fe5 debian: bump standards version, don't package 'dummy jars'
note: jasper-compiler is kept due to it being referenced at http://www.i2p2.i2p/plugin_spec
2013-04-30 23:26:42 +00:00
686aa870ea Updates to readme_ar and a CSS tweak from hamada (ticket #489) 2013-04-30 12:35:45 +00:00
zzz
ecac69134d param fix 2013-04-30 01:21:23 +00:00
zzz
8a99be1db3 move page nav 2013-04-29 22:40:49 +00:00
zzz
26f0c98ef8 * Transports:
- Initial prep for multiple addresses per style
   - Simplify NTCP send pool
2013-04-29 18:09:21 +00:00
5375e425ac minor cleanup 2013-04-29 17:55:27 +00:00
650b920e11 I2PTunnel: break out of frame when using the "test server bypassing i2p" link 2013-04-29 17:09:25 +00:00
7a43bd87c2 remove unused param (javadoc fix) 2013-04-29 17:07:08 +00:00
ebb2f1396b Meeh's patch for trac ticket 729 2013-04-29 16:54:36 +00:00
zzz
3a4ac1fc4e one more param fix; javadoc fix 2013-04-29 11:50:23 +00:00
zzz
188ff3392d * i2psnark: Support HTTP request ranges so in-browser and other http-aware media players work better.
Single range only; no multipart
2013-04-28 16:46:52 +00:00
zzz
0cf7e91475 baseline class from Jetty 7.6.10 2013-04-28 16:44:30 +00:00
zzz
609bbac8d5 * i2psnark:
- Only show lower section on first page
   - Hide peer count if not connected
   - Dir page CSS tweaks
2013-04-28 16:43:40 +00:00
zzz
f4431b8d1e more parameter fixes 2013-04-27 22:34:59 +00:00
zzz
45bf2e0715 more classes pkg private 2013-04-27 22:34:39 +00:00
zzz
d7040a23e4 page count fix and cleanups 2013-04-27 16:08:35 +00:00
zzz
6f8fe0ecac add epub mime type 2013-04-27 14:51:07 +00:00
zzz
7181e3eb87 * i2psnark: Ensure current stats and correct event delivered in announce 2013-04-27 14:34:00 +00:00
zzz
011e91140c * i2psnark: Improve page nav 2013-04-27 13:14:43 +00:00
zzz
0f1224de98 * installer: Fix DOS line endings on misc. files (ticket #872)
* SusiDNS:
   - Trim and sort config form data
   - Fix DOS line endings on config files in Linux (ticket #872)
2013-04-26 20:32:58 +00:00
zzz
2e356172d4 document ignored RouterAddress expiration (ticket #832) 2013-04-26 17:12:37 +00:00
zzz
c6bf9a7cf6 deprecate isJobActive() ticket 670 2013-04-26 16:45:52 +00:00
zzz
0816cfe273 * Plugins: Track pending plugin clients better, don't hold references,
start delayed clients from SimpleTimer2 instead of Job queue (ticket #670)
2013-04-26 16:41:09 +00:00
zzz
1cea18346b * Console: Show log location on /logs even if not opened yet (ticket #905) 2013-04-26 13:36:38 +00:00
zzz
0d4bc500ee * HTTP proxy: Verify nonce count in digest auth 2013-04-26 13:02:56 +00:00
zzz
ff313e0301 * i2psnark: Use smaller piece size for small torrents 2013-04-26 13:01:16 +00:00
85001d2622 process debian/po/es.po with update-po 2013-04-25 15:10:40 +00:00
654b240e9d translation updates
* Portuguese, Russian, Spanish, and Swedish translation updates from Transifex
* ant poupdate run for EN for submission to tx
2013-04-25 15:06:27 +00:00
85f3f5615f Allow the "AUTHENTICATE" command in IRC tunnels (ticket #904) 2013-04-25 05:27:55 +00:00
zzz
813a1981d9 * Console, TunnelControllerGroup: Don't register shutdown hook if ClientAppManager is present
* JettyStart: Fixes for use by plugins
 * RouterAppManager: Add shutdown hook
2013-04-24 15:45:15 +00:00
57fd46d3a1 Updated i2p.c default classpath with new Jetty jars, fixed separator 2013-04-24 03:53:12 +00:00
ffbbfdfc0d merge of 'a58d3f77fd66a83579a9978f954077bc0cd3dfed'
and 'c61f304e5ee2d59c51c4e700ab47e61d479257d2'
2013-04-24 03:48:35 +00:00
31bc67a1cd Added launch.properties for i2pExe based on i2pstandalone.xml and doBuildEXE target 2013-04-24 00:30:39 +00:00
ec4f2d2100 merge of '3cff53ae6e9e995199ab4c7c4ce5fa78ec417768'
and 'e824a448e5e49d646a33e7be13f648f66b1b6a47'
2013-04-24 00:01:01 +00:00
5b40914552 Removed some unnecessary code from i2pExe 2013-04-23 21:19:28 +00:00
e8025f09bd merge of '3c164e606c1ed364a6caf2b5b77abbdf819a2bc7'
and 'ebe0842bec96b1e0ed3b8e0c18d4ea05ba7cb981'
2013-04-23 19:27:52 +00:00
zzz
aa547a1610 * i2ptunnel: Block b32.i2p supercookies 2013-04-23 18:23:38 +00:00
zzz
22025b0c3a * Console: Fix Jetty digest auth bug causing repeated password requests
I2P fixes for out-of-order nonce counts.
   Based on DigestAuthenticator in Jetty 7.6.10.
   Includes the nonce count verification code from Tomcat 7.0.35.
   ref: http://jira.codehaus.org/browse/JETTY-1468 which was closed not-a-bug.
   ref: https://bugs.eclipse.org/bugs/show_bug.cgi?id=336443 in which the
   Jetty implementation was introduced.
2013-04-23 18:22:48 +00:00
zzz
4358d11191 Baseline checkin of DigestAuthenticator from Jetty 7.6.10 before mods 2013-04-23 18:19:49 +00:00
5fd63c12a8 remove an ifdef that is not relevant to I2P 2013-04-23 18:05:43 +00:00
37ff4090b4 merge of '97f6b32a68c76e9cbe8832d250144facb6aa729e'
and 'd9b5e2fc62256d9dc0d320fe593d56f0252b7f48'
2013-04-22 20:38:52 +00:00
9550de6760 disapproval of revision '4747eea80e136e04c9a239f0b6ecd9ef134c4d5a' 2013-04-22 20:37:42 +00:00
f5838ffefb add new jetty7 jars to the i2p.exe classpath 2013-04-21 20:26:41 +00:00
zzz
2a374c9b22 bump to -12 after prop 2013-04-21 16:07:08 +00:00
zzz
59ba47eca5 propagate from branch 'i2p.i2p.zzz.winfix095' (head 7d31b90b87adb2c0cfb837e5b66cc4c223766331)
to branch 'i2p.i2p' (head b004014ccfbca6241a090d5b47f1228702f4dfcc)
2013-04-21 15:57:22 +00:00
zzz
60d0b2976b * AppManager:Add HTML debug output 2013-04-21 15:41:34 +00:00
zzz
a44e75201f * Streaming: Pcap window size fixes 2013-04-21 15:40:08 +00:00
zzz
eb3de929bf Pluck of 48ac112fe938c8e960413ad60f64d313a1e5c9ac and e415e24aca895c5a1f88380b1a3946e3b49749a9
* Add new *.i2p2.de certificate
* Added backup's ressed server. (Thanks backup!)
* Temporary removing h2ik's server since he's been AWOL since 06-03-2013 and he's reseed server is down.


applied changes from 185bc62d33224812060d2f68266a029935fb710d
             through 48ac112fe938c8e960413ad60f64d313a1e5c9ac

applied changes from 1194eb12084302380b4315b20e5ae0c574ce1be3
             through e415e24aca895c5a1f88380b1a3946e3b49749a9
2013-04-21 13:47:16 +00:00
d0fa9f8f1e And back to HTTP 403 for Bad URI (we are refusing to fulfill the request) 2013-04-21 13:36:59 +00:00
a3886b0080 Use HTTP 404 for Bad URI (c/f jetty, lighttpd) 2013-04-21 13:30:22 +00:00
b872764624 Use HTTP 400 for Bad URI 2013-04-21 13:27:28 +00:00
075b1fd6f6 Ticket #891 - return "Invalid Request URI" for URIs with illegal characters 2013-04-21 03:20:43 +00:00
zzz
2430e180f3 Add EXTRA version "win1" in prep for Windows-only point release.
We don't want to bump BUILD as it could cause confusion,
and would cause all installs to attempt update via torrent.
2013-04-20 19:07:11 +00:00
zzz
0c22af9578 Convert install.xml to use new utility.jar Main.main()
(ticket #912)
2013-04-20 19:03:38 +00:00
zzz
4976e52389 Pluck of 40d650b134e48bdb0bb636227381c22217365c47
* WorkingDir: Correctly strip DOS line endings while migrating,
              to fix eepsite location on 0.9.5 Windows installs (ticket #919)

applied changes from cc74155815c98674b74cd7d9abb59704005d6b85
             through 40d650b134e48bdb0bb636227381c22217365c47
2013-04-20 18:53:01 +00:00
zzz
88afb23a8c Backport of b6b65cd637f41758bfd38692772ffade3c8cbbbc
Installer: run fixperms.bat all Windows versions except XP/2003.
Wasn't being run on Windows 8.
2013-04-20 18:46:27 +00:00
zzz
a7a0ca87c9 Branch from 0.9.5 release.
Implement new Main wrapper class for utility.jar, to
work around izpack ticket #162 http://jira.codehaus.org/browse/IZPACK-162
which prevents us from specifying a main class as it fails on
Windows installations when a full path including a drive letter is specified
(ticket #912)
2013-04-20 18:42:55 +00:00
7371718afc Installer: run fixperms.bat all Windows versions except XP/2003. 2013-04-19 13:41:56 +00:00
zzz
1e5ffe636f * Updates:
- Notify manager about all available update methods at once, so the priority
     system works and it doesn't only update via HTTP
   - Start router update download at startup if available
   - Only check plugins when core version increases, not decreases, so we
     don't update plugins when downgrading
   - Limit length of URL shown on summary bar
2013-04-19 11:49:22 +00:00
zzz
ca1e8d09cc debug log 2013-04-19 11:47:05 +00:00
zzz
ddc5e2c23f * WorkingDir: Correctly strip DOS line endings while migrating,
to fix eepsite location on 0.9.5 Windows installs (ticket #919)
2013-04-19 11:44:57 +00:00
zzz
3086fd3ce0 * LogManager: Add support for saving properties added in recent releases 2013-04-19 11:42:32 +00:00
zzz
5ea2832ae0 * AppManager: Register jetty, console, and SAM with manager 2013-04-19 11:41:35 +00:00
zzz
5cb449efed * i2psnark: Disable spellcheck in more form fields 2013-04-19 11:40:36 +00:00
46f8344d30 Add new *.i2p2.de certificate 2013-04-18 15:51:17 +00:00
zzz
b370fe6838 * SusiMail: Fix loading of Jetty classes 2013-04-18 15:25:33 +00:00
zzz
d6b28a4eb1 * i2ptunnel: Set target=_top in all external links to break out of console iframe 2013-04-18 15:24:46 +00:00
zzz
72ead2bbcc * i2psnark: Fix params after P-R-G 2013-04-18 15:24:01 +00:00
zzz
648701afdd * Eepsite: Fix jetty.xml configuration of ThreadPool 2013-04-17 21:06:52 +00:00
zzz
389f540f44 less dots 2013-04-17 21:04:21 +00:00
ceda25fb36 added browser http proxy setup to initial news 2013-04-17 18:21:55 +00:00
zzz
c4e2019657 * SusiDNS: Set target=_top in all external links to break out of console iframe 2013-04-17 17:06:34 +00:00
zzz
b64b2629b9 * i2ptunnel: Fix default form action (ticket #882) 2013-04-17 17:04:34 +00:00
zzz
9443a96f0c * Systray: Better detection of 64-bit Windows (tickets #756, #912)
- Don't even instantiate systray unless on 32-bit Windows
2013-04-17 14:49:25 +00:00
zzz
6af73d087b * Console: Better handling of missing font for graphing (ticket #915)
- Remove unused imports
2013-04-17 14:45:24 +00:00
zzz
c61f2af8b3 * SAM: Implement ClientApp interface (ticket #347) 2013-04-16 21:07:00 +00:00
zzz
a3aee79e9c * ClientAppManager: Add method to look up clients by class and args
* Console: Implement stopping of clients using the ClientApp interface
            (ticket #347)
2013-04-16 14:59:18 +00:00
7d0f626fd5 remove mime types already set by jetty 2013-04-15 21:41:53 +00:00
zzz
e34a98620c merge of '186e5e48c613c85b8e11c61ec920a40837bfae8e'
and '3449c389b42e40b9c9a07848a868bb745c5c4540'
2013-04-15 20:59:28 +00:00
zzz
6c32a05378 2nd instance bootstraps DHT from 1st instance 2013-04-15 20:56:10 +00:00
ec4c830c09 i2psnark: update mime types 2013-04-15 20:28:22 +00:00
zzz
9e5d809650 trim form values 2013-04-15 20:23:39 +00:00
zzz
1746a81234 update servlet base after changing dir 2013-04-15 18:54:47 +00:00
zzz
efe7a7536d * i2psnark:
- Add data directory configuration to GUI (ticket #768)
   - Add page size configuration to GUI
2013-04-15 18:39:59 +00:00
zzz
11dd7f6b8c * Console: Move from deprecated Jetty SSL methods to SslContextFactory 2013-04-15 15:53:29 +00:00
zzz
e29bb5b88b * i2psnark:
- Mime type fixes
   - Remove web classes from jar
2013-04-15 12:12:35 +00:00
zzz
57b794f72a * Jetty logging: Fix logging using I2PLogger class;
log ignored messages at debug level
2013-04-14 14:02:43 +00:00
zzz
8bfe3f632e * i2psnark:
- Set unique tunnel nickname for additional instances
   - Increase page size to 50
   - Restore 1-arg SnarkManager constructor for compatibility
   - Add note about DHT file w/ multiple instances, to be fixed
   - Log tweak
2013-04-14 14:00:47 +00:00
zzz
21e47e61f0 * Console: Add /graph support for bw.combined, consolidate
rendering code (ticket #890)
2013-04-13 12:13:55 +00:00
zzz
49cc6b5100 * i2psnark:
- Limit number of torrents displayed; add previous/next page buttons
   - Only register one instance with UpdateManager
   - New icons from famfam/silk, same license
2013-04-13 12:12:22 +00:00
10a42c8b0d debian: add new jetty7 jars to package 2013-04-13 00:23:24 +00:00
zzz
f59ea790ca Javadoc fixups for Jetty 7 2013-04-12 13:53:54 +00:00
zzz
28f1170d95 history for prop, -1 2013-04-10 17:39:27 +00:00
zzz
8eb7cf7bae propagate from branch 'i2p.i2p.zzz.jetty7' (head 12e512b792594fe6a291ad3ab303fca30228391b)
to branch 'i2p.i2p' (head f3775dd82af85ba335258bd9f0fc06131a1daaa9)
2013-04-10 17:24:11 +00:00
zzz
1be0695a21 remove extra semicolon 2013-04-10 17:23:43 +00:00
zzz
65480456cd - I2NP: Ignore unused 7 bits of the Database Lookup Message,
so we can use them later
2013-04-10 17:22:51 +00:00
zzz
5962577b53 - I2NP: Ignore unused 7 bits of the Database Lookup Message,
so we can use them later
2013-04-10 17:06:32 +00:00
zzz
1222776da3 tweak proxy error page 2013-04-10 17:04:07 +00:00
zzz
13633a0532 remove debug id 2013-04-10 17:03:15 +00:00
zzz
1eda9e9053 set ethertype to IPv4 2013-04-10 17:01:54 +00:00
zzz
2557a0bd84 increase threads 2013-04-10 17:00:54 +00:00
e1c533e9de Fixed path to start.ico 2013-04-08 22:44:58 +00:00
zzz
bb8183d0ee - Backup up more Jetty 6 config files before migration
- Try to avoid zip file closed exceptions
  - Fix jetty.xml, switch from deprecated WebAppDeployer to WebAppProvider
2013-04-08 15:29:02 +00:00
zzz
9478a84af7 - Switch from Jetty 7.6.8 to 7.6.10; check in jars
- Re-enable web downloads for easy jetty updating
  - Add dependency checking in apps/jetty build
  - Other build.xml tweaks
2013-04-07 15:01:02 +00:00
zzz
56eba28a50 propagate from branch 'i2p.i2p' (head d30ab8d5835ca55d63913342f0d28169c88e5d77)
to branch 'i2p.i2p.zzz.jetty7' (head fdd1d82c4bb26ed934170c34dd803c342a183a91)
2013-04-07 13:33:13 +00:00
zzz
f8d323bc7b propagate from branch 'i2p.i2p' (head 5737078c5993e2fcf73520cc610a71125b12520b)
to branch 'i2p.i2p.zzz.jetty7' (head a93a47d79b1db119ec8c62b46a4a4e226043bd17)
2013-04-07 13:20:34 +00:00
8857fe5550 Set defaults based on installer/i2pstandalone.xml and build.xml/doBuildEXE 2013-04-04 22:25:05 +00:00
45a38a5425 Only use original argc/v if there are arguments, otherwise use launch.properties or defaults 2013-04-04 22:15:21 +00:00
7f471910ed Marked Windows-specific code in preparation for a cross-platform binary 2013-04-04 21:51:57 +00:00
f6190dd82d Get a simple I2P.exe working 2013-04-03 01:55:02 +00:00
51f072cc72 Migrated limewireExe to i2pExe 2013-04-03 01:52:14 +00:00
b65898e0dd Ticket #741 - Added limewireExe source 2013-04-03 01:39:33 +00:00
7b753c9d30 merge of '48ac112fe938c8e960413ad60f64d313a1e5c9ac'
and 'c4b1087c95c82bb9dde50c078a0c2c0e86c562bc'
2013-04-02 22:46:25 +00:00
dev
dc8d70102c merge of '185bc62d33224812060d2f68266a029935fb710d'
and '381b15133084a1b3e1c37f66a62a768fedefd3d4'
2013-04-02 22:12:57 +00:00
dev
2cbb157f2d add lists.i2p2.i2p 2013-04-02 22:10:08 +00:00
2c47c21038 * Added backup's ressed server. (Thanks backup!)
* Temporary removing h2ik's server since he's been AWOL since 06-03-2013 and he's reseed server is down.
2013-04-01 13:18:47 +00:00
5904d5764c Debian: update changelog 2013-03-31 12:51:20 +00:00
d5443a34ea Debian: explicitly set permissions in postinst on /etc/i2p/wrapper.config (fixes #906) 2013-03-31 12:47:53 +00:00
af79b74c8c checkcerts.sh: cross platform support on *NIX
- function to convert dates to Julian to perform date calculation if GNU date is
  not present.
2013-03-30 21:52:01 +00:00
bfc327833c checkcerts.sh: add some support for non-Linux systems
Date computations as performed in this script require the use of GNU date,
which is only available by default on Linux systems. With this check-in we
explicitly check for the existence of GNU date before continuing with the date
calculations.

Previous versions of this script relied on 'certtool' to print the expiration
dates but certtool isn't available by default on non-Linux systems either. The
previous check-in added support for using OpenSSL, retaining the old behavior
on non-Linux systems.

(Also a re-arrangement of the date warning logic)
2013-03-30 14:24:59 +00:00
427abb081c remove debug text 2013-03-30 02:26:37 +00:00
6992090cda various updates to checkcerts script
- add support for 'openssl'
- parse expiration date, failing if expired or if expires within 30 days
- warn at 60
2013-03-30 02:22:23 +00:00
zzz
9b0c481525 0.9.5 2013-03-08 13:03:50 +00:00
zzz
77cfe0be01 graphs.jsp: Fix saving settings (ticket #857) 2013-03-03 20:32:02 +00:00
041da814d2 merge of '4482eec8563d6ed220c2042b18fc09164aaa4404'
and 'ce2de3b5c7bc1fcd077ff9d6327eaf24758d2a13'
2013-03-03 18:42:46 +00:00
7b7f3ea025 update geoip based on the Maxmind GeoLite Country database from 2013-02-19 2013-03-03 17:22:09 +00:00
53d5c0854f removing email address per request 2013-03-03 17:15:06 +00:00
b2f1e78d62 Temporary removing ju1c3d's reseed server until it's up and working fine on the new system. 2013-03-03 17:08:26 +00:00
9ba17d2e90 French, German, Norwegian, Polish, and Portuguese translation updates from tx 2013-02-22 13:20:41 +00:00
cc18f62fb5 Add new syndie hostnames 2013-02-13 20:50:05 +00:00
8950cc48a6 Flag of Curaçao, courtesy of David Benbennick, released into the public domain 2013-02-13 20:47:29 +00:00
zzz
51edaed610 NetDB: Randomize delay before floodfill store verify 2013-02-12 14:58:52 +00:00
zzz
3a2accdebb * Update: Bump torrent update to 3% of routers 2013-02-10 16:38:09 +00:00
zzz
6cef4f90e1 * Logs: Again, fix setting log filename (ticket #805) 2013-02-10 16:37:06 +00:00
zzz
f5e416d6bf Wrapper 3.5.17 compiled on Raspberry Pi (ticket #826)
GPLv2
binaries stripped

gcc (Debian 4.6.3-12+rpi1) 4.6.3

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-1+rpi1)
OpenJDK Zero VM (build 20.0-b12, mixed mode)

Processor	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 697.95
Features	: swp half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2708
Revision	: 0002
2013-02-10 15:02:04 +00:00
zzz
5eba38a24e * NetDB:
- Encrypt DatabaseLookup messages out exploratory tunnels
     when we already have the RI of the ff
   - Don't use multiple routers from the same /16 in lookups or stores
2013-02-09 19:29:08 +00:00
zzz
7f5d6ca1c7 javadocs 2013-02-09 19:28:12 +00:00
e4318e95a5 German, Polish, Portuguese, Spanish, and Swedish translation updates from Transifex 2013-02-06 02:39:44 +00:00
eaa86664bd Fixed SOCKS mapping terminology, bumped history 2013-02-04 11:29:30 +00:00
5a1053e4fb Allow any domain name to be mapped to an IP
This enables .onion domain names to be accessed by clients that are being
routed through the SOCKS tunnel by e.g. proxychains (assuming that the SOCKS
tunnel has been configured with a SOCKS outproxy that exits into Tor). If the
.onion is not mapped to an IP address, the client would attempt a DNS lookup
which would of course fail to find the .onion.

Clearnet domain names can also be mapped to IPs, but this is irrelevant as DNS
lookups work through SOCKS (via the configured outproxy).
2013-02-04 11:21:26 +00:00
0052ebf334 Set SOCKS5 addressType to AddressType.DOMAINNAME on a successful mapping 2013-02-04 11:13:23 +00:00
d9f7b24cc7 use short name for diftracker 2013-01-31 18:18:48 +00:00
67ca0a4d20 Norwegian translations:
- enable Bokmål in router
- add to tx config
- add Bokmål translations from transifex
2013-01-31 17:51:01 +00:00
fea91a35f6 fix Norwegian translation, add to tx config 2013-01-31 16:42:57 +00:00
3214bc4f81 merge of '4e5a2d2f78b9a7603ece4e4b54720e83e062cbf4'
and '8bbaf8414a2475919844450aad53b325ee0f7e84'
2013-01-31 15:40:15 +00:00
zzz
a0befe59c3 * EepGet:
- Fix URL when not proxied to conform to RFC 2616
   - Add port to Host header to conform to RFC 2616
2013-01-31 12:54:23 +00:00
5f614db59b Adding a new reseed host. http(s)://netdb2.i2p2.no
Using certificate from cacert.org

Thanks to ju1c3d, ju1c3d@mail.i2p
2013-01-30 15:34:28 +00:00
cc4b03604d Adding Norwegian Bokmål translation to i2ptunnel. 2013-01-29 18:14:34 +00:00
zzz
573692dbdf * Console: Catch IllegalStateException storing nonces (ticket #852) 2013-01-29 13:48:00 +00:00
zzz
78dcfd830c * Translations:
- Use JVM language name if available
  - Correct Estonian language code from ee to et
2013-01-29 13:44:36 +00:00
zzz
95d0dc0419 fix BuildHandler NPE from previous checkin 2013-01-28 12:50:04 +00:00
zzz
9247dc898c * BuildHandler:
- Add early throttler based on previous hop
   - Limit concurrent next-hop lookups
2013-01-27 16:24:29 +00:00
zzz
bd900d8d55 increase ff count 2013-01-27 16:21:09 +00:00
zzz
a9eb48c4c6 javadoc 2013-01-27 16:20:26 +00:00
zzz
8afe7c261f * RandomSource: Seed from SecureRandom too 2013-01-27 16:18:56 +00:00
zzz
543870ff02 change injection errors to warns 2013-01-27 16:17:29 +00:00
92707efe8a history bump 2013-01-24 00:18:11 +00:00
42040eb6c8 Added IP -> I2P URL mapping support to SOCKS client tunnels
To use, add custom options to the SOCKS client tunnel like:

ipmapping.127.12.12.12=stats.i2p

Then save and restart the tunnel.
2013-01-24 00:14:03 +00:00
zzz
18e369bcf4 - Use servlet path everywhere, so the war can be renamed
- Use servlet path as base for config file and data directory names,
    so we may have multiple instances running together
  - Don't override service(), use doGet() and doPost() instead
2013-01-23 22:44:52 +00:00
zzz
4ba8f02f59 * Eliminate Jetty dependencies in i2psnark for good.
Required due to webapp classloader changes in Jetty 7,
  we can no longer access or extend Jetty classes.
  - Extend javax HttpServlet instead of Jetty's DefaultServlet
  - Implement BasicServlet to replace functions of DefaultServlet
  - Add MimeTypes implementation to add to servlet's defaults
  - Add local mime.properties file, remove checks in I2PSnarkServlet for those
    we were missing
  - Eliminate all use of Jetty utility classes including MimeType, Resource,
    Buffer, Cache, URIUtil, ...

TODO:
  - Use servlet path everywhere, so the war can be renamed
  - Don't override service()
2013-01-23 20:26:50 +00:00
a7fc8bdf53 Added a link to the summary bar for mobile users on /home 2013-01-21 08:38:00 +00:00
3710346764 history 2013-01-21 06:23:19 +00:00
bb0d2ef17c Added User Agent string for Opera Mobile
On tablets the UA is "Opera Tablet" so tablets will use the desktop console.
2013-01-21 06:01:42 +00:00
d5a870226c Added option to /configui to force the mobile console to be used 2013-01-21 05:59:53 +00:00
34aa3ac207 Updated history.txt 2013-01-19 03:51:42 +00:00
7d38041d23 Tweak so Android tablets use the normal routerconsole 2013-01-19 03:46:38 +00:00
e643d0a086 Fixed up mobile view of routerconsole with a mobile.css in each theme 2013-01-19 03:42:54 +00:00
dcd655fa4b * Translations
- Hungrarian, Italian, Portuguese, Russian, and Swedish translation updates
    from Transifex
  - Refresh of **/messages_en.po
2013-01-17 13:14:08 +00:00
zzz
f57f49c3c5 propagate from branch 'i2p.i2p' (head f33e0980fd48ba4acda12d2079f2a4834a710ae4)
to branch 'i2p.i2p.zzz.jetty7' (head bd1a64f7262ad5bbea3529675f1f055b9ad257a8)
2013-01-13 12:38:05 +00:00
zzz
4f146772e7 * I2CP: Failsafe check for delivery job requeueing forever (ticket #819) 2013-01-12 18:18:17 +00:00
zzz
083dffe8ed try again to prevent IllegalStateException on Java 5 2013-01-12 18:17:31 +00:00
zzz
c43a73e756 log and javadoc tweaks 2013-01-12 18:16:38 +00:00
zzz
0c94680a45 * NetDB: Split up files into subdirectories 2013-01-12 18:14:51 +00:00
zzz
832c0ff683 * SAM: Force i2cp.messageReliability=None (ticket #819) 2013-01-12 18:13:59 +00:00
zzz
95b4fe7378 * jobs.jsp: Add table of pending jobs 2013-01-12 18:13:19 +00:00
zzz
ed12bcefdb * EepGet:
- Fix format of last-modified header to use strictest RFC 822
  - Stop immediately if socket connection to proxy fails
  - Don't forget lastModified/etag headers after redirect
  - Note SocketTimeout API breakage for Syndie
2013-01-12 18:12:35 +00:00
41af00a7d6 don't run gettext if 'require.gettext' is set to false 2013-01-10 16:51:06 +00:00
e34cd0ba3f merge of '27711f734eca9313f7e0742dc1a6df964b744b86'
and '4d27e2149e5bb50280599426f3884dfcc04f920a'
2013-01-10 15:09:20 +00:00
18664d39f3 add bumpBuild target 2013-01-10 14:43:15 +00:00
zab
680c31b843 Fix/update/refactor InboundTest 2013-01-07 19:03:30 +00:00
zab
ba5005c467 Fix OutboundGatewayTest
Refactor as much as possible into GatewayTestBase
2013-01-07 18:38:13 +00:00
zab
7a8fde6637 Refactor common code between Inbound and Outbound Gateway tests in a base class
OutboundGatewayTest still fails, investigating...
2013-01-06 23:02:10 +00:00
zab
973e0e7448 Fix/update InboundGatewayTest 2013-01-06 21:42:15 +00:00
101702552f re-enable DataHelperTest since the jenkins test was a success 2013-01-06 02:41:42 +00:00
8aa7433a80 merge of '2246f1b81c19ddc2c058e68870f1445b9cca1598'
and '956cf5bff87f174141628efbad07e028e30fc4c9'
2013-01-06 02:24:09 +00:00
e7d48f1d3c - s/classpath/javac.classpath/ I'm fairly sure that this must have been added
in error.
- add jenkins.cobertura.report target. The jenkins plugin couldn't find the
  sources, so I'm hoping this helps it out.
- add debug lines cobertura needs
2013-01-06 02:22:10 +00:00
zab
7e7a68a61d fix BandwidthLimiterTest 2013-01-05 23:21:04 +00:00
zab
c558f5af85 Update FragmentTest to expect an IAE.
Update {Batched}FragmentTest to JUnit 4
	Use a single instance of I2PAppContext
2013-01-05 23:08:00 +00:00
zab
a33457ff7f Rename BuildMessageTest so it doesn't match the JUnit wildcard.
Add note that the test (most likely) needs to be re-written fom scratch.
2013-01-05 21:52:33 +00:00
16be8deb00 regex tidying
(fixed version of revision 5135b9e8fb88986fdc130971ebe75c3ab0665dcc)
2013-01-05 20:12:35 +00:00
dfcf1c1575 disapproval of revision '5135b9e8fb88986fdc130971ebe75c3ab0665dcc' 2013-01-05 16:22:28 +00:00
d1dc7cd269 tidy up version # regexes 2013-01-05 16:18:41 +00:00
88c2b3da58 merge of '3c30547c23e641e3cc7a7927d956997c0187aa5c'
and 'd0f6b1e4566b9690b60fa0fb686aadc3ad629a31'
2013-01-05 00:31:14 +00:00
0bfd747c95 Exclude from router cobertura anything that isn't net.i2p.* 2013-01-05 00:30:37 +00:00
zab
d150403395 Rename a non-junit test so it doesn't fall under the junit wildcard 2013-01-04 23:44:26 +00:00
zab
1939aaca93 Fix test and make it actually test something 2013-01-04 20:57:18 +00:00
zab
d0cb714f69 add installer/resources to the classpath for eclipse and junit task
do not use hardcoded filesystem path in junit test 
	(test still fails for different reason)
2013-01-04 20:17:35 +00:00
zab
54a35df9e9 merge of '3cd63a1366e2ca171fb8c348927047e0c0b7393d'
and 'a461c087d600d3fa0b5da2085d1dd97aff721d44'
2013-01-04 19:31:35 +00:00
zab
b1a29c9514 enable more output for easier debugging of tests 2013-01-04 19:28:37 +00:00
af21093012 javadoc fixes 2013-01-04 19:20:08 +00:00
zab
cea1b08a98 Update javadoc to specify non-null payload for datagrams 2013-01-04 18:46:00 +00:00
zab
c7f1329c04 get rid of two tests that don't make sense 2013-01-04 18:38:32 +00:00
a02f9313ff fix javadoc-test target 2013-01-04 02:47:10 +00:00
5a7d975ed6 speed up datahelper test (thanks zab) 2013-01-04 01:17:29 +00:00
455618dc26 merge of '9a6aaa59a51ac9c26f4a1a1a1db90feb17819a22'
and 'b5f4c5514ac1fbd9f7b61180c7874ddcac422c11'
2013-01-04 00:36:02 +00:00
bddfc5b526 Turn BuildMessageTest into a JUnit TestCase 2013-01-04 00:33:03 +00:00
zzz
bcbf7e6270 - Speed up crypto tests, reduce memory usage, use common context 2013-01-04 00:31:28 +00:00
83886cdcfb merge of '9cd70f6c6a5d8100782f92785a0082b09248e6b0'
and 'e6b29f8caf5730bada39b1296ff3eb3b5f363f0e'
2013-01-04 00:20:03 +00:00
zab
dbfb4cbbbb Remove test that does nothing anyway 2013-01-04 00:19:08 +00:00
fe477f0a0b merge of '96801f1975a618da3caa8943bc186ad78449ee94'
and 'fa2d2cb834d3792b816984bc44da70ad903e40e8'
2013-01-04 00:10:56 +00:00
dd24ab6f70 Create a new RouterContext for net.i2p.router.tunnel tests (can't cast I2PAppContext) 2013-01-04 00:07:15 +00:00
zab
47592377f2 Make test expect an UOE 2013-01-03 23:58:18 +00:00
zzz
e3ecc42e88 - Fix delivery instructions test 2013-01-03 23:13:47 +00:00
999b8d3c68 merge of '7b3e55d16589c2194327677322fca98e2ce056ad'
and '85eec7bc28af462eca4a83562771af846cb2b91c'
2013-01-03 22:58:46 +00:00
8e5c26270e cross platform unit test hostname faking not relying
on external tools

The original method failed on Archlinux. This should work everywhere.
2013-01-03 22:58:21 +00:00
zab
e67aa430cd merge of '616d36fc49bb03f28c56540cdd475e2f7e9e3663'
and '7a64fceed49d038439e050a81f45b1e6abb2ad19'
2013-01-03 22:55:56 +00:00
zab
8e57a2e386 Fix most of the test cases, reduce the runtime of the test
using LogManager.flush()
2013-01-03 22:55:40 +00:00
zzz
d28184ce72 - Test data strucure equals() for everything except I2CP 2013-01-03 22:05:10 +00:00
94827d6d55 merge of '4e4692d229faefe5a1a891b9e7e89302117d2970'
and '90cf0bde41018fcb22d53d168c8d6f56294d8660'
2013-01-03 20:12:47 +00:00
6c676869a0 change an ant 1.8ism to one supported in 1.7 2013-01-03 20:12:18 +00:00
zab
2c8f2ae404 Change the Rate.equals(..) method to work for Rates w/o a parent RateStat
Change the RateStat.equals(..) method to work with deserialized RateStats
	Update and fix the JUnit tests for both
2013-01-03 20:08:54 +00:00
3eb00c526d remove extranous reference (that I added) to junit; fix a bit more of the
router tests
2013-01-03 19:36:39 +00:00
zzz
83e25ef26c merge of '78c1ef42cf8e75cb54df7c34644855f54428565c'
and 'd37cf6a7b286442b886dbfd6f74ac948eee5b3fc'
2013-01-03 16:11:29 +00:00
zzz
8f4f7a677f - Fix junit path typo
- Fix several router unit test compile errors.
  They all compile now.
- Move SubmitMessageHistoryJob to i2p.scripts, it is not a unit test
2013-01-03 16:10:49 +00:00
b54c5f8545 renable slow tests
these tests are only slow with cobertura enabled
2013-01-03 14:15:56 +00:00
zzz
17ac0e4b5f - Fix last three I2CP message junit test failures caused by the removal of equals().
- Fix RouterAddress test failure caused by removal of expiration
2013-01-03 12:50:28 +00:00
zzz
4730690978 - Fix most of the I2CP message junit test failures caused by the removal of equals().
Still a few left where the test is overridden.
- Fix DestLookupMessage test failure caused by missing data.
2013-01-03 12:13:48 +00:00
9d77cd7761 allow setting hamcrest and junit locations with properties
Defaults to the ant library path (the previously hardcoded path) if not set.
2013-01-03 11:53:08 +00:00
5b81a1a6d5 catch unset classpath prop 2013-01-03 10:43:31 +00:00
f788ef97de remove cobertura.ser when ant clean is called 2013-01-03 02:43:51 +00:00
zzz
e4ec046363 - Add separate top-level junit.test and scalatest.test targets, so
you can run whichever you have the libs for
 - Add router to test target (if we don't run it, it won't get fixed)
2013-01-02 23:46:14 +00:00
cdc3682baa Fixes to JUnit tests under net.i2p.router.transport 2013-01-02 22:05:12 +00:00
dae66d7f73 Updated JUnit tests in net.i2p.router.tunnel - almost all bugs fixed 2013-01-02 21:29:54 +00:00
d6d1b51970 Set up build.xml test harness to run the JUnit4 tests as well
You will need junit4.jar, hamcrest-core.jar and hamcrest-library.jar in your
Ant library path (probably /usr/share/ant/lib)
2013-01-02 21:06:59 +00:00
zzz
6f301f01dc * Logs: Fix setting log filename (ticket #805) 2013-01-02 14:12:02 +00:00
zzz
71607fff2d javadoc 2013-01-02 14:02:02 +00:00
zzz
6ed602309f - Local mods and wrapper for SipHashInline
- Convert SessionTag.hashCode() to SipHash to prevent collision attacks
     in the SessionKeyManager; cache for speed
2013-01-02 14:01:29 +00:00
zzz
20cc48cd87 SipHash inline implementation and junit test, unmodified.
As pulled from https://github.com/nahi/siphash-java-inline
Last commit was 5be5c84851
2012-11-06

Copyright 2012  Hiroshi Nakamura <nahi@ruby-lang.org>
Apache 2 license

25%-35% faster than reference implementation in my tests.
2013-01-02 13:54:49 +00:00
zzz
f2331b0603 * New getASCII() for use in findbugs cleanups for 7-bit strings
This code was supplied by zab
2013-01-02 13:31:41 +00:00
zzz
8c2ddec400 add shortcut in equals() for speed 2013-01-02 13:27:24 +00:00
zzz
c8e12b9ac9 * Transport: Fix early NPE (ticket #824) 2013-01-02 13:23:23 +00:00
zzz
452d1d01b8 * SAM: Synchronize dissector 2013-01-02 13:21:45 +00:00
zzz
e375ffe8f1 * I2CP:
- Fix leak if nonce = 0 but reliability != none
   - More work on failure codes (ticket #788)
   - Fix race with _finished indication in OCMOSJ
2013-01-02 13:19:40 +00:00
zzz
2ea9fc5d61 I2CP: Remove static logs; Fix thread ID counter 2013-01-02 13:17:02 +00:00
zzz
912e29f8af - Remove unused equals() methods for I2CP message classes,
most did not have hashCode() implementations.
     These are never used as keys in a Set or Map or checked for equality.
     Fixes findbugs issues (ticket #379)
2013-01-02 13:13:35 +00:00
zzz
72054a7d30 reorder synch and loop 2013-01-02 13:08:34 +00:00
ab2c5ef9bb postinstall: delete both OSX scripts if we're not on OSX 2013-01-01 18:26:08 +00:00
ab0b4936ec refresh patch 2013-01-01 18:22:18 +00:00
2dd1aaab63 Update wrapper to v3.6.17 (ticket #826) 2013-01-01 10:39:08 +00:00
c05cd07ff7 Fixing two potential NPEs found by findbugs 2013-01-01 00:02:18 +00:00
adfc22499c Remove outdated javadoc reference & explicitly specify locale 2012-12-31 21:45:49 +00:00
44498ca8c7 installer: extra checks & add to findbugs target 2012-12-31 18:00:42 +00:00
a40566eefb improve installer javadocs; add minimalist package.html 2012-12-30 00:36:14 +00:00
zzz
77f0dd653a - Fix handling of duplicate participating tunnel IDs
- Reduce chance of generating duplicate IDs for our tunnels
   (ticket #812)
 - Stat cleanup
 - Comment out effectively unused countProactiveDrops()
2012-12-29 13:40:55 +00:00
zzz
8ed70084db catch iterator exception on java 5 2012-12-29 13:31:31 +00:00
zzz
2f4e3862e3 cleanups 2012-12-29 13:23:57 +00:00
zzz
667393e8cf * Javadocs: Fix javax links; add installer utils 2012-12-29 13:19:09 +00:00
zzz
c6dd7b4cc5 * i2psnark: Redirect after post
Button spacing on config form
2012-12-29 13:17:27 +00:00
db0501f31b explicitly specify encoding 2012-12-29 00:10:38 +00:00
3be5002f15 ant debian-tarball target: set .sh to mode 755 2012-12-28 21:17:56 +00:00
4389f277d6 * windows installer fixes / improvements
- move deprecated installer-only classes (Exec, Delete, and Copy) from
    i2p.jar into installer/
  - replace installer/resources/fixpaths.cmd with an improved method in java
  - combine the installer-only utility classes into a single jar and call the
    classes from within izpack
2012-12-28 20:59:17 +00:00
cf10cb1c09 Fixed out-of-date references to wrapper.jar and jbigi.jar so that the justBOB target works 2012-12-27 11:59:48 +00:00
zzz
38214cf5be * I2CP:
- Prep for delivery of detailed failure codes to the client (ticket #788)
   - Store session ID as an int instead of a long
   - Clean up some duplicate createRateStat calls (ticket #787 comment 2)
   - Other optimizations, cleanups, final
2012-12-26 14:29:49 +00:00
zzz
f4740d2639 * Stats: Clean up some duplicate createRateStat calls (ticket #787 comment 2) 2012-12-26 14:22:30 +00:00
zzz
48309c0f6d * NetDB: Split routerInfo files into subdirectories, disabled for now,
enable with router.networkDatabase.flat=false
2012-12-26 14:19:52 +00:00
zzz
cf1f42ebf8 * Tunnels: Catch rare BuildExecutor IAE only in Java 7 (ticket #811) 2012-12-26 14:16:49 +00:00
zzz
7c8bb0ba69 comment out main 2012-12-26 14:15:19 +00:00
zzz
14eedaa029 * i2psnark: Create torrent form tweaks 2012-12-26 14:14:43 +00:00
73e25aad76 * Add EOL modifications
- set eol for certain files in installer targets (since editing *.config and *.xml in windows is practically impossible without an externally installed editor such as vim or notepad++ and of course we want people to be able to read the licenses if they desire...etc.)
  - try to prevent user error by ensuring that the proxy/*.ht files have eol set to crlf in the prepConsoleDocs target
2012-12-25 00:13:32 +00:00
f3f4529d84 use ant features instead of Unix commands where possible in the installer2app target. Also make izpack2app a settable property 2012-12-24 22:09:10 +00:00
5dbe6294fb debian-binary: don't assume that noAutoDebchange will be set by people that know that debian/changelog needs to be set 2012-12-24 19:55:16 +00:00
91c9bfed3a add additional arm types to the 'noExe' condition & add reference the cybergarage javadocs revision in history.txt 2012-12-24 19:46:40 +00:00
420ccad91b javadoc fixes for the upstream cybergarage UPnP library. Upstream ticket #3598391 has been filed for this issue. 2012-12-24 19:44:25 +00:00
1d0f8b4c6d Add missing shebang lines to bundle-messages scripts 2012-12-23 17:35:07 +00:00
3396626a0c * new ant targets
- trimMtnRev: create a new property with the revision trimmed to  8 characters.
  - getExtendedVersion: create a new property that includes the full version with the shortened MTN revision tacked on
  - debchange:  automatically update debian/changelog with the I2P version. Called by the "debian" target unless the property noAutoDebchange is set.
  - debian-tarball: export i2p.i2p branch to a new directory, remove the binaries like jbigi and launch4j, and create a tarball.
* move packages created by "ant debian" to ${basedir}
* add debian/changelog to .mtn-ignore since it is now automatically updated (by default).
* add *.deb to .mtn-ignore
2012-12-23 17:30:56 +00:00
8c13d32036 debian: add repack script and update watch file to use repack.sh 2012-12-23 17:20:15 +00:00
zzz
5d523723ed merge of '2e3c8b51430edfa3ce0e82bc4b49ea7c21c0606b'
and 'c643595f81605fc5534465da3f1655e4c23345a1'
2012-12-22 19:59:06 +00:00
zzz
6d2fa690dc quoting fixups 2012-12-22 19:30:36 +00:00
zzz
470b8c59e7 minor console/update cleanups 2012-12-22 18:37:26 +00:00
zzz
81975e919b propagate from branch 'i2p.i2p.zzz.test2' (head f33dbe1499b84cf6192b1a7bd494eaf081a047c0)
to branch 'i2p.i2p' (head 4e5bd2836592b95e1eff01d8e83f2690da386ef8)
2012-12-22 18:34:51 +00:00
zzz
436d8f0785 - Add support for announce-list (BEP 12) to TrackerClient (ticket #778)
- Refactor dup tracker detection
2012-12-22 18:05:42 +00:00
fa235d97af enable i2prouter translations in the debian package & refresh patch 2012-12-22 17:51:15 +00:00
42f8c71d4e update .mtn-ignore 2012-12-22 17:50:46 +00:00
9a241af241 enable translations for 'i2prouter' 2012-12-22 15:10:57 +00:00
69d22b84f9 i2prouter: integrate modifications from upstream (Tanuki) 2012-12-22 14:57:28 +00:00
zzz
7ea1bffea2 rename Tracker class for clarity 2012-12-22 14:13:16 +00:00
c1f4155cd8 French language update from transifex + updated EN po files that were uploaded to transifex 2012-12-21 23:50:08 +00:00
85fda3ed7f minor regex tweak 2012-12-21 21:17:33 +00:00
8998bdec17 remove another reliance on external UNIX-only tools (and fixing formatting of my earlier commit) 2012-12-21 21:13:31 +00:00
c9b6a3f01c Instead of deleting the empty directory placeholders, let's just not copy them to pkg-temp to begin with. 2012-12-21 20:53:51 +00:00
05c5f66012 fix my getBuildNumber regex 2012-12-21 20:46:02 +00:00
7fd59c4f10 add more excludes to 'sloccount.report' and make the report location configurable 2012-12-21 20:45:05 +00:00
6fe127286f add armv6 and armv7 to the "do not build EXE" list 2012-12-20 07:25:28 +00:00
406bcbef9d remove dependencies on external tools for getReleaseNumber and getBuildNumber
getReleaseNumber and getBuildNumber were *NIX only targets that relied on the external tools grep, cut, awk, and tr. These targets have been rewritten to use ant features.
2012-12-20 07:23:01 +00:00
9eb25f60c3 add sloccount report target 2012-12-20 07:16:39 +00:00
b7c10d2adb remove a few more files with "ant clean" 2012-12-20 07:13:26 +00:00
816149efd3 debian: refresh patches 2012-12-19 21:31:02 +00:00
aa6eefcc76 debian: add commented entries required for PPA builds & update "debianhowto" target
If someone runs "ant debian" to make installable packages, they do not need to
have their own wrapper or commons-logging  jars. The PPA builds, however, do
require them. During the last release I made the mistake of overwriting my "PPA
debian/control" file with the one from MTN that did not include these
dependencies.

Also updating "debianhowto" to reflect the fact that we no longer use
Debian's/Ubuntu's Jetty pkgs since Jetty6 appears to be leaving their repos in
the near future.
2012-12-19 21:25:04 +00:00
9ef9e48da9 remove executable bit 2012-12-19 21:09:17 +00:00
166e36aaef move taskdefs to targets
The directory installer/lib/ will be removed if a 'stripped' source tarball is
required. Without the changes in this commit, removing this directory will
require hackery to be performed on the I2P source in order for any of the ant
targets to work.
2012-12-19 21:08:57 +00:00
zzz
667b548d3b * Update: Hide the update buttons when router.updateDisabled=true, as is the case
for Debian packages. Broken in 0.9.4. (Ticket #817)
           Remove unused shouldInstall() method.
2012-12-19 14:58:37 +00:00
5dfef69688 Add dummy placeholder files to empty eepsite directories
git and a few other vcses don't store empty directories....but now these directories
are no longer empty.
2012-12-18 20:50:29 +00:00
zzz
4e558320a9 - i2psnark: Add announce list support (BEP 12) (ticket #778)
Preliminary. Still todo: TrackerClient
2012-12-10 22:48:44 +00:00
zzz
9f6ebd8e10 longer tunnel options for servers; fix spacing issue 2012-12-10 17:39:02 +00:00
zzz
c4a0fcbf43 propagate from branch 'i2p.i2p' (head 99b582d7fcc9d377341809a5fe580b439b37fea6)
to branch 'i2p.i2p.zzz.test2' (head f620dc8ce09657b3bfe0d87b5ee09c1bc33c31d1)
2012-12-10 17:23:29 +00:00
zzz
8104cb40cd Apache Tomcat 6.0.36 2012-12-10 17:23:07 +00:00
zzz
8d2eff76f2 fix jetty system properties 2012-11-24 19:56:58 +00:00
zzz
009b0bfdde more empty jars not to pack 2012-11-23 01:30:48 +00:00
zzz
924963eba0 fix class cast exception 2012-11-22 23:14:08 +00:00
zzz
de175b80fe updates 2012-11-22 22:54:11 +00:00
zzz
9fc7258537 - Update non-default xml files
- Update DTD
2012-11-22 21:42:15 +00:00
zzz
50df4b53db - Clean up WebAppconfiguration
- Fix eepsite xml files
- First cut at updating migration code (untested)
2012-11-22 21:17:50 +00:00
zzz
02ad4d5200 fix NPE 2012-11-21 22:53:22 +00:00
zzz
56ae54c2ff Jetty 7 license info copied from jetty-distribution-7.6.8.v20121106 2012-11-21 22:20:05 +00:00
zzz
a70e040e33 susimail compile fixes for Jetty 7.
Untested.
2012-11-21 21:21:38 +00:00
zzz
c0d82fe83f i2psnark compile fixes for Jetty 7.
Untested.
2012-11-21 21:09:31 +00:00
zzz
f1dd77982a RouterConsole compile fixes for Jetty 7.
Convert LocaleWebAppHandler from extending WebAppContext to
extending HandlerWrapper, since handle() is now final in WebAppContext.
Untested.
2012-11-21 20:49:18 +00:00
zzz
be8697cb9a jetty 7 first cut 2012-11-21 18:05:50 +00:00
1427 changed files with 214334 additions and 145665 deletions

47
.gitignore vendored Normal file
View File

@ -0,0 +1,47 @@
# Just to try and prevent some noob disasters.
# Use git add -f foo.jar to ignore this ignore list
# generated release files
*.exe
*.[gx]z
*.bz2
*.[rwjt]ar
*.sig
*.su[d23]
*.deb
*.zip
*.torrent
*~
web-fragment.xml
web-out.xml
*.out
# Temporary/build dirs
build/
pkg-temp/
classes/
dist/
/installer/resources/locale/mo
/tmp
/apps/jetty/jettylib
*_jsp.java
*.class
# Debian-related
/debian/copyright
/debian/changelog
# Build property overrides
/override.properties
# Reporting
*.fba
sloccount.sc
/reports/
# Don't allow patches
*.(diff|patch)
# but allow debian/patches
!/debian/patches/*.(patch|diff)

View File

@ -1,7 +1,10 @@
# Just to try and prevent some noob disasters.
# Use mtn add --no-respect-ignore foo.jar to ignore this ignore list
# Temporary/build files
_jsp\.java$
\.bz2$
\.tar$
\.class$
\.diff$
\.exe$
@ -13,14 +16,34 @@ _jsp\.java$
\.sig$
\.sud$
\.su2$
.\su3$
\.tar$
\.war$
.\deb$
\.zip$
\.torrent$
^\.
^build
^pkg-temp/
~$
web-fragment.xml
web-out.xml
# Temporary/build dirs
^build
^pkg-temp
/build
/classes/
/classes
/dist
^installer/resources/locale/mo
/tmp
^apps/jetty/jettylib
# Debian-related
^debian/copyright
^debian/changelog
# Build property overrides
override.properties
# Reporting
sloccount.sc
^reports/

View File

@ -9,14 +9,40 @@ trans.es = apps/i2ptunnel/locale/messages_es.po
trans.fr = apps/i2ptunnel/locale/messages_fr.po
trans.hu = apps/i2ptunnel/locale/messages_hu.po
trans.it = apps/i2ptunnel/locale/messages_it.po
trans.ja = apps/i2ptunnel/locale/messages_ja.po
trans.nb = apps/i2ptunnel/locale/messages_nb.po
trans.nl = apps/i2ptunnel/locale/messages_nl.po
trans.pl = apps/i2ptunnel/locale/messages_pl.po
trans.pt = apps/i2ptunnel/locale/messages_pt.po
trans.ru = apps/i2ptunnel/locale/messages_ru.po
trans.pt_BR = apps/i2ptunnel/locale/messages_pt_BR.po
trans.ru_RU = apps/i2ptunnel/locale/messages_ru.po
trans.sv_SE = apps/i2ptunnel/locale/messages_sv.po
trans.uk_UA = apps/i2ptunnel/locale/messages_uk.po
trans.vi = apps/i2ptunnel/locale/messages_vi.po
trans.zh_CN = apps/i2ptunnel/locale/messages_zh.po
[I2P.proxy]
source_file = apps/i2ptunnel/locale-proxy/messages_en.po
source_lang = en
trans.ar = apps/i2ptunnel/locale-proxy/messages_ar.po
trans.cs = apps/i2ptunnel/locale-proxy/messages_cs.po
trans.de = apps/i2ptunnel/locale-proxy/messages_de.po
trans.es = apps/i2ptunnel/locale-proxy/messages_es.po
trans.fr = apps/i2ptunnel/locale-proxy/messages_fr.po
trans.hu = apps/i2ptunnel/locale-proxy/messages_hu.po
trans.it = apps/i2ptunnel/locale-proxy/messages_it.po
trans.nb = apps/i2ptunnel/locale-proxy/messages_nb.po
trans.nl = apps/i2ptunnel/locale-proxy/messages_nl.po
trans.pl = apps/i2ptunnel/locale-proxy/messages_pl.po
trans.pt = apps/i2ptunnel/locale-proxy/messages_pt.po
trans.pt_BR = apps/i2ptunnel/locale-proxy/messages_pt_BR.po
trans.ro = apps/i2ptunnel/locale-proxy/messages_ro.po
trans.ru_RU = apps/i2ptunnel/locale-proxy/messages_ru.po
trans.sv_SE = apps/i2ptunnel/locale-proxy/messages_sv.po
trans.uk_UA = apps/i2ptunnel/locale-proxy/messages_uk.po
trans.vi = apps/i2ptunnel/locale-proxy/messages_vi.po
trans.zh_CN = apps/i2ptunnel/locale-proxy/messages_zh.po
[I2P.routerconsole]
source_file = apps/routerconsole/locale/messages_en.po
source_lang = en
@ -26,20 +52,71 @@ trans.da = apps/routerconsole/locale/messages_da.po
trans.de = apps/routerconsole/locale/messages_de.po
trans.el = apps/routerconsole/locale/messages_el.po
trans.es = apps/routerconsole/locale/messages_es.po
trans.et_EE = apps/routerconsole/locale/messages_ee.po
trans.et_EE = apps/routerconsole/locale/messages_et.po
trans.fi = apps/routerconsole/locale/messages_fi.po
trans.fr = apps/routerconsole/locale/messages_fr.po
trans.hu = apps/routerconsole/locale/messages_hu.po
trans.it = apps/routerconsole/locale/messages_it.po
trans.ja = apps/routerconsole/locale/messages_ja.po
trans.nb = apps/routerconsole/locale/messages_nb.po
trans.nl = apps/routerconsole/locale/messages_nl.po
trans.pl = apps/routerconsole/locale/messages_pl.po
trans.pt = apps/routerconsole/locale/messages_pt.po
trans.ru = apps/routerconsole/locale/messages_ru.po
trans.pt_BR = apps/routerconsole/locale/messages_pt_BR.po
trans.ro = apps/routerconsole/locale/messages_ro.po
trans.ru_RU = apps/routerconsole/locale/messages_ru.po
trans.sv_SE = apps/routerconsole/locale/messages_sv.po
trans.tr_TR = apps/routerconsole/locale/messages_tr.po
trans.uk_UA = apps/routerconsole/locale/messages_uk.po
trans.vi = apps/routerconsole/locale/messages_vi.po
trans.zh_CN = apps/routerconsole/locale/messages_zh.po
[I2P.welcome]
source_file = apps/routerconsole/locale-news/messages_en.po
source_lang = en
trans.ar = apps/routerconsole/locale-news/messages_ar.po
trans.de = apps/routerconsole/locale-news/messages_de.po
trans.es = apps/routerconsole/locale-news/messages_es.po
trans.fr = apps/routerconsole/locale-news/messages_fr.po
trans.he = apps/routerconsole/locale-news/messages_he.po
trans.ja = apps/routerconsole/locale-news/messages_ja.po
trans.it = apps/routerconsole/locale-news/messages_it.po
trans.nl = apps/routerconsole/locale-news/messages_nl.po
trans.pl = apps/routerconsole/locale-news/messages_pl.po
trans.pt = apps/routerconsole/locale-news/messages_pt.po
trans.pt_BR = apps/routerconsole/locale-news/messages_pt_BR.po
trans.ro = apps/routerconsole/locale-news/messages_ro.po
trans.ru_RU = apps/routerconsole/locale-news/messages_ru.po
trans.sv_SE = apps/routerconsole/locale-news/messages_sv.po
trans.tr_TR = apps/routerconsole/locale-news/messages_tr.po
trans.zh_CN = apps/routerconsole/locale-news/messages_zh.po
[I2P.countries]
type = PO
source_file = apps/routerconsole/locale-countries/messages_en.po
source_lang = en
trans.da = apps/routerconsole/locale-countries/messages_da.po
trans.de = apps/routerconsole/locale-countries/messages_de.po
trans.el = apps/routerconsole/locale-countries/messages_el.po
trans.es = apps/routerconsole/locale-countries/messages_es.po
trans.et_EE = apps/routerconsole/locale-countries/messages_et.po
trans.fi = apps/routerconsole/locale-countries/messages_fi.po
trans.fr = apps/routerconsole/locale-countries/messages_fr.po
trans.hu = apps/routerconsole/locale-countries/messages_hu.po
trans.it = apps/routerconsole/locale-countries/messages_it.po
trans.ja = apps/routerconsole/locale-countries/messages_ja.po
trans.nb = apps/routerconsole/locale-countries/messages_nb.po
trans.nl = apps/routerconsole/locale-countries/messages_nl.po
trans.pl = apps/routerconsole/locale-countries/messages_pl.po
trans.pt = apps/routerconsole/locale-countries/messages_pt.po
trans.pt_BR = apps/routerconsole/locale-countries/messages_pt_BR.po
trans.ro = apps/routerconsole/locale-countries/messages_ro.po
trans.ru_RU = apps/routerconsole/locale-countries/messages_ru.po
trans.sv_SE = apps/routerconsole/locale-countries/messages_sv.po
trans.tr_TR = apps/routerconsole/locale-countries/messages_tr.po
trans.vi = apps/routerconsole/locale-countries/messages_vi.po
trans.zh_CN = apps/routerconsole/locale-countries/messages_zh.po
[I2P.i2psnark]
source_file = apps/i2psnark/locale/messages_en.po
source_lang = en
@ -50,10 +127,12 @@ trans.es = apps/i2psnark/locale/messages_es.po
trans.fr = apps/i2psnark/locale/messages_fr.po
trans.hu = apps/i2psnark/locale/messages_hu.po
trans.it = apps/i2psnark/locale/messages_it.po
trans.nb = apps/i2psnark/locale/messages_nb.po
trans.nl = apps/i2psnark/locale/messages_nl.po
trans.pl = apps/i2psnark/locale/messages_pl.po
trans.pt = apps/i2psnark/locale/messages_pt.po
trans.ru = apps/i2psnark/locale/messages_ru.po
trans.ro = apps/i2psnark/locale/messages_ro.po
trans.ru_RU = apps/i2psnark/locale/messages_ru.po
trans.sv_SE = apps/i2psnark/locale/messages_sv.po
trans.vi = apps/i2psnark/locale/messages_vi.po
trans.zh_CN = apps/i2psnark/locale/messages_zh.po
@ -70,10 +149,13 @@ trans.es = apps/susidns/locale/messages_es.po
trans.fr = apps/susidns/locale/messages_fr.po
trans.hu = apps/susidns/locale/messages_hu.po
trans.it = apps/susidns/locale/messages_it.po
trans.ja = apps/susidns/locale/messages_ja.po
trans.nl = apps/susidns/locale/messages_nl.po
trans.pl = apps/susidns/locale/messages_pl.po
trans.pt = apps/susidns/locale/messages_pt.po
trans.ru = apps/susidns/locale/messages_ru.po
trans.pt_BR = apps/susidns/locale/messages_pt_BR.po
trans.ro = apps/susidns/locale/messages_ro.po
trans.ru_RU = apps/susidns/locale/messages_ru.po
trans.sv_SE = apps/susidns/locale/messages_sv.po
trans.uk_UA = apps/susidns/locale/messages_uk.po
trans.vi = apps/susidns/locale/messages_vi.po
@ -91,11 +173,15 @@ trans.es = apps/desktopgui/locale/messages_es.po
trans.fr = apps/desktopgui/locale/messages_fr.po
trans.hu = apps/desktopgui/locale/messages_hu.po
trans.it = apps/desktopgui/locale/messages_it.po
trans.ja = apps/desktopgui/locale/messages_ja.po
trans.nl = apps/desktopgui/locale/messages_nl.po
trans.pl = apps/desktopgui/locale/messages_pl.po
trans.ru = apps/desktopgui/locale/messages_ru.po
trans.pt_BR = apps/desktopgui/locale/messages_pt_BR.po
trans.ro = apps/desktopgui/locale/messages_ro.po
trans.ru_RU = apps/desktopgui/locale/messages_ru.po
trans.sv_SE = apps/desktopgui/locale/messages_sv.po
trans.uk_UA = apps/desktopgui/locale/messages_uk.po
trans.tr_TR = apps/desktopgui/locale/messages_tr.po
trans.vi = apps/desktopgui/locale/messages_vi.po
trans.zh_CN = apps/desktopgui/locale/messages_zh.po
@ -109,9 +195,12 @@ trans.fr = apps/susimail/locale/messages_fr.po
trans.hu = apps/susimail/locale/messages_hu.po
trans.it = apps/susimail/locale/messages_it.po
trans.nl = apps/susimail/locale/messages_nl.po
trans.ru = apps/susimail/locale/messages_ru.po
trans.ru_RU = apps/susimail/locale/messages_ru.po
trans.sv_SE = apps/susimail/locale/messages_sv.po
trans.pl = apps/susimail/locale/messages_pl.po
trans.pt = apps/susimail/locale/messages_pt.po
trans.pt_BR = apps/susimail/locale/messages_pt_BR.po
trans.ro = apps/susimail/locale/messages_ro.po
trans.uk_UA = apps/susimail/locale/messages_uk.po
trans.vi = apps/susimail/locale/messages_vi.po
trans.zh_CN = apps/susimail/locale/messages_zh.po
@ -126,11 +215,52 @@ trans.es = debian/po/es.po
trans.fr = debian/po/fr.po
trans.it = debian/po/it.po
trans.hu = debian/po/hu.po
trans.ja = debian/po/ja.po
trans.ko = debian/po/ko.po
trans.pl = debian/po/pl.po
trans.ru = debian/po/ru.po
trans.pt = debian/po/pt.po
trans.ro = debian/po/ro.po
trans.ru_RU = debian/po/ru.po
trans.sv_SE = debian/po/sv.po
trans.uk_UA = debian/po/uk.po
trans.tr_TR = debian/po/tr.po
trans.zh_CN = debian/po/zh.po
[I2P.i2prouter-script]
source_file = installer/resources/locale/po/messages_en.po
source_lang = en
trans.de = installer/resources/locale/po/messages_de.po
trans.es = installer/resources/locale/po/messages_es.po
trans.fr = installer/resources/locale/po/messages_fr.po
trans.it = installer/resources/locale/po/messages_it.po
trans.pl = installer/resources/locale/po/messages_pl.po
trans.pt = installer/resources/locale/po/messages_pt.po
trans.pt_BR = installer/resources/locale/po/messages_pt_BR.po
trans.ro = installer/resources/locale/po/messages_ro.po
trans.sv_SE = installer/resources/locale/po/messages_sv.po
trans.ru_RU = installer/resources/locale/po/messages_ru.po
trans.tr_TR = installer/resources/locale/po/messages_tr.po
trans.zh_CN = installer/resources/locale/po/messages_zh.po
[I2P.getopt]
source_file = core/java/src/gnu/getopt/MessagesBundle.properties
source_lang = en
type = PROPERTIES
trans.cs = core/java/src/gnu/getopt/MessagesBundle_cs.properties
trans.de = core/java/src/gnu/getopt/MessagesBundle_de.properties
trans.es = core/java/src/gnu/getopt/MessagesBundle_es.properties
trans.fr = core/java/src/gnu/getopt/MessagesBundle_fr.properties
trans.hu = core/java/src/gnu/getopt/MessagesBundle_hu.properties
trans.it = core/java/src/gnu/getopt/MessagesBundle_it.properties
trans.ja = core/java/src/gnu/getopt/MessagesBundle_ja.properties
trans.nl = core/java/src/gnu/getopt/MessagesBundle_nl.properties
trans.nb = core/java/src/gnu/getopt/MessagesBundle_nb.properties
trans.pl = core/java/src/gnu/getopt/MessagesBundle_pl.properties
trans.pt_BR = core/java/src/gnu/getopt/MessagesBundle_pt_BR.properties
trans.ro = core/java/src/gnu/getopt/MessagesBundle_ro.properties
trans.ru_RU = core/java/src/gnu/getopt/MessagesBundle_ru.properties
trans.zh_CN = core/java/src/gnu/getopt/MessagesBundle_zh.properties
[main]
host = http://www.transifex.net
host = https://www.transifex.com

View File

@ -12,7 +12,7 @@ you may use:
to configure the router.
If you're having trouble, swing by http://forum.i2p/, check the
website at http://www.i2p2.de/, or get on irc://irc.freenode.net/#i2p
website at https://geti2p.net/, or get on irc://irc.freenode.net/#i2p
I2P will create and store files and configuration data in the user directory
~/.i2p/ on Linux and %APPDATA%\I2P\ on Windows. This directory is created
@ -39,7 +39,10 @@ To uninstall I2P:
rm -rf $I2PInstallDir ~/.i2p
Supported JVMs:
Windows: Latest available from http://java.com/download (1.5+ supported)
Linux: Latest available from http://java.com/download (1.5+ supported)
FreeBSD: 1.5-compatible (NIO required)
Other operating systems and JVMs: See http://trac.i2p2.de/wiki/java
All platforms: Java 1.6 or higher required; 1.7 or higher recommended
Windows: OpenJDK or Oracle from http://java.com/download
Linux: OpenJDK or Oracle from http://java.com/download
FreeBSD: OpenJDK or Oracle from http://java.com/download
Raspberry Pi: Oracle 8 Early Access https://jdk8.java.net/download.html
PowerPC: IBM SDK 7 http://www.ibm.com/developerworks/java/jdk/linux/download.html
Other operating systems and JVMs: See https://trac.i2p2.de/wiki/java or https://geti2p.net/download

View File

@ -2,7 +2,7 @@ I2P source installation instructions
Prerequisites to build from source:
Java SDK (preferably Oracle/Sun or OpenJDK) 1.6.0 or higher
Non-linux operating systems and JVMs: See http://trac.i2p2.de/wiki/java
Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
Apache Ant 1.7.0 or higher
The xgettext, msgfmt, and msgmerge tools installed
from the GNU gettext package http://www.gnu.org/software/gettext/

View File

@ -36,7 +36,7 @@ Public domain except as listed below:
Copyright (c) 2003, TheCrypto
See licenses/LICENSE-ElGamalDSA.txt
SHA256 and HMAC-SHA256:
SHA256 and HMAC:
Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
See licenses/LICENSE-SHA256.txt
@ -72,6 +72,14 @@ Public domain except as listed below:
Copyright (c) 2006, Matthew Estes
See licenses/LICENSE-BlockFile.txt
SipHashInline:
Copyright 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
See licenses/LICENSE-Apache2.0.txt
Getopt:
Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
See licenses/LICENSE-LGPLv2.1.txt
Router (router.jar):
Public domain except as listed below:
@ -129,7 +137,7 @@ Installer:
Java Service Wrapper Community Edition 32-bit 3.5.13:
Java Service Wrapper Community Edition 32-bit 3.5.19:
Copyright (C) 1999-2011 Tanuki Software, Ltd. All Rights Reserved.
See licenses/LICENSE-Wrapper.txt
@ -174,10 +182,11 @@ Applications:
By welterde.
See licenses/LICENSE-GPLv2.txt
Jetty 6.1.26:
Copyright 1995-2009 Mort Bay Consulting Pty Ltd
See licenses/LICENSE-Jetty.txt
Jetty 8.1.14.v20131031:
See licenses/ABOUT-Jetty.html
See licenses/NOTICE-Jetty.html
See licenses/LICENSE-Apache2.0.txt
See licenses/LICENSE-ECLIPSE-1.0.html
See licenses/NOTICE-Commons-Logging.txt
JRobin 1.5.9.1:
@ -197,12 +206,13 @@ Applications:
- Jersey and EU flag icons: public domain, courtesy Xrmap flag
collection http://www.arvernes.com/wiki/index.php/Xrmap
- Guernsey and Isle of Man flags from the Open Clip Art Library, released into the public domain
- Curaçao, courtesy of David Benbennick, released into the public domain
- All other flag icons: public domain, courtesy mjames@gmail.com http://www.famfamfam.com/
Silk icons: See licenses/LICENSE-SilkIcons.txt
FatCow icons: See licenses/LICENSE-FatCowIcons.txt
GeoIP Data:
Copyright (c) 2008 MaxMind, Inc. All Rights Reserved.
This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/
See licenses/LICENSE-GeoIP.txt
Router Console and I2PSnark themes:
@ -238,8 +248,8 @@ Applications:
Bundles systray4j-2.4.1:
See licenses/LICENSE-LGPLv2.1.txt
Tomcat 6.0.35:
Copyright 1999-2011 The Apache Software Foundation
Tomcat 6.0.37:
Copyright 1999-2013 The Apache Software Foundation
See licenses/LICENSE-Apache2.0.txt
See licenses/NOTICE-Tomcat.txt

View File

@ -1,6 +1,6 @@
Prerequisites to build from source:
Java SDK (preferably Oracle/Sun or OpenJDK) 1.6.0 or higher
Non-linux operating systems and JVMs: See http://trac.i2p2.de/wiki/java
Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
Apache Ant 1.7.0 or higher
The xgettext, msgfmt, and msgmerge tools installed
from the GNU gettext package http://www.gnu.org/software/gettext/
@ -15,20 +15,20 @@ To build:
ant installer-osx
Run 'ant' with no arguments to see other build options.
See INSTALL.txt or http://www.i2p2.de/download.html for installation instructions.
See INSTALL.txt or https://geti2p.net/download for installation instructions.
Documentation:
http://www.i2p2.de/how
https://geti2p.net/how
API: run 'ant javadoc' then start at build/javadoc/index.html
Latest release:
http://www.i2p2.de/download.html
https://geti2p.net/download
To get development branch from source control:
http://www.i2p2.de/newdevelopers.html
https://geti2p.net/newdevelopers
FAQ:
http://www.i2p2.de/faq.html
https://geti2p.net/faq
Need help?
IRC irc.freenode.net #i2p

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
INST_DIR=directory

8
apps/BOB/.classpath Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" kind="src" path="/i2p_sdk"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/ministreaming"/>
<classpathentry kind="output" path="build"/>
</classpath>

17
apps/BOB/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BOB</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -83,7 +83,7 @@
<pathelement path="${javac.classpath}" />
</path>
</copy>
<copy todir="${dist.dir}/lib" file="../../installer/lib/jbigi/jbigi.jar" />
<copy todir="${dist.dir}/lib" file="../../build/jbigi.jar" />
<!-- Extract the classes inside the jar files -->
<unjar dest="${dist.dir}/classes" >

View File

@ -30,11 +30,11 @@ excludes=**/*.html,**/*.txt
file.reference.build-javadoc=../../i2p.i2p/build/javadoc
file.reference.i2p.jar=../../core/java/build/i2p.jar
file.reference.i2ptunnel.jar=../i2ptunnel/java/build/i2ptunnel.jar
file.reference.jbigi.jar=../../installer/lib/jbigi/jbigi.jar
file.reference.jbigi.jar=../../build/jbigi.jar
file.reference.mstreaming.jar=../ministreaming/java/build/mstreaming.jar
file.reference.router.jar=../../router/java/build/router.jar
file.reference.streaming.jar=../streaming/java/build/streaming.jar
file.reference.wrapper.jar=../../installer/lib/wrapper/linux/wrapper.jar
file.reference.wrapper.jar=../../installer/lib/wrapper/all/wrapper.jar
includes=**
jar.compress=true
javac.classpath=\

View File

@ -15,6 +15,8 @@
*/
package net.i2p.BOB;
import static net.i2p.app.ClientAppState.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -25,12 +27,17 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.Arrays;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import net.i2p.I2PAppContext;
import net.i2p.app.*;
import net.i2p.client.I2PClient;
import net.i2p.util.Log;
import net.i2p.util.I2PAppThread;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer2;
@ -105,57 +112,76 @@ import net.i2p.util.SimpleTimer2;
*
* @author sponge
*/
public class BOB {
public class BOB implements Runnable, ClientApp {
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";
public final static String PROP_CFG_VER = "BOB.CFG.VER";
private static NamedDB database;
private static Properties props = new Properties();
private static AtomicBoolean spin = new AtomicBoolean(true);
private static BOB _bob;
private NamedDB database;
private Properties props = new Properties();
private AtomicBoolean spin = new AtomicBoolean(true);
private static final String P_RUNNING = "RUNNING";
private static final String P_STARTING = "STARTING";
private static final String P_STOPPING = "STOPPING";
private static AtomicBoolean lock = new AtomicBoolean(false);
private AtomicBoolean lock = new AtomicBoolean(false);
// no longer used.
// private static int maxConnections = 0;
/**
* Log a warning
*
* @param arg
*/
public static void info(String arg) {
System.out.println("INFO:" + arg);
(new Log(BOB.class)).info(arg);
}
private final Logger _log;
private final ClientAppManager _mgr;
private final String[] _args;
private volatile ClientAppState _state = UNINITIALIZED;
/**
* Log a warning
*
* @param arg
*/
public static void warn(String arg) {
System.out.println("WARNING:" + arg);
(new Log(BOB.class)).warn(arg);
}
/**
* Log an error
*
* @param arg
*/
public static void error(String arg) {
System.out.println("ERROR: " + arg);
(new Log(BOB.class)).error(arg);
}
private volatile ServerSocket listener;
private volatile Thread _runner;
/**
* Stop BOB gracefully
* @deprecated unused
*/
public static void stop() {
spin.set(false);
_bob.shutdown(null);
}
/**
* For ClientApp interface.
* Does NOT open the listener socket or start threads; caller must call startup()
*
* @param mgr may be null
* @param args non-null
* @throws Exception on bad args
* @since 0.9.10
*/
public BOB(I2PAppContext context, ClientAppManager mgr, String[] args) {
// If we were run from command line, log to stdout
boolean logToStdout = false;
URL classResource = BOB.class.getResource("BOB.class");
if (classResource != null) {
String classPath = classResource.toString();
if (classPath.startsWith("jar")) {
String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) +
"/META-INF/MANIFEST.MF";
try {
Manifest manifest = new Manifest(new URL(manifestPath).openStream());
Attributes attrs = manifest.getMainAttributes();
String mainClass = attrs.getValue("Main-Class");
if ("net.i2p.BOB.Main".equals(mainClass))
logToStdout = true;
} catch (IOException ioe) {}
}
}
_log = new Logger(context.logManager().getLog(BOB.class), logToStdout);
_mgr = mgr;
_args = args;
_state = INITIALIZED;
database = new NamedDB();
loadConfig();
}
/**
@ -164,8 +190,22 @@ public class BOB {
* @param args
*/
public static void main(String[] args) {
database = new NamedDB();
ServerSocket listener = null;
try {
_bob = new BOB(I2PAppContext.getGlobalContext(), null, args);
_bob.startup();
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
* @since 0.9.10
*/
private void loadConfig() {
int i = 0;
boolean save = false;
// Set up all defaults to be passed forward to other threads.
@ -176,116 +216,144 @@ public class BOB {
SimpleTimer2 Y2 = SimpleTimer2.getInstance();
i = Y1.hashCode();
i = Y2.hashCode();
Log _log = new Log(BOB.class);
try {
{
File cfg = new File(configLocation);
if (!cfg.isAbsolute()) {
cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
}
try {
FileInputStream fi = new FileInputStream(cfg);
props.load(fi);
fi.close();
} catch (FileNotFoundException fnfe) {
warn("Unable to load up the BOB config file " + cfg.getAbsolutePath() + ", Using defaults.");
warn(fnfe.toString());
save = true;
} catch (IOException ioe) {
warn("IOException on BOB config file " + cfg.getAbsolutePath() + ", using defaults.");
warn(ioe.toString());
}
{
File cfg = new File(configLocation);
if (!cfg.isAbsolute()) {
cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
}
// 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");
save = true;
}
if (!props.containsKey(I2PClient.PROP_TCP_PORT)) {
props.setProperty(I2PClient.PROP_TCP_PORT, "7654");
save = true;
}
if (!props.containsKey(PROP_BOB_PORT)) {
props.setProperty(PROP_BOB_PORT, "2827"); // 0xB0B
save = true;
}
if (!props.containsKey("inbound.length")) {
props.setProperty("inbound.length", "1");
save = true;
}
if (!props.containsKey("outbound.length")) {
props.setProperty("outbound.length", "1");
save = true;
}
if (!props.containsKey("inbound.lengthVariance")) {
props.setProperty("inbound.lengthVariance", "0");
save = true;
}
if (!props.containsKey("outbound.lengthVariance")) {
props.setProperty("outbound.lengthVariance", "0");
save = true;
}
if (!props.containsKey(PROP_BOB_HOST)) {
props.setProperty(PROP_BOB_HOST, "localhost");
save = true;
}
// PROP_RELIABILITY_NONE, PROP_RELIABILITY_BEST_EFFORT, PROP_RELIABILITY_GUARANTEED
if (!props.containsKey(PROP_CFG_VER)) {
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_NONE);
props.setProperty(PROP_CFG_VER,"1");
save = true;
}
if (save) {
File cfg = new File(configLocation);
if (!cfg.isAbsolute()) {
cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
}
try {
warn("Writing new defaults file " + cfg.getAbsolutePath());
FileOutputStream fo = new FileOutputStream(cfg);
props.store(fo, cfg.getAbsolutePath());
fo.close();
} catch (IOException ioe) {
error("IOException on BOB config file " + cfg.getAbsolutePath() + ", " + ioe);
}
}
i = 0;
boolean g = false;
spin.set(true);
FileInputStream fi = null;
try {
info("BOB is now running.");
listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
Socket server = null;
listener.setSoTimeout(500); // .5 sec
while (spin.get()) {
//DoCMDS connection;
try {
server = listener.accept();
server.setKeepAlive(true);
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
Thread t = new Thread(conn_c);
t.setName("BOB.DoCMDS " + i);
t.start();
i++;
}
}
fi = new FileInputStream(cfg);
props.load(fi);
} catch (FileNotFoundException fnfe) {
_log.warn("Unable to load up the BOB config file " + cfg.getAbsolutePath() + ", Using defaults.", fnfe);
save = true;
} catch (IOException ioe) {
error("IOException on socket listen: " + ioe);
ioe.printStackTrace();
_log.warn("IOException on BOB config file " + cfg.getAbsolutePath() + ", using defaults.", ioe);
} finally {
if (fi != null) try { fi.close(); } catch (IOException ioe) {}
}
}
// 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");
save = true;
}
if (!props.containsKey(I2PClient.PROP_TCP_PORT)) {
props.setProperty(I2PClient.PROP_TCP_PORT, "7654");
save = true;
}
if (!props.containsKey(PROP_BOB_PORT)) {
props.setProperty(PROP_BOB_PORT, "2827"); // 0xB0B
save = true;
}
if (!props.containsKey("inbound.length")) {
props.setProperty("inbound.length", "1");
save = true;
}
if (!props.containsKey("outbound.length")) {
props.setProperty("outbound.length", "1");
save = true;
}
if (!props.containsKey("inbound.lengthVariance")) {
props.setProperty("inbound.lengthVariance", "0");
save = true;
}
if (!props.containsKey("outbound.lengthVariance")) {
props.setProperty("outbound.lengthVariance", "0");
save = true;
}
if (!props.containsKey(PROP_BOB_HOST)) {
props.setProperty(PROP_BOB_HOST, "localhost");
save = true;
}
// PROP_RELIABILITY_NONE, PROP_RELIABILITY_BEST_EFFORT, PROP_RELIABILITY_GUARANTEED
if (!props.containsKey(PROP_CFG_VER)) {
props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_NONE);
props.setProperty(PROP_CFG_VER,"1");
save = true;
}
if (save) {
File cfg = new File(configLocation);
if (!cfg.isAbsolute()) {
cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
}
FileOutputStream fo = null;
try {
_log.warn("Writing new defaults file " + cfg.getAbsolutePath());
fo = new FileOutputStream(cfg);
props.store(fo, cfg.getAbsolutePath());
} catch (IOException ioe) {
_log.error("IOException on BOB config file " + cfg.getAbsolutePath(), ioe);
} finally {
if (fo != null) try { fo.close(); } catch (IOException ioe) {}
}
}
}
/**
* @since 0.9.10
*/
private void startListener() throws IOException {
listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
listener.setSoTimeout(500); // .5 sec
}
/**
* @since 0.9.10
*/
private void startThread() {
I2PAppThread t = new I2PAppThread(this, "BOBListener");
t.start();
_runner = t;
}
/**
* @since 0.9.10
*/
public void run() {
if (listener == null) return;
changeState(RUNNING);
_log.info("BOB is now running.");
if (_mgr != null)
_mgr.register(this);
int i = 0;
boolean g = false;
spin.set(true);
try {
Socket server = null;
while (spin.get()) {
//DoCMDS connection;
try {
server = listener.accept();
server.setKeepAlive(true);
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
Thread t = new Thread(conn_c);
t.setName("BOB.DoCMDS " + i);
t.start();
i++;
}
}
changeState(STOPPING);
} catch (Exception e) {
if (spin.get())
_log.error("Unexpected error while listening for connections", e);
else
e = null;
changeState(STOPPING, e);
} finally {
info("BOB is now shutting down...");
_log.info("BOB is now shutting down...");
// Clean up everything.
try {
listener.close();
@ -308,7 +376,7 @@ public class BOB {
database.releaseReadLock();
database.getWriteLock();
nickinfo.getWriteLock();
nickinfo.add(P_STOPPING, new Boolean(true));
nickinfo.add(P_STOPPING, Boolean.valueOf(true));
nickinfo.releaseWriteLock();
database.releaseWriteLock();
} else {
@ -316,8 +384,8 @@ public class BOB {
database.releaseReadLock();
}
}
info("BOB is now stopped.");
changeState(STOPPED);
_log.info("BOB is now stopped.");
}
}
@ -369,4 +437,86 @@ public class BOB {
waitjoin(groups[i], level + 1, groups[i].getName());
}
}
////// begin ClientApp interface
/**
* @since 0.9.10
*/
@Override
public void startup() throws IOException {
if (_state != INITIALIZED)
return;
changeState(STARTING);
try {
startListener();
} catch (IOException e) {
_log.error("Error starting BOB on"
+ props.getProperty(PROP_BOB_HOST)
+ ":" + props.getProperty(PROP_BOB_PORT), e);
changeState(START_FAILED, e);
throw e;
}
startThread();
}
/**
* @since 0.9.10
*/
@Override
public void shutdown(String[] args) {
if (_state != RUNNING)
return;
changeState(STOPPING);
spin.set(false);
if (_runner != null)
_runner.interrupt();
else
changeState(STOPPED);
}
/**
* @since 0.9.10
*/
@Override
public ClientAppState getState() {
return _state;
}
/**
* @since 0.9.10
*/
@Override
public String getName() {
return "BOB";
}
/**
* @since 0.9.10
*/
@Override
public String getDisplayName() {
return "BOB " + Arrays.toString(_args);
}
////// end ClientApp interface
////// begin ClientApp helpers
/**
* @since 0.9.10
*/
private void changeState(ClientAppState state) {
changeState(state, null);
}
/**
* @since 0.9.10
*/
private synchronized void changeState(ClientAppState state, Exception e) {
_state = state;
if (_mgr != null)
_mgr.notify(this, state, null, e);
}
////// end ClientApp helpers
}

View File

@ -31,7 +31,6 @@ import net.i2p.client.I2PClientFactory;
//import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
//import net.i2p.i2ptunnel.I2PTunnel;
import net.i2p.util.Log;
// needed only for debugging.
// import java.util.logging.Level;
// import java.util.logging.Logger;
@ -56,7 +55,7 @@ public class DoCMDS implements Runnable {
private ByteArrayOutputStream prikey;
private boolean dk, ns, ip, op;
private NamedDB nickinfo;
private Log _log;
private Logger _log;
private AtomicBoolean LIVE;
private AtomicBoolean lock;
/* database strings */
@ -164,7 +163,7 @@ public class DoCMDS implements Runnable {
* @param database
* @param _log
*/
DoCMDS(AtomicBoolean LIVE, AtomicBoolean lock, Socket server, Properties props, NamedDB database, Log _log) {
DoCMDS(AtomicBoolean LIVE, AtomicBoolean lock, Socket server, Properties props, NamedDB database, Logger _log) {
this.lock = lock;
this.LIVE = LIVE;
this.server = server;
@ -388,7 +387,7 @@ public class DoCMDS implements Runnable {
* Does the base64 information look OK
*
* @param data
* @return
* @return OK
*/
private boolean is64ok(String data) {
try {
@ -606,7 +605,7 @@ public class DoCMDS implements Runnable {
break die;
}
} catch (I2PException ipe) {
BOB.error("Error generating keys" + ipe);
_log.error("Error generating keys", ipe);
out.println("ERROR generating keys");
}
@ -665,7 +664,7 @@ public class DoCMDS implements Runnable {
break die;
}
try {
nickinfo.add(P_QUIET, new Boolean(Boolean.parseBoolean(Arg) == true));
nickinfo.add(P_QUIET, Boolean.valueOf(Arg));
} catch (Exception ex) {
try {
wunlock();
@ -817,10 +816,10 @@ public class DoCMDS implements Runnable {
try {
database.add(Arg, nickinfo);
nickinfo.add(P_NICKNAME, Arg);
nickinfo.add(P_STARTING, new Boolean(false));
nickinfo.add(P_RUNNING, new Boolean(false));
nickinfo.add(P_STOPPING, new Boolean(false));
nickinfo.add(P_QUIET, new Boolean(false));
nickinfo.add(P_STARTING, Boolean.valueOf(false));
nickinfo.add(P_RUNNING, Boolean.valueOf(false));
nickinfo.add(P_STOPPING, Boolean.valueOf(false));
nickinfo.add(P_QUIET, Boolean.valueOf(false));
nickinfo.add(P_INHOST, "localhost");
nickinfo.add(P_OUTHOST, "localhost");
Properties Q = new Properties();
@ -989,7 +988,7 @@ public class DoCMDS implements Runnable {
prt = Integer.parseInt(Arg);
if (prt > 1 && prt < 65536) {
try {
nickinfo.add(P_INPORT, new Integer(prt));
nickinfo.add(P_INPORT, Integer.valueOf(prt));
} catch (Exception ex) {
try {
wunlock();
@ -1076,7 +1075,7 @@ public class DoCMDS implements Runnable {
prt = Integer.parseInt(Arg);
if (prt > 1 && prt < 65536) {
try {
nickinfo.add(P_OUTPORT, new Integer(prt));
nickinfo.add(P_OUTPORT, Integer.valueOf(prt));
} catch (Exception ex) {
try {
wunlock();
@ -1355,7 +1354,7 @@ public class DoCMDS implements Runnable {
break die;
}
nickinfo.add(P_STOPPING, new Boolean(true));
nickinfo.add(P_STOPPING, Boolean.valueOf(true));
try {
wunlock();

View File

@ -22,7 +22,6 @@ import net.i2p.I2PException;
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
@ -32,7 +31,7 @@ import net.i2p.util.Log;
public class I2Plistener implements Runnable {
private NamedDB info, database;
private Log _log;
private Logger _log;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private AtomicBoolean lives;
@ -45,7 +44,7 @@ public class I2Plistener implements Runnable {
* @param database
* @param _log
*/
I2Plistener(I2PServerSocket SS, I2PSocketManager S, NamedDB info, NamedDB database, Log _log, AtomicBoolean lives) {
I2Plistener(I2PServerSocket SS, I2PSocketManager S, NamedDB info, NamedDB database, Logger _log, AtomicBoolean lives) {
this.database = database;
this.info = info;
this._log = _log;

View File

@ -15,7 +15,7 @@
*/
package net.i2p.BOB;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
/**
@ -39,10 +39,8 @@ public class Lifted {
*
**/
public static void copyProperties(Properties src_prop, Properties dest_prop) {
for (Enumeration propertyNames = src_prop.propertyNames();
propertyNames.hasMoreElements();) {
Object key = propertyNames.nextElement();
dest_prop.put(key, src_prop.get(key));
for (Map.Entry<Object, Object> e : src_prop.entrySet()) {
dest_prop.put((String)e.getKey(), (String)e.getValue());
}
}
}

View File

@ -0,0 +1,44 @@
package net.i2p.BOB;
import net.i2p.util.Log;
public class Logger {
public Log log;
private boolean logToStdout;
public Logger(Log log, boolean logToStdout) {
this.log = log;
this.logToStdout = logToStdout;
}
public void info(String msg) {
if (logToStdout)
System.out.println("INFO: " + msg);
if (log.shouldLog(Log.INFO))
log.info(msg);
}
public void warn(String msg) {
warn(msg, null);
}
public void warn(String msg, Throwable e) {
if (logToStdout) {
System.out.println("WARNING: " + msg);
if (e != null)
e.printStackTrace();
}
if (log.shouldLog(Log.WARN))
log.warn(msg, e);
}
public void error(String msg, Throwable e) {
if (logToStdout) {
System.out.println("ERROR: " + msg);
if (e != null)
e.printStackTrace();
}
if (log.shouldLog(Log.ERROR))
log.error(msg, e);
}
}

View File

@ -22,6 +22,7 @@ import java.net.ServerSocket;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PException;
import net.i2p.client.I2PClient;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
@ -36,7 +37,7 @@ import net.i2p.util.Log;
public class MUXlisten implements Runnable {
private NamedDB database, info;
private Log _log;
private Logger _log;
private I2PSocketManager socketManager;
private ByteArrayInputStream prikey;
private ThreadGroup tg;
@ -57,7 +58,7 @@ public class MUXlisten implements Runnable {
* @throws net.i2p.I2PException
* @throws java.io.IOException
*/
MUXlisten(AtomicBoolean lock, NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
MUXlisten(AtomicBoolean lock, NamedDB database, NamedDB info, Logger _log) throws I2PException, IOException, RuntimeException {
try {
int port = 0;
InetAddress host = null;
@ -70,7 +71,7 @@ public class MUXlisten implements Runnable {
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(true));
this.info.add("STARTING", Boolean.valueOf(true));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
this.database.getReadLock();
@ -96,15 +97,25 @@ public class MUXlisten implements Runnable {
this.database.releaseReadLock();
this.info.releaseReadLock();
String i2cpHost = Q.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1");
int i2cpPort = 7654;
String i2cpPortStr = Q.getProperty(I2PClient.PROP_TCP_PORT, "7654");
try {
i2cpPort = Integer.parseInt(i2cpPortStr);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Invalid I2CP port specified [" + i2cpPortStr + "]");
}
if (this.come_in) {
this.listener = new ServerSocket(port, backlog, host);
}
socketManager = I2PSocketManagerFactory.createManager(prikey, Q);
socketManager = I2PSocketManagerFactory.createManager(
prikey, i2cpHost, i2cpPort, Q);
} catch (IOException e) {
// Something went bad.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(false));
this.info.add("STARTING", Boolean.valueOf(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
throw new IOException(e.toString());
@ -112,7 +123,7 @@ public class MUXlisten implements Runnable {
// Something went bad.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(false));
this.info.add("STARTING", Boolean.valueOf(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
throw new RuntimeException(e);
@ -120,7 +131,7 @@ public class MUXlisten implements Runnable {
// Something else went bad.
this.database.getWriteLock();
this.info.getWriteLock();
this.info.add("STARTING", new Boolean(false));
this.info.add("STARTING", Boolean.valueOf(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
e.printStackTrace();
@ -160,7 +171,7 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("RUNNING", new Boolean(true));
info.add("RUNNING", Boolean.valueOf(true));
} catch (Exception e) {
lock.set(false);
wunlock();
@ -204,7 +215,7 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STARTING", Boolean.valueOf(false));
} catch (Exception e) {
wunlock();
break quit;
@ -258,9 +269,9 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STOPPING", new Boolean(true));
info.add("RUNNING", new Boolean(false));
info.add("STARTING", Boolean.valueOf(false));
info.add("STOPPING", Boolean.valueOf(true));
info.add("RUNNING", Boolean.valueOf(false));
} catch (Exception e) {
lock.set(false);
wunlock();
@ -309,9 +320,9 @@ public class MUXlisten implements Runnable {
try {
wlock();
try {
info.add("STARTING", new Boolean(false));
info.add("STOPPING", new Boolean(false));
info.add("RUNNING", new Boolean(false));
info.add("STARTING", Boolean.valueOf(false));
info.add("STOPPING", Boolean.valueOf(false));
info.add("RUNNING", Boolean.valueOf(false));
} catch (Exception e) {
lock.set(false);
wunlock();

View File

@ -23,7 +23,7 @@ package net.i2p.BOB;
public class NamedDB {
private volatile Object[][] data;
private volatile int index, writersWaiting, readers;
private int index, writersWaiting, readers;
/**
* make initial NULL object
@ -31,7 +31,6 @@ public class NamedDB {
*/
public NamedDB() {
this.data = new Object[1][2];
this.index = this.writersWaiting = this.readers = 0;
}
synchronized public void getReadLock() {

View File

@ -116,7 +116,6 @@ public class TCPio implements Runnable {
Aout.close();
} catch (IOException ex) {
}
return;
}
}
}

View File

@ -22,7 +22,6 @@ import java.net.SocketTimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
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
@ -32,7 +31,7 @@ import net.i2p.util.Log;
public class TCPlistener implements Runnable {
private NamedDB info, database;
private Log _log;
private Logger _log;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private ServerSocket listener;
@ -45,7 +44,7 @@ public class TCPlistener implements Runnable {
* @param database
* @param _log
*/
TCPlistener(ServerSocket listener, I2PSocketManager S, NamedDB info, NamedDB database, Log _log, AtomicBoolean lives) {
TCPlistener(ServerSocket listener, I2PSocketManager S, NamedDB info, NamedDB database, Logger _log, AtomicBoolean lives) {
this.database = database;
this.info = info;
this._log = _log;

View File

@ -70,12 +70,10 @@ public class TCPtoI2P implements Runnable {
* @throws IOException
*/
private static String lnRead(InputStream in) throws IOException {
String S;
StringBuilder builder = new StringBuilder();
int b;
char c;
S = new String();
while (true) {
b = in.read();
if (b == 13) {
@ -87,9 +85,9 @@ public class TCPtoI2P implements Runnable {
break;
}
c = (char) (b & 0x7f); // We only care about ASCII
S = new String(S + c);
builder.append(c);
}
return S;
return builder.toString();
}
/**
@ -101,7 +99,7 @@ public class TCPtoI2P implements Runnable {
*/
private void Emsg(String e, OutputStream out) throws IOException {
// Debugging System.out.println("ERROR TCPtoI2P: " + e);
out.write("ERROR ".concat(e).getBytes());
out.write("ERROR ".concat(e).getBytes("UTF-8"));
out.write(13);
out.write(10);
out.flush();

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="java/src"/>
<classpathentry combineaccessrules="false" kind="src" path="/i2p_sdk"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/jetty/jettylib/javax.servlet.jar"/>
<classpathentry kind="output" path="build"/>
</classpath>

17
apps/addressbook/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>addressbook</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -7,6 +7,7 @@
<property name="jar" value="addressbook.jar"/>
<property name="war" value="addressbook.war"/>
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.6" />
<target name="init">
<mkdir dir="${build}"/>
@ -24,6 +25,18 @@
<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" />
</classpath>
</depend>
</target>
<target name="dependServlet" if="depend.available">
<depend
cache="../../build"
srcdir="${src}"
@ -37,9 +50,23 @@
</target>
<target name="compile" depends="init, depend">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
includeAntRuntime="false"
srcdir="${src}" destdir="${build}">
srcdir="${src}" destdir="${build}"
excludes="net/i2p/addressbook/Servlet.java">
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../core/java/build/i2p.jar" />
<pathelement location="../jetty/jettylib/javax.servlet.jar" />
</classpath>
</javac>
</target>
<target name="compileServlet" depends="init, dependServlet, compile">
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
includeAntRuntime="false"
srcdir="${src}" destdir="${build}"
includes="net/i2p/addressbook/Servlet.java">
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../core/java/build/i2p.jar" />
@ -50,9 +77,9 @@
<!-- unused for now, as we oddly ship addressbook as a .war -->
<target name="jar" depends="compile, changes">
<jar basedir="${build}" destfile="${dist}/${jar}">
<!-- set if unset -->
<property name="workspace.changes" value="" />
<jar basedir="${build}" destfile="${dist}/${jar}">
<manifest>
<attribute name="Main-Class" value="addressbook.Daemon"/>
<attribute name="Implementation-Version" value="${full.version}" />
@ -64,7 +91,7 @@
</jar>
</target>
<target name="war" depends="compile, changes, warUpToDate" unless="war.uptodate">
<target name="war" depends="compileServlet, changes, warUpToDate" unless="war.uptodate">
<mkdir dir="${dist}/tmp"/>
<mkdir dir="${dist}/tmp/WEB-INF"/>
<mkdir dir="${dist}/tmp/WEB-INF/classes"/>

View File

@ -120,11 +120,11 @@ class AddressBook {
subscription.setLastFetched(I2PAppContext.getGlobalContext().clock().now());
subf = tmp;
} else {
a = Collections.EMPTY_MAP;
a = Collections.emptyMap();
tmp.delete();
}
} catch (IOException ioe) {
a = Collections.EMPTY_MAP;
a = Collections.emptyMap();
}
this.addresses = a;
this.subFile = subf;
@ -148,7 +148,7 @@ class AddressBook {
try {
a = ConfigParser.parse(file);
} catch (IOException exp) {
a = new HashMap();
a = new HashMap<String, String>();
}
this.addresses = a;
this.subFile = null;
@ -260,7 +260,7 @@ class AddressBook {
* An AddressBook to merge with.
* @param overwrite True to overwrite
* @param log
* The log to write messages about new addresses or conflicts to.
* The log to write messages about new addresses or conflicts to. May be null.
*
* @throws IllegalStateException if this was created with the Subscription constructor.
*/

View File

@ -138,7 +138,8 @@ class ConfigIterator implements Iterator<Map.Entry<String, String>> {
public boolean equals(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry e = (Map.Entry) o;
@SuppressWarnings("unchecked")
Map.Entry<Object, Object> e = (Map.Entry<Object, Object>) o;
return key.equals(e.getKey()) && value.equals(e.getValue());
}
}

View File

@ -87,11 +87,11 @@ class ConfigParser {
*
*/
public static Map<String, String> parse(BufferedReader input) throws IOException {
Map<String, String> result = new HashMap();
Map<String, String> result = new HashMap<String, String>();
String inputLine;
inputLine = input.readLine();
while (inputLine != null) {
inputLine = ConfigParser.stripComments(inputLine);
inputLine = stripComments(inputLine);
String[] splitLine = inputLine.split("=");
if (splitLine.length == 2) {
result.put(splitLine[0].trim().toLowerCase(Locale.US), splitLine[1].trim());
@ -116,7 +116,7 @@ class ConfigParser {
FileInputStream fileStream = new FileInputStream(file);
BufferedReader input = new BufferedReader(new InputStreamReader(
fileStream));
Map<String, String> rv = ConfigParser.parse(input);
Map<String, String> rv = parse(input);
try {
fileStream.close();
} catch (IOException ioe) {}
@ -136,7 +136,7 @@ class ConfigParser {
public static Map<String, String> parse(String string) throws IOException {
StringReader stringReader = new StringReader(string);
BufferedReader input = new BufferedReader(stringReader);
return ConfigParser.parse(input);
return parse(input);
}
/**
@ -153,7 +153,7 @@ class ConfigParser {
public static Map<String, String> parse(File file, Map<String, String> map) {
Map<String, String> result;
try {
result = ConfigParser.parse(file);
result = parse(file);
for (Map.Entry<String, String> entry : map.entrySet()) {
if (!result.containsKey(entry.getKey()))
result.put(entry.getKey(), entry.getValue());
@ -161,7 +161,7 @@ class ConfigParser {
} catch (IOException exp) {
result = map;
try {
ConfigParser.write(result, file);
write(result, file);
} catch (IOException exp2) {
}
}
@ -179,10 +179,10 @@ class ConfigParser {
*/
public static List<String> parseSubscriptions(BufferedReader input)
throws IOException {
List<String> result = new LinkedList();
List<String> result = new LinkedList<String>();
String inputLine = input.readLine();
while (inputLine != null) {
inputLine = ConfigParser.stripComments(inputLine).trim();
inputLine = stripComments(inputLine).trim();
if (inputLine.length() > 0) {
result.add(inputLine);
}
@ -205,7 +205,7 @@ class ConfigParser {
FileInputStream fileStream = new FileInputStream(file);
BufferedReader input = new BufferedReader(new InputStreamReader(
fileStream));
List<String> rv = ConfigParser.parseSubscriptions(input);
List<String> rv = parseSubscriptions(input);
try {
fileStream.close();
} catch (IOException ioe) {}
@ -224,7 +224,7 @@ class ConfigParser {
public static List<String> parseSubscriptions(String string) throws IOException {
StringReader stringReader = new StringReader(string);
BufferedReader input = new BufferedReader(stringReader);
return ConfigParser.parseSubscriptions(input);
return parseSubscriptions(input);
}
/**
@ -234,18 +234,30 @@ class ConfigParser {
*
* @param file
* A File to attempt to parse.
* @param list list of files to parse
* @param list The default subscriptions to be saved and returned if the file cannot be read
* @return A List consisting of one element for each line in file, or if
* file cannot be read, list.
*/
public static List<String> parseSubscriptions(File file, List<String> list) {
List<String> result;
try {
result = ConfigParser.parseSubscriptions(file);
result = parseSubscriptions(file);
// Fix up files that contain the old default
// which was changed in 0.9.11
if (result.remove(Daemon.OLD_DEFAULT_SUB)) {
for (String sub : list) {
if (!result.contains(sub))
result.add(sub);
}
try {
writeSubscriptions(result, file);
// TODO log
} catch (IOException ioe) {}
}
} catch (IOException exp) {
result = list;
try {
ConfigParser.writeSubscriptions(result, file);
writeSubscriptions(result, file);
} catch (IOException exp2) {
}
}
@ -289,8 +301,7 @@ class ConfigParser {
boolean success = false;
if (!isWindows) {
File tmp = SecureFile.createTempFile("temp-", ".tmp", file.getAbsoluteFile().getParentFile());
ConfigParser
.write(map, new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(tmp), "UTF-8")));
write(map, new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(tmp), "UTF-8")));
success = tmp.renameTo(file);
if (!success) {
tmp.delete();
@ -299,8 +310,7 @@ class ConfigParser {
}
if (!success) {
// hmm, that didn't work, try it the old way
ConfigParser
.write(map, new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(file), "UTF-8")));
write(map, new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(file), "UTF-8")));
}
}
@ -337,7 +347,7 @@ class ConfigParser {
*/
public static void writeSubscriptions(List<String> list, File file)
throws IOException {
ConfigParser.writeSubscriptions(list, new BufferedWriter(
writeSubscriptions(list, new BufferedWriter(
new OutputStreamWriter(new SecureFileOutputStream(file), "UTF-8")));
}

View File

@ -37,6 +37,7 @@ import net.i2p.client.naming.SingleFileNamingService;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.util.SecureDirectory;
import net.i2p.util.SystemVersion;
/**
* Main class of addressbook. Performs updates, and runs the main loop.
@ -47,8 +48,11 @@ import net.i2p.util.SecureDirectory;
public class Daemon {
public static final String VERSION = "2.0.4";
private static final Daemon _instance = new Daemon();
private boolean _running;
private volatile boolean _running;
private static final boolean DEBUG = false;
private static final String DEFAULT_SUB = "http://i2p-projekt.i2p/hosts.txt";
/** @since 0.9.12 */
static final String OLD_DEFAULT_SUB = "http://www.i2p2.i2p/hosts.txt";
/**
* Update the router and published address books using remote data from the
@ -168,7 +172,7 @@ public class Daemon {
if (publishedNS == null)
publishedNS = new SingleFileNamingService(I2PAppContext.getGlobalContext(), published.getAbsolutePath());
success = publishedNS.putIfAbsent(key, dest);
if (!success) {
if (log != null && !success) {
try {
log.append("Save to published address book " + published.getCanonicalPath() + " failed for new key " + key);
} catch (IOException ioe) {}
@ -250,14 +254,14 @@ public class Daemon {
}
delay *= 60 * 60 * 1000;
List<String> defaultSubs = new LinkedList();
List<String> defaultSubs = new LinkedList<String>();
// 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");
defaultSubs.add(DEFAULT_SUB);
SubscriptionList subscriptions = new SubscriptionList(subscriptionFile,
etagsFile, lastModifiedFile, lastFetchedFile, delay, defaultSubs, settings
.get("proxy_host"), Integer.parseInt(settings.get("proxy_port")));
Log log = new Log(logFile);
Log log = SystemVersion.isAndroid() ? null : new Log(logFile);
// If false, add hosts via naming service; if true, write hosts.txt file directly
// Default false
@ -330,7 +334,7 @@ public class Daemon {
homeFile = new SecureDirectory(System.getProperty("user.dir"));
}
Map<String, String> defaultSettings = new HashMap();
Map<String, String> defaultSettings = new HashMap<String, String>();
defaultSettings.put("proxy_host", "127.0.0.1");
defaultSettings.put("proxy_port", "4444");
defaultSettings.put("master_addressbook", "../userhosts.txt");

View File

@ -81,7 +81,7 @@ class SubscriptionIterator implements Iterator<AddressBook> {
// DataHelper.formatDuration(I2PAppContext.getGlobalContext().clock().now() - sub.getLastFetched()) +
// " ago but the minimum delay is " +
// DataHelper.formatDuration(this.delay));
return new AddressBook(Collections.EMPTY_MAP);
return new AddressBook(Collections.<String, String> emptyMap());
}
}

View File

@ -69,7 +69,7 @@ class SubscriptionList {
public SubscriptionList(File locationsFile, File etagsFile,
File lastModifiedFile, File lastFetchedFile, long delay, List<String> defaultSubs, String proxyHost,
int proxyPort) {
this.subscriptions = new LinkedList();
this.subscriptions = new LinkedList<Subscription>();
this.etagsFile = etagsFile;
this.lastModifiedFile = lastModifiedFile;
this.lastFetchedFile = lastFetchedFile;
@ -84,17 +84,17 @@ class SubscriptionList {
try {
etags = ConfigParser.parse(etagsFile);
} catch (IOException exp) {
etags = new HashMap();
etags = new HashMap<String, String>();
}
try {
lastModified = ConfigParser.parse(lastModifiedFile);
} catch (IOException exp) {
lastModified = new HashMap();
lastModified = new HashMap<String, String>();
}
try {
lastFetched = ConfigParser.parse(lastFetchedFile);
} catch (IOException exp) {
lastFetched = new HashMap();
lastFetched = new HashMap<String, String>();
}
for (String location : locations) {
this.subscriptions.add(new Subscription(location, etags.get(location),
@ -121,9 +121,9 @@ class SubscriptionList {
* won't be read back correctly; the '=' should be escaped.
*/
public void write() {
Map<String, String> etags = new HashMap();
Map<String, String> lastModified = new HashMap();
Map<String, String> lastFetched = new HashMap();
Map<String, String> etags = new HashMap<String, String>();
Map<String, String> lastModified = new HashMap<String, String>();
Map<String, String> lastFetched = new HashMap<String, String>();
for (Subscription sub : this.subscriptions) {
if (sub.getEtag() != null) {
etags.put(sub.getLocation(), sub.getEtag());

View File

@ -7,13 +7,17 @@
<property name="jar" value="desktopgui.jar"/>
<property name="resources" value="resources"/>
<property name="javadoc" value="javadoc"/>
<property name="javac.compilerargs" value=""/>
<property name="javac.version" value="1.6" />
<property name="require.gettext" value="true" />
<condition property="no.bundle">
<isfalse value="${require.gettext}" />
</condition>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build}/${resources}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build}/${resources}"/>
<mkdir dir="${build}/${javadoc}"/>
<mkdir dir="${dist}"/>
</target>
@ -24,7 +28,7 @@
</target>
<target name="compile" depends="init">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
includeAntRuntime="false"
srcdir="${src}" destdir="${build}">
<compilerarg line="${javac.compilerargs}" />
@ -39,8 +43,9 @@
</copy>
</target>
<target name="bundle" >
<target name="bundle" unless="no.bundle">
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" />
<arg value="./bundle-messages.sh" />
</exec>
<exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >

View File

@ -1,3 +1,4 @@
#!/bin/sh
#
# Update messages_xx.po and messages_xx.class files,
# from both java and jsp sources.
@ -15,6 +16,10 @@ TMPFILE=build/javafiles.txt
export TZ=UTC
RC=0
if ! $(which javac > /dev/null 2>&1); then
export JAVAC=${JAVA_HOME}/../bin/javac
fi
if [ "$1" = "-p" ]
then
POUPDATE=1

View File

@ -11,6 +11,7 @@ msgstr ""
"POT-Creation-Date: 2011-02-20 11:53+0000\n"
"PO-Revision-Date: 2011-02-26 19:46-0000\n"
"Last-Translator: hamada <hamada@mail.i2p>\n"
"Language: ar\n"
"Language-Team: duck <duck@mail.i2p>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"

View File

@ -3,19 +3,19 @@
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
# foo <foo@bar>, 2009.
#
#
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: https://trac.i2p2.de/\n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-09 18:07+0000\n"
"PO-Revision-Date: 2011-03-22 15:49+0000\n"
"Last-Translator: blabla <blabla@trash-mail.com>\n"
"Language-Team: German <>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
@ -46,10 +46,10 @@ msgstr "I2P neustarten"
msgid "Stop I2P"
msgstr "I2P beenden"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Systemleistensymbol konfigurieren"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr "Systemleistensymbol aktivieren?"

View File

@ -8,11 +8,11 @@ msgid ""
msgstr ""
"Project-Id-Version: I2P desktopgui\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"POT-Creation-Date: 2014-01-09 19:27+0000\n"
"PO-Revision-Date: 2010-06-15 14:09+0100\n"
"Last-Translator: duck <duck@mail.i2p>\n"
"Language-Team: duck <duck@mail.i2p>\n"
"Language: \n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -46,10 +46,10 @@ msgstr ""
msgid "Stop I2P"
msgstr ""
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr ""
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr ""

View File

@ -2,21 +2,26 @@
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
# foo <foo@bar>, 2009.
#
# Translators:
# blabla <blabla@trash-mail.com>, 2011
# ducki2p <ducki2p@gmail.com>, 2011
# foo <foo@bar>, 2009
# Boxoa590, 2013
msgid ""
msgstr ""
"Project-Id-Version: I2P desktopgui\n"
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"PO-Revision-Date: 2011-03-30 21:58+0100\n"
"Last-Translator: magma <magma@mail.i2p>\n"
"Language-Team: duck <duck@mail.i2p>\n"
"Language: \n"
"POT-Creation-Date: 2014-01-09 19:14+0000\n"
"PO-Revision-Date: 2013-06-08 04:50+0000\n"
"Last-Translator: Boxoa590\n"
"Language-Team: French (http://www.transifex.com/projects/p/I2P/language/"
"fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
@ -24,7 +29,7 @@ msgstr "Démarrer I2P"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "I2P is starting!"
msgstr "I2P démarre!"
msgstr "I2P démarre !"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "Starting"
@ -32,7 +37,7 @@ msgstr "Démarrage"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "Lancer le navigateur"
msgstr "Lancer le navigateur I2P"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
@ -46,11 +51,10 @@ msgstr "Redémarrer I2P"
msgid "Stop I2P"
msgstr "Arrêter I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Configuration de l'icône de notification"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr "Activer l'icône de notification"
msgstr "Activer l'icône de notification ?"

View File

@ -0,0 +1,56 @@
# I2P
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# plazmism <gomidori@live.jp>, 2013
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"PO-Revision-Date: 2013-11-26 10:38+0000\n"
"Last-Translator: plazmism <gomidori@live.jp>\n"
"Language-Team: Japanese (http://www.transifex.com/projects/p/I2P/language/ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
msgstr "I2P を開始"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "I2P is starting!"
msgstr "I2P 起動中!"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "Starting"
msgstr "起動中"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "I2P ブラウザを起動"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
msgstr "desktopgui を設定"
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
msgid "Restart I2P"
msgstr "I2P を再起動"
#: src/net/i2p/desktopgui/InternalTrayManager.java:85
msgid "Stop I2P"
msgstr "I2P を停止"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
msgid "Tray icon configuration"
msgstr "トレイアイコン設定"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
msgid "Should tray icon be enabled?"
msgstr "トレイアイコンを有効にしますか?"

View File

@ -0,0 +1,56 @@
# I2P
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# blueboy, 2013
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"PO-Revision-Date: 2013-11-23 16:31+0000\n"
"Last-Translator: blueboy\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/I2P/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
msgstr "Conectar-se à I2P"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "I2P is starting!"
msgstr "Conectando-se a I2P!"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "Starting"
msgstr "Conectando"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr ""
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
msgstr ""
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
msgid "Restart I2P"
msgstr "Reinicializar o roteador I2P"
#: src/net/i2p/desktopgui/InternalTrayManager.java:85
msgid "Stop I2P"
msgstr "Interromper o roteador I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
msgid "Tray icon configuration"
msgstr ""
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
msgid "Should tray icon be enabled?"
msgstr ""

View File

@ -0,0 +1,57 @@
# I2P
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-09 19:03+0000\n"
"PO-Revision-Date: 2013-11-11 11:31+0000\n"
"Last-Translator: polearnik <polearnik@mail.ru>\n"
"Language-Team: Romanian (http://www.transifex.com/projects/p/I2P/language/"
"ro/)\n"
"Language: ro\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?"
"2:1));\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
msgstr "Start I2P"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "I2P is starting!"
msgstr "I2P se pornește!"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "Starting"
msgstr "Începere"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "Lansare I2P Browser"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
msgstr "Configurarea desktopgui"
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
msgid "Restart I2P"
msgstr "Restart I2P"
#: src/net/i2p/desktopgui/InternalTrayManager.java:85
msgid "Stop I2P"
msgstr "Stop I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Configurare pictogramei din bara de sistem"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr "Ar trebui să fie activata pictograma din bara de sistem?"

View File

@ -2,21 +2,24 @@
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
# foo <foo@bar>, 2009.
#
#
# Translators:
# ducki2p <ducki2p@gmail.com>, 2011
# foo <foo@bar>, 2009
# Роман Азаренко <transifex@basicxp.ru>, 2013
msgid ""
msgstr ""
"Project-Id-Version: I2P desktopgui\n"
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-02-19 17:26+0000\n"
"PO-Revision-Date: 2011-02-23 10:23+0500\n"
"Last-Translator: Hidden Z <hiddenz@mail.i2p>\n"
"Language-Team: duck <duck@mail.i2p>\n"
"Language: \n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"PO-Revision-Date: 2013-12-04 11:46+0000\n"
"Last-Translator: Bergitte <alvina_alexandrova@mail.ru>\n"
"Language-Team: Russian (Russia) (http://www.transifex.com/projects/p/I2P/language/ru_RU/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Language: ru_RU\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
@ -32,7 +35,7 @@ msgstr "Запускается"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "Запустить I2P браузер"
msgstr "Запустить браузер I2P"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
@ -48,9 +51,8 @@ msgstr "Остановить I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
msgid "Tray icon configuration"
msgstr "Настройка иконки в трее"
msgstr "Конфигурация значка в области уведомлений"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
msgid "Should tray icon be enabled?"
msgstr "Отображать ли иконку в трее?"
msgstr "Отображать ли значок в области уведомлений?"

View File

@ -0,0 +1,56 @@
# I2P
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# Kaya Zeren <kayazeren@gmail.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: https://trac.i2p2.de/\n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"PO-Revision-Date: 2013-04-26 06:07+0000\n"
"Last-Translator: Kaya Zeren <kayazeren@gmail.com>\n"
"Language-Team: Turkish (Turkey) (http://www.transifex.com/projects/p/I2P/language/tr_TR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: tr_TR\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
msgstr "I2P başlasın"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "I2P is starting!"
msgstr "I2P başlatılıyor!"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "Starting"
msgstr "Başlatılıyor"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "I2P Tarayıcısınıın"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
msgstr "Masaüstü Arayüzünü Ayarlayın"
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
msgid "Restart I2P"
msgstr "I2P Yeniden Başlasın"
#: src/net/i2p/desktopgui/InternalTrayManager.java:85
msgid "Stop I2P"
msgstr "I2P Durdurulsun"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
msgid "Tray icon configuration"
msgstr "Sistem tepsisi simgesi ayarı"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
msgid "Should tray icon be enabled?"
msgstr "Sistem tepsisi simgesi kullanılsın"

View File

@ -7,9 +7,6 @@ package net.i2p.desktopgui;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import java.awt.GraphicsEnvironment;
import net.i2p.I2PAppContext;
import net.i2p.desktopgui.router.RouterManager;
import net.i2p.desktopgui.util.*;
import net.i2p.util.Log;

View File

@ -1,28 +1,15 @@
package net.i2p.desktopgui;
import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.Desktop.Action;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.swing.SwingWorker;
import net.i2p.desktopgui.i18n.DesktopguiTranslator;
import net.i2p.desktopgui.router.RouterManager;
import net.i2p.desktopgui.util.BrowseException;
import net.i2p.desktopgui.util.ConfigurationManager;
import net.i2p.desktopgui.util.I2PDesktop;
import net.i2p.util.Log;
/**

View File

@ -32,7 +32,6 @@ public class DesktopguiConfigurationFrame extends javax.swing.JFrame {
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@ -115,7 +114,7 @@ public class DesktopguiConfigurationFrame extends javax.swing.JFrame {
System.out.println("Enabling desktopgui");
}
try {
RouterManager.getRouterContext().setProperty(property, value);
RouterManager.getRouterContext().router().saveConfig(property, value);
} catch (Exception ex) {
Logger.getLogger(DesktopguiConfigurationFrame.class.getName()).log(Level.SEVERE, null, ex);
}

View File

@ -5,8 +5,6 @@ import java.io.IOException;
import org.tanukisoftware.wrapper.WrapperManager;
import net.i2p.I2PAppContext;
import net.i2p.desktopgui.i18n.DesktopguiTranslator;
import net.i2p.desktopgui.util.ConfigurationManager;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.util.Log;

View File

@ -1,13 +1,8 @@
package net.i2p.desktopgui.util;
import java.awt.Desktop;
import java.awt.TrayIcon;
import java.awt.Desktop.Action;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import net.i2p.desktopgui.router.RouterManager;
import net.i2p.util.Log;
public class I2PDesktop {

View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="java/src"/>
<classpathentry combineaccessrules="false" kind="src" path="/i2p_sdk"/>
<classpathentry combineaccessrules="false" kind="src" path="/ministreaming"/>
<classpathentry kind="lib" path="/jetty/jettylib/javax.servlet.jar"/>
<classpathentry kind="lib" path="/jetty/jettylib/jetty-util.jar"/>
<classpathentry kind="lib" path="/jetty/jettylib/org.mortbay.jetty.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/i2p_sdk"/>
<classpathentry combineaccessrules="false" kind="src" path="/jetty"/>
<classpathentry combineaccessrules="false" kind="src" path="/ministreaming"/>
<classpathentry kind="output" path="java/build/obj"/>
</classpath>

View File

@ -17,25 +17,28 @@
<classpath>
<pathelement location="../../../core/java/build/obj" />
<pathelement location="../../ministreaming/java/build/obj" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../jetty/jettylib/jetty-util.jar" />
</classpath>
</depend>
</target>
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.6" />
<property name="require.gettext" value="true" />
<condition property="no.bundle">
<isfalse value="${require.gettext}" />
</condition>
<target name="compile" depends="depend">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac
srcdir="./src"
debug="true" deprecation="on" source="1.5" target="1.5"
debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
destdir="./build/obj"
includeAntRuntime="false"
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../jetty/jettylib/jetty-util.jar:../../ministreaming/java/build/mstreaming.jar" >
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
@ -57,7 +60,7 @@
<target name="jar" depends="builddep, compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
<!-- set if unset -->
<property name="workspace.changes.tr" value="" />
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class **/FetchAndAdd*.class **/messages_*.class">
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class">
<manifest>
<attribute name="Main-Class" value="org.klomp.snark.Snark" />
<attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
@ -72,7 +75,7 @@
<target name="jarUpToDate">
<uptodate property="jar.uptodate" targetfile="build/i2psnark.jar" >
<srcfiles dir= "build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class **/FetchAndAdd*.class **/messages_*.class" />
<srcfiles dir= "build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class" />
</uptodate>
<condition property="shouldListChanges" >
<and>
@ -100,9 +103,11 @@
<copy todir="build/icons/.icons" >
<fileset dir="../icons/" />
</copy>
<!-- mime.properties must be in with the classes -->
<copy file="../mime.properties" todir="build/obj/org/klomp/snark/web" />
<war destfile="../i2psnark.war" webxml="../web.xml" >
<!-- include only the web stuff, as of 0.7.12 the router will add i2psnark.jar to the classpath for the war -->
<classes dir="./build/obj" includes="**/web/*.class" />
<classes dir="./build/obj" includes="**/web/*" />
<fileset dir="build/icons/" />
<manifest>
<attribute name="Implementation-Version" value="${full.version}" />
@ -120,10 +125,11 @@
</uptodate>
</target>
<target name="bundle" depends="compile">
<target name="bundle" depends="compile" unless="no.bundle">
<!-- Update the messages_*.po files.
We need to supply the bat file for windows, and then change the fail property to true -->
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" />
<arg value="./bundle-messages.sh" />
</exec>
<exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
@ -169,7 +175,6 @@
<copy file="../../jetty/jettylib/commons-logging.jar" tofile="./dist/lib/commons-logging.jar" />
<copy file="../../jetty/jettylib/javax.servlet.jar" tofile="./dist/lib/javax.servlet.jar" />
<copy file="../../jetty/jettylib/org.mortbay.jetty.jar" tofile="./dist/lib/org.mortbay.jetty.jar" />
<copy file="../../jetty/jettylib/jasper-compiler.jar" tofile="./dist/lib/jasper-compiler.jar" />
<copy file="../../jetty/jettylib/jasper-runtime.jar" tofile="./dist/lib/jasper-runtime.jar" />
<copy file="../../ministreaming/java/build/mstreaming.jar" tofile="./dist/lib/mstreaming.jar" />
<copy file="../../streaming/java/build/streaming.jar" tofile="./dist/lib/streaming.jar" />

View File

@ -1,3 +1,4 @@
#!/bin/sh
#
# Update messages_xx.po and messages_xx.class files,
# from both java and jsp sources.
@ -14,6 +15,10 @@ TMPFILE=build/javafiles.txt
export TZ=UTC
RC=0
if ! $(which javac > /dev/null 2>&1); then
export JAVAC=${JAVA_HOME}/../bin/javac
fi
if [ "$1" = "-p" ]
then
POUPDATE=1

View File

@ -1,28 +0,0 @@
package net.i2p.kademlia;
import java.util.Comparator;
import net.i2p.data.DataHelper;
import net.i2p.data.SimpleDataStructure;
/**
* Help sort Hashes in relation to a base key using the XOR metric
*
* @since 0.9.2
*/
class XORComparator<T extends SimpleDataStructure> implements Comparator<T> {
private final byte[] _base;
/**
* @param target key to compare distances with
*/
public XORComparator(T target) {
_base = target.getData();
}
public int compare(T lhs, T rhs) {
byte lhsDelta[] = DataHelper.xor(lhs.getData(), _base);
byte rhsDelta[] = DataHelper.xor(rhs.getData(), _base);
return DataHelper.compareTo(lhsDelta, rhsDelta);
}
}

View File

@ -4,7 +4,6 @@
*/
package org.klomp.snark;
import java.util.Arrays;
import java.util.Properties;
import net.i2p.client.I2PSessionException;
@ -37,7 +36,9 @@ class BWLimits {
return rv;
}
/****
public static void main(String args[]) {
System.out.println(Arrays.toString(getBWLimits("127.0.0.1", 7654)));
}
****/
}

View File

@ -33,79 +33,106 @@ import net.i2p.data.Hash;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.util.ObjectCounter;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
import net.i2p.util.SimpleTimer2;
/**
* Accepts connections on a TCP port and routes them to sub-acceptors.
* Accepts connections on a I2PServerSocket and routes them to PeerAcceptors.
*/
public class ConnectionAcceptor implements Runnable
class ConnectionAcceptor implements Runnable
{
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(ConnectionAcceptor.class);
private I2PServerSocket serverSocket;
private PeerAcceptor peeracceptor;
private final PeerAcceptor peeracceptor;
private Thread thread;
private final I2PSnarkUtil _util;
private final ObjectCounter<Hash> _badCounter = new ObjectCounter();
private final ObjectCounter<Hash> _badCounter = new ObjectCounter<Hash>();
private final SimpleTimer2.TimedEvent _cleaner;
private boolean stop;
private boolean socketChanged;
private volatile boolean stop;
private static final int MAX_BAD = 2;
// protocol errors before blacklisting.
private static final int MAX_BAD = 1;
private static final long BAD_CLEAN_INTERVAL = 30*60*1000;
public ConnectionAcceptor(I2PSnarkUtil util) { _util = util; }
/**
* Multitorrent. Caller MUST call startAccepting()
*/
public ConnectionAcceptor(I2PSnarkUtil util, PeerCoordinatorSet set) {
_util = util;
_cleaner = new Cleaner();
peeracceptor = new PeerAcceptor(set);
}
public synchronized void startAccepting(PeerCoordinatorSet set, I2PServerSocket socket) {
if (serverSocket != socket) {
if ( (peeracceptor == null) || (peeracceptor.coordinators != set) )
peeracceptor = new PeerAcceptor(set);
serverSocket = socket;
/**
* May be called even when already running. May be called to start up again after halt().
*/
public synchronized void startAccepting() {
stop = false;
socketChanged = true;
if (_log.shouldLog(Log.WARN))
_log.warn("ConnectionAcceptor startAccepting new thread? " + (thread == null));
if (thread == null) {
thread = new I2PAppThread(this, "I2PSnark acceptor");
thread.setDaemon(true);
thread.start();
_util.getContext().simpleScheduler().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
_cleaner.reschedule(BAD_CLEAN_INTERVAL, false);
}
}
}
public ConnectionAcceptor(I2PSnarkUtil util, I2PServerSocket serverSocket,
/**
* Unused (single torrent).
* Do NOT call startAccepting().
*/
public ConnectionAcceptor(I2PSnarkUtil util,
PeerAcceptor peeracceptor)
{
this.serverSocket = serverSocket;
this.peeracceptor = peeracceptor;
_util = util;
thread = new I2PAppThread(this, "I2PSnark acceptor");
thread.setDaemon(true);
thread.start();
_util.getContext().simpleScheduler().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
_cleaner = new Cleaner();
}
public void halt()
/**
* May be restarted later with startAccepting().
*/
public synchronized void halt()
{
if (stop) return;
stop = true;
locked_halt();
Thread t = thread;
if (t != null) {
t.interrupt();
thread = null;
}
}
I2PServerSocket ss = serverSocket;
if (ss != null)
/**
* Caller must synch
* @since 0.9.9
*/
private void locked_halt()
{
I2PServerSocket ss = _util.getServerSocket();
if (ss != null) {
try
{
ss.close();
}
catch(I2PException ioe) { }
Thread t = thread;
if (t != null)
t.interrupt();
}
_badCounter.clear();
_cleaner.cancel();
}
public void restart() {
serverSocket = _util.getServerSocket();
socketChanged = true;
/**
* Effectively unused, would only be called if we changed
* I2CP host/port, which is hidden in the gui if in router context
* FIXME this only works if already running
*/
public synchronized void restart() {
Thread t = thread;
if (t != null)
t.interrupt();
@ -113,21 +140,32 @@ public class ConnectionAcceptor implements Runnable
public int getPort()
{
return 6881; // serverSocket.getLocalPort();
return TrackerClient.PORT; // serverSocket.getLocalPort();
}
public void run()
{
try {
run2();
} finally {
synchronized(this) {
thread = null;
}
}
}
private void run2()
{
while(!stop)
{
if (socketChanged) {
// ok, already updated
socketChanged = false;
}
I2PServerSocket serverSocket = _util.getServerSocket();
while ( (serverSocket == null) && (!stop)) {
if (!(_util.isConnecting() || _util.connected())) {
stop = true;
break;
}
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
serverSocket = _util.getServerSocket();
if (serverSocket == null)
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
}
if(stop)
break;
@ -135,24 +173,26 @@ public class ConnectionAcceptor implements Runnable
{
I2PSocket socket = serverSocket.accept();
if (socket == null) {
if (socketChanged) {
continue;
} else {
I2PServerSocket ss = _util.getServerSocket();
if (ss != serverSocket) {
serverSocket = ss;
socketChanged = true;
}
}
} else {
if (socket.getPeerDestination().equals(_util.getMyDestination())) {
_log.error("Incoming connection from myself");
try { socket.close(); } catch (IOException ioe) {}
continue;
}
if (_badCounter.count(socket.getPeerDestination().calculateHash()) >= MAX_BAD) {
Hash h = socket.getPeerDestination().calculateHash();
if (socket.getLocalPort() == 80) {
_badCounter.increment(h);
if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting connection from " + socket.getPeerDestination().calculateHash() + " after " + MAX_BAD + " failures");
_log.error("Dropping incoming HTTP from " + h);
try { socket.close(); } catch (IOException ioe) {}
continue;
}
int bad = _badCounter.count(h);
if (bad >= MAX_BAD) {
if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting connection from " + h +
" after " + bad + " failures, max is " + MAX_BAD);
try { socket.close(); } catch (IOException ioe) {}
continue;
}
@ -162,26 +202,34 @@ public class ConnectionAcceptor implements Runnable
}
catch (I2PException ioe)
{
if (!socketChanged) {
_log.error("Error while accepting", ioe);
stop = true;
int level = stop ? Log.WARN : Log.ERROR;
if (_log.shouldLog(level))
_log.log(level, "Error while accepting", ioe);
synchronized(this) {
if (!stop) {
locked_halt();
thread = null;
stop = true;
}
}
}
catch (IOException ioe)
{
_log.error("Error while accepting", ioe);
stop = true;
int level = stop ? Log.WARN : Log.ERROR;
if (_log.shouldLog(level))
_log.log(level, "Error while accepting", ioe);
synchronized(this) {
if (!stop) {
locked_halt();
thread = null;
stop = true;
}
}
}
// catch oom?
}
try
{
if (serverSocket != null)
serverSocket.close();
}
catch (I2PException ignored) { }
if (_log.shouldLog(Log.WARN))
_log.warn("ConnectionAcceptor closed");
}
private class Handler implements Runnable {
@ -214,7 +262,17 @@ public class ConnectionAcceptor implements Runnable
}
/** @since 0.9.1 */
private class Cleaner implements SimpleTimer.TimedEvent {
public void timeReached() { _badCounter.clear(); }
private class Cleaner extends SimpleTimer2.TimedEvent {
public Cleaner() {
super(_util.getContext().simpleTimer2());
}
public void timeReached() {
if (stop)
return;
_badCounter.clear();
schedule(BAD_CLEAN_INTERVAL);
}
}
}

View File

@ -37,8 +37,20 @@ interface CoordinatorListener
*/
void gotMetaInfo(PeerCoordinator coordinator, MetaInfo metainfo);
/**
* Is this number of uploaders over the per-torrent limit?
*/
public boolean overUploadLimit(int uploaders);
/**
* Are we currently over the upstream bandwidth limit?
*/
public boolean overUpBWLimit();
/**
* Is the total (in Bps) over the upstream bandwidth limit?
*/
public boolean overUpBWLimit(long total);
public void addMessage(String message);
}

View File

@ -43,8 +43,8 @@ abstract class ExtensionHandler {
* @return bencoded outgoing handshake message
*/
public static byte[] getHandshake(int metasize, boolean pexAndMetadata, boolean dht) {
Map<String, Object> handshake = new HashMap();
Map<String, Integer> m = new HashMap();
Map<String, Object> handshake = new HashMap<String, Object>();
Map<String, Integer> m = new HashMap<String, Integer>();
if (pexAndMetadata) {
m.put(TYPE_METADATA, Integer.valueOf(ID_METADATA));
m.put(TYPE_PEX, Integer.valueOf(ID_PEX));
@ -56,7 +56,7 @@ abstract class ExtensionHandler {
}
// include the map even if empty so the far-end doesn't NPE
handshake.put("m", m);
handshake.put("p", Integer.valueOf(6881));
handshake.put("p", Integer.valueOf(TrackerClient.PORT));
handshake.put("v", "I2PSnark");
handshake.put("reqq", Integer.valueOf(5));
return BEncoder.bencode(handshake);
@ -110,7 +110,8 @@ abstract class ExtensionHandler {
// drop if we need metainfo and we haven't found anybody yet
synchronized(state) {
if (!state.isInitialized()) {
log.debug("Dropping peer, we need metadata! " + peer);
if (log.shouldLog(Log.DEBUG))
log.debug("Dropping peer, we need metadata! " + peer);
peer.disconnect();
}
}
@ -124,7 +125,8 @@ abstract class ExtensionHandler {
// drop if we need metainfo and we haven't found anybody yet
synchronized(state) {
if (!state.isInitialized()) {
log.debug("Dropping peer, we need metadata! " + peer);
if (log.shouldLog(Log.DEBUG))
log.debug("Dropping peer, we need metadata! " + peer);
peer.disconnect();
}
}
@ -274,7 +276,7 @@ abstract class ExtensionHandler {
/** REQUEST and REJECT are the same except for message type */
private static void sendMessage(Peer peer, int type, int piece) {
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("msg_type", Integer.valueOf(type));
map.put("piece", Integer.valueOf(piece));
byte[] payload = BEncoder.bencode(map);
@ -289,7 +291,7 @@ abstract class ExtensionHandler {
}
private static void sendPiece(Peer peer, int piece, byte[] data) {
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("msg_type", Integer.valueOf(TYPE_DATA));
map.put("piece", Integer.valueOf(piece));
map.put("total_size", Integer.valueOf(data.length));
@ -332,7 +334,7 @@ abstract class ExtensionHandler {
if (ids.length < HASH_LENGTH)
return;
int len = Math.min(ids.length, (I2PSnarkUtil.MAX_CONNECTIONS - 1) * HASH_LENGTH);
List<PeerID> peers = new ArrayList(len / HASH_LENGTH);
List<PeerID> peers = new ArrayList<PeerID>(len / HASH_LENGTH);
for (int off = 0; off < len; off += HASH_LENGTH) {
byte[] hash = new byte[HASH_LENGTH];
System.arraycopy(ids, off, hash, 0, HASH_LENGTH);
@ -380,7 +382,7 @@ abstract class ExtensionHandler {
public static void sendPEX(Peer peer, List<Peer> pList) {
if (pList.isEmpty())
return;
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
byte[] peers = new byte[HASH_LENGTH * pList.size()];
int off = 0;
for (Peer p : pList) {
@ -404,7 +406,7 @@ abstract class ExtensionHandler {
* @since DHT
*/
public static void sendDHT(Peer peer, int qport, int rport) {
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("port", Integer.valueOf(qport));
map.put("rport", Integer.valueOf(rport));
byte[] payload = BEncoder.bencode(map);

View File

@ -3,16 +3,12 @@ package org.klomp.snark;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PSession;
@ -33,7 +29,6 @@ import net.i2p.util.FileUtil;
import net.i2p.util.Log;
import net.i2p.util.SecureDirectory;
import net.i2p.util.SecureFile;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
import net.i2p.util.Translate;
@ -49,6 +44,7 @@ import org.klomp.snark.dht.KRPC;
public class I2PSnarkUtil {
private final I2PAppContext _context;
private final Log _log;
private final String _baseName;
private boolean _shouldProxy;
private String _proxyHost;
@ -80,14 +76,24 @@ public class I2PSnarkUtil {
public static final int MAX_CONNECTIONS = 16; // per torrent
public static final String PROP_MAX_BW = "i2cp.outboundBytesPerSecond";
public static final boolean DEFAULT_USE_DHT = true;
public static final String EEPGET_USER_AGENT = "I2PSnark";
public I2PSnarkUtil(I2PAppContext ctx) {
this(ctx, "i2psnark");
}
/**
* @param baseName generally "i2psnark"
* @since Jetty 7
*/
public I2PSnarkUtil(I2PAppContext ctx, String baseName) {
_context = ctx;
_log = _context.logManager().getLog(Snark.class);
_opts = new HashMap();
_baseName = baseName;
_opts = new HashMap<String, String>();
//setProxy("127.0.0.1", 4444);
setI2CPConfig("127.0.0.1", 7654, null);
_banlist = new ConcurrentHashSet();
_banlist = new ConcurrentHashSet<Hash>();
_maxUploaders = Snark.MAX_TOTAL_UPLOADERS;
_maxUpBW = DEFAULT_MAX_UP_BW;
_maxConnections = MAX_CONNECTIONS;
@ -99,7 +105,7 @@ public class I2PSnarkUtil {
// This is used for both announce replies and .torrent file downloads,
// so it must be available even if not connected to I2CP.
// so much for multiple instances
_tmpDir = new SecureDirectory(ctx.getTempDir(), "i2psnark");
_tmpDir = new SecureDirectory(ctx.getTempDir(), baseName);
FileUtil.rmdir(_tmpDir, false);
_tmpDir.mkdirs();
}
@ -148,7 +154,7 @@ public class I2PSnarkUtil {
}
/**
* This updates the session options and tells the router
* This updates ALL the session options (not just the bw) and tells the router
* @param limit KBps
*/
public void setMaxUpBW(int limit) {
@ -210,15 +216,13 @@ public class I2PSnarkUtil {
_log.debug("Connecting to I2P", new Exception("I did it"));
Properties opts = _context.getProperties();
if (_opts != null) {
for (Iterator iter = _opts.keySet().iterator(); iter.hasNext(); ) {
String key = (String)iter.next();
opts.setProperty(key, _opts.get(key).toString());
}
for (Map.Entry<String, String> entry : _opts.entrySet() )
opts.setProperty(entry.getKey(), entry.getValue());
}
if (opts.getProperty("inbound.nickname") == null)
opts.setProperty("inbound.nickname", "I2PSnark");
opts.setProperty("inbound.nickname", _baseName.replace("i2psnark", "I2PSnark"));
if (opts.getProperty("outbound.nickname") == null)
opts.setProperty("outbound.nickname", "I2PSnark");
opts.setProperty("outbound.nickname", _baseName.replace("i2psnark", "I2PSnark"));
if (opts.getProperty("outbound.priority") == null)
opts.setProperty("outbound.priority", "-10");
// Dont do this for now, it is set in I2PSocketEepGet for announces,
@ -249,11 +253,13 @@ public class I2PSnarkUtil {
opts.setProperty("i2p.streaming.enforceProtocol", "true");
if (opts.getProperty("i2p.streaming.disableRejectLogging") == null)
opts.setProperty("i2p.streaming.disableRejectLogging", "true");
if (opts.getProperty("i2p.streaming.answerPings") == null)
opts.setProperty("i2p.streaming.answerPings", "false");
_manager = I2PSocketManagerFactory.createManager(_i2cpHost, _i2cpPort, opts);
_connecting = false;
}
if (_shouldUseDHT && _manager != null && _dht == null)
_dht = new KRPC(_context, _manager.getSession());
_dht = new KRPC(_context, _baseName, _manager.getSession());
return (_manager != null);
}
@ -314,6 +320,8 @@ public class I2PSnarkUtil {
if (_banlist.contains(dest))
throw new IOException("Not trying to contact " + dest.toBase64() + ", as they are banlisted");
try {
// TODO opts.setPort(xxx); connect(addr, opts)
// DHT moved above 6881 in 0.9.9
I2PSocket rv = _manager.connect(addr);
if (rv != null)
_banlist.remove(dest);
@ -321,7 +329,9 @@ public class I2PSnarkUtil {
} catch (I2PException ie) {
_banlist.add(dest);
_context.simpleScheduler().addEvent(new Unbanlist(dest), 10*60*1000);
throw new IOException("Unable to reach the peer " + peer + ": " + ie.getMessage());
IOException ioe = new IOException("Unable to reach the peer " + peer);
ioe.initCause(ie);
throw ioe;
}
}
@ -384,6 +394,7 @@ public class I2PSnarkUtil {
}
}
EepGet get = new I2PSocketEepGet(_context, _manager, retries, out.getAbsolutePath(), fetchURL);
get.addHeader("User-Agent", EEPGET_USER_AGENT);
if (get.fetch(timeout)) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Fetch successful [" + url + "]: size=" + out.length());
@ -425,6 +436,7 @@ public class I2PSnarkUtil {
}
ByteArrayOutputStream out = new ByteArrayOutputStream(initialSize);
EepGet get = new I2PSocketEepGet(_context, _manager, retries, -1, maxSize, null, out, fetchURL);
get.addHeader("User-Agent", EEPGET_USER_AGENT);
if (get.fetch(timeout)) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Fetch successful [" + url + "]: size=" + out.size());
@ -503,7 +515,7 @@ public class I2PSnarkUtil {
if (_log.shouldLog(Log.INFO))
_log.info("Using existing session for lookup of " + ip);
try {
return sess.lookupDest(h);
return sess.lookupDest(h, 15*1000);
} catch (I2PSessionException ise) {
}
}
@ -563,7 +575,7 @@ public class I2PSnarkUtil {
*/
public List<String> getOpenTrackers() {
if (!shouldUseOpenTrackers())
return Collections.EMPTY_LIST;
return Collections.emptyList();
return _openTrackers;
}
@ -588,7 +600,7 @@ public class I2PSnarkUtil {
public synchronized void setUseDHT(boolean yes) {
_shouldUseDHT = yes;
if (yes && _manager != null && _dht == null) {
_dht = new KRPC(_context, _manager.getSession());
_dht = new KRPC(_context, _baseName, _manager.getSession());
} else if (!yes && _dht != null) {
_dht.stop();
_dht = null;

View File

@ -0,0 +1,143 @@
/*
* Released into the public domain
* with no warranty of any kind, either expressed or implied.
*/
package org.klomp.snark;
import java.util.Map;
import java.util.Properties;
import net.i2p.client.I2PSession;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
/**
* Periodically check for idle condition based on connected peers,
* and reduce/restore tunnel count as necessary.
* We can't use the I2CP idle detector because it's based on traffic,
* so DHT and announces would keep it non-idle.
*
* @since 0.9.7
*/
class IdleChecker extends SimpleTimer2.TimedEvent {
private final SnarkManager _mgr;
private final I2PSnarkUtil _util;
private final PeerCoordinatorSet _pcs;
private final Log _log;
private int _consec;
private int _consecNotRunning;
private boolean _isIdle;
private static final long CHECK_TIME = 63*1000;
private static final int MAX_CONSEC_IDLE = 4;
private static final int MAX_CONSEC_NOT_RUNNING = 20;
/**
* Caller must schedule
*/
public IdleChecker(SnarkManager mgr, PeerCoordinatorSet pcs) {
super(mgr.util().getContext().simpleTimer2());
_util = mgr.util();
_log = _util.getContext().logManager().getLog(IdleChecker.class);
_mgr = mgr;
_pcs = pcs;
}
public void timeReached() {
if (_util.connected()) {
boolean torrentRunning = false;
boolean hasPeers = false;
for (PeerCoordinator pc : _pcs) {
if (!pc.halted()) {
torrentRunning = true;
if (pc.getPeers() > 0) {
hasPeers = true;
break;
}
}
}
if (torrentRunning) {
_consecNotRunning = 0;
} else {
if (_consecNotRunning++ >= MAX_CONSEC_NOT_RUNNING) {
if (_log.shouldLog(Log.WARN))
_log.warn("Closing tunnels on idle");
_util.disconnect();
_mgr.addMessage(_util.getString("I2P tunnel closed."));
schedule(3 * CHECK_TIME);
return;
}
}
if (hasPeers) {
if (_isIdle)
restoreTunnels();
} else {
if (!_isIdle) {
if (_consec++ >= MAX_CONSEC_IDLE)
reduceTunnels();
}
}
} else {
_isIdle = false;
_consec = 0;
_consecNotRunning = 0;
}
schedule(CHECK_TIME);
}
/**
* Reduce to 1 in / 1 out tunnel
*/
private void reduceTunnels() {
_isIdle = true;
if (_log.shouldLog(Log.INFO))
_log.info("Reducing tunnels on idle");
setTunnels("1", "1", "0", "0");
}
/**
* Restore tunnel count
*/
private void restoreTunnels() {
_isIdle = false;
if (_log.shouldLog(Log.INFO))
_log.info("Restoring tunnels on activity");
Map<String, String> opts = _util.getI2CPOptions();
String i = opts.get("inbound.quantity");
if (i == null)
i = "3";
String o = opts.get("outbound.quantity");
if (o == null)
o = "3";
String ib = opts.get("inbound.backupQuantity");
if (ib == null)
ib = "0";
String ob= opts.get("outbound.backupQuantity");
if (ob == null)
ob = "0";
setTunnels(i, o, ib, ob);
}
/**
* Set in / out / in backup / out backup tunnel counts
*/
private void setTunnels(String i, String o, String ib, String ob) {
_consec = 0;
I2PSocketManager mgr = _util.getSocketManager();
if (mgr != null) {
I2PSession sess = mgr.getSession();
if (sess != null) {
Properties newProps = new Properties();
newProps.setProperty("inbound.quantity", i);
newProps.setProperty("outbound.quantity", o);
newProps.setProperty("inbound.backupQuantity", ib);
newProps.setProperty("outbound.backupQuantity", ob);
sess.updateOptions(newProps);
}
}
}
}

View File

@ -6,7 +6,6 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.RandomSource;
@ -190,7 +189,7 @@ class MagnetState {
*/
public MetaInfo buildMetaInfo() throws Exception {
// top map has nothing in it but the info map (no announce)
Map<String, BEValue> map = new HashMap();
Map<String, BEValue> map = new HashMap<String, BEValue>();
InputStream is = new ByteArrayInputStream(metainfoBytes);
BDecoder dec = new BDecoder(is);
BEValue bev = dec.bdecodeMap();

View File

@ -133,7 +133,7 @@ public class MagnetURI {
}
if (idx < 0 || idx > uri.length())
return null;
List<String> rv = new ArrayList();
List<String> rv = new ArrayList<String>();
while (true) {
String p = uri.substring(idx);
uri = p;

View File

@ -61,6 +61,10 @@ public class MetaInfo
private final byte[] piece_hashes;
private final long length;
private final boolean privateTorrent;
private final List<List<String>> announce_list;
private final String comment;
private final String created_by;
private final long creation_date;
private Map<String, BEValue> infoMap;
/**
@ -69,9 +73,11 @@ public class MetaInfo
* @param announce may be null
* @param files null for single-file torrent
* @param lengths null for single-file torrent
* @param announce_list may be null
*/
MetaInfo(String announce, String name, String name_utf8, List<List<String>> files, List<Long> lengths,
int piece_length, byte[] piece_hashes, long length, boolean privateTorrent)
int piece_length, byte[] piece_hashes, long length, boolean privateTorrent,
List<List<String>> announce_list)
{
this.announce = announce;
this.name = name;
@ -83,6 +89,10 @@ public class MetaInfo
this.piece_hashes = piece_hashes;
this.length = length;
this.privateTorrent = privateTorrent;
this.announce_list = announce_list;
this.comment = null;
this.created_by = null;
this.creation_date = 0;
// TODO if we add a parameter for other keys
//if (other != null) {
@ -141,6 +151,49 @@ public class MetaInfo
this.announce = val.getString();
}
// BEP 12
val = m.get("announce-list");
if (val == null) {
this.announce_list = null;
} else {
this.announce_list = new ArrayList<List<String>>();
List<BEValue> bl1 = val.getList();
for (BEValue bev : bl1) {
List<BEValue> bl2 = bev.getList();
List<String> sl2 = new ArrayList<String>();
for (BEValue bev2 : bl2) {
sl2.add(bev2.getString());
}
this.announce_list.add(sl2);
}
}
// misc. optional top-level stuff
val = m.get("comment");
String st = null;
if (val != null) {
try {
st = val.getString();
} catch (InvalidBEncodingException ibee) {}
}
this.comment = st;
val = m.get("created by");
st = null;
if (val != null) {
try {
st = val.getString();
} catch (InvalidBEncodingException ibee) {}
}
this.created_by = st;
val = m.get("creation date");
long time = 0;
if (val != null) {
try {
time = val.getLong() * 1000;
} catch (InvalidBEncodingException ibee) {}
}
this.creation_date = time;
val = m.get("info");
if (val == null)
throw new InvalidBEncodingException("Missing info map");
@ -163,7 +216,16 @@ public class MetaInfo
// BEP 27
val = info.get("private");
privateTorrent = val != null && val.getString().equals("1");
if (val != null) {
Object o = val.getValue();
// Is it supposed to be a number or a string?
// i2psnark does it as a string. BEP 27 doesn't say.
// Transmission does numbers.
privateTorrent = "1".equals(o) ||
((o instanceof Number) && ((Number) o).intValue() == 1);
} else {
privateTorrent = false;
}
val = info.get("piece length");
if (val == null)
@ -197,9 +259,9 @@ public class MetaInfo
if (size == 0)
throw new InvalidBEncodingException("zero size files list");
List<List<String>> m_files = new ArrayList(size);
List<List<String>> m_files_utf8 = new ArrayList(size);
List<Long> m_lengths = new ArrayList(size);
List<List<String>> m_files = new ArrayList<List<String>>(size);
List<List<String>> m_files_utf8 = new ArrayList<List<String>>(size);
List<Long> m_lengths = new ArrayList<Long>(size);
long l = 0;
for (int i = 0; i < list.size(); i++)
{
@ -225,7 +287,7 @@ public class MetaInfo
if (path_length == 0)
throw new InvalidBEncodingException("zero size file path list");
List<String> file = new ArrayList(path_length);
List<String> file = new ArrayList<String>(path_length);
Iterator<BEValue> it = path_list.iterator();
while (it.hasNext()) {
String s = it.next().getString();
@ -248,7 +310,7 @@ public class MetaInfo
path_list = val.getList();
path_length = path_list.size();
if (path_length > 0) {
file = new ArrayList(path_length);
file = new ArrayList<String>(path_length);
it = path_list.iterator();
while (it.hasNext())
file.add(it.next().getString());
@ -296,6 +358,15 @@ public class MetaInfo
return announce;
}
/**
* Returns a list of lists of urls.
*
* @since 0.9.5
*/
public List<List<String>> getAnnounceList() {
return announce_list;
}
/**
* Returns the original 20 byte SHA1 hash over the bencoded info map.
*/
@ -351,6 +422,33 @@ public class MetaInfo
return lengths;
}
/**
* The comment string or null.
* Not available for locally-created torrents.
* @since 0.9.7
*/
public String getComment() {
return this.comment;
}
/**
* The created-by string or null.
* Not available for locally-created torrents.
* @since 0.9.7
*/
public String getCreatedBy() {
return this.created_by;
}
/**
* The creation date (ms) or zero.
* Not available for locally-created torrents.
* @since 0.9.7
*/
public long getCreationDate() {
return this.creation_date;
}
/**
* Returns the number of pieces.
*/
@ -428,7 +526,6 @@ public class MetaInfo
* @since 0.9.1
*/
boolean checkPiece(PartialPiece pp) {
MessageDigest sha1 = SHA1.getInstance();
int piece = pp.getPiece();
byte[] hash;
try {
@ -470,12 +567,18 @@ public class MetaInfo
/**
* Creates a copy of this MetaInfo that shares everything except the
* announce URL.
* Drops any announce-list.
* Preserves infohash and info map, including any non-standard fields.
* @param announce may be null
*/
public MetaInfo reannounce(String announce)
public MetaInfo reannounce(String announce) throws InvalidBEncodingException
{
return new MetaInfo(announce, name, name_utf8, files,
lengths, piece_length,
piece_hashes, length, privateTorrent);
Map<String, BEValue> m = new HashMap<String, BEValue>();
if (announce != null)
m.put("announce", new BEValue(DataHelper.getUTF8(announce)));
Map<String, BEValue> info = createInfoMap();
m.put("info", new BEValue(info));
return new MetaInfo(m);
}
/**
@ -483,10 +586,12 @@ public class MetaInfo
*/
public synchronized byte[] getTorrentData()
{
Map m = new HashMap();
Map<String, Object> m = new HashMap<String, Object>();
if (announce != null)
m.put("announce", announce);
Map info = createInfoMap();
if (announce_list != null)
m.put("announce-list", announce_list);
Map<String, BEValue> info = createInfoMap();
m.put("info", info);
// don't save this locally, we should only do this once
return BEncoder.bencode(m);
@ -506,32 +611,46 @@ public class MetaInfo
// or else we will lose any non-standard keys and corrupt the infohash.
if (infoMap != null)
return Collections.unmodifiableMap(infoMap);
// we should only get here if serving a magnet on a torrent we created
if (_log.shouldLog(Log.WARN))
_log.warn("Creating new infomap", new Exception());
// otherwise we must create it
Map info = new HashMap();
info.put("name", name);
Map<String, BEValue> info = new HashMap<String, BEValue>();
info.put("name", new BEValue(DataHelper.getUTF8(name)));
if (name_utf8 != null)
info.put("name.utf-8", name_utf8);
info.put("name.utf-8", new BEValue(DataHelper.getUTF8(name_utf8)));
// BEP 27
if (privateTorrent)
info.put("private", "1");
info.put("private", new BEValue(DataHelper.getUTF8("1")));
info.put("piece length", Integer.valueOf(piece_length));
info.put("pieces", piece_hashes);
info.put("piece length", new BEValue(Integer.valueOf(piece_length)));
info.put("pieces", new BEValue(piece_hashes));
if (files == null)
info.put("length", Long.valueOf(length));
info.put("length", new BEValue(Long.valueOf(length)));
else
{
List l = new ArrayList();
List<BEValue> l = new ArrayList<BEValue>();
for (int i = 0; i < files.size(); i++)
{
Map file = new HashMap();
file.put("path", files.get(i));
if ( (files_utf8 != null) && (files_utf8.size() > i) )
file.put("path.utf-8", files_utf8.get(i));
file.put("length", lengths.get(i));
l.add(file);
Map<String, BEValue> file = new HashMap<String, BEValue>();
List<String> fi = files.get(i);
List<BEValue> befiles = new ArrayList<BEValue>(fi.size());
for (int j = 0; j < fi.size(); j++) {
befiles.add(new BEValue(DataHelper.getUTF8(fi.get(j))));
}
file.put("path", new BEValue(befiles));
if ( (files_utf8 != null) && (files_utf8.size() > i) ) {
List<String> fiu = files_utf8.get(i);
List<BEValue> beufiles = new ArrayList<BEValue>(fiu.size());
for (int j = 0; j < fiu.size(); j++) {
beufiles.add(new BEValue(DataHelper.getUTF8(fiu.get(j))));
}
file.put("path.utf-8", new BEValue(beufiles));
}
file.put("length", new BEValue(lengths.get(i)));
l.add(new BEValue(file));
}
info.put("files", l);
info.put("files", new BEValue(l));
}
// TODO if we add the ability for other keys in the first constructor

View File

@ -31,7 +31,7 @@ import net.i2p.util.SecureFile;
*
* @since 0.8.2
*/
class PartialPiece implements Comparable {
class PartialPiece implements Comparable<PartialPiece> {
// we store the piece so we can use it in compareTo()
private final Piece piece;
@ -295,8 +295,7 @@ class PartialPiece implements Comparable {
* then rarest first,
* then highest downloaded first
*/
public int compareTo(Object o) throws ClassCastException {
PartialPiece opp = (PartialPiece)o;
public int compareTo(PartialPiece opp) {
int d = this.piece.compareTo(opp.piece);
if (d != 0)
return d;

View File

@ -28,6 +28,8 @@ import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PSocket;
@ -37,7 +39,7 @@ import net.i2p.util.Log;
import org.klomp.snark.bencode.BEValue;
public class Peer implements Comparable
public class Peer implements Comparable<Peer>
{
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Peer.class);
// Identifying property, the peer id of the other side.
@ -68,8 +70,10 @@ public class Peer implements Comparable
private I2PSocket sock;
private boolean deregister = true;
private static long __id;
private long _id;
private static final AtomicLong __id = new AtomicLong();
private final long _id;
private final AtomicBoolean _disconnected = new AtomicBoolean();
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};
@ -98,7 +102,7 @@ public class Peer implements Comparable
this.my_id = my_id;
this.infohash = infohash;
this.metainfo = metainfo;
_id = ++__id;
_id = __id.incrementAndGet();
//_log.debug("Creating a new peer with " + peerID.toString(), new Exception("creating"));
}
@ -123,7 +127,7 @@ public class Peer implements Comparable
byte[] id = handshake(in, out);
this.peerID = new PeerID(id, sock.getPeerDestination());
_id = ++__id;
_id = __id.incrementAndGet();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Creating a new peer " + peerID.toString(), new Exception("creating " + _id));
}
@ -190,7 +194,7 @@ public class Peer implements Comparable
* Compares the PeerIDs.
* @deprecated unused?
*/
public int compareTo(Object o)
public int compareTo(Peer o)
{
Peer p = (Peer)o;
int rv = peerID.compareTo(p.peerID);
@ -359,7 +363,7 @@ public class Peer implements Comparable
String bittorrentProtocol = new String(bs, "UTF-8");
if (!"BitTorrent protocol".equals(bittorrentProtocol))
throw new IOException("Handshake failure, expected "
+ "'Bittorrent protocol', got '"
+ "'BitTorrent protocol', got '"
+ bittorrentProtocol + "'");
// Handshake read - options
@ -457,6 +461,8 @@ public class Peer implements Comparable
void disconnect()
{
if (!_disconnected.compareAndSet(false, true))
return;
PeerState s = state;
if (s != null)
{
@ -476,9 +482,11 @@ public class Peer implements Comparable
PeerConnectionIn in = s.in;
if (in != null)
in.disconnect();
PeerConnectionOut out = s.out;
if (out != null)
out.disconnect();
// this is blocking in streaming, so do this after closing the socket
// so it won't really block
//PeerConnectionOut out = s.out;
//if (out != null)
// out.disconnect();
PeerListener pl = s.listener;
if (pl != null)
pl.disconnected(this);
@ -492,6 +500,13 @@ public class Peer implements Comparable
_log.warn("Error disconnecting " + toString(), ioe);
}
}
if (s != null) {
// this is blocking in streaming, so do this after closing the socket
// so it won't really block
PeerConnectionOut out = s.out;
if (out != null)
out.disconnect();
}
}
/**

View File

@ -26,8 +26,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.SequenceInputStream;
import java.util.Iterator;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.data.Base64;
@ -40,7 +38,7 @@ import net.i2p.util.Log;
* protocol connection. The PeerAcceptor will then create a new peer
* if the PeerCoordinator wants more peers.
*/
public class PeerAcceptor
class PeerAcceptor
{
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(PeerAcceptor.class);
private final PeerCoordinator coordinator;
@ -170,8 +168,7 @@ public class PeerAcceptor
if (b != PROTO[i])
throw new IOException("Bad protocol 0x" + Integer.toHexString(b) + " at byte " + i);
}
if (in.skip(8) != 8)
throw new IOException("EOF before hash");
DataHelper.skip(in, 8);
byte buf[] = new byte[20];
int read = DataHelper.read(in, buf);
if (read != buf.length)

View File

@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.Log;
@ -73,7 +72,7 @@ class PeerCheckerTask implements Runnable
// Keep track of peers we remove now,
// we will add them back to the end of the list.
List<Peer> removed = new ArrayList();
List<Peer> removed = new ArrayList<Peer>();
int uploadLimit = coordinator.allowedUploaders();
boolean overBWLimit = coordinator.overUpBWLimit();
DHT dht = _util.getDHT();

View File

@ -65,7 +65,7 @@ class PeerConnectionIn implements Runnable
try {
din.close();
} catch (IOException ioe) {
_log.warn("Error closing the stream from " + peer, ioe);
//_log.warn("Error closing the stream from " + peer, ioe);
}
}
}

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;
import net.i2p.util.I2PAppThread;
@ -42,10 +43,10 @@ class PeerConnectionOut implements Runnable
private boolean quit;
// Contains Messages.
private final List<Message> sendQueue = new ArrayList();
private final List<Message> sendQueue = new ArrayList<Message>();
private static long __id = 0;
private long _id;
private static final AtomicLong __id = new AtomicLong();
private final long _id;
long lastSent;
@ -53,10 +54,9 @@ class PeerConnectionOut implements Runnable
{
this.peer = peer;
this.dout = dout;
_id = ++__id;
_id = __id.incrementAndGet();
lastSent = System.currentTimeMillis();
quit = false;
}
public void startup() {
@ -66,7 +66,7 @@ class PeerConnectionOut implements Runnable
/**
* Continuesly monitors for more outgoing messages that have to be send.
* Stops if quit is true of an IOException occurs.
* Stops if quit is true or an IOException occurs.
*/
public void run()
{
@ -116,10 +116,10 @@ class PeerConnectionOut implements Runnable
// And remove piece messages if we are choking.
// this should get fixed for starvation
Iterator it = sendQueue.iterator();
Iterator<Message> it = sendQueue.iterator();
while (m == null && it.hasNext())
{
Message nm = (Message)it.next();
Message nm = it.next();
if (nm.type == Message.PIECE)
{
if (state.choking) {
@ -215,13 +215,13 @@ class PeerConnectionOut implements Runnable
thread.interrupt();
sendQueue.clear();
sendQueue.notify();
sendQueue.notifyAll();
}
if (dout != null) {
try {
dout.close();
} catch (IOException ioe) {
_log.warn("Error closing the stream to " + peer, ioe);
//_log.warn("Error closing the stream to " + peer, ioe);
}
}
}
@ -274,10 +274,10 @@ class PeerConnectionOut implements Runnable
boolean removed = false;
synchronized(sendQueue)
{
Iterator it = sendQueue.iterator();
Iterator<Message> it = sendQueue.iterator();
while (it.hasNext())
{
Message m = (Message)it.next();
Message m = it.next();
if (m.type == type)
{
it.remove();
@ -360,13 +360,13 @@ class PeerConnectionOut implements Runnable
/** reransmit requests not received in 7m */
private static final int REQ_TIMEOUT = (2 * SEND_TIMEOUT) + (60 * 1000);
void retransmitRequests(List requests)
void retransmitRequests(List<Request> requests)
{
long now = System.currentTimeMillis();
Iterator it = requests.iterator();
Iterator<Request> it = requests.iterator();
while (it.hasNext())
{
Request req = (Request)it.next();
Request req = it.next();
if(now > req.sendTime + REQ_TIMEOUT) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Retransmit request " + req + " to peer " + peer);
@ -375,12 +375,12 @@ class PeerConnectionOut implements Runnable
}
}
void sendRequests(List requests)
void sendRequests(List<Request> requests)
{
Iterator it = requests.iterator();
Iterator<Request> it = requests.iterator();
while (it.hasNext())
{
Request req = (Request)it.next();
Request req = it.next();
sendRequest(req);
}
}
@ -391,10 +391,10 @@ class PeerConnectionOut implements Runnable
// (multiple choke/unchokes received cause duplicate requests in the queue)
synchronized(sendQueue)
{
Iterator it = sendQueue.iterator();
Iterator<Message> it = sendQueue.iterator();
while (it.hasNext())
{
Message m = (Message)it.next();
Message m = it.next();
if (m.type == Message.REQUEST && m.piece == req.getPiece() &&
m.begin == req.off && m.length == req.len)
{
@ -419,10 +419,10 @@ class PeerConnectionOut implements Runnable
int total = 0;
synchronized(sendQueue)
{
Iterator it = sendQueue.iterator();
Iterator<Message> it = sendQueue.iterator();
while (it.hasNext())
{
Message m = (Message)it.next();
Message m = it.next();
if (m.type == Message.PIECE)
total += m.length;
}
@ -489,10 +489,10 @@ class PeerConnectionOut implements Runnable
// See if it is still in our send queue
synchronized(sendQueue)
{
Iterator it = sendQueue.iterator();
Iterator<Message> it = sendQueue.iterator();
while (it.hasNext())
{
Message m = (Message)it.next();
Message m = it.next();
if (m.type == Message.REQUEST
&& m.piece == req.getPiece()
&& m.begin == req.off
@ -530,10 +530,10 @@ class PeerConnectionOut implements Runnable
{
synchronized (sendQueue)
{
Iterator it = sendQueue.iterator();
Iterator<Message> it = sendQueue.iterator();
while (it.hasNext())
{
Message m = (Message)it.next();
Message m = it.next();
if (m.type == Message.PIECE
&& m.piece == piece
&& m.begin == begin

View File

@ -151,12 +151,12 @@ class PeerCoordinator implements PeerListener
this.listener = listener;
this.snark = torrent;
wantedPieces = new ArrayList();
wantedPieces = new ArrayList<Piece>();
setWantedPieces();
partialPieces = new ArrayList(getMaxConnections() + 1);
peers = new LinkedBlockingQueue();
partialPieces = new ArrayList<PartialPiece>(getMaxConnections() + 1);
peers = new LinkedBlockingQueue<Peer>();
magnetState = new MagnetState(infohash, metainfo);
pexPeers = new ConcurrentHashSet();
pexPeers = new ConcurrentHashSet<PeerID>();
// Install a timer to check the uploaders.
// Randomize the first start time so multiple tasks are spread out,
@ -218,7 +218,7 @@ class PeerCoordinator implements PeerListener
/** for web page detailed stats */
public List<Peer> peerList()
{
return new ArrayList(peers);
return new ArrayList<Peer>(peers);
}
public byte[] getID()
@ -376,10 +376,10 @@ class PeerCoordinator implements PeerListener
*/
public boolean needOutboundPeers() {
//return wantedBytes != 0 && needPeers();
// minus one to make it a little easier for new peers to get in on large swarms
// minus two to make it a little easier for new peers to get in on large swarms
return wantedBytes != 0 &&
!halted &&
peers.size() < getMaxConnections() - 1 &&
peers.size() < getMaxConnections() - 2 &&
(storage == null || !storage.isChecking());
}
@ -412,7 +412,7 @@ class PeerCoordinator implements PeerListener
public void halt()
{
halted = true;
List<Peer> removed = new ArrayList();
List<Peer> removed = new ArrayList<Peer>();
synchronized(peers)
{
// Stop peer checker task.
@ -613,7 +613,7 @@ class PeerCoordinator implements PeerListener
// linked list will contain all interested peers that we choke.
// At the start are the peers that have us unchoked at the end the
// other peer that are interested, but are choking us.
List<Peer> interested = new LinkedList();
List<Peer> interested = new LinkedList<Peer>();
int count = 0;
int unchokedCount = 0;
int maxUploaders = allowedUploaders();
@ -729,7 +729,7 @@ class PeerCoordinator implements PeerListener
}
Piece piece = null;
List<Piece> requested = new ArrayList();
List<Piece> requested = new ArrayList<Piece>();
int wantedSize = END_GAME_THRESHOLD + 1;
synchronized(wantedPieces)
{
@ -833,7 +833,7 @@ class PeerCoordinator implements PeerListener
_log.debug("Updated piece priorities called but no priorities to set?");
return;
}
List<Piece> toCancel = new ArrayList();
List<Piece> toCancel = new ArrayList<Piece>();
synchronized(wantedPieces) {
// Add incomplete and previously unwanted pieces to the list
// Temp to avoid O(n**2)
@ -999,13 +999,13 @@ class PeerCoordinator implements PeerListener
}
catch (IOException ioe)
{
snark.stopTorrent();
String msg = "Error writing storage (piece " + piece + ") for " + metainfo.getName() + ": " + ioe;
_log.error(msg, ioe);
if (listener != null) {
listener.addMessage(msg);
listener.addMessage("Fatal storage error: Stopping torrent " + metainfo.getName());
}
snark.stopTorrent();
throw new RuntimeException(msg, ioe);
}
wantedPieces.remove(p);
@ -1019,7 +1019,7 @@ class PeerCoordinator implements PeerListener
// Announce to the world we have it!
// Disconnect from other seeders when we get the last piece
List<Peer> toDisconnect = done ? new ArrayList() : null;
List<Peer> toDisconnect = done ? new ArrayList<Peer>() : null;
for (Peer p : peers) {
if (p.isConnected())
{
@ -1231,16 +1231,16 @@ class PeerCoordinator implements PeerListener
return pp;
}
}
if (_log.shouldLog(Log.WARN)) {
if (_log.shouldLog(Log.INFO)) {
if (skipped)
_log.warn("Partial piece " + pp + " with multiple peers skipped for seeder");
_log.info("Partial piece " + pp + " with multiple peers skipped for seeder");
else
_log.warn("Partial piece " + pp + " NOT in wantedPieces??");
_log.info("Partial piece " + pp + " NOT in wantedPieces??");
}
}
}
if (_log.shouldLog(Log.WARN) && !partialPieces.isEmpty())
_log.warn("Peer " + peer + " has none of our partials " + partialPieces);
if (_log.shouldLog(Log.INFO) && !partialPieces.isEmpty())
_log.info("Peer " + peer + " has none of our partials " + partialPieces);
}
// ...and this section turns this into the general move-requests-around code!
// Temporary? So PeerState never calls wantPiece() directly for now...

View File

@ -12,11 +12,11 @@ import net.i2p.crypto.SHA1Hash;
* Each PeerCoordinator is added to the set from within the Snark (and removed
* from it there too)
*/
public class PeerCoordinatorSet {
class PeerCoordinatorSet implements Iterable<PeerCoordinator> {
private final Map<SHA1Hash, PeerCoordinator> _coordinators;
public PeerCoordinatorSet() {
_coordinators = new ConcurrentHashMap();
_coordinators = new ConcurrentHashMap<SHA1Hash, PeerCoordinator>();
}
public Iterator<PeerCoordinator> iterator() {

View File

@ -24,7 +24,6 @@ import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Map;
import net.i2p.I2PAppContext;
import net.i2p.data.Base32;
import net.i2p.data.Base64;
import net.i2p.data.DataHelper;
@ -43,7 +42,7 @@ import org.klomp.snark.bencode.InvalidBEncodingException;
* and the PeerID is not required.
* Equality is now determined solely by the dest hash.
*/
public class PeerID implements Comparable
class PeerID implements Comparable<PeerID>
{
private byte[] id;
private Destination address;
@ -53,12 +52,13 @@ public class PeerID implements Comparable
private boolean triedDestLookup;
private final int hash;
private final I2PSnarkUtil util;
private String _toStringCache;
public PeerID(byte[] id, Destination address)
{
this.id = id;
this.address = address;
this.port = 6881;
this.port = TrackerClient.PORT;
this.destHash = address.calculateHash().getData();
hash = calculateHash();
util = null;
@ -77,22 +77,22 @@ public class PeerID implements Comparable
* Creates a PeerID from a Map containing BEncoded peer id, ip and
* port.
*/
public PeerID(Map m)
public PeerID(Map<String, BEValue> m)
throws InvalidBEncodingException, UnknownHostException
{
BEValue bevalue = (BEValue)m.get("peer id");
BEValue bevalue = m.get("peer id");
if (bevalue == null)
throw new InvalidBEncodingException("peer id missing");
id = bevalue.getBytes();
bevalue = (BEValue)m.get("ip");
bevalue = m.get("ip");
if (bevalue == null)
throw new InvalidBEncodingException("ip missing");
address = I2PSnarkUtil.getDestinationFromBase64(bevalue.getString());
if (address == null)
throw new InvalidBEncodingException("Invalid destination [" + bevalue.getString() + "]");
port = 6881;
port = TrackerClient.PORT;
this.destHash = address.calculateHash().getData();
hash = calculateHash();
util = null;
@ -106,7 +106,7 @@ public class PeerID implements Comparable
public PeerID(byte[] dest_hash, I2PSnarkUtil util) throws InvalidBEncodingException
{
// id and address remain null
port = 6881;
port = TrackerClient.PORT;
if (dest_hash.length != 32)
throw new InvalidBEncodingException("bad hash length");
destHash = dest_hash;
@ -196,10 +196,8 @@ public class PeerID implements Comparable
* Compares port, address and id.
* @deprecated unused? and will NPE now that address can be null?
*/
public int compareTo(Object o)
public int compareTo(PeerID pid)
{
PeerID pid = (PeerID)o;
int result = port - pid.port;
if (result != 0)
return result;
@ -219,13 +217,15 @@ public class PeerID implements Comparable
}
/**
* Returns the String "id@address" where id is the base64 encoded id
* and address is the base64 dest (was the base64 hash of the dest) which
* Returns the String "id@address" where id is the first 4 chars of the base64 encoded id
* and address is the first 6 chars of the base64 dest (was the base64 hash of the dest) which
* should match what the bytemonsoon tracker reports on its web pages.
*/
@Override
@Override
public String toString()
{
if (_toStringCache != null)
return _toStringCache;
if (id == null || address == null)
return "unkn@" + Base64.encode(destHash).substring(0, 6);
int nonZero = 0;
@ -235,7 +235,8 @@ public class PeerID implements Comparable
break;
}
}
return Base64.encode(id, nonZero, id.length-nonZero).substring(0,4) + "@" + address.toBase64().substring(0,6);
_toStringCache = Base64.encode(id, nonZero, id.length-nonZero).substring(0,4) + "@" + address.toBase64().substring(0,6);
return _toStringCache;
}
/**

View File

@ -27,6 +27,8 @@ import net.i2p.data.DataHelper;
/**
* TimerTask that monitors the peers and total up/download speeds.
* Works together with the main Snark class to report periodical statistics.
*
* @deprecated unused, for command line client only, commented out in Snark.java
*/
class PeerMonitorTask implements Runnable
{
@ -45,6 +47,7 @@ class PeerMonitorTask implements Runnable
public void run()
{
/*****
// Get some statistics
int peers = 0;
int uploaders = 0;
@ -117,5 +120,6 @@ class PeerMonitorTask implements Runnable
lastDownloaded = downloaded;
lastUploaded = uploaded;
****/
}
}

View File

@ -56,7 +56,7 @@ class PeerState implements DataLoader
final PeerConnectionOut out;
// Outstanding request
private final List<Request> outstandingRequests = new ArrayList();
private final List<Request> outstandingRequests = new ArrayList<Request>();
/** the tail (NOT the head) of the request queue */
private Request lastRequest = null;
@ -451,7 +451,7 @@ class PeerState implements DataLoader
synchronized List<Request> returnPartialPieces()
{
Set<Integer> pcs = getRequestedPieces();
List<Request> rv = new ArrayList(pcs.size());
List<Request> rv = new ArrayList<Request>(pcs.size());
for (Integer p : pcs) {
Request req = getLowestOutstandingRequest(p.intValue());
if (req != null) {
@ -469,7 +469,7 @@ class PeerState implements DataLoader
* @return all pieces we are currently requesting, or empty Set
*/
synchronized private Set<Integer> getRequestedPieces() {
Set<Integer> rv = new HashSet(outstandingRequests.size() + 1);
Set<Integer> rv = new HashSet<Integer>(outstandingRequests.size() + 1);
for (Request req : outstandingRequests) {
rv.add(Integer.valueOf(req.getPiece()));
if (pendingRequest != null)

View File

@ -7,7 +7,7 @@ import java.util.Set;
* This class is used solely by PeerCoordinator.
* Caller must synchronize on many of these methods.
*/
class Piece implements Comparable {
class Piece implements Comparable<Piece> {
private final int id;
private final Set<PeerID> peers;
@ -18,7 +18,7 @@ class Piece implements Comparable {
public Piece(int id) {
this.id = id;
this.peers = new HashSet(I2PSnarkUtil.MAX_CONNECTIONS / 2);
this.peers = new HashSet<PeerID>(I2PSnarkUtil.MAX_CONNECTIONS / 2);
// defer creating requests to save memory
}
@ -26,11 +26,11 @@ class Piece implements Comparable {
* Highest priority first,
* then rarest first
*/
public int compareTo(Object o) throws ClassCastException {
int pdiff = ((Piece)o).priority - this.priority; // reverse
public int compareTo(Piece op) {
int pdiff = op.priority - this.priority; // reverse
if (pdiff != 0)
return pdiff;
return this.peers.size() - ((Piece)o).peers.size();
return this.peers.size() - op.peers.size();
}
@Override
@ -82,7 +82,7 @@ class Piece implements Comparable {
public void setRequested(Peer peer, boolean requested) {
if (requested) {
if (this.requests == null)
this.requests = new HashSet(2);
this.requests = new HashSet<PeerID>(2);
this.requests.add(peer.getPeerID());
} else {
if (this.requests != null)

View File

@ -25,7 +25,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Random;
@ -34,7 +33,6 @@ import java.util.StringTokenizer;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.data.Destination;
import net.i2p.util.I2PThread;
import net.i2p.util.Log;
/**
@ -232,11 +230,12 @@ public class Snark
private byte[] id;
private final byte[] infoHash;
private String additionalTrackerURL;
private final I2PSnarkUtil _util;
protected final I2PSnarkUtil _util;
private final Log _log;
private final PeerCoordinatorSet _peerCoordinatorSet;
private String trackerProblems;
private int trackerSeenPeers;
private volatile String trackerProblems;
private volatile int trackerSeenPeers;
private volatile boolean _autoStoppable;
/** from main() via parseArguments() single torrent */
@ -526,18 +525,17 @@ public class Snark
if (_peerCoordinatorSet != null) {
// multitorrent
_peerCoordinatorSet.add(coordinator);
if (acceptor != null) {
acceptor.startAccepting(_peerCoordinatorSet, serversocket);
} else {
// error
}
} else {
// single torrent
acceptor = new ConnectionAcceptor(_util, serversocket, new PeerAcceptor(coordinator));
acceptor = new ConnectionAcceptor(_util, new PeerAcceptor(coordinator));
}
// TODO pass saved closest DHT nodes to the tracker? or direct to the coordinator?
trackerclient = new TrackerClient(_util, meta, additionalTrackerURL, coordinator, this);
}
// ensure acceptor is running when in multitorrent
if (_peerCoordinatorSet != null && acceptor != null) {
acceptor.startAccepting();
}
stopped = false;
if (coordinator.halted()) {
@ -761,7 +759,7 @@ public class Snark
PeerCoordinator coord = coordinator;
if (coord != null)
return coord.peerList();
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
/**
@ -905,6 +903,16 @@ public class Snark
return additionalTrackerURL;
}
/**
* @since 0.9.9
*/
public boolean isAutoStoppable() { return _autoStoppable; }
/**
* @since 0.9.9
*/
public void setAutoStoppable(boolean yes) { _autoStoppable = yes; }
/**
* Sets debug, ip and torrent variables then creates a Snark
* instance. Calls usage(), which terminates the program, if
@ -1226,8 +1234,7 @@ public class Snark
if (_peerCoordinatorSet == null || uploaders <= 0)
return false;
int totalUploaders = 0;
for (Iterator<PeerCoordinator> iter = _peerCoordinatorSet.iterator(); iter.hasNext(); ) {
PeerCoordinator c = iter.next();
for (PeerCoordinator c : _peerCoordinatorSet) {
if (!c.halted())
totalUploaders += c.uploaders;
}
@ -1240,8 +1247,7 @@ public class Snark
if (_peerCoordinatorSet == null)
return false;
long total = 0;
for (Iterator<PeerCoordinator> iter = _peerCoordinatorSet.iterator(); iter.hasNext(); ) {
PeerCoordinator c = iter.next();
for (PeerCoordinator c : _peerCoordinatorSet) {
if (!c.halted())
total += c.getCurrentUploadRate();
}

View File

@ -14,7 +14,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -25,6 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import net.i2p.I2PAppContext;
import net.i2p.app.ClientAppManager;
import net.i2p.data.Base64;
import net.i2p.data.DataHelper;
import net.i2p.update.*;
@ -35,8 +35,8 @@ import net.i2p.util.Log;
import net.i2p.util.OrderedProperties;
import net.i2p.util.SecureDirectory;
import net.i2p.util.SecureFileOutputStream;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
import net.i2p.util.SimpleTimer2;
import org.klomp.snark.dht.DHT;
@ -57,6 +57,8 @@ public class SnarkManager implements CompleteListener {
private /* FIXME final FIXME */ File _configFile;
private Properties _config;
private final I2PAppContext _context;
private final String _contextPath;
private final String _contextName;
private final Log _log;
private final Queue<String> _messages;
private final I2PSnarkUtil _util;
@ -68,6 +70,7 @@ public class SnarkManager implements CompleteListener {
private final Map<String, Tracker> _trackerMap;
private UpdateManager _umgr;
private UpdateHandler _uhandler;
private SimpleTimer2.TimedEvent _idleChecker;
public static final String PROP_I2CP_HOST = "i2psnark.i2cpHost";
public static final String PROP_I2CP_PORT = "i2psnark.i2cpPort";
@ -82,7 +85,7 @@ public class SnarkManager implements CompleteListener {
public static final String PROP_META_PRIORITY_SUFFIX = ".priority";
public static final String PROP_META_MAGNET_PREFIX = "i2psnark.magnet.";
private static final String CONFIG_FILE = "i2psnark.config";
private static final String CONFIG_FILE_SUFFIX = ".config";
public static final String PROP_FILES_PUBLIC = "i2psnark.filesPublic";
public static final String PROP_AUTO_START = "i2snark.autoStart"; // oops
public static final String DEFAULT_AUTO_START = "false";
@ -90,6 +93,7 @@ public class SnarkManager implements CompleteListener {
//public static final String DEFAULT_LINK_PREFIX = "file:///";
public static final String PROP_STARTUP_DELAY = "i2psnark.startupDelay";
public static final String PROP_REFRESH_DELAY = "i2psnark.refreshSeconds";
public static final String PROP_PAGE_SIZE = "i2psnark.pageSize";
public static final String RC_PROP_THEME = "routerconsole.theme";
public static final String RC_PROP_UNIVERSAL_THEMING = "routerconsole.universal.theme";
public static final String PROP_THEME = "i2psnark.theme";
@ -103,12 +107,13 @@ public class SnarkManager implements CompleteListener {
public static final int DEFAULT_MAX_UP_BW = 10;
public static final int DEFAULT_STARTUP_DELAY = 3;
public static final int DEFAULT_REFRESH_DELAY_SECS = 60;
private static final int DEFAULT_PAGE_SIZE = 50;
/**
* "name", "announceURL=websiteURL" pairs
* '=' in announceURL must be escaped as &#44;
*/
public static final String DEFAULT_TRACKERS[] = {
private static final String DEFAULT_TRACKERS[] = {
// "Postman", "http://YRgrgTLGnbTq2aZOZDJQ~o6Uk5k6TK-OZtx0St9pb0G-5EGYURZioxqYG8AQt~LgyyI~NCj6aYWpPO-150RcEvsfgXLR~CxkkZcVpgt6pns8SRc3Bi-QSAkXpJtloapRGcQfzTtwllokbdC-aMGpeDOjYLd8b5V9Im8wdCHYy7LRFxhEtGb~RL55DA8aYOgEXcTpr6RPPywbV~Qf3q5UK55el6Kex-6VCxreUnPEe4hmTAbqZNR7Fm0hpCiHKGoToRcygafpFqDw5frLXToYiqs9d4liyVB-BcOb0ihORbo0nS3CLmAwZGvdAP8BZ7cIYE3Z9IU9D1G8JCMxWarfKX1pix~6pIA-sp1gKlL1HhYhPMxwyxvuSqx34o3BqU7vdTYwWiLpGM~zU1~j9rHL7x60pVuYaXcFQDR4-QVy26b6Pt6BlAZoFmHhPcAuWfu-SFhjyZYsqzmEmHeYdAwa~HojSbofg0TMUgESRXMw6YThK1KXWeeJVeztGTz25sL8AAAA.i2p/announce.php=http://tracker.postman.i2p/"
// , "eBook", "http://E71FRom6PZNEqTN2Lr8P-sr23b7HJVC32KoGnVQjaX6zJiXwhJy2HsXob36Qmj81TYFZdewFZa9mSJ533UZgGyQkXo2ahctg82JKYZfDe5uDxAn1E9YPjxZCWJaFJh0S~UwSs~9AZ7UcauSJIoNtpxrtbmRNVFLqnkEDdLZi26TeucfOmiFmIWnVblLniWv3tG1boE9Abd-6j3FmYVrRucYuepAILYt6katmVNOk6sXmno1Eynrp~~MBuFq0Ko6~jsc2E2CRVYXDhGHEMdt-j6JUz5D7S2RIVzDRqQyAZLKJ7OdQDmI31przzmne1vOqqqLC~1xUumZVIvF~yOeJUGNjJ1Vx0J8i2BQIusn1pQJ6UCB~ZtZZLQtEb8EPVCfpeRi2ri1M5CyOuxN0V5ekmPHrYIBNevuTCRC26NP7ZS5VDgx1~NaC3A-CzJAE6f1QXi0wMI9aywNG5KGzOPifcsih8eyGyytvgLtrZtV7ykzYpPCS-rDfITncpn5hliPUAAAA.i2p/pub/bt/announce.php=http://de-ebook-archiv.i2p/pub/bt/"
// , "Gaytorrents", "http://uxPWHbK1OIj9HxquaXuhMiIvi21iK0~ZiG9d8G0840ZXIg0r6CbiV71xlsqmdnU6wm0T2LySriM0doW2gUigo-5BNkUquHwOjLROiETnB3ZR0Ml4IGa6QBPn1aAq2d9~g1r1nVjLE~pcFnXB~cNNS7kIhX1d6nLgYVZf0C2cZopEow2iWVUggGGnAA9mHjE86zLEnTvAyhbAMTqDQJhEuLa0ZYSORqzJDMkQt90MV4YMjX1ICY6RfUSFmxEqu0yWTrkHsTtRw48l~dz9wpIgc0a0T9C~eeWvmBFTqlJPtQZwntpNeH~jF7nlYzB58olgV2HHFYpVYD87DYNzTnmNWxCJ5AfDorm6AIUCV2qaE7tZtI1h6fbmGpGlPyW~Kw5GXrRfJwNvr6ajwAVi~bPVnrBwDZezHkfW4slOO8FACPR28EQvaTu9nwhAbqESxV2hCTq6vQSGjuxHeOuzBOEvRWkLKOHWTC09t2DbJ94FSqETmZopTB1ukEmaxRWbKSIaAAAA.i2p/announce.php=http://gaytorrents.i2p/"
@ -120,26 +125,53 @@ public class SnarkManager implements CompleteListener {
// , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
"Postman", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
,"Diftracker", "http://n--XWjHjUPjnMNrSwXA2OYXpMIUL~u4FNXnrt2HtjK3y6j~4SOClyyeKzd0zRPlixxkCe2wfBIYye3bZsaqAD8bd0QMmowxbq91WpjsPfKMiphJbePKXtYAVARiy0cqyvh1d2LyDE-6wkvgaw45hknmS0U-Dg3YTJZbAQRU2SKXgIlAbWCv4R0kDFBLEVpReDiJef3rzAWHiW8yjmJuJilkYjMwlfRjw8xx1nl2s~yhlljk1pl13jGYb0nfawQnuOWeP-ASQWvAAyVgKvZRJE2O43S7iveu9piuv7plXWbt36ef7ndu2GNoNyPOBdpo9KUZ-NOXm4Kgh659YtEibL15dEPAOdxprY0sYUurVw8OIWqrpX7yn08nbi6qHVGqQwTpxH35vkL8qrCbm-ym7oQJQnNmSDrNTyWYRFSq5s5~7DAdFDzqRPW-pX~g0zEivWj5tzkhvG9rVFgFo0bpQX3X0PUAV9Xbyf8u~v8Zbr9K1pCPqBq9XEr4TqaLHw~bfAAAA.i2p/announce.php=http://diftracker.i2p/"
,"Diftracker", "http://diftracker.i2p/announce.php=http://diftracker.i2p/"
// , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
// ,"Exotrack", "http://blbgywsjubw3d2zih2giokakhe3o2cko7jtte4risb3hohbcoyva.b32.i2p/announce.php=http://exotrack.i2p/"
};
public static final Set<String> DEFAULT_TRACKER_ANNOUNCES;
static {
Set<String> ann = new HashSet();
for (int i = 1; i < DEFAULT_TRACKERS.length; i += 2) {
String urls[] = DEFAULT_TRACKERS[i].split("=", 2);
ann.add(urls[0]);
}
DEFAULT_TRACKER_ANNOUNCES = Collections.unmodifiableSet(ann);
}
/** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */
public static final String PROP_TRACKERS = "i2psnark.trackers";
/**
* For embedded.
*/
public SnarkManager(I2PAppContext ctx) {
_snarks = new ConcurrentHashMap();
_magnets = new ConcurrentHashSet();
this(ctx, "/i2psnark", "i2psnark");
}
/**
* For webapp.
* @param ctxPath generally "/i2psnark"
* @param ctxName generally "i2psnark"
* @since 0.9.6
*/
public SnarkManager(I2PAppContext ctx, String ctxPath, String ctxName) {
_snarks = new ConcurrentHashMap<String, Snark>();
_magnets = new ConcurrentHashSet<String>();
_addSnarkLock = new Object();
_context = ctx;
_contextPath = ctxPath;
_contextName = ctxName;
_log = _context.logManager().getLog(SnarkManager.class);
_messages = new LinkedBlockingQueue();
_util = new I2PSnarkUtil(_context);
_configFile = new File(CONFIG_FILE);
_messages = new LinkedBlockingQueue<String>();
_util = new I2PSnarkUtil(_context, ctxName);
String cfile = ctxName + CONFIG_FILE_SUFFIX;
_configFile = new File(cfile);
if (!_configFile.isAbsolute())
_configFile = new File(_context.getConfigDir(), CONFIG_FILE);
_trackerMap = new ConcurrentHashMap(4);
_configFile = new File(_context.getConfigDir(), cfile);
_trackerMap = new ConcurrentHashMap<String, Tracker>(4);
loadConfig(null);
}
@ -149,13 +181,17 @@ public class SnarkManager implements CompleteListener {
public void start() {
_running = true;
_peerCoordinatorSet = new PeerCoordinatorSet();
_connectionAcceptor = new ConnectionAcceptor(_util);
_connectionAcceptor = new ConnectionAcceptor(_util, _peerCoordinatorSet);
_monitor = new I2PAppThread(new DirMonitor(), "Snark DirMonitor", true);
_monitor.start();
// delay until UpdateManager is there
_context.simpleScheduler().addEvent(new Register(), 4*60*1000);
// only if default instance
if ("i2psnark".equals(_contextName))
// delay until UpdateManager is there
_context.simpleScheduler().addEvent(new Register(), 4*60*1000);
// Not required, Jetty has a shutdown hook
//_context.addShutdownTask(new SnarkManagerShutdown());
_idleChecker = new IdleChecker(this, _peerCoordinatorSet);
_idleChecker.schedule(5*60*1000);
}
/** @since 0.9.4 */
@ -163,10 +199,13 @@ public class SnarkManager implements CompleteListener {
public void timeReached() {
if (!_running)
return;
_umgr = _context.updateManager();
ClientAppManager cmgr = _context.clientAppManager();
if (cmgr != null)
_umgr = (UpdateManager) cmgr.getRegisteredApp(UpdateManager.APP_NAME);
if (_umgr != null) {
_uhandler = new UpdateHandler(_context, _umgr, SnarkManager.this);
_umgr.register(_uhandler, UpdateType.ROUTER_SIGNED, UpdateMethod.TORRENT, 10);
_umgr.register(_uhandler, UpdateType.ROUTER_SIGNED_SU3, UpdateMethod.TORRENT, 10);
_log.warn("Registering with update manager");
} else {
_log.warn("No update manager to register with");
@ -184,10 +223,12 @@ public class SnarkManager implements CompleteListener {
if (_umgr != null && _uhandler != null) {
//_uhandler.shutdown();
_umgr.unregister(_uhandler, UpdateType.ROUTER_SIGNED, UpdateMethod.TORRENT);
_umgr.unregister(_uhandler, UpdateType.ROUTER_SIGNED_SU3, UpdateMethod.TORRENT);
}
_running = false;
_monitor.interrupt();
_connectionAcceptor.halt();
_idleChecker.cancel();
stopAllTorrents(true);
}
@ -211,8 +252,8 @@ public class SnarkManager implements CompleteListener {
/** newest last */
public List<String> getMessages() {
if (_messages.isEmpty())
return Collections.EMPTY_LIST;
return new ArrayList(_messages);
return Collections.emptyList();
return new ArrayList<String>(_messages);
}
/** @since 0.9 */
@ -250,6 +291,18 @@ public class SnarkManager implements CompleteListener {
}
}
/**
* For GUI
* @since 0.9.6
*/
public int getPageSize() {
try {
return Integer.parseInt(_config.getProperty(PROP_PAGE_SIZE));
} catch (NumberFormatException nfe) {
return DEFAULT_PAGE_SIZE;
}
}
private int getStartupDelayMinutes() {
try {
return Integer.parseInt(_config.getProperty(PROP_STARTUP_DELAY));
@ -259,7 +312,7 @@ public class SnarkManager implements CompleteListener {
}
public File getDataDir() {
String dir = _config.getProperty(PROP_DIR, "i2psnark");
String dir = _config.getProperty(PROP_DIR, _contextName);
File f;
if (areFilesPublic())
f = new File(dir);
@ -305,13 +358,15 @@ public class SnarkManager implements CompleteListener {
if (!_config.containsKey(PROP_UPLOADERS_TOTAL))
_config.setProperty(PROP_UPLOADERS_TOTAL, "" + Snark.MAX_TOTAL_UPLOADERS);
if (!_config.containsKey(PROP_DIR))
_config.setProperty(PROP_DIR, "i2psnark");
_config.setProperty(PROP_DIR, _contextName);
if (!_config.containsKey(PROP_AUTO_START))
_config.setProperty(PROP_AUTO_START, DEFAULT_AUTO_START);
if (!_config.containsKey(PROP_REFRESH_DELAY))
_config.setProperty(PROP_REFRESH_DELAY, Integer.toString(DEFAULT_REFRESH_DELAY_SECS));
if (!_config.containsKey(PROP_STARTUP_DELAY))
_config.setProperty(PROP_STARTUP_DELAY, Integer.toString(DEFAULT_STARTUP_DELAY));
if (!_config.containsKey(PROP_PAGE_SIZE))
_config.setProperty(PROP_PAGE_SIZE, Integer.toString(DEFAULT_PAGE_SIZE));
if (!_config.containsKey(PROP_THEME))
_config.setProperty(PROP_THEME, DEFAULT_THEME);
// no, so we can switch default to true later
@ -383,7 +438,7 @@ public class SnarkManager implements CompleteListener {
String i2cpHost = _config.getProperty(PROP_I2CP_HOST);
int i2cpPort = getInt(PROP_I2CP_PORT, 7654);
String opts = _config.getProperty(PROP_I2CP_OPTS);
Map i2cpOpts = new HashMap();
Map<String, String> i2cpOpts = new HashMap<String, String>();
if (opts != null) {
StringTokenizer tok = new StringTokenizer(opts, " ");
while (tok.hasMoreTokens()) {
@ -429,11 +484,15 @@ public class SnarkManager implements CompleteListener {
return defaultVal;
}
/**
* all params may be null or need trimming
*/
public void updateConfig(String dataDir, boolean filesPublic, boolean autoStart, String refreshDelay,
String startDelay, String seedPct, String eepHost,
String startDelay, String pageSize, String seedPct, String eepHost,
String eepPort, String i2cpHost, String i2cpPort, String i2cpOpts,
String upLimit, String upBW, boolean useOpenTrackers, boolean useDHT, String theme) {
boolean changed = false;
boolean interruptMonitor = false;
//if (eepHost != null) {
// // unused, we use socket eepget
// int port = _util.getEepProxyPort();
@ -450,12 +509,12 @@ public class SnarkManager implements CompleteListener {
//}
if (upLimit != null) {
int limit = _util.getMaxUploaders();
try { limit = Integer.parseInt(upLimit); } catch (NumberFormatException nfe) {}
try { limit = Integer.parseInt(upLimit.trim()); } catch (NumberFormatException nfe) {}
if ( limit != _util.getMaxUploaders()) {
if ( limit >= Snark.MIN_TOTAL_UPLOADERS ) {
_util.setMaxUploaders(limit);
changed = true;
_config.setProperty(PROP_UPLOADERS_TOTAL, "" + limit);
_config.setProperty(PROP_UPLOADERS_TOTAL, Integer.toString(limit));
addMessage(_("Total uploaders limit changed to {0}", limit));
} else {
addMessage(_("Minimum total uploaders limit is {0}", Snark.MIN_TOTAL_UPLOADERS));
@ -464,12 +523,12 @@ public class SnarkManager implements CompleteListener {
}
if (upBW != null) {
int limit = _util.getMaxUpBW();
try { limit = Integer.parseInt(upBW); } catch (NumberFormatException nfe) {}
try { limit = Integer.parseInt(upBW.trim()); } catch (NumberFormatException nfe) {}
if ( limit != _util.getMaxUpBW()) {
if ( limit >= MIN_UP_BW ) {
_util.setMaxUpBW(limit);
changed = true;
_config.setProperty(PROP_UPBW_MAX, "" + limit);
_config.setProperty(PROP_UPBW_MAX, Integer.toString(limit));
addMessage(_("Up BW limit changed to {0}KBps", limit));
} else {
addMessage(_("Minimum up bandwidth limit is {0}KBps", MIN_UP_BW));
@ -479,21 +538,21 @@ public class SnarkManager implements CompleteListener {
if (startDelay != null){
int minutes = _util.getStartupDelay();
try { minutes = Integer.parseInt(startDelay); } catch (NumberFormatException nfe) {}
try { minutes = Integer.parseInt(startDelay.trim()); } catch (NumberFormatException nfe) {}
if ( minutes != _util.getStartupDelay()) {
_util.setStartupDelay(minutes);
changed = true;
_config.setProperty(PROP_STARTUP_DELAY, "" + minutes);
addMessage(_("Startup delay changed to {0}", DataHelper.formatDuration2(minutes * 60 * 1000)));
_config.setProperty(PROP_STARTUP_DELAY, Integer.toString(minutes));
addMessage(_("Startup delay changed to {0}", DataHelper.formatDuration2(minutes * (60L * 1000))));
}
}
if (refreshDelay != null) {
try {
int secs = Integer.parseInt(refreshDelay);
int secs = Integer.parseInt(refreshDelay.trim());
if (secs != getRefreshDelaySeconds()) {
changed = true;
_config.setProperty(PROP_REFRESH_DELAY, refreshDelay);
_config.setProperty(PROP_REFRESH_DELAY, Integer.toString(secs));
if (secs >= 0)
addMessage(_("Refresh time changed to {0}", DataHelper.formatDuration2(secs * 1000)));
else
@ -502,6 +561,42 @@ public class SnarkManager implements CompleteListener {
} catch (NumberFormatException nfe) {}
}
if (pageSize != null) {
try {
int size = Integer.parseInt(pageSize.trim());
if (size <= 0)
size = 999999;
else if (size < 5)
size = 5;
if (size != getPageSize()) {
changed = true;
pageSize = Integer.toString(size);
_config.setProperty(PROP_PAGE_SIZE, pageSize);
addMessage(_("Page size changed to {0}", pageSize));
}
} catch (NumberFormatException nfe) {}
}
if (dataDir != null && !dataDir.equals(getDataDir().getAbsolutePath())) {
dataDir = dataDir.trim();
File dd = new File(dataDir);
if (!dd.isAbsolute()) {
addMessage(_("Data directory must be an absolute path") + ": " + dataDir);
} else if (!dd.exists()) {
addMessage(_("Data directory does not exist") + ": " + dataDir);
} else if (!dd.isDirectory()) {
addMessage(_("Not a directory") + ": " + dataDir);
} else if (!dd.canRead()) {
addMessage(_("Unreadable") + ": " + dataDir);
} else {
changed = true;
interruptMonitor = true;
_config.setProperty(PROP_DIR, dataDir);
addMessage(_("Data directory changed to {0}", dataDir));
}
}
// Start of I2CP stuff.
// i2cpHost will generally be null since it is hidden from the form if in router context.
@ -512,7 +607,7 @@ public class SnarkManager implements CompleteListener {
try { port = Integer.parseInt(i2cpPort); } catch (NumberFormatException nfe) {}
}
Map<String, String> opts = new HashMap();
Map<String, String> opts = new HashMap<String, String>();
if (i2cpOpts == null) i2cpOpts = "";
StringTokenizer tok = new StringTokenizer(i2cpOpts, " \t\n");
while (tok.hasMoreTokens()) {
@ -521,7 +616,7 @@ public class SnarkManager implements CompleteListener {
if (split > 0)
opts.put(pair.substring(0, split), pair.substring(split+1));
}
Map<String, String> oldOpts = new HashMap();
Map<String, String> oldOpts = new HashMap<String, String>();
String oldI2CPOpts = _config.getProperty(PROP_I2CP_OPTS);
if (oldI2CPOpts == null) oldI2CPOpts = "";
tok = new StringTokenizer(oldI2CPOpts, " \t\n");
@ -559,6 +654,7 @@ public class SnarkManager implements CompleteListener {
addMessage(_("I2CP options changed to {0}", i2cpOpts));
_util.setI2CPConfig(oldI2CPHost, oldI2CPPort, opts);
} else {
// Won't happen, I2CP host/port, are hidden in the GUI if in router context
if (_util.connected()) {
_util.disconnect();
addMessage(_("Disconnecting old I2CP destination"));
@ -582,6 +678,8 @@ public class SnarkManager implements CompleteListener {
for (Snark snark : _snarks.values()) {
if (snark.restartAcceptor()) {
addMessage(_("I2CP listener restarted for \"{0}\"", snark.getBaseName()));
// this is the common ConnectionAcceptor, so we only need to do it once
break;
}
}
}
@ -636,6 +734,9 @@ public class SnarkManager implements CompleteListener {
}
if (changed) {
saveConfig();
if (interruptMonitor)
// Data dir changed. this will stop and remove all old torrents, and add the new ones
_monitor.interrupt();
} else {
addMessage(_("Configuration unchanged."));
}
@ -648,7 +749,7 @@ public class SnarkManager implements CompleteListener {
*/
private List<String> getOpenTrackers() {
if (!_util.shouldUseOpenTrackers())
return Collections.EMPTY_LIST;
return Collections.emptyList();
return getListConfig(PROP_OPENTRACKERS, I2PSnarkUtil.DEFAULT_OPENTRACKERS);
}
@ -665,7 +766,7 @@ public class SnarkManager implements CompleteListener {
* @since 0.9.1
*/
public void saveOpenTrackers(List<String> ot) {
String val = setListConfig(PROP_OPENTRACKERS, ot);
setListConfig(PROP_OPENTRACKERS, ot);
if (ot == null)
ot = Collections.singletonList(I2PSnarkUtil.DEFAULT_OPENTRACKERS);
_util.setOpenTrackers(ot);
@ -693,7 +794,7 @@ public class SnarkManager implements CompleteListener {
if (val == null)
val = dflt;
if (val == null)
return Collections.EMPTY_LIST;
return Collections.emptyList();
return Arrays.asList(val.split(","));
}
@ -731,6 +832,11 @@ public class SnarkManager implements CompleteListener {
public Properties getConfig() { return _config; }
/** @since Jetty 7 */
public String getConfigFilename() {
return _configFile.getAbsolutePath();
}
/** hardcoded for sanity. perhaps this should be customizable, for people who increase their ulimit, etc. */
public static final int MAX_FILES_PER_TORRENT = 512;
@ -739,7 +845,7 @@ public class SnarkManager implements CompleteListener {
* An unsynchronized copy.
*/
public Set<String> listTorrentFiles() {
return new HashSet(_snarks.keySet());
return new HashSet<String>(_snarks.keySet());
}
/**
@ -810,7 +916,7 @@ public class SnarkManager implements CompleteListener {
filename = sfile.getCanonicalPath();
} catch (IOException ioe) {
_log.error("Unable to add the torrent " + filename, ioe);
addMessage(_("Error: Could not add the torrent {0}", filename) + ": " + ioe.getMessage());
addMessage(_("Error: Could not add the torrent {0}", filename) + ": " + ioe);
return;
}
File dataDir = getDataDir();
@ -886,7 +992,9 @@ public class SnarkManager implements CompleteListener {
}
}
} catch (IOException ioe) {
addMessage(_("Torrent in \"{0}\" is invalid", sfile.getName()) + ": " + ioe.getMessage());
String err = _("Torrent in \"{0}\" is invalid", sfile.getName()) + ": " + ioe.getMessage();
addMessage(err);
_log.error(err, ioe);
if (sfile.exists())
sfile.delete();
return;
@ -922,7 +1030,8 @@ public class SnarkManager implements CompleteListener {
* @since 0.8.4
*/
public void addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus) {
addMagnet(name, ih, trackerURL, updateStatus, shouldAutoStart(), this);
// updateStatus is true from UI, false from config file bulk add
addMagnet(name, ih, trackerURL, updateStatus, updateStatus, this);
}
/**
@ -1289,7 +1398,7 @@ public class SnarkManager implements CompleteListener {
* @return failure message or null on success
*/
private String validateTorrent(MetaInfo info) {
List files = info.getFiles();
List<List<String>> files = info.getFiles();
if ( (files != null) && (files.size() > MAX_FILES_PER_TORRENT) ) {
return _("Too many files in \"{0}\" ({1}), deleting it!", info.getName(), files.size());
} else if ( (files == null) && (info.getName().endsWith(".torrent")) ) {
@ -1305,7 +1414,7 @@ public class SnarkManager implements CompleteListener {
return _("Torrent \"{0}\" has no data, deleting it!", info.getName());
} else if (info.getTotalLength() > Storage.MAX_TOTAL_SIZE) {
System.out.println("torrent info: " + info.toString());
List lengths = info.getLengths();
List<Long> lengths = info.getLengths();
if (lengths != null)
for (int i = 0; i < lengths.size(); i++)
System.out.println("File " + i + " is " + lengths.get(i) + " long.");
@ -1392,7 +1501,7 @@ public class SnarkManager implements CompleteListener {
private class DirMonitor implements Runnable {
public void run() {
// don't bother delaying if auto start is false
long delay = 60 * 1000 * getStartupDelayMinutes();
long delay = (60L * 1000) * getStartupDelayMinutes();
if (delay > 0 && shouldAutoStart()) {
addMessage(_("Adding torrents in {0}", DataHelper.formatDuration2(delay)));
try { Thread.sleep(delay); } catch (InterruptedException ie) {}
@ -1443,7 +1552,7 @@ public class SnarkManager implements CompleteListener {
if (meta == null || storage == null)
return;
StringBuilder buf = new StringBuilder(256);
buf.append("<a href=\"/i2psnark/").append(storage.getBaseName());
buf.append("<a href=\"").append(_contextPath).append('/').append(storage.getBaseName());
if (meta.getFiles() != null)
buf.append('/');
buf.append("\">").append(storage.getBaseName()).append("</a>");
@ -1557,7 +1666,7 @@ public class SnarkManager implements CompleteListener {
*/
private void monitorTorrents(File dir) {
String fileNames[] = dir.list(TorrentFilenameFilter.instance());
List<String> foundNames = new ArrayList(0);
List<String> foundNames = new ArrayList<String>(0);
if (fileNames != null) {
for (int i = 0; i < fileNames.length; i++) {
try {
@ -1572,8 +1681,8 @@ public class SnarkManager implements CompleteListener {
if (_log.shouldLog(Log.DEBUG))
_log.debug("DirMon found: " + DataHelper.toString(foundNames) + " existing: " + DataHelper.toString(existingNames));
// lets find new ones first...
for (int i = 0; i < foundNames.size(); i++) {
if (existingNames.contains(foundNames.get(i))) {
for (String name : foundNames) {
if (existingNames.contains(name)) {
// already known. noop
} else {
if (shouldAutoStart() && !_util.connect())
@ -1581,17 +1690,17 @@ public class SnarkManager implements CompleteListener {
try {
// Snark.fatal() throws a RuntimeException
// don't let one bad torrent kill the whole loop
addTorrent(foundNames.get(i), !shouldAutoStart());
addTorrent(name, !shouldAutoStart());
} catch (Exception e) {
addMessage(_("Unable to add {0}", foundNames.get(i)) + ": " + e);
addMessage(_("Error: Could not add the torrent {0}", name) + ": " + e);
_log.error("Unable to add the torrent " + name, e);
}
}
}
// Don't remove magnet torrents that don't have a torrent file yet
existingNames.removeAll(_magnets);
// now lets see which ones have been removed...
for (Iterator iter = existingNames.iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
for (String name : existingNames) {
if (foundNames.contains(name)) {
// known and still there. noop
} else {
@ -1643,7 +1752,7 @@ public class SnarkManager implements CompleteListener {
* @since 0.9.1
*/
public List<Tracker> getSortedTrackers() {
List<Tracker> rv = new ArrayList(_trackerMap.values());
List<Tracker> rv = new ArrayList<Tracker>(_trackerMap.values());
Collections.sort(rv, new IgnoreCaseComparator());
return rv;
}
@ -1769,6 +1878,14 @@ public class SnarkManager implements CompleteListener {
private final Snark snark;
public ThreadedStarter(Snark s) { snark = s; }
public void run() {
try {
run2();
} catch (Exception e) {
_log.error("Error starting", e);
}
}
private void run2() {
if (snark != null) {
if (snark.isStopped())
snark.startTorrent();

View File

@ -28,6 +28,7 @@ import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -50,17 +51,7 @@ import net.i2p.util.SystemVersion;
public class Storage
{
private final MetaInfo metainfo;
private long[] lengths;
private RandomAccessFile[] rafs;
private String[] names;
private Object[] RAFlock; // lock on RAF access
private long[] RAFtime; // when was RAF last accessed, or 0 if closed
private File[] RAFfile; // File to make it easier to reopen
/** priorities by file; default 0; may be null. @since 0.8.1 */
private int[] priorities;
/** is the file empty and sparse? */
private boolean[] isSparse;
private final List<TorrentFile> _torrentFiles;
private final StorageListener listener;
private final I2PSnarkUtil _util;
private final Log _log;
@ -77,14 +68,14 @@ public class Storage
private final AtomicInteger _allocateCount = new AtomicInteger();
/** The default piece size. */
private static final int MIN_PIECE_SIZE = 256*1024;
/** note that we start reducing max number of peer connections above 1MB */
public static final int MAX_PIECE_SIZE = 2*1024*1024;
private static final int DEFAULT_PIECE_SIZE = 256*1024;
/** bigger than this will be rejected */
public static final int MAX_PIECE_SIZE = 4*1024*1024;
/** The maximum number of pieces in a torrent. */
public static final int MAX_PIECES = 10*1024;
public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES;
private static final Map<String, String> _filterNameCache = new ConcurrentHashMap();
private static final Map<String, String> _filterNameCache = new ConcurrentHashMap<String, String>();
private static final boolean _isWindows = SystemVersion.isWindows();
@ -108,6 +99,9 @@ public class Storage
piece_size = metainfo.getPieceLength(0);
pieces = needed;
total_length = metainfo.getTotalLength();
List<List<String>> files = metainfo.getFiles();
int sz = files != null ? files.size() : 1;
_torrentFiles = new ArrayList<TorrentFile>(sz);
}
/**
@ -122,6 +116,7 @@ public class Storage
* @throws IOException when creating and/or checking files fails.
*/
public Storage(I2PSnarkUtil util, File baseFile, String announce,
List<List<String>> announce_list,
boolean privateTorrent, StorageListener listener)
throws IOException
{
@ -129,13 +124,13 @@ public class Storage
_log = util.getContext().logManager().getLog(Storage.class);
this.listener = listener;
// Create names, rafs and lengths arrays.
getFiles(baseFile);
_torrentFiles = getFiles(baseFile);
long total = 0;
ArrayList<Long> lengthsList = new ArrayList();
for (int i = 0; i < lengths.length; i++)
ArrayList<Long> lengthsList = new ArrayList<Long>();
for (TorrentFile tf : _torrentFiles)
{
long length = lengths[i];
long length = tf.length;
total += length;
lengthsList.add(Long.valueOf(length));
}
@ -145,9 +140,15 @@ public class Storage
if (total > MAX_TOTAL_SIZE)
throw new IOException("Torrent too big (" + total + " bytes), max is " + MAX_TOTAL_SIZE);
int pc_size = MIN_PIECE_SIZE;
int pc_size;
if (total <= 5*1024*1024)
pc_size = DEFAULT_PIECE_SIZE / 4;
else if (total <= 10*1024*1024)
pc_size = DEFAULT_PIECE_SIZE / 2;
else
pc_size = DEFAULT_PIECE_SIZE;
int pcs = (int) ((total - 1)/pc_size) + 1;
while (pcs > MAX_PIECES && pc_size < MAX_PIECE_SIZE)
while (pcs > (MAX_PIECES * 2 / 3) && pc_size < MAX_PIECE_SIZE)
{
pc_size *= 2;
pcs = (int) ((total - 1)/pc_size) +1;
@ -159,11 +160,11 @@ public class Storage
bitfield = new BitField(pieces);
needed = 0;
List<List<String>> files = new ArrayList();
for (int i = 0; i < names.length; i++)
List<List<String>> files = new ArrayList<List<String>>();
for (TorrentFile tf : _torrentFiles)
{
List<String> file = new ArrayList();
StringTokenizer st = new StringTokenizer(names[i], File.separator);
List<String> file = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(tf.name, File.separator);
while (st.hasMoreTokens())
{
String part = st.nextToken();
@ -172,8 +173,7 @@ public class Storage
files.add(file);
}
if (files.size() == 1) // FIXME: ...and if base file not a directory or should this be the only check?
// this makes a bad metainfo if the directory has only one file in it
if (files.size() == 1 && !baseFile.isDirectory())
{
files = null;
lengthsList = null;
@ -182,7 +182,8 @@ public class Storage
// TODO thread this so we can return and show something on the UI
byte[] piece_hashes = fast_digestCreate();
metainfo = new MetaInfo(announce, baseFile.getName(), null, files,
lengthsList, piece_size, piece_hashes, total, privateTorrent);
lengthsList, piece_size, piece_hashes, total, privateTorrent,
announce_list);
}
@ -213,42 +214,29 @@ public class Storage
return piece_hashes;
}
private void getFiles(File base) throws IOException
private List<TorrentFile> getFiles(File base) throws IOException
{
if (base.getAbsolutePath().equals("/"))
throw new IOException("Don't seed root");
ArrayList files = new ArrayList();
List<File> files = new ArrayList<File>();
addFiles(files, base);
int size = files.size();
names = new String[size];
lengths = new long[size];
rafs = new RandomAccessFile[size];
RAFlock = new Object[size];
RAFtime = new long[size];
RAFfile = new File[size];
priorities = new int[size];
isSparse = new boolean[size];
List<TorrentFile> rv = new ArrayList<TorrentFile>(size);
int i = 0;
Iterator it = files.iterator();
while (it.hasNext())
{
File f = (File)it.next();
names[i] = f.getPath();
if (base.isDirectory() && names[i].startsWith(base.getPath()))
names[i] = names[i].substring(base.getPath().length() + 1);
lengths[i] = f.length();
RAFlock[i] = new Object();
RAFfile[i] = f;
i++;
}
for (File f : files) {
rv.add(new TorrentFile(base, f));
}
// Sort to prevent exposing OS type, and to make it more likely
// the same torrent created twice will have the same infohash.
Collections.sort(rv);
return rv;
}
/**
* @throws IOException if too many total files
*/
private void addFiles(List l, File f) throws IOException {
private void addFiles(List<File> l, File f) throws IOException {
if (!f.isDirectory()) {
if (l.size() >= SnarkManager.MAX_FILES_PER_TORRENT)
throw new IOException("Too many files, limit is " + SnarkManager.MAX_FILES_PER_TORRENT + ", zip them?");
@ -323,8 +311,8 @@ public class Storage
*/
public long remaining(String file) {
long bytes = 0;
for (int i = 0; i < rafs.length; i++) {
File f = RAFfile[i];
for (TorrentFile tf : _torrentFiles) {
File f = tf.RAFfile;
// use canonical in case snark dir or sub dirs are symlinked
String canonical = null;
if (f != null) {
@ -339,11 +327,11 @@ public class Storage
return 0;
int psz = piece_size;
long start = bytes;
long end = start + lengths[i];
long end = start + tf.length;
int pc = (int) (bytes / psz);
long rv = 0;
if (!bitfield.get(pc))
rv = Math.min(psz - (start % psz), lengths[i]);
rv = Math.min(psz - (start % psz), tf.length);
for (int j = pc + 1; (((long)j) * psz) < end && j < pieces; j++) {
if (!bitfield.get(j)) {
if (((long)(j+1))*psz < end)
@ -354,7 +342,7 @@ public class Storage
}
return rv;
}
bytes += lengths[i];
bytes += tf.length;
}
return -1;
}
@ -364,16 +352,16 @@ public class Storage
* @since 0.8.1
*/
public int getPriority(String file) {
if (complete() || metainfo.getFiles() == null || priorities == null)
if (complete() || metainfo.getFiles() == null)
return 0;
for (int i = 0; i < rafs.length; i++) {
File f = RAFfile[i];
for (TorrentFile tf : _torrentFiles) {
File f = tf.RAFfile;
// use canonical in case snark dir or sub dirs are symlinked
if (f != null) {
try {
String canonical = f.getCanonicalPath();
if (canonical.equals(file))
return priorities[i];
return tf.priority;
} catch (IOException ioe) {}
}
}
@ -388,16 +376,16 @@ public class Storage
* @since 0.8.1
*/
public void setPriority(String file, int pri) {
if (complete() || metainfo.getFiles() == null || priorities == null)
if (complete() || metainfo.getFiles() == null)
return;
for (int i = 0; i < rafs.length; i++) {
File f = RAFfile[i];
for (TorrentFile tf : _torrentFiles) {
File f = tf.RAFfile;
// use canonical in case snark dir or sub dirs are symlinked
if (f != null) {
try {
String canonical = f.getCanonicalPath();
if (canonical.equals(file)) {
priorities[i] = pri;
tf.priority = pri;
return;
}
} catch (IOException ioe) {}
@ -411,6 +399,15 @@ public class Storage
* @since 0.8.1
*/
public int[] getFilePriorities() {
if (complete())
return null;
int sz = _torrentFiles.size();
if (sz <= 1)
return null;
int[] priorities = new int[sz];
for (int i = 0; i < sz; i++) {
priorities[i] = _torrentFiles.get(i).priority;
}
return priorities;
}
@ -421,7 +418,18 @@ public class Storage
* @since 0.8.1
*/
void setFilePriorities(int[] p) {
priorities = p;
if (p == null) {
for (TorrentFile tf : _torrentFiles) {
tf.priority = 0;
}
} else {
int sz = _torrentFiles.size();
if (p.length != sz)
throw new IllegalArgumentException();
for (int i = 0; i < sz; i++) {
_torrentFiles.get(i).priority = p[i];
}
}
}
/**
@ -434,22 +442,23 @@ public class Storage
* @since 0.8.1
*/
public int[] getPiecePriorities() {
if (complete() || metainfo.getFiles() == null || priorities == null)
if (complete() || metainfo.getFiles() == null)
return null;
int[] rv = new int[metainfo.getPieces()];
int file = 0;
long pcEnd = -1;
long fileEnd = lengths[0] - 1;
long fileEnd = _torrentFiles.get(0).length - 1;
int psz = piece_size;
for (int i = 0; i < rv.length; i++) {
pcEnd += psz;
int pri = priorities[file];
while (fileEnd <= pcEnd && file < lengths.length - 1) {
int pri = _torrentFiles.get(file).priority;
while (fileEnd <= pcEnd && file < _torrentFiles.size() - 1) {
file++;
TorrentFile tf = _torrentFiles.get(file);
long oldFileEnd = fileEnd;
fileEnd += lengths[file];
if (priorities[file] > pri && oldFileEnd < pcEnd)
pri = priorities[file];
fileEnd += tf.length;
if (tf.priority > pri && oldFileEnd < pcEnd)
pri = tf.priority;
}
rv[i] = pri;
}
@ -479,13 +488,18 @@ public class Storage
/**
* Creates (and/or checks) all files from the metainfo file list.
* Only call this once, and only after the constructor with the metainfo.
*/
public void check(String rootDir) throws IOException
{
check(rootDir, 0, null);
}
/** use a saved bitfield and timestamp from a config file */
/**
* Creates (and/or checks) all files from the metainfo file list.
* Use a saved bitfield and timestamp from a config file.
* Only call this once, and only after the constructor with the metainfo.
*/
public void check(String rootDir, long savedTime, BitField savedBitField) throws IOException
{
File base;
@ -496,6 +510,8 @@ public class Storage
base = new SecureFile(rootDir, filterName(metainfo.getName()));
boolean useSavedBitField = savedTime > 0 && savedBitField != null;
if (!_torrentFiles.isEmpty())
throw new IllegalStateException();
List<List<String>> files = metainfo.getFiles();
if (files == null)
{
@ -505,22 +521,14 @@ public class Storage
if (!base.createNewFile() && !base.exists())
throw new IOException("Could not create file " + base);
lengths = new long[1];
rafs = new RandomAccessFile[1];
names = new String[1];
RAFlock = new Object[1];
RAFtime = new long[1];
RAFfile = new File[1];
isSparse = new boolean[1];
lengths[0] = metainfo.getTotalLength();
RAFlock[0] = new Object();
RAFfile[0] = base;
_torrentFiles.add(new TorrentFile(base, base, metainfo.getTotalLength()));
if (useSavedBitField) {
long lm = base.lastModified();
if (lm <= 0 || lm > savedTime)
useSavedBitField = false;
else if (base.length() != metainfo.getTotalLength())
useSavedBitField = false;
}
names[0] = base.getName();
}
else
{
@ -533,23 +541,16 @@ public class Storage
List<Long> ls = metainfo.getLengths();
int size = files.size();
long total = 0;
lengths = new long[size];
rafs = new RandomAccessFile[size];
names = new String[size];
RAFlock = new Object[size];
RAFtime = new long[size];
RAFfile = new File[size];
isSparse = new boolean[size];
for (int i = 0; i < size; i++)
{
List<String> path = files.get(i);
File f = createFileFromNames(base, path, areFilesPublic);
// dup file name check after filtering
for (int j = 0; j < i; j++) {
if (f.equals(RAFfile[j])) {
if (f.equals(_torrentFiles.get(j).RAFfile)) {
// Rename and start the check over again
// Copy path since metainfo list is unmodifiable
path = new ArrayList(path);
path = new ArrayList<String>(path);
int last = path.size() - 1;
String lastPath = path.get(last);
int dot = lastPath.lastIndexOf('.');
@ -563,16 +564,16 @@ public class Storage
j = 0;
}
}
lengths[i] = ls.get(i).longValue();
RAFlock[i] = new Object();
RAFfile[i] = f;
total += lengths[i];
long len = ls.get(i).longValue();
_torrentFiles.add(new TorrentFile(base, f, len));
total += len;
if (useSavedBitField) {
long lm = f.lastModified();
if (lm <= 0 || lm > savedTime)
useSavedBitField = false;
else if (f.length() != len)
useSavedBitField = false;
}
names[i] = f.getName();
}
// Sanity check for metainfo file.
@ -590,6 +591,8 @@ public class Storage
} else {
// the following sets the needed variable
changed = true;
if (_log.shouldLog(Log.INFO))
_log.info("Forcing check");
checkCreateFiles(false);
}
if (complete()) {
@ -597,8 +600,6 @@ public class Storage
_log.info("Torrent is complete");
} else {
// fixme saved priorities
if (files != null)
priorities = new int[files.size()];
if (_log.shouldLog(Log.INFO))
_log.info("Still need " + needed + " out of " + metainfo.getPieces() + " pieces");
}
@ -613,11 +614,11 @@ public class Storage
*/
public void reopen(String rootDir) throws IOException
{
if (RAFfile == null)
if (_torrentFiles.isEmpty())
throw new IOException("Storage not checked yet");
for (int i = 0; i < RAFfile.length; i++) {
if (!RAFfile[i].exists())
throw new IOException("File does not exist: " + RAFfile[i]);
for (TorrentFile tf : _torrentFiles) {
if (!tf.RAFfile.exists())
throw new IOException("File does not exist: " + tf);
}
}
@ -771,10 +772,10 @@ public class Storage
// Make sure all files are available and of correct length
// The files should all exist as they have been created with zero length by createFilesFromNames()
for (int i = 0; i < rafs.length; i++)
for (TorrentFile tf : _torrentFiles)
{
long length = RAFfile[i].length();
if(RAFfile[i].exists() && length == lengths[i])
long length = tf.RAFfile.length();
if(tf.RAFfile.exists() && length == tf.length)
{
if (listener != null)
listener.storageAllocated(this, length);
@ -782,27 +783,27 @@ public class Storage
}
else if (length == 0) {
changed = true;
synchronized(RAFlock[i]) {
allocateFile(i);
synchronized(tf) {
allocateFile(tf);
// close as we go so we don't run out of file descriptors
try {
closeRAF(i);
tf.closeRAF();
} catch (IOException ioe) {}
}
} else {
String msg = "File '" + names[i] + "' exists, but has wrong length (expected " +
lengths[i] + " but found " + length + ") - repairing corruption";
String msg = "File '" + tf.name + "' exists, but has wrong length (expected " +
tf.length + " but found " + length + ") - repairing corruption";
if (listener != null)
listener.addMessage(msg);
_log.error(msg);
changed = true;
resume = true;
_probablyComplete = false; // to force RW
synchronized(RAFlock[i]) {
checkRAF(i);
rafs[i].setLength(lengths[i]);
synchronized(tf) {
RandomAccessFile raf = tf.checkRAF();
raf.setLength(tf.length);
try {
closeRAF(i);
tf.closeRAF();
} catch (IOException ioe) {}
}
}
@ -813,7 +814,7 @@ public class Storage
{
byte[] piece = new byte[piece_size];
int file = 0;
long fileEnd = lengths[0];
long fileEnd = _torrentFiles.get(0).length;
long pieceEnd = 0;
for (int i = 0; i < pieces; i++)
{
@ -822,14 +823,15 @@ public class Storage
// close as we go so we don't run out of file descriptors
pieceEnd += length;
while (fileEnd <= pieceEnd) {
synchronized(RAFlock[file]) {
TorrentFile tf = _torrentFiles.get(file);
synchronized(tf) {
try {
closeRAF(file);
tf.closeRAF();
} catch (IOException ioe) {}
}
if (++file >= rafs.length)
if (++file >= _torrentFiles.size())
break;
fileEnd += lengths[file];
fileEnd += _torrentFiles.get(file).length;
}
if (correctHash)
{
@ -875,59 +877,17 @@ public class Storage
* Sets isSparse[nr] = true. balloonFile(nr) should be called later to
* defrag the file.
*
* This calls openRAF(); caller must synchronize and call closeRAF().
* This calls OpenRAF(); caller must synchronize and call closeRAF().
*/
private void allocateFile(int nr) throws IOException
private void allocateFile(TorrentFile tf) throws IOException
{
// caller synchronized
openRAF(nr, false); // RW
long remaining = lengths[nr];
if (listener != null)
listener.storageCreateFile(this, names[nr], remaining);
rafs[nr].setLength(remaining);
// don't bother ballooning later on Windows since there is no sparse file support
// until JDK7 using the JSR-203 interface.
// RAF seeks/writes do not create sparse files.
// Windows will zero-fill up to the point of the write, which
// will make the file fairly unfragmented, on average, at least until
// near the end where it will get exponentially more fragmented.
if (!_isWindows)
isSparse[nr] = true;
// caller will close rafs[nr]
if (listener != null)
listener.storageAllocated(this, lengths[nr]);
}
/**
* This "balloons" the file with zeros to eliminate disk fragmentation.,
* Overwrites the entire file with zeros. Sets isSparse[nr] = false.
*
* Caller must synchronize and call checkRAF() or openRAF().
* @since 0.9.1
*/
private void balloonFile(int nr) throws IOException
{
if (_log.shouldLog(Log.INFO))
_log.info("Ballooning " + nr + ": " + RAFfile[nr]);
long remaining = lengths[nr];
final int ZEROBLOCKSIZE = (int) Math.min(remaining, 32*1024);
byte[] zeros = new byte[ZEROBLOCKSIZE];
rafs[nr].seek(0);
// don't bother setting flag for small files
if (remaining > 20*1024*1024)
_allocateCount.incrementAndGet();
try {
while (remaining > 0) {
int size = (int) Math.min(remaining, ZEROBLOCKSIZE);
rafs[nr].write(zeros, 0, size);
remaining -= size;
}
} finally {
remaining = lengths[nr];
if (remaining > 20*1024*1024)
_allocateCount.decrementAndGet();
tf.allocateFile();
if (listener != null) {
listener.storageCreateFile(this, tf.name, tf.length);
listener.storageAllocated(this, tf.length);
}
isSparse[nr] = false;
// caller will close rafs[nr]
}
@ -937,18 +897,14 @@ public class Storage
*/
public void close() throws IOException
{
if (rafs == null) return;
for (int i = 0; i < rafs.length; i++)
for (TorrentFile tf : _torrentFiles)
{
// if we had an IOE in check(), the RAFlock may be null
if (RAFlock[i] == null)
continue;
try {
synchronized(RAFlock[i]) {
closeRAF(i);
synchronized(tf) {
tf.closeRAF();
}
} catch (IOException ioe) {
_log.error("Error closing " + RAFfile[i], ioe);
_log.error("Error closing " + tf, ioe);
// gobble gobble
}
}
@ -1013,40 +969,50 @@ public class Storage
// Early typecast, avoid possibly overflowing a temp integer
long start = (long) piece * (long) piece_size;
int i = 0;
long raflen = lengths[i];
long raflen = _torrentFiles.get(i).length;
while (start > raflen) {
i++;
start -= raflen;
raflen = lengths[i];
raflen = _torrentFiles.get(i).length;
}
int written = 0;
int off = 0;
int length = metainfo.getPieceLength(piece);
while (written < length) {
int need = length - written;
int len = (start + need < raflen) ? need : (int)(raflen - start);
synchronized(RAFlock[i]) {
checkRAF(i);
if (isSparse[i]) {
// If the file is a newly created sparse file,
// AND we aren't skipping it, balloon it with all
// zeros to un-sparse it by allocating the space.
// Obviously this could take a while.
// Once we have written to it, it isn't empty/sparse any more.
if (priorities == null || priorities[i] >= 0)
balloonFile(i);
else
isSparse[i] = false;
TorrentFile tf = _torrentFiles.get(i);
synchronized(tf) {
try {
RandomAccessFile raf = tf.checkRAF();
if (tf.isSparse) {
// If the file is a newly created sparse file,
// AND we aren't skipping it, balloon it with all
// zeros to un-sparse it by allocating the space.
// Obviously this could take a while.
// Once we have written to it, it isn't empty/sparse any more.
if (tf.priority >= 0) {
if (_log.shouldLog(Log.INFO))
_log.info("Ballooning " + tf);
tf.balloonFile();
} else {
tf.isSparse = false;
}
}
raf.seek(start);
//rafs[i].write(bs, off + written, len);
pp.write(raf, written, len);
} catch (IOException ioe) {
// get the file name in the logs
IOException ioe2 = new IOException("Error writing " + tf.RAFfile.getAbsolutePath());
ioe2.initCause(ioe);
throw ioe2;
}
rafs[i].seek(start);
//rafs[i].write(bs, off + written, len);
pp.write(rafs[i], off + written, len);
}
written += len;
if (need - len > 0) {
i++;
raflen = lengths[i];
raflen = _torrentFiles.get(i).length;
start = 0;
}
}
@ -1123,12 +1089,12 @@ public class Storage
long start = ((long) piece * (long) piece_size) + off;
int i = 0;
long raflen = lengths[i];
long raflen = _torrentFiles.get(i).length;
while (start > raflen)
{
i++;
start -= raflen;
raflen = lengths[i];
raflen = _torrentFiles.get(i).length;
}
int read = 0;
@ -1136,17 +1102,24 @@ public class Storage
{
int need = length - read;
int len = (start + need < raflen) ? need : (int)(raflen - start);
synchronized(RAFlock[i])
{
checkRAF(i);
rafs[i].seek(start);
rafs[i].readFully(bs, read, len);
}
TorrentFile tf = _torrentFiles.get(i);
synchronized(tf) {
try {
RandomAccessFile raf = tf.checkRAF();
raf.seek(start);
raf.readFully(bs, read, len);
} catch (IOException ioe) {
// get the file name in the logs
IOException ioe2 = new IOException("Error reading " + tf.RAFfile.getAbsolutePath());
ioe2.initCause(ioe);
throw ioe2;
}
}
read += len;
if (need - len > 0)
{
i++;
raflen = lengths[i];
raflen = _torrentFiles.get(i).length;
start = 0;
}
}
@ -1154,58 +1127,191 @@ public class Storage
return length;
}
private static final long RAFCloseDelay = 4*60*1000;
/**
* Close unused RAFs - call periodically
*/
private static final long RAFCloseDelay = 4*60*1000;
public void cleanRAFs() {
long cutoff = System.currentTimeMillis() - RAFCloseDelay;
for (int i = 0; i < RAFlock.length; i++) {
synchronized(RAFlock[i]) {
if (RAFtime[i] > 0 && RAFtime[i] < cutoff) {
try {
closeRAF(i);
} catch (IOException ioe) {}
}
for (TorrentFile tf : _torrentFiles) {
synchronized(tf) {
tf.closeRAF(cutoff);
}
}
}
/*
* For each of the following,
* caller must synchronize on RAFlock[i]
* ... except at the beginning if you're careful
*/
/**
* This must be called before using the RAF to ensure it is open
* A single file in a torrent.
* @since 0.9.9
*/
private void checkRAF(int i) throws IOException {
if (RAFtime[i] > 0) {
RAFtime[i] = System.currentTimeMillis();
return;
}
openRAF(i);
}
private class TorrentFile implements Comparable<TorrentFile> {
public final long length;
public final String name;
public final File RAFfile;
/**
* when was RAF last accessed, or 0 if closed
* locking: this
*/
private long RAFtime;
/**
* null when closed
* locking: this
*/
private RandomAccessFile raf;
/**
* is the file empty and sparse?
* locking: this
*/
public boolean isSparse;
/** priority by file; default 0 */
public volatile int priority;
private void openRAF(int i) throws IOException {
openRAF(i, _probablyComplete);
}
/**
* For new metainfo from files;
* use base == f for single-file torrent
*/
public TorrentFile(File base, File f) {
this(base, f, f.length());
}
private void openRAF(int i, boolean readonly) throws IOException {
rafs[i] = new RandomAccessFile(RAFfile[i], (readonly || !RAFfile[i].canWrite()) ? "r" : "rw");
RAFtime[i] = System.currentTimeMillis();
}
/**
* For existing metainfo with specified file length;
* use base == f for single-file torrent
*/
public TorrentFile(File base, File f, long len) {
String n = f.getPath();
if (base.isDirectory() && n.startsWith(base.getPath()))
n = n.substring(base.getPath().length() + 1);
name = n;
length = len;
RAFfile = f;
}
/**
* Can be called even if not open
*/
private void closeRAF(int i) throws IOException {
RAFtime[i] = 0;
if (rafs[i] == null)
return;
rafs[i].close();
rafs[i] = null;
/*
* For each of the following,
* caller must synchronize on RAFlock[i]
* ... except at the beginning if you're careful
*/
/**
* This must be called before using the RAF to ensure it is open
* locking: this
*/
public synchronized RandomAccessFile checkRAF() throws IOException {
if (raf != null)
RAFtime = System.currentTimeMillis();
else
openRAF();
return raf;
}
/**
* locking: this
*/
private synchronized void openRAF() throws IOException {
openRAF(_probablyComplete);
}
/**
* locking: this
*/
private synchronized void openRAF(boolean readonly) throws IOException {
raf = new RandomAccessFile(RAFfile, (readonly || !RAFfile.canWrite()) ? "r" : "rw");
RAFtime = System.currentTimeMillis();
}
/**
* Close if last used time older than cutoff.
* locking: this
*/
public synchronized void closeRAF(long cutoff) {
if (RAFtime > 0 && RAFtime < cutoff) {
try {
closeRAF();
} catch (IOException ioe) {}
}
}
/**
* Can be called even if not open
* locking: this
*/
public synchronized void closeRAF() throws IOException {
RAFtime = 0;
if (raf == null)
return;
raf.close();
raf = null;
}
/**
* This creates a (presumably) sparse file so that reads won't fail with IOE.
* Sets isSparse[nr] = true. balloonFile(nr) should be called later to
* defrag the file.
*
* This calls openRAF(); caller must synchronize and call closeRAF().
*/
public synchronized void allocateFile() throws IOException {
// caller synchronized
openRAF(false); // RW
raf.setLength(length);
// don't bother ballooning later on Windows since there is no sparse file support
// until JDK7 using the JSR-203 interface.
// RAF seeks/writes do not create sparse files.
// Windows will zero-fill up to the point of the write, which
// will make the file fairly unfragmented, on average, at least until
// near the end where it will get exponentially more fragmented.
if (!_isWindows)
isSparse = true;
}
/**
* This "balloons" the file with zeros to eliminate disk fragmentation.,
* Overwrites the entire file with zeros. Sets isSparse[nr] = false.
*
* Caller must synchronize and call checkRAF() or openRAF().
* @since 0.9.1
*/
public synchronized void balloonFile() throws IOException
{
long remaining = length;
final int ZEROBLOCKSIZE = (int) Math.min(remaining, 32*1024);
byte[] zeros = new byte[ZEROBLOCKSIZE];
raf.seek(0);
// don't bother setting flag for small files
if (remaining > 20*1024*1024)
_allocateCount.incrementAndGet();
try {
while (remaining > 0) {
int size = (int) Math.min(remaining, ZEROBLOCKSIZE);
raf.write(zeros, 0, size);
remaining -= size;
}
} finally {
remaining = length;
if (remaining > 20*1024*1024)
_allocateCount.decrementAndGet();
}
isSparse = false;
}
public int compareTo(TorrentFile tf) {
return name.compareTo(tf.name);
}
@Override
public int hashCode() { return RAFfile.getAbsolutePath().hashCode(); }
@Override
public boolean equals(Object o) {
return (o instanceof TorrentFile) &&
RAFfile.getAbsolutePath().equals(((TorrentFile)o).RAFfile.getAbsolutePath());
}
@Override
public String toString() { return name; }
}
/**
@ -1225,7 +1331,7 @@ public class Storage
File file = null;
FileOutputStream out = null;
try {
Storage storage = new Storage(util, base, announce, false, null);
Storage storage = new Storage(util, base, announce, null, false, null);
MetaInfo meta = storage.getMetaInfo();
file = new File(storage.getBaseName() + ".torrent");
out = new FileOutputStream(file);

View File

@ -21,8 +21,6 @@
package org.klomp.snark;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@ -31,15 +29,16 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.Set;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.data.Hash;
import net.i2p.util.ConvertToHash;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
@ -84,6 +83,7 @@ public class TrackerClient implements Runnable {
private final static int LONG_SLEEP = 30*60*1000; // sleep a while after lots of fails
private final static long MIN_TRACKER_ANNOUNCE_INTERVAL = 15*60*1000;
private final static long MIN_DHT_ANNOUNCE_INTERVAL = 10*60*1000;
public static final int PORT = 6881;
private final I2PSnarkUtil _util;
private final MetaInfo meta;
@ -109,8 +109,9 @@ public class TrackerClient implements Runnable {
private boolean completed;
private volatile boolean _fastUnannounce;
private long lastDHTAnnounce;
private final List<Tracker> trackers;
private final List<Tracker> backupTrackers;
private final List<TCTracker> trackers;
private final List<TCTracker> backupTrackers;
private long _startedOn;
/**
* Call start() to start it.
@ -132,11 +133,11 @@ public class TrackerClient implements Runnable {
this.coordinator = coordinator;
this.snark = snark;
this.port = 6881; //(port == -1) ? 9 : port;
this.port = PORT; //(port == -1) ? 9 : port;
this.infoHash = urlencode(snark.getInfoHash());
this.peerID = urlencode(snark.getID());
this.trackers = new ArrayList(2);
this.backupTrackers = new ArrayList(2);
this.trackers = new ArrayList<TCTracker>(2);
this.backupTrackers = new ArrayList<TCTracker>(2);
}
public synchronized void start() {
@ -270,9 +271,12 @@ public class TrackerClient implements Runnable {
primary = meta.getAnnounce();
else if (additionalTrackerURL != null)
primary = additionalTrackerURL;
Set<Hash> trackerHashes = new HashSet<Hash>(8);
// primary tracker
if (primary != null) {
if (isValidAnnounce(primary)) {
trackers.add(new Tracker(primary, true));
if (isNewValidTracker(trackerHashes, primary)) {
trackers.add(new TCTracker(primary, true));
if (_log.shouldLog(Log.DEBUG))
_log.debug("Announce: [" + primary + "] infoHash: " + infoHash);
} else {
@ -281,36 +285,35 @@ public class TrackerClient implements Runnable {
}
} else {
_log.warn("No primary announce");
primary = "";
}
// announce list
if (meta != null && !meta.isPrivate()) {
List<List<String>> list = meta.getAnnounceList();
if (list != null) {
for (List<String> llist : list) {
for (String url : llist) {
if (!isNewValidTracker(trackerHashes, url))
continue;
trackers.add(new TCTracker(url, trackers.isEmpty()));
if (_log.shouldLog(Log.DEBUG))
_log.debug("Additional announce (list): [" + url + "] for infoHash: " + infoHash);
}
}
}
}
// configured open trackers
if (meta == null || !meta.isPrivate()) {
List<String> tlist = _util.getOpenTrackers();
for (int i = 0; i < tlist.size(); i++) {
String url = tlist.get(i);
if (!isValidAnnounce(url)) {
_log.error("Bad announce URL: [" + url + "]");
String url = tlist.get(i);
if (!isNewValidTracker(trackerHashes, url))
continue;
}
int slash = url.indexOf('/', 7);
if (slash <= 7) {
_log.error("Bad announce URL: [" + url + "]");
continue;
}
if (primary.startsWith(url.substring(0, slash)))
continue;
String dest = _util.lookup(url.substring(7, slash));
if (dest == null) {
_log.error("Announce host unknown: [" + url.substring(7, slash) + "]");
continue;
}
if (primary.startsWith("http://" + dest))
continue;
if (primary.startsWith("http://i2p/" + dest))
continue;
// opentrackers are primary if we don't have primary
trackers.add(new Tracker(url, primary.equals("")));
if (_log.shouldLog(Log.DEBUG))
_log.debug("Additional announce: [" + url + "] for infoHash: " + infoHash);
// opentrackers are primary if we don't have primary
trackers.add(new TCTracker(url, trackers.isEmpty()));
if (_log.shouldLog(Log.DEBUG))
_log.debug("Additional announce: [" + url + "] for infoHash: " + infoHash);
}
}
@ -318,29 +321,39 @@ public class TrackerClient implements Runnable {
if (trackers.isEmpty() && (meta == null || !meta.isPrivate())) {
List<String> tlist = _util.getBackupTrackers();
for (int i = 0; i < tlist.size(); i++) {
String url = tlist.get(i);
if (!isValidAnnounce(url)) {
_log.error("Bad announce URL: [" + url + "]");
String url = tlist.get(i);
if (!isNewValidTracker(trackerHashes, url))
continue;
}
int slash = url.indexOf('/', 7);
if (slash <= 7) {
_log.error("Bad announce URL: [" + url + "]");
continue;
}
String dest = _util.lookup(url.substring(7, slash));
if (dest == null) {
_log.error("Announce host unknown: [" + url.substring(7, slash) + "]");
continue;
}
backupTrackers.add(new Tracker(url, false));
if (_log.shouldLog(Log.DEBUG))
_log.debug("Backup announce: [" + url + "] for infoHash: " + infoHash);
backupTrackers.add(new TCTracker(url, false));
if (_log.shouldLog(Log.DEBUG))
_log.debug("Backup announce: [" + url + "] for infoHash: " + infoHash);
}
if (backupTrackers.isEmpty()) {
backupTrackers.add(new TCTracker(DEFAULT_BACKUP_TRACKER, false));
}
if (backupTrackers.isEmpty())
backupTrackers.add(new Tracker(DEFAULT_BACKUP_TRACKER, false));
}
this.completed = coordinator.getLeft() == 0;
_startedOn = _util.getContext().clock().now();
}
/**
* @param existing the ones we already know about
* @param ann an announce URL non-null
* @return true if ann is valid and new; adds to existing if returns true
* @since 0.9.5
*/
private boolean isNewValidTracker(Set<Hash> existing, String ann) {
Hash h = getHostHash(ann);
if (h == null) {
_log.error("Bad announce URL: [" + ann + ']');
return false;
}
boolean rv = existing.add(h);
if (!rv) {
if (_log.shouldLog(Log.INFO))
_log.info("Dup announce URL: [" + ann + ']');
}
return rv;
}
/**
@ -364,15 +377,24 @@ public class TrackerClient implements Runnable {
if (dht != null && (meta == null || !meta.isPrivate()))
dht.announce(snark.getInfoHash());
int oldSeenPeers = snark.getTrackerSeenPeers();
int maxSeenPeers = 0;
if (!trackers.isEmpty())
if (!trackers.isEmpty()) {
maxSeenPeers = getPeersFromTrackers(trackers);
// fast update for UI at startup
if (maxSeenPeers > oldSeenPeers)
snark.setTrackerSeenPeers(maxSeenPeers);
}
int p = getPeersFromPEX();
if (p > maxSeenPeers)
maxSeenPeers = p;
p = getPeersFromDHT();
if (p > maxSeenPeers)
if (p > maxSeenPeers) {
maxSeenPeers = p;
// fast update for UI at startup
if (maxSeenPeers > oldSeenPeers)
snark.setTrackerSeenPeers(maxSeenPeers);
}
// backup if DHT needs bootstrapping
if (trackers.isEmpty() && !backupTrackers.isEmpty() && dht != null && dht.size() < 16) {
p = getPeersFromTrackers(backupTrackers);
@ -425,32 +447,41 @@ public class TrackerClient implements Runnable {
/**
* @return max peers seen
*/
private int getPeersFromTrackers(List<Tracker> trckrs) {
long uploaded = coordinator.getUploaded();
long downloaded = coordinator.getDownloaded();
private int getPeersFromTrackers(List<TCTracker> trckrs) {
long left = coordinator.getLeft(); // -1 in magnet mode
// First time we got a complete download?
String event;
if (!completed && left == 0)
{
boolean newlyCompleted;
if (!completed && left == 0) {
completed = true;
event = COMPLETED_EVENT;
}
else
event = NO_EVENT;
newlyCompleted = true;
} else {
newlyCompleted = false;
}
// *** loop once for each tracker
int maxSeenPeers = 0;
for (Tracker tr : trckrs) {
for (TCTracker tr : trckrs) {
if ((!stop) && (!tr.stop) &&
(completed || coordinator.needOutboundPeers() || !tr.started) &&
(event.equals(COMPLETED_EVENT) || System.currentTimeMillis() > tr.lastRequestTime + tr.interval))
(newlyCompleted || System.currentTimeMillis() > tr.lastRequestTime + tr.interval))
{
try
{
if (!tr.started)
event = STARTED_EVENT;
long uploaded = coordinator.getUploaded();
long downloaded = coordinator.getDownloaded();
long len = snark.getTotalLength();
if (len > 0 && downloaded > len)
downloaded = len;
left = coordinator.getLeft();
String event;
if (!tr.started) {
event = STARTED_EVENT;
} else if (newlyCompleted) {
event = COMPLETED_EVENT;
} else {
event = NO_EVENT;
}
TrackerInfo info = doRequest(tr, infoHash, peerID,
uploaded, downloaded, left,
event);
@ -463,12 +494,31 @@ public class TrackerClient implements Runnable {
consecutiveFails = 0;
runStarted = true;
tr.started = true;
Set<Peer> peers = info.getPeers();
tr.seenPeers = info.getPeerCount();
if (snark.getTrackerSeenPeers() < tr.seenPeers) // update rising number quickly
snark.setTrackerSeenPeers(tr.seenPeers);
// auto stop
// These are very high thresholds for now, not configurable,
// just for update torrent
if (completed &&
tr.isPrimary &&
snark.isAutoStoppable() &&
!snark.isChecking() &&
info.getSeedCount() > 100 &&
coordinator.getPeerCount() <= 0 &&
_util.getContext().clock().now() > _startedOn + 2*60*60*1000 &&
snark.getTotalLength() > 0 &&
uploaded >= snark.getTotalLength() * 3 / 2) {
if (_log.shouldLog(Log.WARN))
_log.warn("Auto stopping " + snark.getBaseName());
snark.setAutoStoppable(false);
snark.stopTorrent();
return tr.seenPeers;
}
Set<Peer> peers = info.getPeers();
// pass everybody over to our tracker
DHT dht = _util.getDHT();
if (dht != null) {
@ -480,7 +530,7 @@ public class TrackerClient implements Runnable {
if (coordinator.needOutboundPeers()) {
// we only want to talk to new people if we need things
// from them (duh)
List<Peer> ordered = new ArrayList(peers);
List<Peer> ordered = new ArrayList<Peer>(peers);
Random r = _util.getContext().random();
Collections.shuffle(ordered, r);
Iterator<Peer> it = ordered.iterator();
@ -545,7 +595,7 @@ public class TrackerClient implements Runnable {
if (!pids.isEmpty()) {
if (_log.shouldLog(Log.INFO))
_log.info("Got " + pids.size() + " from PEX");
List<Peer> peers = new ArrayList(pids.size());
List<Peer> peers = new ArrayList<Peer>(pids.size());
for (PeerID pID : pids) {
peers.add(new Peer(pID, snark.getID(), snark.getInfoHash(), snark.getMetaInfo()));
}
@ -577,33 +627,29 @@ public class TrackerClient implements Runnable {
// FIXME this needs to be in its own thread
int rv = 0;
DHT dht = _util.getDHT();
if (dht != null && (meta == null || !meta.isPrivate()) && (!stop) &&
_util.getContext().clock().now() > lastDHTAnnounce + MIN_DHT_ANNOUNCE_INTERVAL) {
if (dht != null &&
(meta == null || !meta.isPrivate()) &&
(!stop) &&
(meta == null || _util.getContext().clock().now() > lastDHTAnnounce + MIN_DHT_ANNOUNCE_INTERVAL)) {
int numwant;
if (!coordinator.needOutboundPeers())
numwant = 1;
else
numwant = _util.getMaxConnections();
Collection<Hash> hashes = dht.getPeers(snark.getInfoHash(), numwant, 2*60*1000);
Collection<Hash> hashes = dht.getPeersAndAnnounce(snark.getInfoHash(), numwant, 5*60*1000, 1, 3*60*1000);
if (!hashes.isEmpty()) {
runStarted = true;
lastDHTAnnounce = _util.getContext().clock().now();
rv = hashes.size();
} else {
lastDHTAnnounce = 0;
}
if (_log.shouldLog(Log.INFO))
_log.info("Got " + hashes + " from DHT");
// announce ourselves while the token is still good
// FIXME this needs to be in its own thread
if (!stop) {
// announce only to the 1 closest
int good = dht.announce(snark.getInfoHash(), 1, 5*60*1000);
if (_log.shouldLog(Log.INFO))
_log.info("Sent " + good + " good announces to DHT");
}
// now try these peers
if ((!stop) && !hashes.isEmpty()) {
List<Peer> peers = new ArrayList(hashes.size());
List<Peer> peers = new ArrayList<Peer>(hashes.size());
for (Hash h : hashes) {
try {
PeerID pID = new PeerID(h.getData(), _util);
@ -639,7 +685,7 @@ public class TrackerClient implements Runnable {
if (dht != null)
dht.unannounce(snark.getInfoHash());
int i = 0;
for (Tracker tr : trackers) {
for (TCTracker tr : trackers) {
if (_util.connected() &&
tr.started && (!tr.stop) && tr.trackerProblems == null) {
try {
@ -659,9 +705,9 @@ public class TrackerClient implements Runnable {
* @since 0.9.1
*/
private class Unannouncer implements Runnable {
private final Tracker tr;
private final TCTracker tr;
public Unannouncer(Tracker tr) {
public Unannouncer(TCTracker tr) {
this.tr = tr;
}
@ -670,6 +716,9 @@ public class TrackerClient implements Runnable {
_log.debug("Running unannounce " + _threadName + " to " + tr.announce);
long uploaded = coordinator.getUploaded();
long downloaded = coordinator.getDownloaded();
long len = snark.getTotalLength();
if (len > 0 && downloaded > len)
downloaded = len;
long left = coordinator.getLeft();
try
{
@ -685,7 +734,7 @@ public class TrackerClient implements Runnable {
}
}
private TrackerInfo doRequest(Tracker tr, String infoHash,
private TrackerInfo doRequest(TCTracker tr, String infoHash,
String peerID, long uploaded,
long downloaded, long left, String event)
throws IOException
@ -775,6 +824,7 @@ public class TrackerClient implements Runnable {
}
/**
* @param ann an announce URL
* @return true for i2p hosts only
* @since 0.7.12
*/
@ -790,10 +840,38 @@ public class TrackerClient implements Runnable {
url.getPort() < 0;
}
private static class Tracker
/**
* @param ann an announce URL non-null
* @return a Hash for i2p hosts only, null otherwise
* @since 0.9.5
*/
private static Hash getHostHash(String ann) {
URL url;
try {
url = new URL(ann);
} catch (MalformedURLException mue) {
return null;
}
if (url.getPort() >= 0 || !url.getProtocol().equals("http"))
return null;
String host = url.getHost();
if (host.endsWith(".i2p"))
return ConvertToHash.getHash(host);
if (host.equals("i2p")) {
String path = url.getPath();
if (path == null || path.length() < 517 ||
!path.startsWith("/"))
return null;
String[] parts = path.substring(1).split("/?&;", 2);
return ConvertToHash.getHash(parts[0]);
}
return null;
}
private static class TCTracker
{
String announce;
boolean isPrimary;
final String announce;
final boolean isPrimary;
long interval;
long lastRequestTime;
String trackerProblems;
@ -803,7 +881,7 @@ public class TrackerClient implements Runnable {
int consecutiveFails;
int seenPeers;
public Tracker(String a, boolean p)
public TCTracker(String a, boolean p)
{
announce = a;
isPrimary = p;

View File

@ -59,7 +59,7 @@ class TrackerInfo
this(be.bdecodeMap().getMap(), my_id, infohash, metainfo, util);
}
private TrackerInfo(Map m, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util)
private TrackerInfo(Map<String, BEValue> m, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util)
throws IOException
{
BEValue reason = (BEValue)m.get("failure reason");
@ -80,7 +80,7 @@ class TrackerInfo
BEValue bePeers = (BEValue)m.get("peers");
if (bePeers == null) {
peers = Collections.EMPTY_SET;
peers = Collections.emptySet();
} else {
Set<Peer> p;
try {
@ -127,7 +127,7 @@ class TrackerInfo
private static Set<Peer> getPeers(List<BEValue> l, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util)
throws IOException
{
Set<Peer> peers = new HashSet(l.size());
Set<Peer> peers = new HashSet<Peer>(l.size());
for (BEValue bev : l) {
PeerID peerID;
@ -161,7 +161,7 @@ class TrackerInfo
throws IOException
{
int count = l.length / HASH_LENGTH;
Set<Peer> peers = new HashSet(count);
Set<Peer> peers = new HashSet<Peer>(count);
for (int i = 0; i < count; i++) {
PeerID peerID;
@ -190,6 +190,12 @@ class TrackerInfo
return Math.max(pc, complete + incomplete - 1);
}
/** @since 0.9.9 */
public int getSeedCount()
{
return complete;
}
public String getFailureReason()
{
return failure_reason;

View File

@ -42,10 +42,10 @@ class UpdateHandler implements Updater {
*/
public UpdateTask update(UpdateType type, UpdateMethod method, List<URI> updateSources,
String id, String newVersion, long maxTime) {
if (type != UpdateType.ROUTER_SIGNED ||
if ((type != UpdateType.ROUTER_SIGNED && type != UpdateType.ROUTER_SIGNED_SU3) ||
method != UpdateMethod.TORRENT || updateSources.isEmpty())
return null;
UpdateRunner update = new UpdateRunner(_context, _umgr, _smgr, updateSources, newVersion);
UpdateRunner update = new UpdateRunner(_context, _umgr, _smgr, type, updateSources, newVersion);
_umgr.notifyProgress(update, "<b>" + _smgr.util().getString("Updating") + "</b>");
return update;
}

View File

@ -6,11 +6,9 @@ import java.util.List;
import net.i2p.I2PAppContext;
import net.i2p.crypto.TrustedUpdate;
import net.i2p.data.DataHelper;
import net.i2p.update.*;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
import net.i2p.util.VersionComparator;
/**
* The downloader for router signed updates.
@ -22,6 +20,7 @@ class UpdateRunner implements UpdateTask, CompleteListener {
private final Log _log;
private final UpdateManager _umgr;
private final SnarkManager _smgr;
private final UpdateType _type;
private final List<URI> _urls;
private volatile boolean _isRunning;
private volatile boolean _hasMetaInfo;
@ -36,11 +35,12 @@ class UpdateRunner implements UpdateTask, CompleteListener {
private static final long CHECK_INTERVAL = 3*60*1000;
public UpdateRunner(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr,
List<URI> uris, String newVersion) {
UpdateType type, List<URI> uris, String newVersion) {
_context = ctx;
_log = ctx.logManager().getLog(getClass());
_umgr = umgr;
_smgr = smgr;
_type = type;
_urls = uris;
_newVersion = newVersion;
}
@ -56,7 +56,7 @@ class UpdateRunner implements UpdateTask, CompleteListener {
}
}
public UpdateType getType() { return UpdateType.ROUTER_SIGNED; }
public UpdateType getType() { return _type; }
public UpdateMethod getMethod() { return UpdateMethod.TORRENT; }
@ -111,7 +111,7 @@ class UpdateRunner implements UpdateTask, CompleteListener {
}
_snark = _smgr.addMagnet(name, ih, trackerURL, true, true, this);
if (_snark != null) {
updateStatus("<b>" + _smgr.util().getString("Updating from {0}", updateURL) + "</b>");
updateStatus("<b>" + _smgr.util().getString("Updating from {0}", linkify(updateURL)) + "</b>");
new Timeout();
break;
}
@ -264,6 +264,7 @@ class UpdateRunner implements UpdateTask, CompleteListener {
}
_hasMetaInfo = true;
notifyProgress();
snark.setAutoStoppable(true);
return _smgr.gotMetaInfo(snark);
}
@ -291,6 +292,12 @@ class UpdateRunner implements UpdateTask, CompleteListener {
//////// end CompleteListener methods
private static String linkify(String url) {
String durl = url.length() <= 28 ? url :
url.substring(0, 25) + "&hellip;";
return "<a target=\"_blank\" href=\"" + url + "\"/>" + durl + "</a>";
}
private void updateStatus(String s) {
_umgr.notifyProgress(this, s);
}

View File

@ -60,7 +60,7 @@ public class BDecoder
private int indicator = 0;
// Used for ugly hack to get SHA hash over the metainfo info map
private final String special_map = "info";
private static final String special_map = "info";
private boolean in_special_map = false;
/** creation deferred until we encounter the special map, to make processing of announce replies more efficient */
private MessageDigest sha_digest;
@ -221,46 +221,51 @@ public class BDecoder
{
c = read();
if (c == 'e')
return new BEValue(BigInteger.ZERO);
return new BEValue(Integer.valueOf(0));
else
throw new InvalidBEncodingException("'e' expected after zero,"
+ " not '" + (char)c + "'");
}
// XXX - We don't support more the 255 char big integers
char[] chars = new char[256];
int off = 0;
StringBuilder chars = new StringBuilder(16);
if (c == '-')
{
c = read();
if (c == '0')
throw new InvalidBEncodingException("Negative zero not allowed");
chars[off] = (char)c;
off++;
chars.append((char)c);
}
if (c < '1' || c > '9')
throw new InvalidBEncodingException("Invalid Integer start '"
+ (char)c + "'");
chars[off] = (char)c;
off++;
chars.append((char)c);
c = read();
int i = c - '0';
while(i >= 0 && i <= 9)
while(c >= '0' && c <= '9')
{
chars[off] = (char)c;
off++;
chars.append((char)c);
c = read();
i = c - '0';
}
if (c != 'e')
throw new InvalidBEncodingException("Integer should end with 'e'");
String s = new String(chars, 0, off);
return new BEValue(new BigInteger(s));
String s = chars.toString();
int len = s.length();
// save a little space if we're sure it will fit
Number num;
if (len < 10)
num = Integer.valueOf(s);
else if (len < 19)
num = Long.valueOf(s);
else if (len > 256)
throw new InvalidBEncodingException("Too many digits: " + len);
else
num = new BigInteger(s);
return new BEValue(num);
}
/**
@ -276,7 +281,7 @@ public class BDecoder
+ (char)c + "'");
indicator = 0;
List result = new ArrayList();
List<BEValue> result = new ArrayList<BEValue>();
c = getNextIndicator();
while (c != 'e')
{
@ -303,7 +308,7 @@ public class BDecoder
+ (char)c + "'");
indicator = 0;
Map result = new HashMap();
Map<String, BEValue> result = new HashMap<String, BEValue>();
c = getNextIndicator();
while (c != 'e')
{

View File

@ -49,12 +49,12 @@ public class BEValue
this.value = value;
}
public BEValue(List value)
public BEValue(List<BEValue> value)
{
this.value = value;
}
public BEValue(Map value)
public BEValue(Map<String, BEValue> value)
{
this.value = value;
}
@ -142,11 +142,12 @@ public class BEValue
* succeeds when the BEValue is actually a List, otherwise it will
* throw a InvalidBEncodingException.
*/
@SuppressWarnings("unchecked")
public List<BEValue> getList() throws InvalidBEncodingException
{
try
{
return (List)value;
return (List<BEValue>)value;
}
catch (ClassCastException cce)
{
@ -159,11 +160,12 @@ public class BEValue
* values. This operation only succeeds when the BEValue is actually
* a Map, otherwise it will throw a InvalidBEncodingException.
*/
@SuppressWarnings("unchecked")
public Map<String, BEValue> getMap() throws InvalidBEncodingException
{
try
{
return (Map)value;
return (Map<String, BEValue>)value;
}
catch (ClassCastException cce)
{

View File

@ -59,9 +59,9 @@ public class BEncoder
else if (o instanceof Number)
bencode((Number)o, out);
else if (o instanceof List)
bencode((List)o, out);
bencode((List<?>)o, out);
else if (o instanceof Map)
bencode((Map<String, Object>)o, out);
bencode((Map<?, ?>)o, out);
else if (o instanceof BEValue)
bencode(((BEValue)o).getValue(), out);
else
@ -110,7 +110,7 @@ public class BEncoder
out.write('e');
}
public static byte[] bencode(List l)
public static byte[] bencode(List<?> l)
{
try
{
@ -124,10 +124,10 @@ public class BEncoder
}
}
public static void bencode(List l, OutputStream out) throws IOException
public static void bencode(List<?> l, OutputStream out) throws IOException
{
out.write('l');
Iterator it = l.iterator();
Iterator<?> it = l.iterator();
while (it.hasNext())
bencode(it.next(), out);
out.write('e');
@ -155,7 +155,7 @@ public class BEncoder
out.write(bs);
}
public static byte[] bencode(Map<String, Object> m)
public static byte[] bencode(Map<?, ?> m)
{
try
{
@ -169,23 +169,29 @@ public class BEncoder
}
}
public static void bencode(Map<String, Object> m, OutputStream out) throws IOException
public static void bencode(Map<?, ?> m, OutputStream out)
throws IOException, IllegalArgumentException
{
out.write('d');
// Keys must be sorted. XXX - But is this the correct order?
Set<String> s = m.keySet();
List<String> l = new ArrayList(s);
Set<?> s = m.keySet();
List<String> l = new ArrayList<String>(s.size());
for (Object k : s) {
// Keys must be Strings.
if (String.class.isAssignableFrom(k.getClass()))
l.add((String) k);
else
throw new IllegalArgumentException("Cannot bencode map: contains non-String key of type " + k.getClass());
}
Collections.sort(l);
Iterator<String> it = l.iterator();
while(it.hasNext())
{
// Keys must be Strings.
String key = it.next();
Object value = m.get(key);
bencode(key, out);
bencode(value, out);
bencode(m.get(key), out);
}
out.write('e');

View File

@ -36,16 +36,18 @@ public interface DHT {
public void ping(Destination dest, int port);
/**
* Get peers for a torrent.
* Get peers for a torrent, and announce to the closest node we find.
* Blocking!
* Caller should run in a thread.
*
* @param ih the Info Hash (torrent)
* @param max maximum number of peers to return
* @param maxWait the maximum time to wait (ms) must be > 0
* @param annMax the number of peers to announce to
* @param annMaxWait the maximum total time to wait for announces, may be 0 to return immediately without waiting for acks
* @return possibly empty (never null)
*/
public Collection<Hash> getPeers(byte[] ih, int max, long maxWait);
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait, int annMax, long annMaxWait);
/**
* Announce to ourselves.

View File

@ -5,11 +5,8 @@ package org.klomp.snark.dht;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import net.i2p.I2PAppContext;
@ -53,8 +50,8 @@ class DHTNodes {
_context = ctx;
_expireTime = MAX_EXPIRE_TIME;
_log = _context.logManager().getLog(DHTNodes.class);
_nodeMap = new ConcurrentHashMap();
_kad = new KBucketSet(ctx, me, KAD_K, KAD_B, new KBTrimmer(ctx, KAD_K));
_nodeMap = new ConcurrentHashMap<NID, NodeInfo>();
_kad = new KBucketSet<NID>(ctx, me, KAD_K, KAD_B, new KBTrimmer(ctx, KAD_K));
}
public void start() {
@ -120,7 +117,7 @@ class DHTNodes {
else
key = new NID(h.getData());
List<NID> keys = _kad.getClosest(key, numWant);
List<NodeInfo> rv = new ArrayList(keys.size());
List<NodeInfo> rv = new ArrayList<NodeInfo>(keys.size());
for (NID nid : keys) {
NodeInfo ninfo = _nodeMap.get(nid);
if (ninfo != null)

View File

@ -104,10 +104,10 @@ class DHTTracker {
List<Hash> getPeers(InfoHash ih, int max) {
Peers peers = _torrents.get(ih);
if (peers == null)
return Collections.EMPTY_LIST;
return Collections.emptyList();
int size = peers.size();
List<Hash> rv = new ArrayList(peers.values());
List<Hash> rv = new ArrayList<Hash>(peers.values());
if (max < size) {
Collections.shuffle(rv, _context.random());
rv = rv.subList(0, max);

View File

@ -10,7 +10,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -24,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;
import net.i2p.client.I2PClient;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.I2PSessionMuxedListener;
@ -32,17 +30,16 @@ import net.i2p.client.SendMessageOptions;
import net.i2p.client.datagram.I2PDatagramDissector;
import net.i2p.client.datagram.I2PDatagramMaker;
import net.i2p.client.datagram.I2PInvalidDatagramException;
import net.i2p.crypto.SHA1Hash;
import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.Hash;
import net.i2p.data.SimpleDataStructure;
import net.i2p.util.ConcurrentHashSet;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
import org.klomp.snark.TrackerClient;
import org.klomp.snark.bencode.BDecoder;
import org.klomp.snark.bencode.BEncoder;
import org.klomp.snark.bencode.BEValue;
@ -114,6 +111,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
/** signed dgrams */
private final int _qPort;
private final File _dhtFile;
private final File _backupDhtFile;
private volatile boolean _isRunning;
private volatile boolean _hasBootstrapped;
/** stats */
@ -148,30 +146,34 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private static final long MAX_MSGID_AGE = 2*60*1000;
/** how long since sent do we wait for a reply */
private static final long DEFAULT_QUERY_TIMEOUT = 75*1000;
private static final long DEST_LOOKUP_TIMEOUT = 10*1000;
/** stagger with other cleaners */
private static final long CLEAN_TIME = 63*1000;
private static final long EXPLORE_TIME = 877*1000;
private static final long BLACKLIST_CLEAN_TIME = 17*60*1000;
private static final String DHT_FILE = "i2psnark.dht.dat";
private static final String DHT_FILE_SUFFIX = ".dht.dat";
private static final int SEND_CRYPTO_TAGS = 8;
private static final int LOW_CRYPTO_TAGS = 4;
public KRPC (I2PAppContext ctx, I2PSession session) {
/**
* @param baseName generally "i2psnark"
*/
public KRPC(I2PAppContext ctx, String baseName, I2PSession session) {
_context = ctx;
_session = session;
_log = ctx.logManager().getLog(KRPC.class);
_tracker = new DHTTracker(ctx);
_sentQueries = new ConcurrentHashMap();
_outgoingTokens = new ConcurrentHashMap();
_incomingTokens = new ConcurrentHashMap();
_blacklist = new ConcurrentHashSet();
_sentQueries = new ConcurrentHashMap<MsgID, ReplyWaiter>();
_outgoingTokens = new ConcurrentHashMap<Token, NodeInfo>();
_incomingTokens = new ConcurrentHashMap<NID, Token>();
_blacklist = new ConcurrentHashSet<NID>();
// Construct my NodeInfo
// Pick ports over a big range to marginally increase security
// If we add a search DHT, adjust to stay out of each other's way
_qPort = 2555 + ctx.random().nextInt(61111);
_qPort = TrackerClient.PORT + 10 + ctx.random().nextInt(65535 - 20 - TrackerClient.PORT);
_rPort = _qPort + 1;
if (SECURE_NID) {
_myNID = NodeInfo.generateNID(session.getMyDestination().calculateHash(), _qPort, _context.random());
@ -182,7 +184,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
_myNID = new NID(_myID);
}
_myNodeInfo = new NodeInfo(_myNID, session.getMyDestination(), _qPort);
_dhtFile = new File(ctx.getConfigDir(), DHT_FILE);
_dhtFile = new File(ctx.getConfigDir(), baseName + DHT_FILE_SUFFIX);
_backupDhtFile = baseName.equals("i2psnark") ? null : new File(ctx.getConfigDir(), "i2psnark" + DHT_FILE_SUFFIX);
_knownNodes = new DHTNodes(ctx, _myNID);
start();
@ -239,9 +242,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
_log.info("DHT is empty, cannot explore");
return;
}
SortedSet<NodeInfo> toTry = new TreeSet(new NodeInfoComparator(target));
SortedSet<NodeInfo> toTry = new TreeSet<NodeInfo>(new NodeInfoComparator(target));
toTry.addAll(nodes);
Set<NodeInfo> tried = new HashSet();
Set<NodeInfo> tried = new HashSet<NodeInfo>();
if (_log.shouldLog(Log.INFO))
_log.info("Starting explore of " + target);
@ -302,7 +305,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
/**
* Get peers for a torrent.
* Get peers for a torrent, and announce to the closest node we find.
* This is an iterative lookup in the DHT.
* Blocking!
* Caller should run in a thread.
@ -310,30 +313,38 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param ih the Info Hash (torrent)
* @param max maximum number of peers to return
* @param maxWait the maximum time to wait (ms) must be > 0
* @param annMax the number of peers to announce to
* @param annMaxWait the maximum total time to wait for announces, may be 0 to return immediately without waiting for acks
* @return possibly empty (never null)
*/
public Collection<Hash> getPeers(byte[] ih, int max, long maxWait) {
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait, int annMax, long annMaxWait) {
// check local tracker first
InfoHash iHash = new InfoHash(ih);
Collection<Hash> rv = _tracker.getPeers(iHash, max);
rv.remove(_myNodeInfo.getHash());
if (rv.size() >= max)
return rv;
rv = new HashSet(rv);
rv = new HashSet<Hash>(rv);
long endTime = _context.clock().now() + maxWait;
// needs to be much higher than log(size) since many lookups will fail
// at first and we will give up too early
int maxNodes = 30;
// Initial set to try, will get added to as we go
int maxNodes = 12;
List<NodeInfo> nodes = _knownNodes.findClosest(iHash, maxNodes);
SortedSet<NodeInfo> toTry = new TreeSet(new NodeInfoComparator(iHash));
NodeInfoComparator comp = new NodeInfoComparator(iHash);
SortedSet<NodeInfo> toTry = new TreeSet<NodeInfo>(comp);
SortedSet<NodeInfo> heardFrom = new TreeSet<NodeInfo>(comp);
toTry.addAll(nodes);
Set<NodeInfo> tried = new HashSet();
SortedSet<NodeInfo> tried = new TreeSet<NodeInfo>(comp);
if (_log.shouldLog(Log.INFO))
_log.info("Starting getPeers for " + iHash + " with " + nodes.size() + " to try");
_log.info("Starting getPeers for " + iHash + " (b64: " + new NID(ih) + ") " + " with " + nodes.size() + " to try");
for (int i = 0; i < maxNodes; i++) {
if (!_isRunning)
break;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Now to try: " + toTry);
NodeInfo nInfo;
try {
nInfo = toTry.first();
@ -342,13 +353,15 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
toTry.remove(nInfo);
tried.add(nInfo);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Try " + i + ": " + nInfo);
ReplyWaiter waiter = sendGetPeers(nInfo, iHash);
if (waiter == null)
continue;
synchronized(waiter) {
try {
waiter.wait(Math.max(20*1000, (Math.min(40*1000, endTime - _context.clock().now()))));
waiter.wait(Math.max(30*1000, (Math.min(45*1000, endTime - _context.clock().now()))));
} catch (InterruptedException ie) {}
}
@ -360,18 +373,24 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Got pong");
} else if (replyType == REPLY_PEERS) {
heardFrom.add(waiter.getSentTo());
if (_log.shouldLog(Log.DEBUG))
_log.debug("Got peers");
List<Hash> reply = (List<Hash>) waiter.getReplyObject();
// shouldn't send us an empty peers list but through
// 0.9.8.1 it will
if (!reply.isEmpty()) {
for (int j = 0; j < reply.size() && rv.size() < max; j++) {
rv.add(reply.get(j));
Hash h = reply.get(j);
if (!h.equals(_myNodeInfo.getHash()))
rv.add(h);
}
if (_log.shouldLog(Log.INFO))
_log.info("Finished get Peers, got " + rv.size() + " from DHT, returning " + reply.size());
return rv;
}
if (_log.shouldLog(Log.INFO))
_log.info("Finished get Peers, got " + reply.size() + " from DHT, returning " + rv.size());
break;
} else if (replyType == REPLY_NODES) {
heardFrom.add(waiter.getSentTo());
List<NodeInfo> reply = (List<NodeInfo>) waiter.getReplyObject();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Got " + reply.size() + " nodes");
@ -387,9 +406,45 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
if (_context.clock().now() > endTime)
break;
if (!toTry.isEmpty() && !heardFrom.isEmpty() &&
comp.compare(toTry.first(), heardFrom.first()) >= 0) {
if (_log.shouldLog(Log.INFO))
_log.info("Finished get Peers, nothing closer to try after " + (i+1));
break;
}
}
// now announce
if (!heardFrom.isEmpty()) {
announce(ih);
// announce to the closest we've heard from
int annCnt = 0;
long start = _context.clock().now();
for (Iterator<NodeInfo> iter = heardFrom.iterator(); iter.hasNext() && annCnt < annMax && _isRunning; ) {
NodeInfo annTo = iter.next();
if (_log.shouldLog(Log.INFO))
_log.info("Announcing to closest from get peers: " + annTo);
long toWait = annMaxWait > 0 ? Math.min(annMaxWait, 60*1000) : 0;
if (announce(ih, annTo, toWait))
annCnt++;
if (annMaxWait > 0) {
annMaxWait -= _context.clock().now() - start;
if (annMaxWait < 1000)
break;
}
}
} else {
// spray it, but unlikely to work, we just went through the kbuckets,
// so this is essentially just a retry
if (_log.shouldLog(Log.INFO))
_log.info("Announcing to closest in kbuckets after get peers failed");
announce(ih, annMax, annMaxWait);
}
if (_log.shouldLog(Log.INFO)) {
_log.info("Finished get Peers, returning " + rv.size());
_log.info("Tried: " + tried);
_log.info("Heard from: " + heardFrom);
_log.info("Not tried: " + toTry);
}
if (_log.shouldLog(Log.INFO))
_log.info("Finished get Peers, " + rv.size() + " from local and none from DHT");
return rv;
}
@ -431,13 +486,16 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
/**
* Not recommended - use getPeersAndAnnounce().
*
* Announce to the closest peers in the local DHT.
* This is NOT iterative - call getPeers() first to get the closest
* peers into the local DHT.
* Blocking unless maxWait <= 0
* Caller should run in a thread.
* This also automatically announces ourself to our local tracker.
* For best results do a getPeers() first so we have tokens.
* For best results do a getPeersAndAnnounce() instead, as this announces to
* the closest in the kbuckets, it does NOT sort through the known nodes hashmap.
*
* @param ih the Info Hash (torrent)
* @param max maximum number of peers to announce to
@ -547,7 +605,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
_session.addMuxedSessionListener(this, I2PSession.PROTO_DATAGRAM, _qPort);
_knownNodes.start();
_tracker.start();
PersistDHT.loadDHT(this, _dhtFile);
PersistDHT.loadDHT(this, _dhtFile, _backupDhtFile);
// start the explore thread
_isRunning = true;
// no need to keep ref, it will eventually stop
@ -635,9 +693,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private ReplyWaiter sendPing(NodeInfo nInfo) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending ping to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("q", "ping");
Map<String, Object> args = new HashMap();
Map<String, Object> args = new HashMap<String, Object>();
map.put("a", args);
return sendQuery(nInfo, map, true);
}
@ -652,9 +710,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private ReplyWaiter sendFindNode(NodeInfo nInfo, NID tID) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending find node of " + tID + " to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("q", "find_node");
Map<String, Object> args = new HashMap();
Map<String, Object> args = new HashMap<String, Object>();
args.put("target", tID.getData());
map.put("a", args);
return sendQuery(nInfo, map, true);
@ -669,9 +727,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private ReplyWaiter sendGetPeers(NodeInfo nInfo, InfoHash ih) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending get peers of " + ih + " to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("q", "get_peers");
Map<String, Object> args = new HashMap();
Map<String, Object> args = new HashMap<String, Object>();
args.put("info_hash", ih.getData());
map.put("a", args);
ReplyWaiter rv = sendQuery(nInfo, map, true);
@ -690,12 +748,12 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private ReplyWaiter sendAnnouncePeer(NodeInfo nInfo, InfoHash ih, Token token) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending announce of " + ih + " to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
map.put("q", "announce_peer");
Map<String, Object> args = new HashMap();
Map<String, Object> args = new HashMap<String, Object>();
args.put("info_hash", ih.getData());
// port ignored
args.put("port", Integer.valueOf(6881));
args.put("port", Integer.valueOf(TrackerClient.PORT));
args.put("token", token.getData());
map.put("a", args);
// an announce need not be signed, we have a token
@ -713,8 +771,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private boolean sendPong(NodeInfo nInfo, MsgID msgID) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending pong to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> resps = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> resps = new HashMap<String, Object>();
map.put("r", resps);
return sendResponse(nInfo, msgID, map);
}
@ -732,8 +790,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private boolean sendNodes(NodeInfo nInfo, MsgID msgID, Token token, byte[] ids) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending nodes to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> resps = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> resps = new HashMap<String, Object>();
map.put("r", resps);
if (token != null)
resps.put("token", token.getData());
@ -745,8 +803,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private boolean sendPeers(NodeInfo nInfo, MsgID msgID, Token token, List<byte[]> peers) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending peers to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> resps = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> resps = new HashMap<String, Object>();
map.put("r", resps);
resps.put("token", token.getData());
resps.put("values", peers);
@ -762,8 +820,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
private boolean sendError(NodeInfo nInfo, MsgID msgID, int err, String msg) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending error " + msg + " to: " + nInfo);
Map<String, Object> map = new HashMap();
Map<String, Object> resps = new HashMap();
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> resps = new HashMap<String, Object>();
map.put("r", resps);
return sendResponse(nInfo, msgID, map);
}
@ -795,8 +853,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// Lookup the dest for the hash
// TODO spin off into thread or queue? We really don't want to block here
if (!lookupDest(nInfo)) {
if (_log.shouldLog(Log.WARN))
_log.warn("Dropping repliable query, no dest for " + nInfo);
if (_log.shouldLog(Log.INFO))
_log.info("Dropping repliable query, no dest for " + nInfo);
timeout(nInfo);
return null;
}
@ -886,7 +944,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
_log.info("looking up dest for " + nInfo);
try {
// use a short timeout for now
Destination dest = _session.lookupDest(nInfo.getHash(), 5*1000);
Destination dest = _session.lookupDest(nInfo.getHash(), DEST_LOOKUP_TIMEOUT);
if (dest != null) {
nInfo.setDestination(dest);
if (_log.shouldLog(Log.INFO))
@ -1185,6 +1243,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
_log.info("Stored new OB token: " + token + " for: " + nInfo);
List<Hash> peers = _tracker.getPeers(ih, MAX_WANT);
peers.remove(nInfo.getHash()); // him
if (peers.isEmpty()) {
// similar to find node, but with token
// get closest from DHT
@ -1197,11 +1256,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
sendNodes(nInfo, msgID, token, nodeArray);
} else {
List<byte[]> hashes = new ArrayList(peers.size());
Hash him = nInfo.getHash();
List<byte[]> hashes = new ArrayList<byte[]>(peers.size());
for (Hash peer : peers) {
if (!peer.equals(him))
hashes.add(peer.getData());
hashes.add(peer.getData());
}
sendPeers(nInfo, msgID, token, hashes);
}
@ -1285,7 +1342,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
*/
private List<NodeInfo> receiveNodes(NodeInfo nInfo, byte[] ids) throws InvalidBEncodingException {
int max = Math.min(K, ids.length / NodeInfo.LENGTH);
List<NodeInfo> rv = new ArrayList(max);
List<NodeInfo> rv = new ArrayList<NodeInfo>(max);
for (int off = 0; off < ids.length && rv.size() < max; off += NodeInfo.LENGTH) {
NodeInfo nInf = new NodeInfo(ids, off);
if (_blacklist.contains(nInf.getNID())) {
@ -1309,7 +1366,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
if (_log.shouldLog(Log.INFO))
_log.info("Rcvd peers from: " + nInfo);
int max = Math.min(MAX_WANT, peers.size());
List<Hash> rv = new ArrayList(max);
List<Hash> rv = new ArrayList<Hash>(max);
for (BEValue bev : peers) {
byte[] b = bev.getBytes();
//Hash h = new Hash(b);
@ -1319,7 +1376,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
break;
}
if (_log.shouldLog(Log.INFO))
_log.info("Rcvd peers from: " + nInfo + ": " + DataHelper.toString(rv));
_log.info("Rcvd " + peers.size() + " peers from: " + nInfo + ": " + DataHelper.toString(rv));
return rv;
}

View File

@ -23,13 +23,24 @@ abstract class PersistDHT {
private static final long MAX_AGE = 60*60*1000;
/**
* @param backupFile may be null
* @since 0.9.6
*/
public static synchronized void loadDHT(KRPC krpc, File file, File backupFile) {
if (file.exists())
loadDHT(krpc, file);
else if (backupFile != null)
loadDHT(krpc, backupFile);
}
public static synchronized void loadDHT(KRPC krpc, File file) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(PersistDHT.class);
int count = 0;
FileInputStream in = null;
BufferedReader br = null;
try {
in = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(in, "ISO-8859-1"));
br = new BufferedReader(new InputStreamReader(
new FileInputStream(file), "ISO-8859-1"));
String line = null;
while ( (line = br.readLine()) != null) {
if (line.startsWith("#"))
@ -50,7 +61,7 @@ abstract class PersistDHT {
if (log.shouldLog(Log.WARN) && file.exists())
log.warn("Error reading the DHT File", ioe);
} finally {
if (in != null) try { in.close(); } catch (IOException ioe) {}
if (br != null) try { br.close(); } catch (IOException ioe) {}
}
if (log.shouldLog(Log.INFO))
log.info("Loaded " + count + " nodes from " + file);

View File

@ -7,7 +7,6 @@ import java.util.Date;
import net.i2p.I2PAppContext;
import net.i2p.data.ByteArray;
import net.i2p.data.DataHelper;
/**
* Used for Both outgoing and incoming tokens

View File

@ -0,0 +1,602 @@
// ========================================================================
// Copyright 199-2004 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
package org.klomp.snark.web;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Enumeration;
import java.util.List;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.i2p.I2PAppContext;
import net.i2p.data.ByteArray;
import net.i2p.data.DataHelper;
import net.i2p.util.ByteCache;
import net.i2p.util.Log;
import net.i2p.util.SystemVersion;
/* ------------------------------------------------------------ */
/**
* Based on DefaultServlet from Jetty 6.1.26, heavily simplified
* and modified to remove all dependencies on Jetty libs.
*
* Supports HEAD and GET only, for resources from the .war and local files.
* Supports files and resource only.
* Supports MIME types with local overrides and additions.
* Supports Last-Modified.
* Supports single request ranges.
*
* Does not support directories or "welcome files".
* Does not support gzip.
* Does not support multiple request ranges.
* Does not cache.
*
* POST returns 405.
* Directories return 403.
* Jar resources are sent with a long cache directive.
*
* ------------------------------------------------------------
*
* The default servlet.
* This servlet, normally mapped to /, provides the handling for static
* content, OPTION and TRACE methods for the context.
* The following initParameters are supported, these can be set
* on the servlet itself:
* <PRE>
*
* resourceBase Set to replace the context resource base
* warBase Path allowed for resource in war
*
* </PRE>
*
*
* @author Greg Wilkins (gregw)
* @author Nigel Canonizado
*
* @since Jetty 7
*/
class BasicServlet extends HttpServlet
{
protected final I2PAppContext _context;
protected final Log _log;
protected File _resourceBase;
private String _warBase;
private final MimeTypes _mimeTypes;
/** same as PeerState.PARTSIZE */
private static final int BUFSIZE = 16*1024;
private ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
private static final int WAR_CACHE_CONTROL_SECS = 24*60*60;
private static final int FILE_CACHE_CONTROL_SECS = 24*60*60;
public BasicServlet() {
super();
_context = I2PAppContext.getGlobalContext();
_log = _context.logManager().getLog(getClass());
_mimeTypes = new MimeTypes();
}
/* ------------------------------------------------------------ */
public void init(ServletConfig cfg) throws ServletException {
super.init(cfg);
String rb=getInitParameter("resourceBase");
if (rb!=null)
{
File f = new File(rb);
setResourceBase(f);
}
String wb = getInitParameter("warBase");
if (wb != null)
setWarBase(wb);
}
/**
* Files are served from here
*/
protected void setResourceBase(File base) throws UnavailableException {
if (!base.isDirectory())
throw new UnavailableException("Resource base does not exist: " + base);
_resourceBase = base;
if (_log.shouldLog(Log.INFO))
_log.info("Resource base is " + _resourceBase);
}
/**
* Only paths starting with this in the path are served
*/
protected void setWarBase(String base) {
if (!base.startsWith("/"))
base = '/' + base;
if (!base.endsWith("/"))
base = base + '/';
_warBase = base;
if (_log.shouldLog(Log.INFO))
_log.info("War base is " + _warBase);
}
/** get Resource to serve.
* Map a path to a resource. The default implementation calls
* HttpContext.getResource but derived servlets may provide
* their own mapping.
* @param pathInContext The path to find a resource for.
* @return The resource to serve or null if not existing
*/
public File getResource(String pathInContext)
{
if (_resourceBase==null)
return null;
File r = null;
if (!pathInContext.contains("..") &&
!pathInContext.endsWith("/")) {
File f = new File(_resourceBase, pathInContext);
if (f.exists())
r = f;
}
return r;
}
/** get Resource to serve.
* Map a path to a resource. The default implementation calls
* HttpContext.getResource but derived servlets may provide
* their own mapping.
* @param pathInContext The path to find a resource for.
* @return The resource to serve or null. Returns null for directories
*/
public HttpContent getContent(String pathInContext)
{
if (_resourceBase==null)
return null;
HttpContent r = null;
if (_warBase != null && pathInContext.startsWith(_warBase)) {
r = new JarContent(pathInContext);
} else if (!pathInContext.contains("..") &&
!pathInContext.endsWith("/")) {
File f = new File(_resourceBase, pathInContext);
// exists && !directory
if (f.isFile())
r = new FileContent(f);
}
return r;
}
/* ------------------------------------------------------------ */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
// always starts with a '/'
String servletpath = request.getServletPath();
String pathInfo=request.getPathInfo();
// ??? right??
String pathInContext = addPaths(servletpath, pathInfo);
// Find the resource and content
try {
HttpContent content = getContent(pathInContext);
// Handle resource
if (content == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("Not found: " + pathInContext);
response.sendError(404);
} else {
if (passConditionalHeaders(request, response, content)) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending: " + content);
sendData(request, response, content);
} else {
if (_log.shouldLog(Log.INFO))
_log.info("Not modified: " + content);
}
}
}
catch(IllegalArgumentException e)
{
if (_log.shouldLog(Log.WARN))
_log.warn("Error sending " + pathInContext, e);
if(!response.isCommitted())
response.sendError(500, e.getMessage());
}
catch(IOException e)
{
if (_log.shouldLog(Log.WARN))
// typical browser abort
//_log.warn("Error sending", e);
_log.warn("Error sending " + pathInContext + ": " + e);
throw e;
}
}
/* ------------------------------------------------------------ */
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.sendError(405);
}
/* ------------------------------------------------------------ */
/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#doTrace(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void doTrace(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.sendError(405);
}
protected void doOptions(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.sendError(405);
}
protected void doDelete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.sendError(405);
}
/* ------------------------------------------------------------ */
/** Check modification date headers.
* @return true to keep going, false if handled here
*/
protected boolean passConditionalHeaders(HttpServletRequest request,HttpServletResponse response, HttpContent content)
throws IOException
{
try
{
if (!request.getMethod().equals("HEAD") ) {
long ifmsl=request.getDateHeader("If-Modified-Since");
if (ifmsl!=-1)
{
if (content.getLastModified()/1000 <= ifmsl/1000)
{
response.reset();
response.setStatus(304);
response.flushBuffer();
return false;
}
}
}
}
catch(IllegalArgumentException iae)
{
if(!response.isCommitted())
response.sendError(400, iae.getMessage());
throw iae;
}
return true;
}
/* ------------------------------------------------------------ */
protected void sendData(HttpServletRequest request,
HttpServletResponse response,
HttpContent content)
throws IOException
{
InputStream in =null;
try {
in = content.getInputStream();
} catch (IOException e) {
if (_log.shouldLog(Log.WARN))
_log.warn("Not found: " + content);
response.sendError(404);
return;
}
OutputStream out =null;
try {
out = response.getOutputStream();
} catch (IllegalStateException e) {
out = new WriterOutputStream(response.getWriter());
}
long content_length = content.getContentLength();
// see if there are any range headers
Enumeration<?> reqRanges = request.getHeaders("Range");
if (reqRanges == null || !reqRanges.hasMoreElements()) {
// if there were no ranges, send entire entity
// Write content normally
writeHeaders(response,content,content_length);
if (content_length >= 0 && request.getMethod().equals("HEAD")) {
// if we know the content length, don't send it to be counted
if (_log.shouldLog(Log.INFO))
_log.info("HEAD: " + content);
} else {
// GET or unknown size for HEAD
copy(in, out);
}
return;
}
// Parse the satisfiable ranges
List<InclusiveByteRange> ranges = InclusiveByteRange.satisfiableRanges(reqRanges, content_length);
// if there are no satisfiable ranges, send 416 response
// Completely punt on multiple ranges (unlike Default)
if (ranges == null || ranges.size() != 1) {
writeHeaders(response, content, content_length);
response.setStatus(416);
response.setHeader("Content-Range", InclusiveByteRange.to416HeaderRangeString(content_length));
return;
}
// if there is only a single valid range (must be satisfiable
// since were here now), send that range with a 216 response
InclusiveByteRange singleSatisfiableRange = ranges.get(0);
long singleLength = singleSatisfiableRange.getSize(content_length);
writeHeaders(response, content, singleLength);
response.setStatus(206);
response.setHeader("Content-Range", singleSatisfiableRange.toHeaderRangeString(content_length));
copy(in, singleSatisfiableRange.getFirst(content_length), out, singleLength);
}
/* ------------------------------------------------------------ */
protected void writeHeaders(HttpServletResponse response,HttpContent content,long count)
throws IOException
{
if (content.getContentType()!=null && response.getContentType()==null)
response.setContentType(content.getContentType());
long lml = content.getLastModified();
if (lml > 0)
response.setDateHeader("Last-Modified",lml);
if (count != -1)
{
if (count<Integer.MAX_VALUE)
response.setContentLength((int)count);
else
response.setHeader("Content-Length", Long.toString(count));
}
long ct = content.getCacheTime();
if (ct>=0)
response.setHeader("Cache-Control", "public, max-age=" + ct);
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* I2P additions below here */
/** from Jetty HttpContent.java */
public interface HttpContent
{
String getContentType();
long getLastModified();
/** in seconds */
int getCacheTime();
long getContentLength();
InputStream getInputStream() throws IOException;
}
private class FileContent implements HttpContent
{
private final File _file;
public FileContent(File file)
{
_file = file;
}
/* ------------------------------------------------------------ */
public String getContentType()
{
//return _mimeTypes.getMimeByExtension(_file.toString());
return getMimeType(_file.toString());
}
/* ------------------------------------------------------------ */
public long getLastModified()
{
return _file.lastModified();
}
public int getCacheTime()
{
return FILE_CACHE_CONTROL_SECS;
}
/* ------------------------------------------------------------ */
public long getContentLength()
{
return _file.length();
}
/* ------------------------------------------------------------ */
public InputStream getInputStream() throws IOException
{
return new BufferedInputStream(new FileInputStream(_file));
}
@Override
public String toString() { return "File \"" + _file + '"'; }
}
private class JarContent implements HttpContent
{
private final String _path;
public JarContent(String path)
{
_path = path;
}
/* ------------------------------------------------------------ */
public String getContentType()
{
return getMimeType(_path);
}
/* ------------------------------------------------------------ */
public long getLastModified()
{
String cpath = getServletContext().getContextPath();
// this won't work if we aren't at top level
String cname = "".equals(cpath) ? "i2psnark" : cpath.substring(1).replace("/", "_");
return (new File(_context.getBaseDir(), "webapps/" + cname + ".war")).lastModified();
}
public int getCacheTime()
{
return WAR_CACHE_CONTROL_SECS;
}
/* ------------------------------------------------------------ */
public long getContentLength()
{
return -1;
}
/* ------------------------------------------------------------ */
public InputStream getInputStream() throws IOException
{
InputStream rv = getServletContext().getResourceAsStream(_path);
if (rv == null)
throw new IOException("Not found");
return rv;
}
@Override
public String toString() { return "Jar resource \"" + _path + '"'; }
}
/**
* @param resourcePath in the classpath, without ".properties" extension
*/
protected void loadMimeMap(String resourcePath) {
_mimeTypes.loadMimeMap(resourcePath);
}
/* ------------------------------------------------------------ */
/** Get the MIME type by filename extension.
* @param filename A file name
* @return MIME type matching the longest dot extension of the
* file name.
*/
protected String getMimeType(String filename) {
String rv = _mimeTypes.getMimeByExtension(filename);
if (rv != null)
return rv;
return getServletContext().getMimeType(filename);
}
protected void addMimeMapping(String extension, String type) {
_mimeTypes.addMimeMapping(extension, type);
}
/**
* Simple version of URIUtil.addPaths()
* @param path may be null
*/
protected static String addPaths(String base, String path) {
if (path == null)
return base;
String rv = (new File(base, path)).toString();
if (SystemVersion.isWindows())
rv = rv.replace("\\", "/");
return rv;
}
/**
* Simple version of URIUtil.decodePath()
*/
protected static String decodePath(String path) throws MalformedURLException {
if (!path.contains("%"))
return path;
try {
URI uri = new URI(path);
return uri.getPath();
} catch (URISyntaxException use) {
// for ease of use, since a USE is not an IOE but a MUE is...
throw new MalformedURLException(use.getMessage());
}
}
/**
* Simple version of URIUtil.encodePath()
*/
protected static String encodePath(String path) throws MalformedURLException {
try {
URI uri = new URI(null, null, path, null);
return uri.toString();
} catch (URISyntaxException use) {
// for ease of use, since a USE is not an IOE but a MUE is...
throw new MalformedURLException(use.getMessage());
}
}
/**
* Write from in to out
*/
private void copy(InputStream in, OutputStream out) throws IOException {
copy(in, 0, out, -1);
}
/**
* Write from in to out
*/
private void copy(InputStream in, long skip, OutputStream out, final long len) throws IOException {
ByteArray ba = _cache.acquire();
byte[] buf = ba.getData();
try {
if (skip > 0)
DataHelper.skip(in, skip);
int read = 0;
long tot = 0;
boolean done = false;
while ( (read = in.read(buf)) != -1 && !done) {
if (len >= 0) {
tot += read;
if (tot >= len) {
read -= (int) (tot - len);
done = true;
}
}
out.write(buf, 0, read);
}
} finally {
_cache.release(ba, false);
if (in != null)
try { in.close(); } catch (IOException ioe) {}
if (out != null)
try { out.close(); } catch (IOException ioe) {}
}
}
}

View File

@ -13,11 +13,13 @@ import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PSocketEepGet;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.crypto.SHA1;
import net.i2p.data.DataHelper;
import net.i2p.util.EepGet;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.util.SecureFile;
import org.klomp.snark.I2PSnarkUtil;
import org.klomp.snark.MetaInfo;
import org.klomp.snark.Snark;
import org.klomp.snark.SnarkManager;
@ -95,7 +97,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
add(file);
} else {
_mgr.addMessage(_("Torrent was not retrieved from {0}", urlify(_url)) +
((_failCause != null) ? (": " + _failCause) : ""));
((_failCause != null) ? (": " + DataHelper.stripHTML(_failCause)) : ""));
}
if (file != null)
file.delete();
@ -130,6 +132,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
return null;
_eepGet = new I2PSocketEepGet(_ctx, manager, RETRIES, out.getAbsolutePath(), _url);
_eepGet.addStatusListener(this);
_eepGet.addHeader("User-Agent", I2PSnarkUtil.EEPGET_USER_AGENT);
if (_eepGet.fetch()) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Fetch successful [" + _url + "]: size=" + out.length());
@ -160,8 +163,8 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
return;
}
name = Storage.filterName(name);
name = name + ".torrent";
String originalName = Storage.filterName(name);
name = originalName + ".torrent";
File torrentFile = new File(_mgr.getDataDir(), name);
String canonical = torrentFile.getCanonicalPath();
@ -174,6 +177,8 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
} else {
// This may take a LONG time to create the storage.
_mgr.copyAndAddTorrent(file, canonical);
snark = _mgr.getTorrentByBaseName(originalName);
snark.startTorrent();
}
} catch (IOException ioe) {
_mgr.addMessage(_("Torrent at {0} was not valid", urlify(_url)) + ": " + ioe.getMessage());
@ -196,7 +201,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
//_total = -1;
_transferred = 0;
_failCause = null;
_started = _ctx.clock().now();
_started = _util.getContext().clock().now();
_isRunning = true;
_active = false;
_thread = new I2PAppThread(this, "Torrent File EepGet", true);

View File

@ -0,0 +1,218 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.klomp.snark.web;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.StringTokenizer;
/* ------------------------------------------------------------ */
/** Byte range inclusive of end points.
* <PRE>
*
* parses the following types of byte ranges:
*
* bytes=100-499
* bytes=-300
* bytes=100-
* bytes=1-2,2-3,6-,-2
*
* given an entity length, converts range to string
*
* bytes 100-499/500
*
* </PRE>
*
* Based on RFC2616 3.12, 14.16, 14.35.1, 14.35.2
* @version $version$
*
*/
public class InclusiveByteRange
{
long first = 0;
long last = 0;
public InclusiveByteRange(long first, long last)
{
this.first = first;
this.last = last;
}
public long getFirst()
{
return first;
}
public long getLast()
{
return last;
}
/* ------------------------------------------------------------ */
/**
* @param headers Enumeration of Range header fields.
* @param size Size of the resource.
* @return List of satisfiable ranges
*/
public static List<InclusiveByteRange> satisfiableRanges(Enumeration<?> headers, long size)
{
List<InclusiveByteRange> satRanges = null;
// walk through all Range headers
headers:
while (headers.hasMoreElements())
{
String header = (String) headers.nextElement();
StringTokenizer tok = new StringTokenizer(header,"=,",false);
String t=null;
try
{
// read all byte ranges for this header
while (tok.hasMoreTokens())
{
try
{
t = tok.nextToken().trim();
long first = -1;
long last = -1;
int d = t.indexOf('-');
if (d < 0 || t.indexOf("-",d + 1) >= 0)
{
if ("bytes".equals(t))
continue;
continue headers;
}
else if (d == 0)
{
if (d + 1 < t.length())
last = Long.parseLong(t.substring(d + 1).trim());
else
{
continue;
}
}
else if (d + 1 < t.length())
{
first = Long.parseLong(t.substring(0,d).trim());
last = Long.parseLong(t.substring(d + 1).trim());
}
else
first = Long.parseLong(t.substring(0,d).trim());
if (first == -1 && last == -1)
continue headers;
if (first != -1 && last != -1 && (first > last))
continue headers;
if (first < size)
{
if (satRanges == null)
satRanges = new ArrayList<InclusiveByteRange>(4);
InclusiveByteRange range = new InclusiveByteRange(first,last);
satRanges.add(range);
}
}
catch (NumberFormatException e)
{
continue;
}
}
}
catch(Exception e)
{
}
}
return satRanges;
}
/* ------------------------------------------------------------ */
public long getFirst(long size)
{
if (first<0)
{
long tf=size-last;
if (tf<0)
tf=0;
return tf;
}
return first;
}
/* ------------------------------------------------------------ */
public long getLast(long size)
{
if (first<0)
return size-1;
if (last<0 ||last>=size)
return size-1;
return last;
}
/* ------------------------------------------------------------ */
public long getSize(long size)
{
return getLast(size)-getFirst(size)+1;
}
/* ------------------------------------------------------------ */
public String toHeaderRangeString(long size)
{
StringBuilder sb = new StringBuilder(40);
sb.append("bytes ");
sb.append(getFirst(size));
sb.append('-');
sb.append(getLast(size));
sb.append("/");
sb.append(size);
return sb.toString();
}
/* ------------------------------------------------------------ */
public static String to416HeaderRangeString(long size)
{
StringBuilder sb = new StringBuilder(40);
sb.append("bytes */");
sb.append(size);
return sb.toString();
}
/* ------------------------------------------------------------ */
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(60);
sb.append(Long.toString(first));
sb.append(":");
sb.append(Long.toString(last));
return sb.toString();
}
}

View File

@ -0,0 +1,129 @@
// ========================================================================
// Copyright 2000-2005 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
package org.klomp.snark.web;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.concurrent.ConcurrentHashMap;
/* ------------------------------------------------------------ */
/**
* Based on MimeTypes from Jetty 6.1.26, heavily simplified
* and modified to remove all dependencies on Jetty libs.
*
* Supports mime types only, not encodings.
* Does not support a default "*" mapping.
*
* This is only for local mappings.
* Caller should use getServletContext().getMimeType() if this returns null.
*
*
* ------------------------------------------------------------
*
* @author Greg Wilkins
*
* @since Jetty 7
*/
class MimeTypes
{
private final Map<String, String> _mimeMap;
public MimeTypes() {
_mimeMap = new ConcurrentHashMap<String, String>();
}
/* ------------------------------------------------------------ */
/**
* @param resourcePath A Map of file extension to mime-type.
*/
public void loadMimeMap(String resourcePath) {
loadMimeMap(_mimeMap, resourcePath);
}
/**
* Tries both webapp and system class loader, since Jetty blocks
* its classes from the webapp class loader.
*/
private static void loadMimeMap(Map<String, String> map, String resourcePath) {
try
{
ResourceBundle mime;
try {
mime = ResourceBundle.getBundle(resourcePath);
} catch(MissingResourceException e) {
// Jetty 7 webapp classloader blocks jetty classes
// http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading
//System.out.println("No mime types loaded from " + resourcePath + ", trying system classloader");
mime = ResourceBundle.getBundle(resourcePath, Locale.getDefault(), ClassLoader.getSystemClassLoader());
}
Enumeration<String> i = mime.getKeys();
while(i.hasMoreElements())
{
String ext = i.nextElement();
String m = mime.getString(ext);
map.put(ext.toLowerCase(Locale.US), m);
}
//System.out.println("Loaded " + map.size() + " mime types from " + resourcePath);
} catch(MissingResourceException e) {
//System.out.println("No mime types loaded from " + resourcePath);
}
}
/* ------------------------------------------------------------ */
/** Get the MIME type by filename extension.
*
* Returns ONLY local mappings.
* Caller should use getServletContext().getMimeType() if this returns null.
*
* @param filename A file name
* @return MIME type matching the longest dot extension of the
* file name.
*/
public String getMimeByExtension(String filename)
{
String type=null;
if (filename!=null)
{
int i=-1;
while(type==null)
{
i=filename.indexOf(".",i+1);
if (i<0 || i>=filename.length())
break;
String ext=filename.substring(i+1).toLowerCase(Locale.US);
type = _mimeMap.get(ext);
}
}
return type;
}
/* ------------------------------------------------------------ */
/** Set a mime mapping
* @param extension
* @param type
*/
public void addMimeMapping(String extension, String type)
{
_mimeMap.put(extension.toLowerCase(Locale.US), type);
}
}

View File

@ -5,13 +5,18 @@ import java.io.File;
import net.i2p.I2PAppContext;
import net.i2p.util.FileUtil;
import org.mortbay.jetty.Server;
//import org.eclipse.jetty.server.Server;
/**
* @deprecated does not work
*/
public class RunStandalone {
/****
static {
System.setProperty("org.mortbay.http.Version.paranoid", "true");
System.setProperty("org.mortbay.xml.XmlParser.NotValidating", "true");
}
****/
private RunStandalone(String args[]) {}
@ -21,6 +26,8 @@ public class RunStandalone {
}
public void start() {
throw new RuntimeException("unsupported");
/****
File workDir = new File(I2PAppContext.getGlobalContext().getTempDir(), "jetty-work");
boolean workDirRemoved = FileUtil.rmdir(workDir, false);
if (!workDirRemoved)
@ -29,8 +36,6 @@ public class RunStandalone {
if (!workDirCreated)
System.err.println("ERROR: Unable to create Jetty temporary work directory");
throw new RuntimeException("unsupported");
/****
try {
_server = new Server("jetty-i2psnark.xml");
// just blow up NPE if we don't have a context

View File

@ -0,0 +1,19 @@
package org.klomp.snark.web;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
/**
* Treat a writer as an output stream. Quick 'n dirty, none
* of that "intarnasheeonaleyzayshun" stuff. So we can treat
* the jsp's PrintWriter as an OutputStream
*
* @since Jetty 7 copied from routerconsole
*/
class WriterOutputStream extends OutputStream {
private final Writer _writer;
public WriterOutputStream(Writer writer) { _writer = writer; }
public void write(int b) throws IOException { _writer.write(b); }
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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