Compare commits

...

1164 Commits

Author SHA1 Message Date
dfb8830802 0.9.23 2015-11-19 00:31:15 +00:00
9483e095d9 build.xml: Stop building SUD and SU2 update files in "ant release" (ticket #1709) 2015-11-19 00:30:22 +00:00
bbaa6f7f87 Tweaks after review 2015-11-16 19:32:00 +00:00
046ef07efd -29-rc 2015-11-15 19:12:53 +00:00
fc7939b404 Translation updates 2015-11-15 19:12:05 +00:00
dd6a3f14ec geoip updates based on Maxmind GeoLite Country database from 2015-11-03. 2015-11-15 19:07:08 +00:00
7a75e2e662 up version for interrupt() 2015-11-13 23:32:55 +00:00
e6644236ed Interrupt when cancelling events 2015-11-13 23:28:02 +00:00
zzz
8a1f02aa89 Console: Fix lifetime participating bandwidth display (ticket #1706)
Add locking to HopConfig counts
Split participatingMessageCount stat into two stats,
participatingMessageCountAvgPerTunnel for throttle (same as old participatingMessagecount)
and participatingMessageCount for console (straight total)
Fix calculation of stat for throttle by adjusting for new
stat coalesce time (50 not 20 seconds)
2015-11-13 21:18:21 +00:00
zzz
a028bba997 Console: Fix filtering and escaping on /configclients
Fix autostart setting on new client, was inverted
2015-11-12 20:39:58 +00:00
e93e76a362 Remove netdb.rows.io and its associated certs
The DNS record for the subdomain was removed about a month ago.
2015-11-11 16:36:32 +00:00
zzz
3fa2fb4c8d Timers: State fix 4th try (tickets #1694, #1705)
log tweaks
2015-11-11 13:38:24 +00:00
zzz
ffddf415c0 snark add .cue mime type 2015-11-11 13:23:04 +00:00
zzz
03a99adaab snark increase max pieces 2015-11-11 13:22:35 +00:00
zzz
48f294024c snark log tweak 2015-11-11 13:20:42 +00:00
123b4ca460 Fix locking on _nextExpire field 2015-11-09 17:48:19 +00:00
c944fcce96 log if we can't cancel the future 2015-11-09 17:44:54 +00:00
zzz
077c4a073f replaceAll -> replace 2015-11-07 12:47:31 +00:00
zzz
f5bf4ec8ea escape referer 2015-11-07 12:06:56 +00:00
c901010d96 Make parameters of NegativeLookupCache configurable 2015-11-07 02:56:59 +00:00
9f0f1f5ec8 Make more ISJ parameters configurable 2015-11-07 02:46:33 +00:00
7175b1cdb9 Make the search limit configurable 2015-11-07 02:22:17 +00:00
ca4642e0f0 Reduce the memory footprint of Rate objects by changing longs to ints and doubles to floats 2015-11-06 20:19:43 +00:00
6bb156a436 Do not expose ISJ lock 2015-11-06 19:01:44 +00:00
zzz
19090343ba add more links in README 2015-11-06 14:16:25 +00:00
zzz
b15138dd67 i2pwiki.i2p icon
license: creative commons
2015-11-06 01:42:43 +00:00
zzz
5f50f23fe1 Streaming: Split blacklist into one for EC and one for Ed 2015-11-05 21:37:21 +00:00
zzz
d5e2defb5f synch fix 2015-11-05 21:34:47 +00:00
zzz
c1d77dfe5c I2CP: Fix additional connections getting rejected during tunnel open (ticket #1650)
State change cleanups
State checking consolidation
2015-11-05 21:18:01 +00:00
zzz
eca234c187 i2ptunnel: Add longer tunnel options in advanced mode 2015-11-05 20:24:12 +00:00
zzz
1a6074a62b Add lenta.i2p icon, public domain 2015-11-05 17:09:52 +00:00
9baeedbc27 merge of '380c87670c1c931cf39e93d5600c4954c6e13d1e'
and '4fe47402bea065caae229256d58d87e60607602a'
2015-11-04 22:22:58 +00:00
3f91e448c0 Add serialization methods to StatManager, FrequencyStat and Frequency
for easier collection
2015-11-04 21:41:33 +00:00
zzz
3e25ff251b Console: Add new home page links as approved at meeting
exchanged.i2p icon license: WTFPL
i2pwiki.i2p and lenta.i2p: Awaiting icons that meet our requirements
2015-11-04 15:08:44 +00:00
zzz
f8830a759e Threads: More conversions to I2PAppThread 2015-11-04 15:01:56 +00:00
zzz
b15ea8ba2f Timers: Improve OutboundMessageRegistry locking
SimpleTimer2 cleanups
possible fix for ticket #1694
2015-11-04 14:57:07 +00:00
zzz
ef428d559e merge of '7db2f97711361f598cb14aa579cb008ac8438577'
and 'cb9b4af48ca3c515eeddd44aefc040857a109b05'
2015-11-04 14:50:17 +00:00
39d749ba16 Fixed generation of eepget target filenames for basic page URLs, URLs with query parameters, certain edge cases. 2015-11-02 17:27:04 +00:00
zzz
a3a092a454 Utils: Double IP lookup cache size (ticket #1700) 2015-11-01 19:31:22 +00:00
zzz
787921aa89 spelling 2015-11-01 17:29:20 +00:00
zzz
bbb6da2ac6 cleanups, javadoc 2015-11-01 16:47:59 +00:00
zzz
b7dc55e326 checklist update 2015-11-01 00:45:30 +00:00
zzz
805979b987 UPnP: Fix deadlock in callbacks (ticket #1699)
possibly more to do
2015-10-31 22:58:51 +00:00
zzz
c37cc7ad52 Convert remaining Threads to I2PThread or I2PAppThread 2015-10-31 19:13:57 +00:00
zzz
02c1417cc5 update ancient snark docs 2015-10-31 14:20:10 +00:00
zzz
627d0d29db Router: Fix cascading I2CP error (ticket #1692)
caused by not setting message ID.
only happens when serialized (external I2CP)
2015-10-30 16:53:45 +00:00
zzz
c595895877 i2psnark: More consistency and torrent links in messages 2015-10-21 13:22:32 +00:00
zzz
6efce31eed Increase timer thread priority 2015-10-21 13:11:35 +00:00
zzz
f713a19785 Disable TLS_DHE_DSS_WITH_AES_128_CBC_SHA 2015-10-17 20:13:03 +00:00
zzz
abc0f4c720 lint core, console, i2ptunnel, jetty 2015-10-17 17:38:57 +00:00
zzz
71bc55b470 lint core, i2psnark, jetty, susimail 2015-10-17 16:49:37 +00:00
zzz
5f175455c7 lint console,streaming 2015-10-17 15:47:49 +00:00
zzz
9bddba56a0 lint router 2015-10-17 14:38:02 +00:00
zzz
4e6ddfcea3 lint core 2015-10-17 14:01:08 +00:00
zzz
3411a7c884 Crypto: Consolidate duplicate unlimited strength crypto check code 2015-10-17 12:55:39 +00:00
zzz
70921a2b09 i2psnark: Don't balloon files on ARM (ticket #1684) 2015-10-16 22:17:09 +00:00
zzz
dd36176997 big fat Java 6 warning 2015-10-16 21:38:12 +00:00
zzz
fe26052189 add mime type for .mka 2015-10-16 20:54:12 +00:00
zzz
ba1488bcce i2psnark: Add "smart sort" option, set sort based on language (tickets #637, #1303) 2015-10-16 19:45:23 +00:00
zzz
39b218b216 i2psnark: Fix deadlock (ticket #1432) 2015-10-16 14:25:55 +00:00
zzz
b43417bf77 update jetty javadoc link 2015-10-15 18:59:37 +00:00
zzz
649a63db6f Update: Fix persistence of the available dev version
Java 7 check at startup with persisted versions
2015-10-14 19:18:10 +00:00
zzz
6aa8ed1280 Update: Require Java 7 to download dev builds 2015-10-14 18:22:35 +00:00
zzz
9224afb78d i2psnark: Don't show empty fields on details page 2015-10-13 21:38:19 +00:00
zzz
5e879b85a8 fix installer build 2015-10-13 19:49:18 +00:00
zzz
2c03b434e1 Startup: Delete our old RI from netDB when rekeying 2015-10-13 19:24:30 +00:00
zzz
55a6f44651 Crypto: Test for broken Gentoo ECDSA support
Add SystemVersion.isJava9()
2015-10-11 15:39:28 +00:00
zzz
971a2652e3 adjust date in warning 2015-10-10 19:53:34 +00:00
zzz
68aa8800b6 increase rekey probability 2015-10-10 15:45:54 +00:00
zzz
dd4d12f287 i2psnark: Increase max piece size to 16 MB, max files to 999,
close files faster based on file count (tickets #1626, #1671)
Remove dup synchs
2015-10-10 14:02:48 +00:00
zzz
7063609f05 JobQueue: Only adjust timing for negative clock shifts 2015-10-10 13:33:46 +00:00
zzz
b32c8d5fa4 NamingServices: Add support for lookups prefixed with "www." 2015-10-10 12:29:52 +00:00
zzz
419d6a8e18 SimpleTimer2: Additional fix for uncaught IllegalStateException
affecting streaming timers (ticket #1672)
Minor streaming cleanup
2015-10-08 13:42:31 +00:00
03f9df4ff0 JobQueue: Listen to clock shifts as well as clock changes (ticket #1014).
Restarter: Don't restart the JobQueue or PeerManager (ticket #1014)/undo previous commit.
More to do.
2015-10-04 15:17:26 +00:00
zzz
f4a6cf2002 Show 'none' if no part. tunnels on /tunnels 2015-10-03 14:06:12 +00:00
zzz
f93da93cf0 Router: Minor cleanup, remove some deprecated and small methods 2015-10-02 13:45:42 +00:00
zzz
b068f9a262 Router: Don't check config files for reload on Android 2015-10-02 13:43:54 +00:00
5fa059b4a8 Adding the new reseed server hosted by our friends at TorontoCrypto. Thanks. :) 2015-09-29 19:41:01 +00:00
2f92b27446 Ticket #1596 - part 2
Removing 193.150.121.66 as a reseed host from the source and its certificate.
2015-09-29 19:30:13 +00:00
zzz
5d345f65a3 SusiDNS: Hide table headers and buttons if there are no search results 2015-09-28 16:58:18 +00:00
zzz
ccc8c04782 i2psnark: Support adding plain base 32 hashes
convert plain hashes to upper case
2015-09-28 14:52:55 +00:00
zzz
58ccfed41d Addressbook:
- Use Patterns instead of replaceAll()
- Fix isValidDest() for EC/Ed dests
2015-09-28 14:50:53 +00:00
zzz
59b05d4214 Util: Speed up IP address validation by using Apache's implementation (ticket #1198) 2015-09-27 21:54:14 +00:00
f46a902256 Router: Fix soft restarts for 'massive' clock jumps (over +150s or -61s) and recover from standby/hibernate (ticket #1014).
I2P should now recover (better) from a system hibernate/standby and be able to reconnect to peers automatically.
2015-09-27 21:15:51 +00:00
zzz
39b810bd79 Tunnels: Use max of 2 not-failing peers in an exploratory tunnel,
use high cap for the rest; change outbound exploratory
default length from 2 + 0-1 to 3+0.
2015-09-27 16:01:22 +00:00
zzz
22417715e7 javadoc 2015-09-27 15:58:47 +00:00
zzz
d21777fbc1 log tweak 2015-09-27 15:57:53 +00:00
zzz
b22a6bc163 log tweak 2015-09-27 15:57:22 +00:00
zzz
1c3527e1a4 Console:
- Export SSL cert on creation
 - new /certs page to show local SSL certs
2015-09-27 15:56:03 +00:00
zzz
4d7ad6ef7f Console: show 'none' if no leases
log timing for /netdb (ticket #1532)
2015-09-27 15:53:37 +00:00
zzz
3ea8b477d8 Streaming: Move throttler from context timer to streaming timer 2015-09-27 15:14:18 +00:00
zzz
ea4dd12bff SimpleTimer2:
- Fix bug in forceReschedule() that caused subsequent uncaught IllegalStateException;
    forceReschedule() is only used by streaming timers
  - Log uncaught exceptions
  - Enforce 5 second minimum delay for periodic events
  - atomic count
  - de-wtf
2015-09-27 15:10:59 +00:00
a13552dd8d Fix news (ant poupdate), typos in bundle-* 2015-09-25 21:49:47 +00:00
89c14c2e9a javadoc 2015-09-25 20:21:03 +00:00
22b9876b68 Rename _() for translation to _t() for Java 9 compatibility (ticket #1456) 2015-09-25 19:55:36 +00:00
zzz
04690bed9f close before rename 2015-09-24 19:08:36 +00:00
zzz
0faa5ba2f4 i2psnark:
- Rename bad .torrent files instead of deleting them
  - Add mime type for .xz
2015-09-24 18:28:26 +00:00
zzz
04d653a8b9 comment out main() 2015-09-21 15:21:54 +00:00
zzz
3f213cf1db register I2CP with the PortMapper 2015-09-21 15:13:39 +00:00
zzz
53ae727935 synch fix 2015-09-21 14:54:08 +00:00
zzz
62acfc0cae use standard error message 2015-09-21 12:35:39 +00:00
5a2f22b00f history 2015-09-20 19:34:10 +00:00
7dd438b5f0 bump 2015-09-20 19:29:47 +00:00
6685b81834 /configreseed: Add 'Reset URL list' button for revert to default hosts (ticket #1554, thanks dzirtt@gmail.com) 2015-09-20 19:28:11 +00:00
c56f686d8c Fix typo. 2015-09-20 19:23:50 +00:00
zzz
b81cbedd5c format multiplies by 100, so complete is 1.0 2015-09-20 11:08:27 +00:00
zzz
02a0ef3526 include man pages in the update 2015-09-20 00:44:51 +00:00
zzz
cfc0664756 Don't try to fetch subscriptions, news, or plugin updates while in VM Comm system 2015-09-19 19:06:07 +00:00
zzz
2a3b55f3a4 i2psnark: Add check progress output 2015-09-19 17:54:07 +00:00
zzz
287f94ad19 i2psnark: Add recheck/start/stop buttons to details page (ticket #372)
remove dup CSS item
2015-09-19 17:05:09 +00:00
zzz
462c882f4e i2psnark: Improve directory listing efficiency (ticket #1079) 2015-09-18 22:54:32 +00:00
zzz
b8a909c4cc Fix eepget man page (ticket #1631)
retry default was changed to 0 a while ago
2015-09-18 20:43:54 +00:00
zzz
83791b2d10 i2psnark: Don't display "Tracker Error" if torrent is stopped (ticket #1654) 2015-09-18 20:15:06 +00:00
zzz
ff420278c5 only log once 2015-09-18 20:08:40 +00:00
zzz
1a385b6dca i2ptunnel:
- Pass Accept-Encoding header through HTTP client and server proxies,
   to allow end-to-end compression
 - Don't do transparent response compression if response
   Content-Encoding indicates it is already compressed
 - Minor encoding cleanups
EepGet:
 - Send Accept-Encoding: gzip even when proxied
 - Minor cleanups
2015-09-18 18:15:32 +00:00
zzz
64889b2bc2 Streaming: Move remaining timers from the context to streaming's SimpleTimer2;
these were the ones migrated from SimpleScheduler earlier
2015-09-18 14:36:49 +00:00
zzz
bfc6534b20 Don't delete torrent config file after error on initial startup (ticket #1658) 2015-09-17 21:20:21 +00:00
zzz
84abfa0190 Store magnet parameters across restart (ticket #1485) 2015-09-17 20:19:10 +00:00
zzz
d5a0d95c61 news appearance tweaks 2015-09-17 19:51:01 +00:00
zzz
1de840ce59 Profiles: Bias slightly away from floodfills 2015-09-16 21:07:46 +00:00
zzz
0f6176b7bf News: Add author to entry headers 2015-09-16 17:26:03 +00:00
zzz
3d533a406d News:
- Fix retrieval of entry links from feed
 - Linkify entry headers
2015-09-16 16:42:24 +00:00
zzz
37597b8c7d Build:
- Include geoip in update files for next release
 - Add created-by string to release torrents
i2psnark:
 - Store torrent added and completed times in config files, display on details page
 - Display dates on details page in local time zone
 - Add metainfo creation command line support for created-by string
2015-09-16 14:21:02 +00:00
zzz
addc9c5ca3 News: connect it all together (ticket #1425):
- Enable new NewsManager to load/store feed items on disk by UUID
 - News items are stored forever, not lost when they are removed from feed
 - News read in once at startup, not at every summary bar refresh
 - Convert old initialNews.xml and news.xml to NewsEntry format
 - Limit display to 2 news items in summary bar, /home and /console
 - New /news page to show all news
2015-09-15 13:33:29 +00:00
zzz
a2e38503fe News: New /news page and helper to show all news
WIP, not yet hooked in
2015-09-14 16:15:21 +00:00
zzz
7912d7650d News: new NewsManager to maintain current news entries.
WIP, not yet hooked in.
2015-09-14 14:49:20 +00:00
zzz
6f5739b9d8 News: Store/load individual news entries as XML in separate files by UUID.
WIP, not yet hooked in.
2015-09-14 11:06:35 +00:00
zzz
ed3e444d1e log tweak 2015-09-13 13:38:19 +00:00
zzz
ac1a28e988 print usage if no arg 2015-09-13 13:34:51 +00:00
zzz
7117438b04 RIP ugha 2015-09-13 13:34:10 +00:00
zzz
d5cbccf186 checklist update 2015-09-13 13:33:00 +00:00
zzz
fd606064d9 0.9.22 2015-09-12 13:55:30 +00:00
zzz
9d05424202 Router: Reduce rekey probability from 10% to 5% 2015-09-11 13:24:10 +00:00
157d494dee bump build to -8-rc 2015-09-11 00:54:45 +00:00
fa792a9d5e GeoIP db updates from 2015-09-02. 2015-09-11 00:54:03 +00:00
ab134261f0 Translation updates from Transifex 2015-09-11 00:53:13 +00:00
de2431e9ee Fix auto-start of new .torrents in the Snark folder 2015-09-07 18:18:16 +00:00
c4cbd7d5c4 (hopefully temporarily) disable netdb.rows.io as it's been down for nearly a month. 2015-09-06 08:01:28 +00:00
zzz
e978bb81a0 checked in correct file 2015-09-05 14:02:21 +00:00
zzz
2c6edf401f add extra to bumpBuild output after change 2015-09-04 21:15:48 +00:00
zzz
fe69d3b8f7 UPnP: Fix "content not allowed in trailing section" (tickets #481, #1653)
patch from 'kay" in #1653, dev agreement received
2015-09-04 21:05:38 +00:00
61edd01e3d Switch URL/certificate for backup's reseed server 2015-09-04 18:44:05 +00:00
zzz
483d7c43ee Router: Change thread name so it truncates better (ticket #1648) 2015-09-01 11:56:58 +00:00
zzz
7c703953be Data: Cache P256 and Ed255i9 key certificates
- Enable P256 caching
 - Create cached Ed25519 cert and enable
 - Fix cached P256 hashcode
2015-08-31 13:25:58 +00:00
zzz
f577a94012 i2psnark: Change default sig type to Ed25519 2015-08-31 13:19:29 +00:00
zzz
b10b8581cc Router:
- Change default RI sig type to Ed25519, with a 10% chance od
     rekeying from DSA at each restart
   - Don't initialize KeyManager before selecting sig type
   - Don't log KeyManager error when changing sig type
2015-08-29 14:20:13 +00:00
zzz
601376561b add Closeable/Flushable interfaces 2015-08-27 14:36:19 +00:00
zzz
5a11a28a35 i2psnark:
- Return partial piece to coordinator after reject
   - Fix tracking of downloaded portion of piece after reject
   - Send reject on receipt of bad request
   - Mark piece unrequested after receiving bad data, so it
     will be requested again, but not from the same peer
   - Fix NPE in Request constructor on error
   - Fix stuck before completion due to reject handling (ticket #1633)
2015-08-24 17:30:32 +00:00
fde0ae8349 sync debian/changelog with packaged version 2015-08-02 15:06:50 +00:00
b5944045fb sync apparmor rules with the 0.9.21 package 2015-08-02 15:04:08 +00:00
zzz
ecd0231cd0 Fix console SSL excluded ciphers (thx lazyg)
Fix typo in local address in I2PSSLSocketFactory
Another findbugs char encoding fix
Add keystore password option to SU3File command line
2015-08-02 12:58:00 +00:00
zzz
44b35f328b 0.9.21 2015-07-31 14:22:03 +00:00
zzz
f3bb20d750 minor updates after review 2015-07-30 20:41:45 +00:00
20cb284f9d update geoip, bump to -23-rc 2015-07-30 17:03:46 +00:00
b4993d42b3 updated i2prouter po files (deb related) 2015-07-30 07:11:45 +00:00
9b466f3261 refresh debian patch so my automated update builds will run again 2015-07-30 06:52:18 +00:00
zzz
0bf9cb3bf2 add news cert 2015-07-28 13:55:10 +00:00
zzz
9efe60d7a8 Fix processing of translated news 2015-07-27 18:10:01 +00:00
zzz
d848a19ab0 update translations, bump -20-rc 2015-07-26 14:22:33 +00:00
zzz
bfde521cf9 NetDB: Fix NPE (ticket #1619) 2015-07-25 13:37:45 +00:00
zzz
fea6b8aec3 i2psnark: Fix total_size in metadata message (ticket #1618) 2015-07-25 13:15:56 +00:00
1681598dec merge of '30be1cda5a1ad30d33bbd355f4d85785a889c9fb'
and '8ec6b122079156e35f7515afa5eb433a13ce41b0'
2015-07-23 01:31:39 +00:00
809a533573 Updated history 2015-07-23 01:22:12 +00:00
265e4b58a5 Throw DataFormatException if not enough bytes 2015-07-23 01:15:11 +00:00
93854e93b5 bump -18-rc 2015-07-22 23:36:19 +00:00
f6605d05d9 merge of '1ba9885122d9a9ec69c77342719d8464aae244be'
and 'c61353ade089ac0e1fa83fab661dc6893b51b95a'
2015-07-22 23:34:32 +00:00
c20772702a I2PSnark: Don't let tunnels start unless we're starting torrents (regression, #766) 2015-07-22 22:05:44 +00:00
ba5af15c6f Fix KeyCert bug 2015-07-21 01:19:37 +00:00
9af197e590 Add KeyCert test that fails 2015-07-21 01:19:23 +00:00
2f59a4b3e6 Fix test 2015-07-21 00:40:35 +00:00
63e934f8f2 Update English PO files 2015-07-17 01:36:45 +00:00
zzz
dd5f804150 Console: Add dates to news headings
Spacing for news headings in summary bar
2015-07-16 18:06:48 +00:00
35b0e99ff0 I2PSnark: Fix torrent-stopping (#766) 2015-07-14 14:33:41 +00:00
zzz
1ed1e4414b Findbugs all over #4
char encoding
2015-07-12 19:19:32 +00:00
zzz
d087fd674b Findbugs all over #3
char encoding, remove FileReader/FileWriter
Fix TunnelConfig bug
2015-07-12 16:34:24 +00:00
zzz
1f9bb046f5 Findbugs all over #2
Mostly char encoding
Use StringWriter rather than OSW->BAOS->String
2015-07-12 16:06:49 +00:00
zzz
914cc120ad Findbugs all over 2015-07-12 14:02:55 +00:00
631a0674ab bump 2015-07-08 21:26:13 +00:00
17d26976d5 lang fixups 2015-07-08 21:25:33 +00:00
dc9d60e261 I2PSnark:
- Fix NPE (#1615, h/t kytv)
- Fix start/stop status resumption on restart (#766, h/t backup)
2015-07-08 21:22:45 +00:00
zzz
2c191e7bf8 Tunnels: New Bloom filter size, increase bandwidth limit (ticket #1505) 2015-07-08 13:40:26 +00:00
zzz
817888c23c i2psnark: Tweak dest display in footer 2015-07-07 18:42:26 +00:00
zzz
1eaf376ee7 Crypto: Check for error return from sign() 2015-07-07 13:46:04 +00:00
zzz
6cb3d1d330 Updates: New news URL 2015-07-07 13:38:44 +00:00
zzz
2681c4b42f Streaming: New config to add to DSA-only list 2015-07-07 13:35:55 +00:00
zzz
05959d5199 SSU: Request outbound bandwidth on the way into the
sender queue, not on the way out, so that SSU requests
bandwidth allocations for each packet in parallel
and competes more effectively with NTCP for bandwidth.
Inbound stubbed-out only.
2015-07-05 12:30:01 +00:00
zzz
113a8a52f3 Transport: Raise bandwidth refiller thread priority
so I/O doesn't stall under high CPU load
- Raise DH generator thread priority to keep
  DH building out of event pumper thread
- Raise PRNG and YK generator thread priorites one notch
- Set I2PThread priority in constructor
Fixes problems mainly seen on Windows, which seems
to be much more sensitive to priority settings
2015-07-05 12:08:33 +00:00
zzz
98a4460bde fix test compile 2015-07-02 15:20:58 +00:00
3645c906e8 merge of 'a0b025f180c1f7befcc1eb504c24140cf9e3fc0f'
and 'e0773d79a9bc8820024206f39686541ddb393c4a'
2015-06-29 20:22:10 +00:00
zzz
fcdd8be7a7 Transport: More fixes for SSU stalling -
Don't skip further bandwidth allocations for SSU, since
it needs the entire allocation to proceed.
Log tweaks
More synchronization of requests
2015-06-29 16:02:07 +00:00
zzz
34f6f65104 UPnP main() test tweak 2015-06-29 15:59:45 +00:00
zzz
4c516cd2af log tweak 2015-06-29 15:58:41 +00:00
8ea6805f8d Prevent double-save for now and auto start all torrents if autostart is already set (don't make the user restart each one). 2015-06-28 19:43:57 +00:00
zzz
23f2261bd9 Apache Tomcat 6.0.44 2015-06-28 12:13:52 +00:00
zzz
dd47389ad1 Console: Use registered host/port for eepsite link (ticket #1604)
Jetty starter: Register host/port when started
PortMapper: Add hostname support
2015-06-25 17:00:52 +00:00
zzz
25268e7cb2 Transport: Add failsafe to prevent complete SSU stall waiting
for bandwidth limiter, root cause unknown
2015-06-24 19:11:05 +00:00
zzz
355b2a1528 I2CP: Don't try to decrypt an LS before it's encrypted (ticket #1608)
log tweaks
2015-06-23 21:16:34 +00:00
zzz
975149d049 Router: Increase default outbound bandwidth to 60 KBps;
raise class L/M boundary to match so defaulted routers are still L
2015-06-23 20:50:22 +00:00
zzz
af394e13ad GeoIP: Add countries and flags for Asia/Pacific, Bonaire, St. Barts,
St. Maarten, South Sudan
AP: black flag copied from A1
BL: official flag is France, copied from FR
BQ, SX, SS: PNG files generated from public domain SVG files from Wikipedia
Shortened some other country names (remove "Republic of", etc.)
Change spelling to Macau, Vietnam
2015-06-23 20:33:38 +00:00
zzz
e3f64f6edf Console: Fix NPE on /configtunnels 2015-06-23 20:26:02 +00:00
2fbbfa388e NetDB: Partially revert last NetDB change: flood because we don't want to create a hole in the DHT before publisher resends to somebody else. 2015-06-22 20:11:29 +00:00
zzz
0b4d4ddcbc update hardcoded tags 2015-06-21 15:42:30 +00:00
zzz
428d89a307 Update: Add config to disable translated news
Rewrite addLang() for efficiency
2015-06-21 15:41:33 +00:00
feff6c003b bump 2015-06-20 10:30:14 +00:00
699d550992 NetDB: Don't say we stored, and don't flood, if we're shutting down 2015-06-20 10:06:54 +00:00
c6896c4418 I2PSnark: Auto-start now only starts torrents which were running at shutdown (#766) 2015-06-20 10:03:47 +00:00
zzz
1b2d4c75eb I2CP: Fix simple session lookups, broken in prop 2015-06-19 15:55:07 +00:00
zzz
586defc802 Tunnels: Increase default max tunnels 2015-06-19 14:57:59 +00:00
zzz
2499aad51d I2PSocketEepGet: Do hostname lookups in-session for efficiency 2015-06-19 14:55:49 +00:00
zzz
addb142ecd I2CP: Move client-side implementation classes to
new package net.i2p.client.impl, leaving only the
factories and interfaces in net.i2p.client
2015-06-18 21:20:00 +00:00
zzz
20c796e87a Update: Add language param to news fetch, to support translated news (ticket #1425) 2015-06-18 15:05:48 +00:00
zzz
cd62d7170c I2CP: Don't send the first LS request to the client until we have
at least one OB tunnel, so the client waits until we are ready.
This will reduce drops, retransmissions, and failures on new client tunnels.
Fixes to prevent multiple pending LS requests.
2015-06-18 15:02:21 +00:00
acc647822f sync debian changelog in mtn 2015-06-18 10:34:54 +00:00
zzz
1cf544f1d4 fix unit test compile 2015-06-18 00:41:58 +00:00
zzz
0f4e09500c javadocs 2015-06-17 23:46:11 +00:00
zzz
7c5dfaee20 I2CP: More fixes after prop, w.r.t. restore after close-on-idle
- When socket is closed, set sessionID and LS to null,
    close subsession and set its sessionID and LS to null
  - Checks on client side for null session ID
  - Check for null session in Destroy Session message
  - Don't kill I2CP connection due to a bad session ID
    in a SendMessage, just drop the message and send
    a MessageStatusMessage
  - Log tweaks
2015-06-17 23:44:12 +00:00
zzz
8d9cced128 history for prop, -6 2015-06-17 16:17:46 +00:00
zzz
8096e4f65d propagate from branch 'i2p.i2p.zzz.multisess' (head 655a0c2bbd50625c804b8de8c809b40ed63f53f4)
to branch 'i2p.i2p' (head b977ab50209475c0e74825f361924e05dbd470c7)
2015-06-17 16:00:53 +00:00
zzz
036b77746b Catch uncaught exceptions in ClientConnectionRunner and stop connection
Catch null SessionId in messages and stop connection instead of NPE
Wait for LS in SubSession in connect() so we don't send data w/o
a session ID and leaseset
Log tweaks
2015-06-17 02:16:06 +00:00
zzz
bc85543ef2 Fix removal of subsession aliases from tunnel manager on
I2CP connection shutdown
Sort tweaks for shared clients in summary bar
2015-06-15 14:35:15 +00:00
627f7076b0 debian: Add support for setting open file limits to initscript, add comment to explain how to do it with systemd 2015-06-14 20:16:16 +00:00
863e120204 Hard-depend on gmp >> 5. 2015-06-14 20:12:00 +00:00
53cfba4cbd merge of 'cb89dec5190f295ba301666166448929f1b7f3c1'
and 'f13d8499995c44dc76ae61d4b5c4c936e307eb89'
2015-06-14 20:07:43 +00:00
3a774b7c37 Rename i2p.mooo.com2.crt to i2p.mooo.com.crt, certificate has been switched out on the server 2015-06-14 20:07:35 +00:00
zzz
0ad34a4b00 Timestamper: Reduce NTP timeouts to shorten startup time
when NTP is blocked
2015-06-13 16:25:58 +00:00
zzz
2b9ffc1270 javadoc fixes after review 2015-06-13 15:14:21 +00:00
zzz
93c7860d2b NetDB: Improve routing of DatabaseStoreMessage acks
Send our own RI unsolicited in reply if we aren't floodfill
  Don't ack or flood a store of an unknown type
PeerTestJob: Don't generate zero reply token
Tunnels: More checks of messages received down exploratory tunnels
javadocs and comments
2015-06-13 15:13:35 +00:00
25f6c3d9e1 apparmor: tweaks to TMPDIR rules 2015-06-13 15:05:28 +00:00
zzz
b9e07bc9aa i2psnark: Fix NPE (ticket #1602) 2015-06-13 14:20:08 +00:00
zzz
09f68e44ca enable ECDSA by default for shared clients 2015-06-10 23:24:38 +00:00
zzz
013b5fd85b more @since updates 2015-06-10 19:24:20 +00:00
zzz
8962bfb6bc more @since updates 2015-06-10 19:23:26 +00:00
zzz
605602e001 @since updates 2015-06-10 19:15:01 +00:00
zzz
f341e5566b Pass session in connect();
Store the session in Connection;
Don't create a new ConnectionManager for a subsession,
now that all components track the session properly.
@since updates
2015-06-10 19:14:33 +00:00
zzz
7b84676f4a remove session ref from PacketQueue 2015-06-10 12:37:19 +00:00
dev
c666f8a4f9 Javadoc fixes. 2015-06-09 14:30:42 +00:00
dev
e067761947 Added a new flavour of checkAvailable() to UpdateManager interface. 2015-06-09 03:57:44 +00:00
dev
226bee64ef Added more variants of isUpdateInProgress to UpdateManager. 2015-06-09 03:44:34 +00:00
dev
1a40e57413 Added isUpdateInProgress() to UpdaterManager interface. 2015-06-09 03:32:33 +00:00
dev
f73101b014 Added checkAvailable(), update() and getStatus() to UpdateManager interface. 2015-06-09 01:09:23 +00:00
zzz
fef65c996f Store the session in Packet, so we may more easily and efficiently
handle multisession, especially on the incoming side.
More refactoring to follow
2015-06-08 22:18:14 +00:00
zzz
cbc2f899a6 fixup after prop 2015-06-08 22:14:49 +00:00
zzz
099515adff propagate from branch 'i2p.i2p' (head 1de143fff53bb56e6eac926d6293d62200f0c392)
to branch 'i2p.i2p.zzz.multisess' (head 70fc07857232668b93ca6ba02c433dffc7639132)
2015-06-08 21:50:42 +00:00
ff2ea9ac3e Irc{Outbound,Inbound}Filter:
- Silence 'no streams' warning when we can't connect to an IRC server. Change to WARN.
2015-06-08 19:35:18 +00:00
97aeecd865 FloodfillMonitorJob, FloodfillRouterInfoFloodJob:
- Directly connect to nearby floodfills to share our RI to speed up integration of new floodfills (#1195).
- Called on both non-ff -> ff OR ff -> non-ff.
- Create FloodfillRouterInfoFloodJob to do so.
2015-06-08 19:24:28 +00:00
8098d705f9 Make netDb.storeFloodNew graphable for testing (#1195) 2015-06-08 16:39:41 +00:00
fa8c390267 Language fixups. 2015-06-08 16:14:08 +00:00
zzz
e8f4e19bac NetDB: Fix early NPE 2015-06-07 16:29:41 +00:00
zzz
9041a2c69f SSU: Possible fix for NPE in establisher 2015-06-07 14:13:58 +00:00
zzz
384e9118c6 Logs: Correct wrapper.config location when running as a Linux service 2015-06-07 12:44:29 +00:00
0936a2ee23 disable 193.150.121.66 (ticket #1596) 2015-06-06 21:36:24 +00:00
bc6b0c12ac update debian changelog to reflect the latest release 2015-06-06 21:33:51 +00:00
f6f051cfa4 remove unneeded user-tmp abstraction; tighten tmpdir perms 2015-06-06 21:31:38 +00:00
zzz
fb131a040c fix snark sort by rate of stopped torrents 2015-06-06 20:54:13 +00:00
zzz
9f2ded6073 cleanup 2015-06-06 20:53:33 +00:00
zzz
55e36ee458 Console: Add indication of current ff status on /configadvanced,
change immediately when config changes, force republish
Router: RI rebuild locking
2015-06-06 16:01:39 +00:00
7c13fb2ba0 Android's SimpleDateFormat doesn't support XXX at any API 2015-06-06 09:24:46 +00:00
663ccb72d7 Bump router version 2015-06-05 01:53:52 +00:00
78e0a37fc9 Define I2PTunnelClientBase stats in one place 2015-06-04 22:36:45 +00:00
09cdc00939 i2ptunnel: Don't call startup() in chained constructor (ticket #1593) 2015-06-04 22:34:13 +00:00
2590e7d4ff i2ptunnel: Don't connect manager to router in constructor (ticket #815) 2015-06-04 22:25:44 +00:00
zzz
27f56776ca Console: Fix display of n/a for events that never happened on floodfill profiles 2015-06-03 20:45:15 +00:00
zzz
657f13af29 Remove ConnectionManager ref from PacketQueue 2015-06-03 17:25:25 +00:00
zzz
e2ca74963f Console: Click on version or country in /netdb table to get list of those routers 2015-06-03 16:55:01 +00:00
zzz
9304cb2bbc SAM message quoting fix 2015-06-03 12:33:42 +00:00
zzz
362086994a history for props, -1 2015-06-03 12:03:07 +00:00
zzz
f57e37d588 comment fix 2015-06-03 12:02:25 +00:00
zzz
d96ddd1a0e propagate from branch 'i2p.i2p.zzz.sam' (head 68de14d0053dea374413f9e0419b1c0f7e9ec3af)
to branch 'i2p.i2p' (head 54f5dd288f7c0c5a50f7f63f911aec4008be27e2)
2015-06-03 11:42:54 +00:00
zzz
7b711ebba0 propagate from branch 'i2p.i2p.zzz.test2' (head 47586aa88408845c51ee4c5fce40c617bdb8e398)
to branch 'i2p.i2p' (head bacb6048bc596f064ff237dd8569014a421b4ef6)
2015-06-03 11:40:28 +00:00
zzz
0762715264 i2psnark: Don't lose sort param when hiding peers 2015-06-02 21:04:12 +00:00
zzz
8a69dc0a97 only log reseed network disconnected warning once 2015-06-02 20:44:10 +00:00
zzz
39dc60cf8a only log UPnP network disconnected error once 2015-06-02 20:19:46 +00:00
zzz
09e867b194 i2psnark: Don't say 'download finished' unless we downloaded something
atomics
2015-06-02 20:14:33 +00:00
zzz
dc9256f274 Console: Prevent bad line-wrap of very long menu items 2015-06-02 16:41:04 +00:00
zzz
272f63dbbd Console: Nicer "move" icons on /configsidebar, add tooltips
Icons from silk, rotated, same license as before
2015-06-02 16:30:35 +00:00
zzz
06104118d0 EepGet: Recognize 418/420 responses 2015-06-02 15:44:17 +00:00
zzz
525ec01c1e Console: Don't allow unbanning of all-zero hash 2015-06-02 15:41:42 +00:00
zzz
f8594c316f DataHelper: make formatDuration() days to years be monotonic 2015-06-02 15:36:19 +00:00
zzz
3c89bd4e19 0.9.20 2015-06-02 12:00:59 +00:00
zzz
1f8408f417 Stats: Reduce number of rates in required stats to save memory 2015-05-31 14:03:39 +00:00
zzz
915b35f0c1 LogWriter: Write dup message to wrapper log and crit buf also 2015-05-31 13:22:36 +00:00
zzz
4521156ecb Fortuna: Catch AIOOBE (ticket #1576) 2015-05-31 12:43:06 +00:00
zzz
c58fd8f84e i2ptunnel: Fix +/- variance config (ticket #1587) 2015-05-30 15:46:37 +00:00
zzz
f02b401b7a SSU: More synchronization in PeerState 2015-05-30 14:25:40 +00:00
zzz
4fdcb6ce29 I2CP: Prevent sending lookup or bw limit messages before handshake with router is complete 2015-05-30 14:13:13 +00:00
zzz
94824e4d2b I2CP: Prevent sending data message before handshake with router is complete 2015-05-30 14:02:38 +00:00
zzz
280fc05c91 susidns, addressbook: Don't attempt to fetch subscriptions if
HTTP proxy is down (ticket #1530)
2015-05-30 13:53:56 +00:00
zzz
89745f5002 HTTP Client: Greatly simplify decompression by using
InflaterOutputStream, available since Java 6.
Removes PipedInputStream, PipedOutputStream.
Removes Pusher threads.
Remove delay workaround for truncated pages, no longer required.
2015-05-30 13:19:29 +00:00
zzz
7715e6484c Router: Add gzip caches to clearCaches() 2015-05-30 11:18:04 +00:00
zzz
c807194e93 propagate from branch 'i2p.i2p' (head 07028378508ab46278d193039b97c543d12ee22e)
to branch 'i2p.i2p.zzz.test2' (head 0074b91cb9fe0ed875457dc0bf1989df03fa9e9a)
2015-05-30 11:16:00 +00:00
zzz
3602f73497 HTTP client: Fix occasional truncation of compressed responses
log tweaks
2015-05-29 17:37:58 +00:00
zzz
4bf115b5f6 javadoc 2015-05-27 21:07:56 +00:00
zzz
7ab85a0a20 Graphs: prevent NaNs if we are skewed ahead of system time 2015-05-27 21:05:44 +00:00
zzz
fba0372339 Banlist: Ban all-zero hash
NetDb: Drop all-zero lookups and stores, add stats
SSU:
 - Fix debug logging of dumped packets
 - Drop sessions with bad clock skew, banlist peer, add stats
 - Drop sessions with corrupt DSM, banlist peer, add stats
Log tweaks
2015-05-27 21:00:46 +00:00
zzz
03dfa6515b SSU: send destroy message in a couple cases where we previously just called dropPeer() 2015-05-27 20:54:22 +00:00
zzz
5e33ed1169 log tweaks 2015-05-27 20:52:00 +00:00
zzz
11ab7fc56c add comment 2015-05-27 20:51:01 +00:00
zzz
716bff41d7 remove cast 2015-05-27 20:50:29 +00:00
zzz
1d8842cfc8 Gunzip: Add tests to main() 2015-05-27 20:49:51 +00:00
zzz
042b03d6b8 DataHelper: Add year output to formatDuration() 2015-05-27 20:48:51 +00:00
ab753651b9 Add new reseed server
Thanks parg!
2015-05-26 20:55:44 +00:00
zzz
4ea99b8a10 I2CP: Take 2 of fix, so a newly created session
isn't destroyed and immediately replaced by i2ptunnel,
which caused dup shared clients in a race at startup;
Clarify session exception text if not open
2015-05-24 00:14:32 +00:00
zzz
3d07e1a10b I2CP: Revert part of prior checkin, prevented idle tunnel from opening;
(treat INIT as CLOSED) better fix to follow
2015-05-23 20:02:46 +00:00
zzz
86525e7239 i2ptunnel: Strip top-level supercookies too 2015-05-23 17:13:15 +00:00
zzz
195171f9ed I2CP: Add an INIT state for session, so a newly created session
isn't treated as CLOSED and immediately replaced by i2ptunnel,
which caused dup shared clients in a race at startup
(possible related tickets #642, #650, #815, #1545)
2015-05-23 16:07:49 +00:00
33c4be5b2f Updates to geoip.txt and geoipv6.dat.gz based on Maxmind GeoLite Country database from 2015-05-06. 2015-05-21 17:32:35 +00:00
fea2c3c6b2 Install the apparmor profiles in complain mode
Instead of enabling exceptions when needed for custom set-ups, some users will
opt for disabling all security functions.
2015-05-21 17:27:29 +00:00
281686ba58 clarify comment 2015-05-21 17:24:32 +00:00
0b91fcb636 sync Translations with Transifex 2015-05-21 17:11:50 +00:00
807f1381fb sync debian/changelog 2015-05-21 16:54:35 +00:00
ac56a63809 remove /dev/(u)?random since these are included in the base abstraction 2015-05-21 16:52:09 +00:00
e4798b9ed8 allow user scripts installed to cgi-bin to be executed 2015-05-21 16:46:19 +00:00
7584346c82 fix indentation of i2p abstraction 2015-05-21 16:44:00 +00:00
zzz
29330aa5d3 i2psnark: Another place to send reject; switch to LBQ 2015-05-19 23:21:18 +00:00
zzz
65ff2c0afe i2psnark: Log tweaks and cleanups after testing 2015-05-19 21:56:21 +00:00
zzz
de4d47de95 i2psnark: Add support for fast extensions (BEP 6)
untested
2015-05-19 18:13:32 +00:00
zzz
ae41a3f316 SSU:
Synchronize UDPPacket methods, possible fix for bad
packets and UDP stalls caused by cache corruption?
Cleanup unused methods and fields
2015-05-19 14:49:02 +00:00
zzz
2dc3d68418 propagate from branch 'i2p.i2p' (head d046bffcd4f94b253e1aa2bfc9a90482974363dd)
to branch 'i2p.i2p.zzz.test2' (head d00c6fd9c9aef6c37218a791a12f2da957181cd2)
2015-05-18 11:09:26 +00:00
zzz
5eb43b6ae4 Translate: Clear ResourceBundle cache too,
available since Java 6 / Android API 9
2015-05-18 11:08:40 +00:00
zzz
0c672ecc49 Update: Fix NPE in initialization 2015-05-16 13:10:07 +00:00
3b6d98fe38 Translate "Dest" instead of "Dest:", tabbing (thx zzz) 2015-05-15 22:36:49 +00:00
b3472cfe80 Show the I2PSnark dest on the main page (#1436) 2015-05-15 20:51:45 +00:00
38f2b93c7a typo 2015-05-15 20:30:59 +00:00
zzz
e7af87a981 Update: Ignore su3 dev build version at startup if older 2015-05-15 19:15:51 +00:00
zzz
d698a67660 Deprecate Router.setConfigSetting() and removeConfigSetting() 2015-05-15 15:50:16 +00:00
zzz
b38f2d62a8 bump -23 2015-05-15 14:58:54 +00:00
zzz
10556bca75 merge of '174649506cd8a9665ad798c090e39481af967011'
and '67eb724b7638284d33f1b4997183cc9f197d2883'
2015-05-15 14:17:41 +00:00
zzz
1f17d2a149 add cacapo plugin cert 2015-05-15 14:17:08 +00:00
dc777c8de5 fix on non-full stats routers (thx zzz)
doh
2015-05-15 13:42:16 +00:00
zzz
1fb9643916 i2psnark: Fix deletion of single-file torrent outside snark dir (ticket #1544) 2015-05-13 14:00:19 +00:00
zzz
081f1865a8 Console: Fix URLs caught in XSS filter on /confighome (ticket #1569)
Fix name and URL escaping
Truncate long URLs in display
2015-05-13 12:04:28 +00:00
zzz
0e17c560b3 NTCP: Catch race in Reader (ticket #1534) 2015-05-13 10:52:26 +00:00
zzz
a3b1327934 javadoc fixes 2015-05-13 10:48:48 +00:00
zzz
e68ca573f0 remove status message 2015-05-13 10:41:49 +00:00
zzz
b5455cee6e SAM: Set keepalive on sockets (ticket #1573)
Also on both sides of I2CP.
BOB already does it.
2015-05-12 20:13:17 +00:00
cbdc1403bf remove old check
bump
2015-05-12 19:53:19 +00:00
zzz
40130a8a61 SAM:
- Close sockets and stop tunnels when router-side SAM stops (ticket #1572)
- Better checks for quoting status message strings (ticket #1488)
- Set encoding for sam.keys file
- Don't throw NPE on rare stream errors
- Comment out unused dumpProperties()
- Cleanups, log tweaks, thread name tweaks
2015-05-12 19:07:42 +00:00
ca14055976 fix build 2015-05-12 19:02:00 +00:00
8303016b48 - Job Queue/stats: add stat/graph for amount of scheduled jobs (router.tunnelBacklog)
- FloodfillMonitorJob:
  - Use avg of router.tunnelBacklog instead of current backlog
- Some language/spelling fixes
2015-05-12 18:46:40 +00:00
287862887d runplain.sh improvements 2015-05-11 01:12:13 +00:00
zzz
f25d2a3d3f Util: Fix corruption of cached ReusableGZIPInputStreams,
caused by calling close() from HTTPResponseOutputStream.Pusher,
but close() rendered the underlying InflaterInputStream unusable.
Broken in -15. Caused failed HTTP fetches and other flakiness.
2015-05-11 00:08:26 +00:00
zzz
7f30f481b2 i2ptunnel: Improve error handling for UDP tunnels,
Sink.send() may now throw RuntimeException,
converted from IOException or I2PSessionException;
interrupt runner threads on error;
ignore I2PSessionException in Pinger.close();
logging and javadoc improvements;
untested
2015-05-09 22:22:13 +00:00
zzz
5ee6826241 Plugins: Add support for custom icons (ticket #1550) 2015-05-09 15:28:43 +00:00
zzz
68951c4c6b remove http in linkify() 2015-05-09 13:19:46 +00:00
zzz
5dc7497802 Reseed: Don't reseed while shutting down (ticket #1565) 2015-05-08 12:27:40 +00:00
zzz
31cfddc218 Router: Clear I2CP lookup cache on exit 2015-05-07 16:46:15 +00:00
zzz
c1e70ac7d2 SAM: Close datagram or raw session when underlying
I2P session closes (ticket #1563)
2015-05-07 16:04:08 +00:00
zzz
dd9abd3f09 set installed dev version 2015-05-07 14:18:47 +00:00
zzz
2f5e64e532 Update: Add support for su3-signed development builds (ticket #1381)
Full version is used as the su3 version.
Uses same su3 certs as release updates. Users may add additional certs
to ~/.i2p/certificates/router/ as necessary.
Copy echelon's reseed key for use as a router signer.
Unsigned update remains a separate option for now.
Various update subsystem cleanups.
2015-05-07 13:04:43 +00:00
zzz
b12f988390 javadoc fixes 2015-05-07 13:03:17 +00:00
9f3d5bf57b use the full version string (including build number) in the signed-* build targets 2015-05-06 23:24:08 +00:00
zzz
7f9e958e5a Datagram: Convert IOE to DFE and throw on datagram load error
rather than failing silently
2015-05-06 20:05:30 +00:00
zzz
c4877ea092 Crypto: Comment out Cryptix debug logging 2015-05-06 01:53:50 +00:00
zzz
2aafc23774 PrintWriter doesn't throw exceptions, so call checkError() 2015-05-06 01:51:57 +00:00
zzz
77c9a644ac Naming services: Export address books with Windows line endings on Windows (ticket #1557) 2015-05-06 01:48:47 +00:00
zzz
abd8ca34dc Transport: Add config to force IPv4 (only) to firewalled (ticket #1541)
since we cannot reliably detect DS-lite (ticket #1458)
Hide transport status on /peers unless routerconsole.advanced
2015-05-06 01:45:33 +00:00
dev
31435685bf Added disclaimer about not being a part of the public API. 2015-05-05 22:16:51 +00:00
zzz
7337fd0670 i2ptunnel: Add Connection: close headers to errors and proxy.i2p responses
where it was missing (ticket #1531)
2015-05-04 16:36:49 +00:00
zzz
f7b7a98b9d i2ptunnel: Close input stream when HTTP client decompressor terminates (ticket #1506)
streaming: Minor cleanups, log tweaks
2015-05-04 14:43:54 +00:00
2226936737 i2prouter 'console' bugfix: Don't report failure for INT signal 2015-05-04 14:10:25 +00:00
8b293b2190 symlink instead of copying
I created this patch a couple of years ago and at that time symlinking (for
reasons I don't remember anymore) didn't work. Now it works with symlinks, so
let's go with that. (Tested in OpenBSD 5.7)
2015-05-04 13:47:32 +00:00
zzz
94bba8d11f I2CP: Fix external I2CP SendMessageExpires, broken in previous cleanup 2015-05-04 12:36:03 +00:00
5c2b5075f9 support OpenBSD in i2prouter
We don't include a wrapper for OpenBSD and Tanuki doesn't offer OpenBSD
binaries either. It is available as an OpenBSD package. Therefore, if the
wrapper is not found (likely), advise the user to install it. The next time
`i2prouter start` is run, the wrapper will be copied to the I2P install
directory and it should "just work".
2015-05-04 09:22:25 +00:00
ca6820a4c0 refresh debian patch 2015-05-04 00:26:26 +00:00
zzz
2fafa3337f Console: Add floodfill configuration form to /configadvanced 2015-05-03 18:49:34 +00:00
zzz
b5f75a4bb9 Router: Allow class M to become floodfill;
add bandwidth classes P and X (ticket #1447)
2015-05-03 17:35:09 +00:00
zzz
707bfbbf8b Router: Put the GarlicMessageParser in the RouterContext
to reduce object churn, we only need one
Add DeliveryInstructions.create() to return immmutable
local instructions, to reduce object churn
Minor cleanups
2015-05-03 17:00:22 +00:00
zzz
1eba6c5167 SusiDNS: Add export button 2015-05-03 13:21:16 +00:00
zzz
a14208b841 Move Indonesian po files used by Java om _id to _in, since
Locale.getDefault().getLanguage() will only return "in".
See Locale javadocs. Same change already made in Android.
2015-05-02 23:23:13 +00:00
83966f9a7f Switch out the certificate for netdb.i2p2.no, replacing it with a stronger one
certificates/ssl/netdb.i2p2.no2.crt was checked in on 2014-12-08 with the
intention of its replacing certificates/ssl/netdb.i2p2.no.crt after a
transition period of a few months had passed. The certificate has already been
switched out on the server.
2015-05-02 20:49:50 +00:00
zzz
d89f06015b merge of '7cc7b74d018c5e2d5d571000d066e65ad034c114'
and 'd87b6870e67271b703a38f82cb6fc9b753bf9698'
2015-05-02 17:46:48 +00:00
zzz
49f786c928 Transport: Ticket #1458 continued...
enum fixes so we don't always force a peer test quickly
set reachability status at startup when interfaces are configured
prevent firewalled -> OK -> firewalled+OK transition
2015-05-02 17:45:37 +00:00
zzz
e8bc0bd5d1 Stats: randomize router count at startup also 2015-05-02 17:42:49 +00:00
8d69b69357 Switch out the certificate for ieb9oopo.mooo.com
certificates/ssl/ieb9oopo.mooo.com2 was checked in on 11/23/2014 with the
intention of its replacing certificates/ssl/ieb9oopo.mooo.com.crt after a
transition period of a few months had passed. The certificate has already been
switched out on the server.
2015-05-02 15:59:33 +00:00
e7b9a230e6 add 'bump' as an alias for the 'bumpBuild' ant target 2015-05-02 15:50:25 +00:00
6385c412fd Disable https://jp.reseed.i2p2.no:444/ due to extended downtime, unresponsive host (ticket #1422) 2015-05-02 15:48:46 +00:00
zzz
bb33b358b4 Change log level for Jetty warnings with exceptions
from error to warn (ticket #1551)
2015-05-02 14:36:39 +00:00
zzz
572f071cfe Jetty 8.1.17.v20150415 2015-05-02 14:09:59 +00:00
zzz
42cb89f525 bump -12 2015-04-30 21:14:56 +00:00
zzz
1868d2b50f Transport: Ticket #1458 continued...
Implement methods to remove only a single IPv4 or IPv6 address,
so that IPv6 addresses will remain when SSU detects that IPv4 is firewalled
Summary bar status fixes
Fix getIsPortFixed() for more enum cases
log tweaks, cleanups
2015-04-30 20:33:46 +00:00
zzz
4588f1ec75 I2CP: Periodically send a SetDate message to external clients
so they stay in sync
2015-04-29 15:22:55 +00:00
zzz
629f7f05c7 Transports: Track IPv4/v6 reachability separately (ticket #1458)
Don't include NTCP conns established too long ago in clock skew vector
Hide unestablished outbound NTCP conns from /peers view
Add per-transport status to /peers
Put status description instead of code into event log reachability changes
2015-04-29 12:50:33 +00:00
zzz
0f18686243 Clock: Make forward slewing work better
when now() is not called too frequently
2015-04-29 11:48:17 +00:00
zzz
2a2587b13d fix logic bug 2015-04-29 02:41:25 +00:00
zzz
489fdd5e4b NTCP: Use context time, not system time, in NTCPConnection
so that clock skew calculations work right
2015-04-29 02:35:22 +00:00
zzz
fe680eb192 Transports: Fix clock skew calculations
- NTCP inbound skew calculation had flipped sign
- Include RTT in NTCP skew calulation
- Set SSU skew on first packet so it's right from the beginning
- Above should fix the "ignoring clock offset" error
- Javadocs
RouterClock:
- Add config to disable clock adjustment for testing
- Reduce window in skew vector for slew calculation
- Double max slew rate
2015-04-29 01:30:33 +00:00
zzz
613440ff63 CSF: New enums for SNAT/OK and SNAT/UNKNOWN 2015-04-28 22:26:40 +00:00
zzz
64121b1e92 catch OOM in the OOM listener 2015-04-28 22:24:05 +00:00
zzz
f16927f316 JobQueueRunner: Don't call System.exit() on OOM,
let the shutdown progress normally;
Make it an I2PThread instead of a Runner so we can
call fireOOM() for consistent logging (ticket #1549)
Router: Don't add OOM listener on Android so
we don't hang onto the context
2015-04-28 21:57:13 +00:00
zzz
cb50c1bd8b improve UDP test 2015-04-28 12:44:53 +00:00
zzz
921ad86274 Comm System: More prep for ticket #1458
- Big method to handle status transitions, not yet used
 - Status enum tweaks, unknown must be higher code than known
2015-04-28 03:25:20 +00:00
zzz
ac76107752 Transports:
- More transition to status enum
 - Don't set TCP keepalive for IPv6
2015-04-28 03:21:28 +00:00
zzz
2359b1edd2 Transports: Convert internal state to enums (ticket #1458) 2015-04-27 17:05:16 +00:00
zzz
2750681d78 CommSystem: Stubs for separate IPv4/v6 status (ticket #1458) 2015-04-27 15:44:05 +00:00
zzz
eaac4d3de0 NamingService: Add export methods,
fill in subclass methods for efficient exporting,
fill in getBase64Entires() and getNames() where unimplemented
SusiDNS: Add export support, no UI yet
2015-04-27 15:41:38 +00:00
zzz
f243968dfa i2ptunnel: Reduce sleep time in runners to reduce latency
greatly improves "loopback" performance
minor cleanups
2015-04-26 17:50:06 +00:00
zzz
8d9e2bdc71 log tweaks 2015-04-26 17:46:48 +00:00
zzz
6dbbb6b61b minor cleanup 2015-04-26 17:46:14 +00:00
zzz
f89bf32390 target=_top 2015-04-26 17:45:31 +00:00
zzz
ef195aa4ef re-add fixed reseed 2015-04-26 17:45:01 +00:00
843230a1cb Fixed MessageInputStreamTest after constructor changes 2015-04-26 01:43:34 +00:00
zzz
84e63f3b38 reseed tweaks for SNI 2015-04-26 00:12:17 +00:00
zzz
b90816fdf8 add package.html files 2015-04-25 23:15:52 +00:00
zzz
40c4a42921 I2PSSLSocketFactory:
- Add hostname verification using code from
Apache HttpClient 4.4.1 (Apache 2.0 license)
and one small class from HttpCore 4.4.1,
slightly modified to remove additional Apache dependencies
and unneeded code.
- Includes support for public suffix list;
use basic list with standard TLDs,
and also support loading the big Mozilla list,
but don't bundle the 150KB Mozilla list for now.
- For Android, use its default verifier, which
should actually work (unlike Oracle)
- Java 7 not required, although servers requiring SNI will now
fail on Java 6, which does not support SNI
SSLEepGet:
- Rework recent setSoTimeout code changes, as they broke SNI
- Add option to save certs even if no errors
- Add option to disable hostname verification
2015-04-25 23:06:44 +00:00
zzz
26f89391d3 Mods to remove additional Apache dependencies
and unneeded code, now compiles
2015-04-25 22:56:51 +00:00
zzz
aaae72cf84 - Initial checkin of Apache classes from
Apache HttpClient 4.4.1 (Apache 2.0 license)
and one small class from HttpCore 4.4.1,
unmodified as a baseline for future merges.
Does not compile.
See following checkins for more info
2015-04-25 22:54:05 +00:00
zzz
3e55cff153 Util: Catch and convert OOM in I2PThread.start() to a RuntimeException,
to give better message to users and prevent JVM shutdown
on what is unlikely to be a heap issue.
2015-04-25 00:02:55 +00:00
zzz
bd778a2204 Remove old pre-0.6.1.30 TunnelCreateMessage and TunnelCreateStatusMessage,
moved to junit years ago but not part of any tests
2015-04-24 22:25:17 +00:00
zzz
235c196f14 log tweaks 2015-04-24 21:37:22 +00:00
zzz
e475c161cb i2ptunnel: Don't register port mapper in clients overriding startRunning()
if super.startRunning() failed
Register as HTTPS proxy also in HTTP client
2015-04-24 21:16:45 +00:00
zzz
08e96109a7 i2ptunnel: Fix shutdown of client tunnels on server socket errors,
broken in fix for ticket #815
TCG still doesn't go back to stopped, to be fixed.
Test case: configure low port.
2015-04-24 19:19:18 +00:00
zzz
81ad33d9e3 lint unchecked 2015-04-24 16:27:03 +00:00
zzz
aecc95825b Updates: Fail fast if HTTP proxy is not running (ticket #1530)
Covers router, unsigned router, plugin, and news updates
2015-04-24 16:08:08 +00:00
zzz
37c6ac3a88 i2ptunnel: Fix Socks and SocksIRC tunnels not starting,
broken in fix for ticket #815
2015-04-24 01:48:07 +00:00
zzz
772d0beac3 Streaming: Don't wait too long to send a dup ACK, so the other
side isn't stuck forever at a window size of 1.
Cleanups, log tweaks, javadocs
2015-04-23 15:34:24 +00:00
zzz
64fdfd81ee remove excess logging 2015-04-23 13:38:44 +00:00
zzz
1b09b9faa4 Streaming: More efficient checking for input buffer overflow,
add additional checks.
Fix bug if available buffer calculation is negative
Check log level before calling displayPacket()
Log tweaks
2015-04-23 13:19:18 +00:00
zzz
6f0ebb2d94 Streaming: Reduce min RTO so that "loopback" connections
recover quicker after packet loss;
Reduce default initial ack delay;
Rename misspelled method
2015-04-23 10:28:02 +00:00
zzz
cbe91e3012 I2PSocketEepGet: Fix i2psnark NPE caused by -6 (ticket #1543) 2015-04-22 20:34:04 +00:00
zzz
238501919b i2psnark: Fix deletion of config files, cleanup
orphaned ones at startup (ticket #1498)
2015-04-22 20:22:17 +00:00
zzz
ae3a5f7b25 name tunnel starter threads 2015-04-22 20:17:33 +00:00
zzz
638cadc3c9 NetDB: Disable floodfill for non-ARM Android also 2015-04-22 15:54:18 +00:00
zzz
da0036581c thread name tweak 2015-04-22 14:51:40 +00:00
zzz
59a58ea310 NTCP: Reduce min send finisher threads to 1 2015-04-22 14:48:59 +00:00
zzz
bebe5f8a4e PortMapper: Status output for /debug 2015-04-22 14:45:40 +00:00
zzz
c3af99685d log tweak 2015-04-22 12:00:46 +00:00
zzz
e1d9e05b8d i2ptunnel: Fixes and cleanups for command line testing;
catch IAE from getInstance() if i2ptunnel.config isn't found
in app context; log tweaks; config command tweaks
Unit tests: Fix several NPEs in LocalClientManager,
implement HostLookup
2015-04-22 11:59:40 +00:00
zzz
212f6b472a i2ptunnel: Catch and log uncaught errors in thread pool 2015-04-21 20:37:59 +00:00
zzz
fdada78edf Reseed: Disable non-su3 reseeding 2015-04-21 18:48:11 +00:00
zzz
638c5429d2 NTP:
- close socket in finally
 - really comment out main()
2015-04-21 14:49:48 +00:00
zzz
b67bbd7065 improved locking 2015-04-21 14:33:59 +00:00
zzz
1caf3e778b Router timestamper:
- Add country-to-continent mapping
 - Add continent pool.ntp.org zones as first fallback,
   this will improve time service for countries that don't have a zone
 - Don't start threads in constructors
 - Fix logging, better prevention of initialization loops
 - Log severe errors to wrapper log also
continent.txt file from http://dev.maxmind.com/geoip/legacy/codes/country_continent/
Creative Commons Attribution-ShareAlike 3.0 Unported License
http://dev.maxmind.com/geoip/legacy/geolite/
Terms already met in LICENSE.txt
2015-04-21 14:22:05 +00:00
zzz
fd82fff07a Transports: Reduce idle timeouts 2015-04-21 09:58:46 +00:00
zzz
a6ac8f8c09 Blockfile: Unroll recursive initialization of BSkipLevels 2015-04-20 22:56:08 +00:00
zzz
19a26f8e22 Reseed: Prep for disabling non-su3 fetches (ticket #1513) 2015-04-20 18:48:00 +00:00
zzz
46e85cf265 only reset the sotimeout if not proxied 2015-04-20 17:57:57 +00:00
zzz
8f321b5427 EepGet: Set soTimeout for non-proxied fetches to enforce
header timeout and prevent long reseed hangs
2015-04-20 17:53:29 +00:00
zzz
e1f8f1a3f4 Reseed: Remove all default HTTP URLs (ticket #1514) 2015-04-20 16:11:33 +00:00
zzz
935a5b573d Reseed: Better error message if no valid URLs for configuration 2015-04-20 15:45:49 +00:00
zzz
8c2636aa99 Reseed: Honor SSL/non-SSL setting when custom reseed list is set (ticket #1136)
patch from "Inondle", cleaned up and tested
2015-04-20 15:33:03 +00:00
zzz
03ddb1075c BuildHandler: Don't enforce conn limits for P or X 2015-04-20 13:15:30 +00:00
zzz
72eb2c058c Streaming: Move Packet.writeSignedPacket() to PacketLocal 2015-04-20 13:13:55 +00:00
zzz
a100d2ccf9 javadoc, remove unneeded volatile and initializer in TCG 2015-04-20 13:12:21 +00:00
zzz
ecfb3e94c8 javadoc and debug log tweaks for ST2 2015-04-20 13:09:48 +00:00
zzz
c31d6b1ac1 javadoc fix 2015-04-20 13:09:13 +00:00
zzz
65993e1d50 add methods to simplify logging 2015-04-20 13:05:14 +00:00
zzz
47c4c0d6bb add all known dsa-only hosts to list 2015-04-19 19:35:38 +00:00
zzz
b2872e6110 I2CP Multisession - Work in progress:
Start availability notifier in subsession
Availability notifier cleanup
Various log tweaks added while chasing this down
Better subsession state management
I2PSocketManagerFull verifies subsession to force connect()
Successfully tested
2015-04-19 19:05:53 +00:00
zzz
b8c8d5b447 I2CP Multisession - Work in progress:
Accept subclient data message down client's tunnel in IMD
2015-04-19 15:49:02 +00:00
zzz
32049d7bfc I2CP Multisession - Work in progress:
Reuse LS encryption keypair from primary LS
Log tweaks
2015-04-19 14:49:13 +00:00
zzz
f0fdb35ba6 I2CP Multisession - Work in progress:
Fix creating subsession LS from primary LS
2015-04-19 03:35:40 +00:00
zzz
d8baf62966 I2CP Multisession - Work in progress:
Stub out hardcoded list of DSA-only destinations
Tweak client name length in summary bar
Force initial leaseset request for subsession
Send SessionStatus msg before LS request for subsession
2015-04-19 03:11:37 +00:00
zzz
be8f7f9676 I2CP Multisession - Work in progress:
Fix sending CreateSessionMessage for subsession
New AliasedTunnelPool for subsessions, don't reuse TunnelPool,
so it has its own settings
Fix addAlias()
Simplify refreshSettings()
Send status message on subsession create failure
Fix settings for subsession
2015-04-19 01:32:30 +00:00
zzz
57b641bf63 I2CP Multisession - Work in progress:
Fix NPE in receiveMessage()
2015-04-18 20:45:30 +00:00
zzz
ff5d29de1a I2CP Multisession - Work in progress:
Fix NPE in addSubsession() by creating key stream
Set sigtype for subsession
2015-04-18 19:50:14 +00:00
zzz
91e98ba447 I2CP Multisession Work in progress:
Fix NPE in requestLeaseSet()
Fix setting new session ID in SessionStatusMessage
Fix subsession support detection
Streaming: one socket manager, multiple connection managers.
Change data structure for subessions in socket manager
Subsession cleanup on destroy
I2PTunnel: add DSA subsession for non-DSA shared client
Javadocs
2015-04-18 19:01:23 +00:00
zzz
6a644dd0e5 propagate from branch 'i2p.i2p' (head 66743cfb9b4e1c257e4f0a20a318ee7eb1fb607c)
to branch 'i2p.i2p.zzz.multisess' (head 4533ba250cb8e49044f5144b34014e9bc618cdc7)
2015-04-18 14:08:22 +00:00
zzz
7b82393336 atomics and finals 2015-04-17 17:15:22 +00:00
22993e1ea6 installer/resources/eepsite/jetty-ssl.xml: fix comments 2015-04-17 14:18:56 +00:00
341bd6d7ca tweak to debian apparmor rules 2015-04-17 14:15:05 +00:00
13d5a36cfc drop unneeded patch (ty zzz) 2015-04-17 14:14:06 +00:00
f3bb84f2c0 merge of '4cd641356d3ecf443fa79aa64c8ad553a37022da'
and 'b9d4479f7e0f562a5fd47f2d494fe1b2b0925cbe'
2015-04-17 13:46:44 +00:00
1d496404be Separate loading and starting of TunnelControllers 2015-04-17 13:45:37 +00:00
zzz
51233371e0 history for prop, -5 2015-04-17 13:43:48 +00:00
zzz
bc0a7ebbbc propagate from branch 'i2p.i2p.zzz.test2' (head b6de226d1664089488ab2b438fe7457e9fb8e563)
to branch 'i2p.i2p' (head 0cf35c87b68a5360bd35257e36dfe7f740e53693)
2015-04-17 13:18:22 +00:00
zzz
72c78b3870 config for SSL to eepsite 2015-04-17 13:03:48 +00:00
zzz
5555c52376 Streaming: Locking for next send time,
rename shadowing field in inner class
2015-04-17 13:00:16 +00:00
e1842be049 Don't automatically start TCG on Android 2015-04-17 11:21:26 +00:00
zzz
6ceb4fcf42 history for prop, -4 2015-04-16 23:25:49 +00:00
zzz
50b68d4e1c propagate from branch 'i2p.i2p.zzz.815' (head 43bce385eecdf95bba08985211b80099d1224462)
to branch 'i2p.i2p' (head 1b89427bd2952dc4be08fba14ad1d814d722739f)
2015-04-16 23:19:48 +00:00
zzz
3f46228f0b ISJ: Reduce max search depth to reduce ff load
- from 7 to 6 if not ff
- from 7 to 3 if ff (we don't need to backtrack much if any, we know most of the ffs)
2015-04-16 22:02:35 +00:00
zzz
6c954f0b68 Transport: Fix NTCP countPeers()
O/P conn limit adjustment
2015-04-16 21:55:43 +00:00
zzz
69c2ed77a0 recognize Intel model 69 2015-04-16 15:38:13 +00:00
zzz
6f09224bdc sort clients on /configclients 2015-04-16 15:07:08 +00:00
zzz
568c90806d I2CP: Run DistributeLocal jobs inline (ticket #1506) 2015-04-16 14:24:56 +00:00
zzz
6e451c8d4d javadocs 2015-04-16 14:18:10 +00:00
zzz
12fd585625 Transport: Fix active peer count for NTCP,
which will make the network-down message in the console consistent.
Javadocs for getActivePeers() and getActiveSendPeers()
Make getActivePeers() and getActiveSendPeers() abstract in TransportImpl
Make getActivePeers() and getActiveSendPeers() more efficient
Preliminary conn limits for P/X
Log tweaks
2015-04-16 14:13:23 +00:00
zzz
997fbb3392 log on failed plugin update check 2015-04-16 13:14:40 +00:00
zzz
089626f6b1 increase max i2psnark tunnels to 10 2015-04-16 13:13:32 +00:00
zzz
71d2049fe8 OOM log tweak 2015-04-16 13:11:34 +00:00
zzz
e5aee3001f bump -2 2015-04-15 18:20:52 +00:00
dev
ec62bcbf8e propagate from branch 'i2p.i2p.tuna.tmp' (head 73f55ef56c4b4800364bc92d69794a7b6715c5a7)
to branch 'i2p.i2p' (head 20e0a6d51df8fa6918a48ac01c808e56d3540bf1)
2015-04-15 16:25:58 +00:00
dev
a8f013f3e4 merge of '303a05a4ccfb4162f4cca475bca49d77dceb06f9'
and '9c1c14d60b15e3d9eed4b291a7fae39c11d3c993'
2015-04-15 16:17:24 +00:00
dev
037cd78dc7 #1069: Propagate fix into i2p.i2p from i2p.i2p.tuna.tmp
* Replace SimpleScheduler with SimpleTimer2
 * Bump version number
2015-04-15 16:15:53 +00:00
dev
b31ae4bae5 propagate from branch 'i2p.i2p.tuna.tmp' (head 1bba286bdb7f8ba879c4db3f356676151674a201)
to branch 'i2p.i2p' (head 5698b31632398b8156a3b4cc215fed677cf205bf)
2015-04-15 16:08:29 +00:00
dev
54dba980b4 #1069: Replaced SimpleScheduler with SimpleTimer2 in a few places 2015-04-15 15:32:40 +00:00
dev
dc19d2fab3 SimpleTimer2: Removed debug print 2015-04-15 15:18:02 +00:00
dev
3a57310fbe SimpleTimer2: Call the 3-arg addPeridicEvenet() from the 2-arg addPeridicEvenet() 2015-04-15 14:42:39 +00:00
749e19a1c3 fixes to apparmor profile for i2prouter 2015-04-14 18:50:45 +00:00
zzz
de6608f6b8 Streaming: Handle reset packets without a FROM field, validate
signature using connection's destination
Log tweaks
Remove 0 arg from addRateData() calls
2015-04-14 14:11:48 +00:00
zzz
cd6d9cdd94 Router: Fix NPE on bad share bandwidth config (ticket #1524) 2015-04-14 14:04:31 +00:00
zzz
e45413d417 Update: Don't log an error for the "dummy" updater (ticket #1525) 2015-04-14 14:01:50 +00:00
11c3230150 updates to apparmor profiles
- hardening (restrict access to proc to owner)
- removing files covered by abstractions
- indentation per apparmor profile style
2015-04-14 01:00:10 +00:00
zzz
dd99978b19 0.9.19 2015-04-12 13:32:49 +00:00
zzz
dd265bbd54 Updates after review:
Remove meeh.i2p as update host (ticket #1515)
Re-add 193.xxx https reseed
Fix SocketManagerFactory property handling
Restore UPnP locale fix lost in the merge
i2ptunnel finals
I2NP unique id fixes
duplicate done() in ReseedChecker
bigger langbox in CSS
reformatting
Javadocs
2015-04-11 19:34:34 +00:00
dev
f5ba1b1b97 #1069: Replaced getInstance() with this 2015-04-09 22:32:59 +00:00
zzz
7825f0f84f i2ptunnel: Remove null workaround and stat, testing passed (ticket #335) 2015-04-09 16:04:06 +00:00
69a0324e86 update debian changelog; bump build 2015-04-09 12:06:26 +00:00
957d3545b6 Translation updates pulled from Transifex; start of Malagasy translation 2015-04-09 11:59:17 +00:00
466348a8c5 Updates to geoip.txt and geoipv6.dat.gz based on Maxmind GeoLite Country database from 2015-04-07. 2015-04-09 11:51:55 +00:00
zzz
e5b7e97ff4 Jetty: Set session cookies to HttpOnly in all webapps
i2psnark: Remove extra mime types in i2psnark web.xml;
added to Jetty's default by now, or in our mime.properties file
2015-04-08 19:45:37 +00:00
dev
4613e5f847 #1069: Improved patch according to feedback in ticket 2015-04-08 17:49:28 +00:00
dev
44f8154f07 #1069: Improved patch according to ticket feedback 2015-04-08 17:47:27 +00:00
zzz
5486874d1a Tunnels: Add config to disable Bloom filter for testing 2015-04-08 14:50:12 +00:00
zzz
d868ca4740 Tunnels: Add new Bloom filter size, increase bandwidth limit (ticket #1505) 2015-04-08 14:40:53 +00:00
zzz
780479be4b Tunnel: Add bloom filter warning if high bw but low memory 2015-04-08 13:36:56 +00:00
zzz
4705f01bc5 Router: Move update extraction code to new class in tasks/ 2015-04-08 12:33:16 +00:00
zzz
2f5f91a084 log tweaks 2015-04-08 11:52:02 +00:00
dev
e44fe98c7e propagate from branch 'i2p.i2p' (head 6ae35262874a1828d53ddad22e6a6c4db7b031c1)
to branch 'i2p.i2p.tuna.tmp' (head 7d48c8e1a01f6c6f6cef802e0436c50785d89716)
2015-04-07 17:01:47 +00:00
dev
d8fbc9c170 Formatting 2015-04-06 21:10:49 +00:00
dev
facbe8f9a0 #1069: Deprecated SimpleScheduler and moved functionality into SimpleTimer2 2015-04-06 21:05:24 +00:00
dev
4d8e577ffd findbugs: Added companion equals() and hashCode() methods to existing compareTo() 2015-04-06 16:04:05 +00:00
dev
80eb7635c1 findbugs: Added companion equals() and hashCode() methods to existing compareTo() 2015-04-06 15:40:39 +00:00
dev
e3103762b6 findbugs: Removed synchronization on concurrent object 2015-04-06 15:00:40 +00:00
zzz
cce710e377 IRC Server: Better timeout handling when reading initial lines (ticket #723)
Send error responses for timeout, EOF, and bad registration.
Only affects "user" mode, not webirc.
detab
move private fields to top
2015-04-05 17:36:30 +00:00
013c79bc45 Debian: Refresh patch 2015-04-04 21:59:36 +00:00
dev
1e375886bd merge of '2cb50c2864d750f33039bdbaeb6c15d2bd636ce4'
and 'cb2fbb74aa4412375fdbc546fe2218ca1704cd7d'
2015-04-04 19:49:47 +00:00
dev
d1ac24c65d findbugs: Covariant equals() method defined, Object.equals(Object) inherited 2015-04-04 19:49:37 +00:00
zzz
6aa1284848 i2ptunnel: Check for total header size too big,
log tweaks
2015-04-04 19:31:20 +00:00
zzz
bb082c35fc recognize more error codes 2015-04-04 19:14:30 +00:00
zzz
f7577e7de8 i2ptunnel: Return specific error pages to client on errors
in HTTP header processing in the HTTP server (ticket #1507)
2015-04-04 19:12:18 +00:00
zzz
b5df13d8b7 propagate from branch 'i2p.i2p' (head 2cb50c2864d750f33039bdbaeb6c15d2bd636ce4)
to branch 'i2p.i2p.zzz.test2' (head 9775e688503ec47dc12efa860a5571317af5f063)
2015-04-04 17:04:52 +00:00
zzz
9d76790cc5 javadoc 2015-04-04 17:01:40 +00:00
zzz
706ee243a5 Streaming read timeout fixes:
i2ptunnel:
- Better timeout handling when reading headers in HTTP server (improved fix for ticket #723)
  Enforce total header timeout with new readLine()
- Prep for returning specific HTTP errors to client on request timeout and header errors,
  instead of just closing socket... further work to be in i2p.i2p.zzz.test2 branch
Streaming:
- Fix read timeout on input stream - was waiting too long, often twice as long as timeout, or more
  Enforce total timeout even when notify()ed
- Fix read() returning 0 on read timeout instead of -1 (possible fix for ticket #335)
  This prevents passing partial headers to server on timeout
- Fix javadocs for read timeout to match current behavior
- Fix StandardSocket SoTimeout to account for differences with I2PSocket readTimeout
- log tweaks
2015-04-04 17:00:57 +00:00
zzz
351a1a8d27 i2ptunnel: Fix NoSuchElementException processing proxyList
caused by 03-31 checkin
2015-04-04 16:59:21 +00:00
zzz
6916cd7977 merge of '18f97452ba9fd5a7274ca689084ffe49b55c2cf3'
and 'c9caed8c48615dc740061fd28315ee659e1afe20'
2015-04-04 15:42:14 +00:00
dev
a444c25c2c silence findbugs: use of uninitialized value 2015-04-04 13:44:37 +00:00
dev
45bc533e38 findbugs fix: equals() used to compare array and nonarray 2015-04-04 13:37:18 +00:00
zzz
03e890b01c merge of '2e3b52a13c62422d86931cd194870b7e2698f3c2'
and 'fde331f6b10f0ef936a2aa0d68092df22348a581'
2015-04-04 11:21:50 +00:00
dev
0c90162e20 Copy directly into buffer without intermediate buffer 2015-04-04 02:27:24 +00:00
dev
ddc3ef8db3 Removed unnecessry buffering 2015-04-04 00:05:29 +00:00
zzz
fcec43b7ca i2ptunnel: Fix stopping tunnel on bad args when starting,
broken by new state code
2015-04-03 23:46:24 +00:00
zzz
edb614d970 wrapper.config: Remove old mortbay properties, unused by new Jetty 2015-04-03 23:40:39 +00:00
dev
820b99e3d3 Commented out java runtime argument 2015-04-03 23:20:39 +00:00
dev
cf0453cee0 Initialize uniqueId lazily to avoid wasting entropy for messages where it isn't used 2015-04-03 23:01:16 +00:00
zzz
75a8d8f6d3 more ssl config tweaks 2015-04-03 13:33:59 +00:00
zzz
1ac8d99145 i2ptunnel: Send HTTP server port 443 traffic to the server
transparently, to support HTTPS over the same tunnel,
when so configured.
Jetty: Add extensive help to jetty-ssl.xml for setting
up SSL on the same server.
2015-04-03 12:19:41 +00:00
dev
b7b5512e7a Formatting 2015-04-02 23:01:41 +00:00
zzz
485acd6c8d Remove all the startRunning() calls in constructors,
which duplicated the new ones in I2PTunnel, causing all sorts of trouble.
May still need more locking. TBD.
2015-04-02 20:52:40 +00:00
dev
bb68728c82 Added link to blog post explaining why the flag was added 2015-04-02 20:44:52 +00:00
dev
f3b2eb69d2 Fixed syntax error 2015-04-02 16:32:38 +00:00
dev
168d688fc9 Disable JVM stats being written to file, to prevent long (up to ~400ms) pauses.
- Blog post: http://www.evanjones.ca/jvm-mmap-pause.html
    - This change prevents tools that use the stats-file (/tmp/hsperfdata) from working (like jstat)
2015-04-02 16:05:43 +00:00
dev
ade93ea76d Added model name for Xeon E3-1230v2 2015-04-02 15:58:46 +00:00
44503af88b * Job Queue/stats: add stat/graph for amount of scheduled jobs. 2015-04-01 22:34:39 +00:00
zzz
eb7693561b spelling 2015-04-01 13:59:51 +00:00
zzz
3ccb03f9be propagate from branch 'i2p.i2p' (head bf7fc6bb213e734788d6527a4a689184ff73d6ad)
to branch 'i2p.i2p.zzz.test2' (head 6a04d890ef0ebf179ec6801d9d96afff26a2e515)
2015-04-01 13:48:18 +00:00
zzz
f3a2af8f10 make job runner quantity configurable 2015-04-01 13:48:06 +00:00
zzz
2ef615a3f7 I2CP: Allow larger client clock skew (ticket #1503),
better error message to client
javadocs
2015-04-01 12:50:51 +00:00
zzz
20197fc3ec i2psnark: Fix changing data directory on Windows (ticket #1503) 2015-04-01 12:41:38 +00:00
zzz
fadc624f7c API: Fix some client-side APIs to honor defaults in Properties;
add javadocs to specify where we do and don't (ticket #1491)
2015-03-31 13:18:11 +00:00
zzz
22c4149358 fix another split() bug 2015-03-31 11:26:02 +00:00
zzz
c770c6bc6a i2ptunnel: Fix multiple SSL outproxies in HTTP client
escape and truncate URL on error page
2015-03-31 11:21:32 +00:00
zzz
891408191e UPnP: Don't rescan when shutting down 2015-03-29 14:59:11 +00:00
zzz
9a8fa246a9 I2CP: Prevent NPE when router receives messages without prior session (ticket #1503) 2015-03-29 13:45:14 +00:00
zzz
83c3152b5d JobQueue: Don't start thread in constructor (ticket #973) 2015-03-29 13:40:04 +00:00
zzz
956730c5e9 log tweak to help diagnose ServerSocket closed 2015-03-28 10:54:00 +00:00
zzz
72b9c92a6e better 7 bit error message 2015-03-28 10:51:59 +00:00
zzz
349255d252 exit code checks and javadocs 2015-03-28 10:49:43 +00:00
zzz
ac902badcd log tweak to hide i2pd badness 2015-03-28 10:47:10 +00:00
zzz
9dc2ae0d7e fixup after prop 2015-03-28 10:25:45 +00:00
zzz
188bd6db7b propagate from branch 'i2p.i2p' (head 2ce39645bf3b3b7fc2f083ebcb073f104114e939)
to branch 'i2p.i2p.zzz.815' (head 4f0279eb4cf13e547a64913443ff7819a43962c0)
2015-03-27 14:47:49 +00:00
zzz
3a8ce64c84 I2PTunnel client-side locking fixes (ticket #815)
Checkin of patches from Oct. 2013, based on 0.9.8.1.
Had some issues back then, and not tested recently.
Prop from i2p.i2p to follow.
2015-03-27 14:16:41 +00:00
zzz
f3d573cab0 i2ptunnel HTTP client: Replace all getBytes() calls
with a Writer or getBytes("UTF-8") for efficiency and to
avoid encoding issues.
Store strings as strings, not bytes.
Catch IOEs to prevent cascading error pages.
Minor cleanups
2015-03-25 12:10:14 +00:00
zzz
9e18c7ea18 Streaming: Throw I2PSocketException when connection is reset,
display new error page in HTTP client (ticket #643)
javadocs
2015-03-24 14:33:36 +00:00
zzz
a975dc4427 Summary bar: linkify news headings, remove 'show news' link 2015-03-23 15:47:33 +00:00
zzz
b875e284af merge of '33b368d75d4b7536dd4a29efa35fba64e6dc409d'
and '8eb5a0d367c4b34eadc326e0ba727e998e6f5505'
2015-03-23 14:21:05 +00:00
46fe4298b9 States for TunnelController (#815) 2015-03-23 13:59:05 +00:00
9790d3ba64 Tweak so TODO is marked in IDEs 2015-03-23 12:50:33 +00:00
2d31f30a22 ReadWriteLock in TunnelControlGroup (#815) 2015-03-23 12:49:30 +00:00
2fefe93922 merge of '91e8b79f2d8c4ffd26867eb6ddd0ee63d22b0ca9'
and 'dd39c6a48fec46017ce527d8b8b8208369ecda5e'
2015-03-23 12:47:40 +00:00
399b068a4e Fixed NPE in test 2015-03-23 03:54:21 +00:00
zzz
dcffde6eeb Javadoc: missing package.html files in applications (ticket #1109) 2015-03-22 18:37:40 +00:00
zzz
78074f6a7e Javadoc: missing package.html files in i2p.jar (ticket #1109) 2015-03-22 17:32:35 +00:00
zzz
79dc01f7e4 Javadoc: missing package.html files in router.jar (ticket #1109) 2015-03-22 16:35:21 +00:00
zzz
0f6040ecb1 enforce a minimum number of RIs to bundle 2015-03-22 12:44:32 +00:00
zzz
a0ab72e362 more /configreseed help text 2015-03-22 12:26:05 +00:00
zzz
2c45378c6d Console: Better status feedback on manual reseed from URL
Reseed: Better status feedback and cleanup in summary bar
2015-03-22 10:08:48 +00:00
zzz
44c75187f5 set tunnel name for ping 2015-03-22 08:30:38 +00:00
zzz
2609a4d124 Floodfill: Don't become ff w/o ECDSA support
Don't transition to non-ff when shutting down if configured true
Set ff for cap P and X
2015-03-22 08:30:10 +00:00
zzz
2d58501db3 Plugins: Add form to browse for local plugin file to install,
easy since we have multipart in console now
Better status feedback from update manager to console
2015-03-21 17:23:19 +00:00
zzz
a337185820 better temp dir fallback and logging 2015-03-21 12:38:48 +00:00
zzz
9c0aa0c271 randomize i2psnark temp dir name 2015-03-21 12:19:03 +00:00
zzz
b2e908f094 add removed certs to delete list 2015-03-21 12:14:07 +00:00
zzz
ef32d37073 TunnelPool: Reduce expl. quantity adder for ff since we're
doing mostly direct lookups now, and delay adding them at
startup to give client tunnels a chance
2015-03-21 12:13:22 +00:00
zzz
f0961a9658 more accurate job stats 2015-03-21 12:10:10 +00:00
876b5714be merge of '7c32d2fbb882e6d56cb06fc0e272f05ee2c0b8ed'
and '7e72459b27feb5176e98c5efc843f63e46e8f63d'
2015-03-21 09:59:00 +00:00
825cd7ff4c Docstring spelling fix 2015-03-21 04:29:45 +00:00
47f3476078 More I2PTunnel UI logic into GeneralHelper 2015-03-21 04:29:32 +00:00
7b10ebc117 fix previous commit 2015-03-20 19:43:01 +00:00
e5cdfd206d Re-enable uk.reseed.i2p2.no; it's back up (ticket #1487) 2015-03-20 19:25:42 +00:00
zzz
dd4c62b560 TunnelDispatcher: Start part. tunnel cleanup job sooner since
we're accepting tunnels sooner.
2015-03-20 16:54:03 +00:00
zzz
aae801efaf sort config tabs 2015-03-20 16:51:34 +00:00
zzz
e02d44433d missed file from last checkin 2015-03-20 13:32:42 +00:00
zzz
590a3c98e5 charset 2015-03-20 12:32:53 +00:00
zzz
7f472e4ee9 Console:
- Move multipart form support from susimail to jetty-i2p.jar
    so console can use it
  - Add multipart form support to formhandler.jsi and FormHandler.java
Reseed:
  - Fix zip magic number
  - Finish manual reseed from local file
package.html files for jetty-i2p.jar
2015-03-20 12:30:04 +00:00
zzz
a3802d4d8b javadoc fix 2015-03-20 12:29:40 +00:00
zzz
59348f8dbd Reseed:
- Add form to manually reseed from zip or su3 URL
    (result status not yet working)
  - Add form to manually reseed from local zip or su3 file
    (not yet working, needs multipart/form-date moved from susimail)
  - Add form to create reseed zip file to share
    (working)
  - Backend support and refactoring in reseed code
2015-03-19 23:17:18 +00:00
zzz
8742a66f2f fix susimail HTTP headers 2015-03-19 21:36:23 +00:00
zzz
a2f027e136 NetDB: Don't publish non-ff RI on exit if we are coming right back 2015-03-18 19:58:31 +00:00
zzz
cb4359cd0a Streaming: Reduce min RTT again 2015-03-18 17:50:40 +00:00
zzz
163c172823 StatisticsManager: Publish dummy LS count if we just started 2015-03-18 17:29:08 +00:00
zzz
80a2d2c1f5 Router: Allow disabling the setting of some System properties, for embedded applications 2015-03-18 14:40:17 +00:00
zzz
486f282999 add CoreVersion.getVersion() 2015-03-18 14:13:05 +00:00
zzz
1293dccf35 I2CP Multisession support and multiple destinations in one tunnel pool.
Work in progress.
Router-side I2CP mostly done.
Client-side I2CP mostly done but undecided on how to handle
listeners.
Streaming stubbed out but may be wrong, may need multiple socket managers,
not clear how to proceed.
I2PTunnel not started.
Blacklist of DSA-only dests not started.
Router leaseset publishing not correct. Not clear whether to have
additional tunnel pools with flags, or put the tunnel pools into
the client hashmap twice. Client config contains destination,
may need to move that to tunnel pool.
2015-03-18 12:59:50 +00:00
zzz
91fe62eee3 History for prop, -6:
Prop from i2p.i2p.zzz.upnp, containing:
Cyberlink for Java v3.0 + (2015-02-15) from github
See branch revs for more info and fixups.
Previous was Cyberlink for Java v2.1 (2011-09-16) from SVN.
From a scan of the 2.1-to-3.0 diff, it's mostly
formatting changes, getting rid of DOS line endings,
and a couple of new features we don't need.
I see very few fixes. And the Device.getAbsoluteURL()
"fixes" did not work in my testing, I had to fix them again.
Unlikely to fix any of the open UPnP tickets #481 #725 #728 #1194 #1480.
But now we're current.
2015-03-18 12:15:41 +00:00
zzz
d3f5596cb2 propagate from branch 'i2p.i2p.zzz.upnp' (head 8719ae9a1473d748947733043f465a4589cc23d5)
to branch 'i2p.i2p' (head 5ae9785903c4b9452f4241758e8ddc1338e94574)
2015-03-18 12:13:41 +00:00
zzz
d7a88db87a NetDB:
- Send exploratory lookups directly to the floodfill if
    we are already connected to him
  - Don't encrypt RI lookups when overloaded
  - Don't explore when overloaded
  - SearchJob cleanups
Tunnels: Drop instead of reject requests on high job lag
2015-03-18 12:10:30 +00:00
zzz
0af1f67c33 Router: Revert deprecation;
addCapabilities() tweaks
2015-03-17 21:38:59 +00:00
zzz
8dde7b70db UPnP:
- New fix Device.getAbsoluteURL() once again after merge
 - Don't load local files in Service.getSCPDNode()
2015-03-17 21:29:03 +00:00
zzz
64faeef6c4 restore previous javadoc fixes after merge 2015-03-17 19:11:21 +00:00
zzz
c79e4aeaea propagate from branch 'i2p.i2p' (head 97716ce246bcbee153cf1a28253bac2385ddf7be)
to branch 'i2p.i2p.zzz.upnp' (head e508f71db90f382080b98d11efbdb4d88c1bc406)
2015-03-17 18:49:37 +00:00
zzz
8b6a86e391 merge of 'c5e201203713f0fefcdef642ca50597f8936c79c'
and 'fbd68f812db1e891f96e212b3a5938beec0233b5'
2015-03-17 18:21:12 +00:00
zzz
92daf4a8df Cyberlink for Java v3.0 + (2015-02-15) from github:
Unmodified cybergarage-upnp from github rev 9499b03 2015-02-05
https://github.com/cybergarage/cybergarage-upnp/commits/master
which is the same as rev 3ed1af9 2014-07-28 except for
the addition of README.md which we aren't using.
This is post-version 3.0.

Omitted files:
  router/java/src/org/cybergarage/xml/parser/XercesParser.java
  router/java/src/org/cybergarage/xml/parser/XmlPullParser.java
  router/java/src/org/cybergarage/xml/parser/kXML2Parser.java
chmod all files back to 644.

Diverging from 2.1 checkin rev 59eae97dbb470d8c4a1e4dba3a9763e134bb0c53
in prep for merging.

License unchanged.
Compile tested only.
2015-03-17 14:36:05 +00:00
zzz
819b07a52a minor refactor 2015-03-17 13:18:30 +00:00
zzz
b8f8c6129d prevent negative sleep 2015-03-17 13:17:38 +00:00
zzz
25d1ae195a New translations from tx:
Indonesian, Finnish, Malagasy, Albanian, Korean, Ukrainian, Brazilian Portuguese, Dutch
Note broken translations in TX config file
2015-03-17 13:16:40 +00:00
zzz
d22b05e114 NetDB: Send RI lookups directly to the floodfill if
we are already connected to him
(from ISJ only; does not affect exploration, verifies, LSes, ...)
2015-03-16 22:40:25 +00:00
zzz
db25eff74a log tweak 2015-03-16 22:38:29 +00:00
zzz
c927441d66 case-insensitive sort of stats 2015-03-16 20:14:32 +00:00
zzz
7e4832d5f2 lint 2015-03-16 15:44:45 +00:00
zzz
819b35c760 Router: Increase exploratory tunnel quantity if floodfill 2015-03-16 15:20:03 +00:00
zzz
071498c413 Router: Republish RI early if capabilities change
- RI javadoc clarifications WRT caps
2015-03-16 15:10:36 +00:00
zzz
7125ed0492 Apache Tomcat 6.0.43 2015-03-16 09:34:37 +00:00
zzz
de201bdd9c Throttle: Reject tunnels based on job lag 2015-03-16 09:12:41 +00:00
zzz
4fccd258e6 javadoc fixes 2015-03-16 09:08:03 +00:00
56d705739b Migrate accessors to GeneralHelper, fix broken outproxyAuth boolean 2015-03-15 20:26:36 +00:00
2a9d61b1ed merge of '6eb0d9bd5731afaa33fa1a0c82dd08a1d16d104b'
and 'f4fa275a1d6e014c64c5ff063fb890dd05e4ed60'
2015-03-15 20:13:16 +00:00
zzz
a9f6839a04 NetDb: Track flood success 2015-03-15 13:37:22 +00:00
zzz
5b555855ef Clear displayed tracker issues when restarting torrent
lint
2015-03-15 12:52:26 +00:00
zzz
76cf80a3d0 Job Queue:
- Fix overload dropping
   - Add drop count to job stats
   - Decrease overload threshold again
   - Concurrent tweaks
2015-03-15 11:48:12 +00:00
zzz
4c6aaa32b6 Router javadocs, stub out class P,
throw ISE instead of exit() if another router running
2015-03-15 11:42:00 +00:00
zzz
74ab1bff53 threshold tweaks for floodfill 2015-03-15 11:37:03 +00:00
zzz
b5bba5e3c8 log tweak 2015-03-15 11:35:49 +00:00
7e5bd17714 Move saveTunnel() and deleteTunnel() from IndexBean into i2ptunnel-ui.jar 2015-03-14 02:52:16 +00:00
zzz
ec6207fc78 Job Queue:
- Drop garlic message decryption jobs on overload
  - Decrease overload threshold
2015-03-13 17:50:32 +00:00
zzz
36d47a0ba9 minor cleanup 2015-03-13 17:48:29 +00:00
zzz
0289cefd8d lint 2015-03-13 17:26:15 +00:00
521eb2d8f8 Router: create router.integratedPeers (floodfills) stat, and allow graphing of it. 2015-03-13 16:53:08 +00:00
zzz
0494266649 i2psnark:
- Auto-reduce tunnel quantity based on peer count
  - Increase max tunnels
2015-03-13 14:56:35 +00:00
zzz
8fac5c064e fix i2ptunnel.war 2015-03-13 14:14:49 +00:00
0b6f74e646 Enable proxy authentication type to be configured 2015-03-11 23:46:38 +00:00
b8b272a5b8 Better multi-mode setters 2015-03-11 10:57:07 +00:00
a570e09166 Explicit boolean setters in TunnelConfig 2015-03-11 10:34:02 +00:00
1919e36c30 Move TunnelConfig to .ui, separate it from i2ptunnel.jar 2015-03-11 03:58:24 +00:00
812c00f11e Move TunnelController config creation logic into class that Android UI can use 2015-03-10 20:05:45 +00:00
419e27cfd1 Disable (jp|uk).reseeder.i2p2.no (tickets #1422, #1487) 2015-03-09 15:49:52 +00:00
d761c02909 Remove commented out reseed server i2p-netdb.innovatio.no and its associated certificates. 2015-03-09 15:40:40 +00:00
zzz
c7d1d2b69a console: Hide cancel graceful shutdown button unless we are shutting down 2015-03-08 20:23:00 +00:00
zzz
0972b6b56a more test cases 2015-03-08 20:20:50 +00:00
zzz
6e3cf7869f log tweak 2015-03-08 20:20:06 +00:00
zzz
f7337b4891 i2psnark: Increase min and default bandwidth
Add creation date to created torrents
log tweaks
more test cases
2015-03-08 20:19:12 +00:00
zzz
55161dec17 Router Throttle: Tweak messages during probabalistic rejection,
other cleanup
2015-03-08 20:07:05 +00:00
zzz
b65b53b0df Transport: Add missing bogons to IP validity check
192.0.0.2 seen out there (RFC 6333)
2015-03-08 20:05:50 +00:00
zzz
49e1e1c8a4 minor transport cleanup 2015-03-08 20:02:28 +00:00
9b73fcda40 Include priority for logged strings 2015-03-04 19:07:28 +00:00
b92e1ee9aa Split LogWriter to make Android subsititution simpler 2015-03-02 10:56:50 +00:00
04ac54cd35 Re-enabling host; its su3 files are now properly signed. 2015-03-01 23:37:27 +00:00
d47916f753 re-enable jp.reseed.i2p2.no (ticket #1422) 2015-03-01 22:34:15 +00:00
zzz
b0ea1d691a log fix, comment fix 2015-02-23 09:50:43 +00:00
zzz
ce041dfbc1 0.9.18 2015-02-22 09:52:27 +00:00
zzz
4613da093d log level tweak, bump for review 2015-02-19 09:47:44 +00:00
2d5f7aaae5 year typo fix 2015-02-18 23:48:21 +00:00
5a7a7ac83d typo fix 2015-02-18 22:36:52 +00:00
f217af2deb extend checkcerts.sh to print bits and hash information 2015-02-18 22:36:33 +00:00
6d58f9a354 Updates to geoip.txt and geoipv6.dat.gz based on Maxmind GeoLite Country database from 2014-02-04. 2015-02-18 22:34:09 +00:00
29953ea5e4 Debian: confine daemon with apparmor (ticket #1061) 2015-02-18 22:25:24 +00:00
bb9cef1e40 Add example apparmor profile (ticket #1092) 2015-02-18 21:38:25 +00:00
ece2f1484c refresh debian patch 2015-02-18 21:32:34 +00:00
a3c8a4363d Pulling in translations from Transifex 2015-02-18 20:20:52 +00:00
2f90b5a201 refresh debian patch 2015-02-17 19:27:11 +00:00
d4bbdc28f3 FloodfillMonitorJob: use the 60 min rate avg instead of lifetime avg, but fallback to the lifetime.
SAMStreamSend: fix tabbing from earlier commit.
2015-02-16 17:27:17 +00:00
f41df969b7 merge of '3e2231827648f614c5df325d9904e8d454e9a847'
and 'cddd2e9d2cf6f5c50a7d9948fbb2b3247d9768eb'
2015-02-16 08:07:54 +00:00
f87d006a1c FloodfillMonitorJob:
- Use lifetime average value for job lag
 - Change the job lag limit to less than 25ms
 - Consider and set the limit of backlogged tunnels to less than 5
2015-02-15 22:40:36 +00:00
f4fa9a7d8f New cert for i2p.mooo.com. Will be switched on the server in a future release. 2015-02-15 19:16:07 +00:00
c52047e6cd Remove reseed host by hoster's request 2015-02-15 19:10:48 +00:00
9163d41228 * I2PSnark, Jetty, SAM, crypto: findbugs resource leaks. 2015-02-10 21:57:27 +00:00
1be9bb29e8 disabling us.i2p2.no over http 2015-02-08 15:05:04 +00:00
522a89a045 reseed: remove reseed.info; hoster is discontinuing the service. 2015-02-08 15:00:01 +00:00
zzz
06b9b6a7fb more clock log tweaks 2015-02-08 12:52:51 +00:00
zzz
7f9c565cd7 fix early NPE 2015-02-08 00:42:43 +00:00
zzz
201afc823e SSU: Limit range for valid clock skew
Reduce log level for ignored clock adjustment
2015-02-07 14:13:14 +00:00
zzz
f4c79c885a Transport: Ban routers if they are too old and we are non-DSA 2015-02-07 14:03:42 +00:00
zzz
656202c9db debug tweak 2015-02-07 14:01:56 +00:00
zzz
72b64072d5 missed file for event log change 2015-02-07 13:59:11 +00:00
zzz
b72271f9a4 NTCP: Block IP for a while when incoming connection is dropped before
receiving a message. Possible workaround for tickets #551, #1075, #1411.
Root cause of problem not yet found.
- Increase threshold for loop throttle, this probably isn't the problem.
- Log tweaks
2015-02-06 15:09:45 +00:00
zzz
b0d09d28f4 SSU: Change peer test log error to warn.
This is caused by an i2pd bug, already fixed.
2015-02-06 11:18:20 +00:00
zzz
b9197e35b5 NetDB: Reduce max job lag for floodfill, was far too high 2015-02-06 00:51:32 +00:00
zzz
e431be2cbe NTCP minor cleanups, javadocs, atomics 2015-02-06 00:49:21 +00:00
zzz
761c883c1f Add event log for reachability change 2015-02-06 00:47:41 +00:00
zzz
60f86f342b Decrease DH refiller initial delay and increase buffer size
to reduce chance of running out on high-bandwidth routers
2015-02-06 00:46:13 +00:00
zzz
1234b6b148 stat tweak 2015-02-06 00:45:24 +00:00
6f45242fc8 Plugin SU3 cert for str4d@mail.i2p 2015-02-04 23:03:42 +00:00
zzz
36c45ccb7b Console: Show UPnP status even if disabled (ticket #1459) 2015-02-04 16:11:17 +00:00
zzz
90cf71b5bc rename headers after review 2015-02-04 11:54:18 +00:00
zzz
7165dc7860 NetDB: Don't flood an RI back to itself. While Java ffs self-flood,
other implementations may not.
2015-02-01 19:57:18 +00:00
zzz
5491287931 OCMOSJ: Pick a OB tunnel at random, not with the OBEP closest
to the lease, as that may be reducing the odds of trying a
different path and hurting connection reliability.
While the change may slightly increase connection congestion,
if it helps with reliability then it's worth it.
2015-02-01 19:53:11 +00:00
zzz
7256096b8a Router: Call warmupCrypto() earlier in the initialization, so it
actually happens before some other thread needs the crypto
2015-02-01 19:49:25 +00:00
zzz
b6008b5414 Crypto: Catch IAE in generateCertificate() 2015-02-01 19:47:09 +00:00
zzz
1042d21278 log tweak 2015-02-01 14:07:56 +00:00
zzz
47eff7ee86 PRNG: Don't hang forever at startup waiting for SecureRandom init 2015-01-31 17:37:59 +00:00
zzz
3da850a6b9 bump -17 2015-01-31 15:20:37 +00:00
zzz
a1358deda2 private method 2015-01-31 15:16:42 +00:00
zzz
df0bbfd615 Netdb: Encrypt lookups for 32-bit x86 also 2015-01-31 15:13:52 +00:00
zzz
0568ac3aa5 javadoc 2015-01-31 15:13:04 +00:00
zzz
e63a69170e Transport: set 4 MBps max bw due to bloom filter 2015-01-31 15:12:21 +00:00
zzz
711f8dedd9 console: disable changing log path 2015-01-31 15:10:45 +00:00
zzz
09c3737a94 reduce log level 2015-01-31 12:53:49 +00:00
zzz
9384424173 disable floodfill in laptop mode 2015-01-31 00:12:25 +00:00
zzz
4936f08212 Console: Don't display invalid IPv6 addresses as options on /confignet 2015-01-30 17:26:45 +00:00
zzz
03f4ebbe35 add throttle stat 2015-01-30 16:17:39 +00:00
zzz
0671785ab2 NTCP: Throttle event pumper if looping too fast (tickets #551, #1075, #1411)
This is just a simple workaround, root cause unknown.
May need tuning.
2015-01-30 16:00:45 +00:00
zzz
381dbc4b4a Proxy error page tweaks 2015-01-30 15:55:12 +00:00
zzz
84cf531f5f SSU: Fix transition from firewalled to non-firewalled 2015-01-29 22:23:28 +00:00
zzz
175806115b SSU:
- Sort introducers in router address, so we won't force a republish
due to a different ordering of the same introducers
- Don't publish an address if we need introducers but don't have any,
so the user won't see a 'firewalled with inbound NTCP enabled' message
2015-01-29 20:34:49 +00:00
zzz
86b45ab1e5 SSU: Fix replaceExternalAddress churn when firewalled,
caused by change in 0.9.17 removing IP/port from published address
when firewalled. We must now keep a local unpublished address
also, containing the detected IP/port.
2015-01-29 15:53:04 +00:00
zzz
17939036bc move comparators to their own class 2015-01-29 12:52:46 +00:00
zzz
5bf515441e Router: Ensure nonzero tunnel IDs 2015-01-28 21:43:27 +00:00
zzz
06edb9f2a6 Router: Stub out capabilities P and X (ticket #1447) 2015-01-28 18:07:45 +00:00
zzz
33b58f5fab UPnP:
- Callback when device removed
  - Consolidate callbacks
  - Clear ignored devices after primary device removed
    to allow one to be promoted on rescan
2015-01-28 17:38:52 +00:00
zzz
47a012a4dd initialize blocklist sooner 2015-01-28 17:36:53 +00:00
zzz
e5801be43e only use valid IP for geoIP 2015-01-28 16:25:50 +00:00
zzz
d5a6ac591c more UPnP locking fixes 2015-01-28 16:25:08 +00:00
zzz
59373f9bdf UPnP:
- Rescan for devices periodically and when reachability changes (tickets #661, #959)
  - Don't put "I2P" in registered protocol name
  - Add uptime to UPnP info
  - HTML escaping
  - Remove static log on Android
  - Javadocs and cleanups
2015-01-28 15:04:59 +00:00
zzz
5da492b9e5 spelling 2015-01-19 12:44:31 +00:00
zzz
9bcc951f10 i2psnark: Skip incompatible welterde tracker if we are ECDSA 2015-01-11 18:21:45 +00:00
zzz
3270ba840e I2PTunnel: Add option for multihoming optimization 2015-01-11 17:36:39 +00:00
zzz
45b3e44cc2 NetDB: Stubs for bandwidth estimation during reseed (ticket #935)
Incomplete and may not ever be, for evaluation only.
2015-01-10 16:51:13 +00:00
zzz
7ed855b2d2 NetDB: Publish RI faster when costs change (ticket #1437)
PLRIJ interval was 37-50 minutes. Reduce that by 4x,
but for 3 out of 4 times, only publish if something changes,
including cost. 4th time, always publish, as before.
This will hopefully reduce routers getting slammed to
conn limits on a transport.
2015-01-09 17:03:33 +00:00
zzz
f08552c2d1 javadocs 2015-01-09 16:58:57 +00:00
zzz
9a4c19b24b reduce log level 2015-01-08 19:32:42 +00:00
zzz
690b695373 remove jisko.i2p, down since 2014-11-08 2015-01-08 18:21:11 +00:00
zzz
65348b2365 more renaming 2015-01-08 18:20:08 +00:00
zzz
285c13d900 fix reseed checking at startup, broken in previous checkin 2015-01-07 23:15:10 +00:00
zzz
0a938d9048 Router: Don't reset uptime after a soft restart
Tunnels: Temporarily increase exploratory tunnel quantity at startup,
so that netdb refresh will work better
2015-01-07 20:11:04 +00:00
zzz
a02a265802 trim all xml news data 2015-01-07 19:55:37 +00:00
zzz
eeeeef81cf NetDB: Possible fixes for reseed completion not recognized (ticket #1384) 2015-01-07 19:16:55 +00:00
zzz
bcb9fe5f24 Startup: Accept tunnels after 10 minutes instead of 20 (ticket #1152) 2015-01-07 19:14:44 +00:00
zzz
37f34d83f8 Router: Add startup/shutdown state machine
Tunnels: Cleanup, catch more cases of zero-hop configuration
ClientAppConfig: Start i2ptunnel sooner
  Since BuildRequestor won't use a zero-hop exploratory as a paired tunnel
  for client builds, it's now safe to start client tunnels
  before the expl. tunnels are ready. This will save up to 90 seconds.
2015-01-07 17:54:21 +00:00
zzz
b3238079c3 reorder 2015-01-06 14:39:14 +00:00
zzz
ee1edb3383 renaming 2015-01-06 14:10:25 +00:00
zzz
7767430af2 EepGet: Fix PcapWriter 2015-01-05 17:05:36 +00:00
zzz
2e5185aa99 EepGet: Change command line default to 0 retries 2015-01-05 15:22:32 +00:00
zzz
6e847a4cc4 Streaming: Add API for sending/receiving payload in ping/pong 2015-01-05 15:09:12 +00:00
zzz
045f6dccf8 Latency reduction all over:
- SSU: Reduce ack delay
- Streaming: Reduce min RTO and flusher delay
- Tunnels: Reduce GW batching time
2015-01-05 13:19:34 +00:00
zzz
d7895a456a minor optimization 2015-01-05 13:17:59 +00:00
zzz
7753d05b61 UrlLauncher:
- Configure browser with routerconsole.browser (ticket #1159)
- Convert to ClientApp interface
2015-01-05 12:42:39 +00:00
zzz
043b4776c3 move port under interface in form 2015-01-05 12:40:46 +00:00
zzz
5db764de5f Blocklist:
- Rewrite to read and merge multiple files
- Include in update, use version in base dir too
- Increase limits
- Bug fixes
2015-01-05 12:38:38 +00:00
zzz
3ae846a713 m4b mime type 2015-01-03 14:15:48 +00:00
zzz
927e29b8ef I2PTunnel: Persist leaseset keys
I2CP: Use configured leaseset keys if available
2015-01-03 13:32:24 +00:00
d271411552 Added Dock fix for Mac OSX 10.10 2015-01-03 01:51:32 +00:00
31d98ac4a5 new reseed host 2014-12-30 02:18:30 +00:00
78f4cc8e30 Add two certs to deletelist (missed in last commit) 2014-12-22 16:27:58 +00:00
cce30a8f42 reseed changes
- cowpuncher is moving to rows.io
- (temporarily) disabling 193.150.* due to downtime
- removing unnecessary certs
2014-12-21 20:41:34 +00:00
zzz
a9e928fb46 Eepsite help: Removed statements requiring dest to end in AAAA.
Translations updated also, but may need some further fixup.
2014-12-19 14:14:04 +00:00
zzz
60017f7c55 Crypto: Stubs for encryption key types 2014-12-17 14:41:24 +00:00
zzz
eb46f74e24 I2CP: Don't log full session config on error 2014-12-17 14:30:11 +00:00
5e890bd781 checkremotecerts.sh: torify was recently deprecated and now is just an alias pointing to
torsocks, so let's use torsocks directly
2014-12-15 15:18:19 +00:00
zzz
20facf78d0 bump -3 2014-12-15 14:51:34 +00:00
zzz
96db43cc8e unchoke new peer faster 2014-12-15 14:43:37 +00:00
zzz
ab4f209c10 remove xml stats link 2014-12-15 14:40:38 +00:00
zzz
fa51a0aef4 enhance logging for inproxy rejections 2014-12-15 14:40:00 +00:00
zzz
aa6a5e053c raise max concurrent tunnel builds 2014-12-15 14:38:33 +00:00
zzz
03df6c2ba0 less casting 2014-12-15 14:38:07 +00:00
501f645e60 disabling reseed host i2p-netdb.innovatio.no: unresponsive hoster + config issues.
Could be re-enabled when/if problems are fixed.
2014-12-14 23:32:11 +00:00
zzz
23534b31c6 SU3File: Infer SigType from private key when signing,
Change default to RSA 4096
SigUtil: Add conversion methods for Java keys with unknown types
2014-12-14 17:52:23 +00:00
zzz
d35363cdbc SU3File: Fix getContentOffset(); fail on excess data after sig 2014-12-14 15:52:44 +00:00
zzz
ba34c90b7f EdDSA cleanup, another null resource check 2014-12-13 20:56:49 +00:00
94a19171ed reseed server and comment updates 2014-12-13 18:54:28 +00:00
8099591589 correct certificate line endings 2014-12-13 18:38:41 +00:00
df6bbc59b3 update of reseed ssl certificates:
The webpack* and cloudflare* certificates are for ssl.webpack.de and
cowpuncher.drollette.com, respectively.  I'm removing the smartcom.org
certificate because it's unused.
2014-12-13 18:29:12 +00:00
zzz
05a616aa0d SU3File: Implement 'extract -k' 2014-12-11 20:58:04 +00:00
zzz
c84105e783 add cacert cert to deletelist 2014-12-10 17:57:16 +00:00
zzz
262721cc90 SSU: reduce log level of uncaught errors processing I2NP message 2014-12-10 17:56:37 +00:00
c24168d5cd remove unused and weak md5 certficate 2014-12-10 14:39:44 +00:00
zzz
4e529a68d3 Console: Prevent two-word translations from splitting across lines in summary bar 2014-12-09 15:16:41 +00:00
4f3244e93b add new, stronger certificate for netdb.i2p2.no
The old certificate will not be replaced on the server yet.  The old cert is
SHA/1024-bit. New cert is SHA256/2048-bit key.
2014-12-08 23:50:06 +00:00
zzz
b2e17916e4 HTTP Proxy: Fix parsing of ECDSA address helper,
ignore '=' when comparing, reindent test
2014-12-08 14:12:00 +00:00
zzz
57ac344e7f show infohash in upper case 2014-12-08 14:08:45 +00:00
zzz
98e275d908 javadoc typo 2014-12-08 14:05:35 +00:00
zzz
8420b6c715 NetDB: Increase lookup throttle time 2014-12-08 14:05:08 +00:00
3dfcb2d5cc (temporarily?) disable jp.reseed.i2p2.no (ticket #1422), add a note that netdb.i2p2.no is currently v3 only 2014-12-07 15:42:57 +00:00
zzz
540720a912 unit test fixes 2014-12-05 16:18:25 +00:00
zzz
f86200e3ae history for prop, -1 2014-12-05 15:37:01 +00:00
zzz
9e43618028 Plugins: More thread group debugging for isRunning check;
Don't count Jetty RolloverFileOutputStream in the thread group,
to fix restart of a plugin
2014-12-05 15:35:38 +00:00
zzz
aacdba1bc7 KeyGenerator: main() test improvements
Allow specification of sig types on command line
2014-12-05 15:32:34 +00:00
zzz
c28d060d52 Update: Use last-modified instead of last-checked for the next
if-modified-since fetch, to fix failing to fetch the latest news
2014-12-05 15:30:53 +00:00
zzz
bf3fdbb1ab Increase default class O conn. limits to 350 NTCP, 1050 SSU 2014-12-05 15:27:24 +00:00
zzz
0a7a637d46 javadocs 2014-12-05 15:21:45 +00:00
zzz
e842165265 more argument checking, javadocs 2014-12-05 15:21:26 +00:00
zzz
2db82da910 cleanup 2014-12-05 15:19:26 +00:00
zzz
9953bc3024 javadoc 2014-12-05 15:18:24 +00:00
zzz
2ba4992d88 propagate from branch 'i2p.i2p.zzz.test2' (head 0feb2e6806927f68c7333aaa0892de185bb2629c)
to branch 'i2p.i2p' (head 0482fa843cb1e9d7ec281440056eef3a0ab07bdb)
2014-12-05 15:14:40 +00:00
zzz
5e67008d26 I2PTunnel: Reduce i2ptunnel threads, more thread pooling.
Big savings is on client side (two less threads per connection)
 - Move client pool from static inI2PTunnelClientBase to TCG.
 - Use client pool for some server threads
 - Run some things inline that were formerly threads
 - Client-side I2PTunnelRunner thread used to do nothing but start 2 more
   threads; now it runs one inline (like we do for server-side HTTP)
 - Javadocs and cleanups
Was originally intended to reduce load for high-traffic servers
but most of the savings for now is on the client side.
Ref: http://zzz.i2p/topics/1741
Todo: Figure out how to run the HTTP client-side gunzipper inline too
Todo: More server-side improvements

---

Client side:

before:
4-5 threads, 1-2 pooled

  I2PTunnel Client Runner (BlockingRunner from client pool)
      starts I2PTunnelRunner or I2PTunnelHTTPClientRunner and exits
          starts StreamForwarder toI2P and waits
          starts StreamForwarder fromI2P and waits
              starts HTTPResponseOutputStream (HTTP gunzip only) (from client pool)
now:
2-3 threads, 1-2 pooled

  I2PTunnel Client Runner (BlockingRunner from client pool)
      runs I2PTunnelRunner or I2PTunnelHTTPClientRunner inline
          starts StreamForwarder toI2P and waits
          runs StreamForwarder fromI2P inline
              starts HTTPResponseOutputStream (HTTP gunzip only) (from client pool)

---

Server side:

before:
1-4 threads, 0-1 pooled

  Server Handler Pool (Handler from server pool) execpt for standard server, blockingHandle() inline in acceptor
      starts I2PTunnelRunner or CompressedRequestor and exits
          starts StreamForwarder toI2P and waits   (inline for HTTP)
          starts StreamForwarder fromI2P and waits  (except not for HTTP GET)

now:
1-4 threads, 0-2 pooled

  Server Handler Pool (Handler from server pool) execpt for standard server, blockingHandle() inline in acceptor
      starts I2PTunnelRunner or CompressedRequestor and exits (using client pool)
          starts StreamForwarder toI2P and waits   (inline for HTTP)
          starts StreamForwarder fromI2P and waits  (except not for HTTP GET)
2014-12-05 15:12:51 +00:00
zzz
e7b50c5940 reduce auto-stop threshold again 2014-12-02 15:23:50 +00:00
zzz
78d7277298 show b32 for local leasesets too 2014-12-02 15:11:12 +00:00
zzz
fb641187b8 use new getVersion() 2014-12-02 13:42:58 +00:00
zzz
4b2715c36f RouterInfo: Add convenience method getVersion() 2014-12-02 13:30:31 +00:00
zzz
f1e9f5d4fd DatabaseStoreMessage: Mask the unused bits in the type field,
in case we ever want to use them for options
2014-12-02 13:28:48 +00:00
zzz
2d43d349ab add more invalid ports 2014-12-02 13:22:26 +00:00
zzz
7ab6708a3c 0.9.17 2014-11-30 16:41:57 +00:00
7010d9b524 really bump 2014-11-28 20:43:42 +00:00
947a3a2181 bump build (-11-rc) 2014-11-28 20:42:33 +00:00
0ff87ef8cb merge of '3e6cfe9a01136316f39f1bd294a515e6bc91ff8e'
and 'b4b595d294ace07f7fde583957d8e00e96af347c'
2014-11-28 20:39:57 +00:00
ec20150ffd geoip updates (2014-11-05) 2014-11-28 19:29:16 +00:00
30876a9cd3 PO files pulled from tx 2014-11-28 19:25:26 +00:00
zzz
1773fc0e0d Add more clues to file locations in default config files 2014-11-28 14:23:34 +00:00
zzz
6d6f7fb89b Data: Disallow duplicate keys in a Mapping 2014-11-28 13:45:33 +00:00
zzz
449ce3176e propagate from branch 'i2p.i2p' (head b4b595d294ace07f7fde583957d8e00e96af347c)
to branch 'i2p.i2p.zzz.test2' (head 90c482d231ea639bff8d37d390dac081e361f48f)
2014-11-28 13:13:00 +00:00
zzz
be8832e87f link to Russian version of ECDSA help page 2014-11-27 18:17:07 +00:00
zzz
5999690665 link ECDSA warning to wiki help page 2014-11-27 12:55:16 +00:00
zzz
285fa6cbc9 BuildRequestor: Reduce delay when client build can't find
a paired tunnel (possible fix for ticket #1412)
2014-11-26 17:32:56 +00:00
zzz
9700f30c35 Tunnels: Disallow changing allowZeroHop setting for exploratory 2014-11-26 16:18:37 +00:00
zzz
a38bd0b5cf Data: Fix NPE on unknown sig type in destination
Fix hashcode and equals for typed data
2014-11-26 16:06:09 +00:00
zzz
5383f9f097 Profiles: Change slice selection argument from an int to an enum for clarity 2014-11-25 14:25:42 +00:00
zzz
a16d17c422 SusiMail: Add save-as button
Fix encoding for filename in Content-Disposition header
New icon from Silk, same license as the others
2014-11-24 18:36:16 +00:00
zzz
5f2b620819 PrivateKeyFile: Don't rewrite file in main() if no options 2014-11-24 14:26:53 +00:00
zzz
fd47cb88de i2ptunnel: Fix automatic setting of random key 2014-11-24 14:15:44 +00:00
zzz
77e7982e74 Drop i2p.feared.eu ssl cert for reseed 2014-11-23 14:24:22 +00:00
zzz
04cd1cedda Reseed update from backup@mail.i2p:
please commit some updates for my reseed servers: Add new ssl-certs:
	ieb9oopo.mooo.com2.crt	-->  certificates/ssl/	
	link.mx24.eu.crt	-->  certificates/ssl/

The first one is a new ssl-cert as exchange for the current one.
On http-server side the exchange will take place sometimes next year,
until then the current existing ieb9oopo.mooo.com.crt is still valid.
The second is a new reseed server from me.

Reseeder.java: Please add to DEFAULT_SSL_SEED_URL:	
	https://link.mx24.eu/
with this comment:	
	// Only HTTPS and SU3 (v3) support

Also the list can be cleaned up from these other dead servers:
2014-11-23 14:18:29 +00:00
zzz
3ef89f49e7 SAM: Fix v3 bug accepting incoming connections
It was starting both the v3 and v1 acceptors.
2014-11-22 17:19:40 +00:00
zzz
2a681608b5 PeerSelector: If non-DSA, don't use incompatible peers
for exploratory tunnels or closest-hop in client tunnels
2014-11-22 14:05:06 +00:00
zzz
a52c06a6c6 point to Jetty 8 Javadocs 2014-11-22 13:17:39 +00:00
49b8a65ad9 Integer.compare() is 1.7 syntax 2014-11-21 22:52:19 +00:00
9781cb72ac Bump version 2014-11-21 13:11:47 +00:00
f7e83fb839 Require at least one update in a release 2014-11-21 13:09:58 +00:00
ce2a2cf684 Only need one torrent magnet; tighten update type spec 2014-11-21 13:02:57 +00:00
c88fa70f82 Cleanups 2014-11-21 12:52:24 +00:00
f76744a0c0 Improved SU3 news file specification 2014-11-21 12:46:33 +00:00
zzz
31cc0764a9 Logger: Configurable flush interval 2014-11-18 14:49:23 +00:00
zzz
15137d9b62 NetDB: Exclude A1/A2 "countries" from auto-floodfill 2014-11-17 14:19:00 +00:00
zzz
8f8adfa39e propagate from branch 'i2p.i2p' (head bde4ef3680071b416b3528bad4c16245964f432a)
to branch 'i2p.i2p.zzz.test2' (head 183d2a30edd10165451d0cbbf75636f3b1dfda16)
2014-11-15 17:48:39 +00:00
zzz
5044f3e58f I2NP:
Move some data structures away from ByteArray; offsets were always zero
  - New BuildRequestRecord constructors
  - BuildRequestRecord field becomes final byte[222]
  - IV becomes byte[16]
  - Build record becomes EncryptedBuildRecord
Remove extra copy in BuildRequestRecord.encryptRecord()
Remove unused BuildRequestRecord.readOurIdentityMatches()
2014-11-15 17:48:11 +00:00
zzz
279e102d7a I2NP:
- Set lookup type flags even if no reply tunnel specified
- Reduce object churn when writing some messages
2014-11-15 17:45:14 +00:00
7f72830ec8 JavaDoc fixes 2014-11-14 22:00:51 +00:00
2caaad95ec Comment out not yet implemented tests 2014-11-14 21:52:47 +00:00
09b995aca6 BigIntegerFieldElement.isNonZero() tests 2014-11-14 21:51:53 +00:00
a0bf8433e4 Tests: copy the EdDSA test.data file to where the classloader can find it 2014-11-14 21:16:28 +00:00
zzz
9104bd7304 Tests: Copy the new EdDSA test vectors
to where the classloader can find them.
Throw a better error message if not found.
2014-11-14 16:44:04 +00:00
zzz
2f2aa7f5a8 I2PTunnel:
- Fix bug that left server acceptor thread running after close
- Add destroy() methods to release all resources when closing a tunnel for good,
  particularly the streaming timer threads
- Use COWAL to prevent concurrency problems
- Javadocs
Streaming:
- Don't return null from accept() any more; actually throw
  ConnectException as the javadocs have always specified
- Throw ConnectException from accept() if interrupted; previously caught and ignored
- Throw exceptions from ConnectionHandler.accept(), not higher up
- Close ServerSocket when ConnectionManager is shut down
- Synchronize setActive(), clear queue when starting to accept,
  better handling of calls that don't change state
- Javadocs
ConfigClientsHelper: Call isPluginRunning() less often
PluginStarter: Simplify detection of active threads

Above changes mostly in support of zzzot plugin implementing ClientApp
and being able to shut down completely so there are no threads
in its thread group, so /configclients will all show status as stopped.
Previously, the I2PTunnelServer acceptor thread and
one or more streaming timer threads would remain.
2014-11-13 20:12:55 +00:00
0773a30578 add hamcrest-all to classpaths and minor formatting fixes 2014-11-12 17:42:50 +00:00
962f5efe6b merge of '1e0d390eeacce432f968251f1bbbe03ef031a116'
and 'f61d617d9bfd5759366102b0b5ff45effde08e84'
2014-11-12 14:52:52 +00:00
6dc3cd9650 build.xml: signing
- move signing to ant macros so they can be used by multiple build targets
- add support for signed devbuilds
- add support for generating i2pseeds.su3 (for testing)
2014-11-12 14:51:27 +00:00
zzz
397ae536f9 Data: Clear more caches when under memory pressure and at shutdown 2014-11-12 14:44:49 +00:00
zzz
f19ec4bd44 Plugins: Fix bug in stopping a ClientApp plugin with $parameters in the args 2014-11-12 14:38:13 +00:00
fd7e549915 Added EdDSA tests
Source:
https://github.com/str4d/ed25519-java
Git commit:
58e4efadf972f4dc4f67c05152f82b49fb22bac6
2014-11-12 10:21:46 +00:00
7a7ae77c83 Updated EdDSA code
Source:
https://github.com/str4d/ed25519-java
Git commit:
58e4efadf972f4dc4f67c05152f82b49fb22bac6
2014-11-12 10:20:28 +00:00
zzz
1a9fb381ed new su3 reseed cert (bugme/mooo.com) 2014-11-11 21:45:32 +00:00
zzz
ae7bfceafb snark tweaks 2014-11-11 14:26:23 +00:00
zzz
a961843aa6 bump -4 2014-11-10 16:27:53 +00:00
zzz
43c6a4ddac fix some issues with tracker config form 2014-11-09 14:33:26 +00:00
zzz
ae1d5648d5 Router, i2ptunnel: Add option for per-pool persistent random key,
so peer ordering does not change across restarts
2014-11-09 13:51:19 +00:00
zzz
2d3e8e0c4e disable spellcheck in custom options field 2014-11-09 13:46:47 +00:00
zzz
4691fc69d5 SSU: Fix bug preventing inbound connection from non-DSA router (ticket #1408)
Transports: If we are non-DSA, check for compatibility before connecting out
2014-11-08 18:01:13 +00:00
zzz
cb87f9f307 ProfileOrganizer: More efficient slice calculation,
don't pollute Hash cache
2014-11-08 17:57:17 +00:00
zzz
5f1e5bc271 Data: make getKeysAndCert() public 2014-11-08 17:53:55 +00:00
zzz
1c6d5ad2db EdDSA: Bump minimum router version to 0.9.17
due to previous bugs
2014-11-08 17:52:35 +00:00
zzz
555189f123 i2psnark: Add support for specifying data dir in add form (ticket #1028) 2014-11-08 17:50:27 +00:00
zzz
049044b827 javadoc fix 2014-11-08 17:47:51 +00:00
zzz
cfd9e2c3ab Fix compile error; history for prop; -2 2014-11-06 18:09:14 +00:00
zzz
a0b457b9a1 propagate from branch 'i2p.i2p.zzz.test2' (head 9dca19f228a66b5ac646c3d97d4f018c733081de)
to branch 'i2p.i2p' (head e7f2b0990f1ff9ab0e0d8633ac2faf35a993b917)
2014-11-06 17:53:02 +00:00
zzz
23f24c7d39 javadoc 2014-11-06 17:50:47 +00:00
zzz
6112cc5a38 i2psnark:
- Add new opentrackers, remove welterde
  - Support multiple default opentrackers
  - Don't link to opentrackers at the top
2014-11-06 17:45:06 +00:00
zzz
7deb8c1bcb Console: Don't disable updates when restarting from /configupdate
Recognize router.newsRefreshFrequency=0 as "never"
2014-11-06 16:41:29 +00:00
zzz
76e4b49d9d Transports: Consolidate port checking code
Disallow SSDP port
2014-11-06 15:20:24 +00:00
5ae267a8a2 EdDSA bugfixes 2014-11-06 03:02:25 +00:00
zzz
f524351041 Console: Add ECDSA warning to sidebar 2014-11-05 17:20:45 +00:00
zzz
893d1bb45f Job Queue: Only drop lookup jobs if lagged 2014-11-05 16:59:19 +00:00
zzz
945988dfb7 i2psnark: Fix NPE when deleting torrent if the data directory
was deleted out from under us (ticket #1407)
2014-11-05 16:39:54 +00:00
zzz
62698664a2 SU3 News: Blacklist HTML event-handler attributes in content 2014-11-05 16:04:21 +00:00
zzz
0d2892c75d SSU: Fix corruption of ack-only packets containing bitfields
Full acks were included in the bitfield portion, which
ran over and appeared to be fragments.
Also clean up setting bytes with initial data, for clarity.
2014-11-04 14:51:31 +00:00
zzz
ecc72e6825 SU3 News: Add echelon cert, change default URL 2014-11-04 13:56:46 +00:00
zzz
531d520ceb Blockfile:
- Add block size to superblock
 - Add span size to skiplist block
 - Bump version to 1.2
2014-11-02 19:37:23 +00:00
zzz
4e72e150ad reduce log level of expired certs on android 2014-11-02 17:36:28 +00:00
zzz
b28628b8e1 Console: Log warning if no pack200 2014-11-02 16:42:35 +00:00
zzz
702830ad0e Reseed: SSL only by default 2014-11-02 16:16:01 +00:00
zzz
6ca0c54ba7 i2ptunnel:
ECDSA default for all new server tunnels
ECDSA default for streamr client tunnels
Fix display of server destination on edit page when not running (privkey file path wasn't absolute)
Fix display of persistent client key b32 on edit page when not running
Fix display of server sig type on edit page when we have a privkey file
Add KeysAndCert.getSigType()
Javadocs
2014-11-02 15:23:13 +00:00
zzz
634bf5f7e3 0.9.16
Fix history.txt UTF-8 breakage
Javadoc fixes after review
2014-11-01 18:50:26 +00:00
zzz
2284c963af drop dummy crypto stubs 2014-11-01 15:52:02 +00:00
zzz
ad2052395f bump -19-rc 2014-10-31 12:47:35 +00:00
e9a1dbf8f1 merge of '3baf6884e9804b23ac99e38fb031fc6c04b6134a'
and '995a4e27dc6bd096a6eb83acfc9e2e09c9cb61aa'
2014-10-31 02:03:44 +00:00
703b21e89b Eclipse classpath fix 2014-10-31 01:58:27 +00:00
36ea2cca6b Removed 20 unnecessary variable definitions from multiply()
Android build tools 21.0.* caused dalvikvm runtime errors before this change.
2014-10-31 01:58:05 +00:00
zzz
8b2cf770a5 bump -18-rc 2014-10-30 20:51:28 +00:00
zzz
7d6d801943 merge of '76a3db43068c5b8578dfad10bf0dad884846f608'
and 'feed7db1184a2b8a06ddf35d45dc0e993895e2be'
2014-10-30 20:50:03 +00:00
d705b43f3a update en po files before pushing to tx 2014-10-30 20:11:11 +00:00
a18ed194cb update debian changelog 2014-10-30 20:09:13 +00:00
a3e4293fd8 geoip updates 2014-10-30 20:03:13 +00:00
df144d8434 Arabic, Chinese, Czech, Dutch, French, German, Russian, Spanish updates from Transifex 2014-10-30 20:01:45 +00:00
zzz
bab1e05235 Router: Fix rare NPE building garlic message (ticket #1403) 2014-10-30 15:14:52 +00:00
zzz
a1fdd41b0e SU3 News: Tweaks after testing
Console /debug: Move DHT section to bottom
2014-10-29 15:34:52 +00:00
zzz
60d9c1651a SU3File: Show content and file types in showversion 2014-10-29 14:31:14 +00:00
zzz
ec1380dfa1 i2psnark: Convert '+' to ' ' in magnet dn param 2014-10-29 14:11:41 +00:00
zzz
798275608e jbigi: Save and report extracted library name 2014-10-28 14:50:40 +00:00
zzz
0f2affd414 SSU: Don't publish direct info if introducers are required 2014-10-28 14:00:37 +00:00
zzz
7695b51d89 Make recognition of a hidden router consistent,
whether specified in the caps or the cert
2014-10-28 13:50:09 +00:00
zzz
fb99122d83 log Java 6 warning 2014-10-28 13:18:48 +00:00
zzz
6d53838e20 javadoc clarification 2014-10-28 13:18:27 +00:00
zzz
ec3fd9a7d7 null check in zip entry name 2014-10-28 13:17:20 +00:00
zzz
304f2ebb7b dont OOM when thread dies 2014-10-28 13:16:20 +00:00
zzz
4976e84488 use recent method 2014-10-28 13:13:40 +00:00
zzz
2ebacb1b9b fix static access 2014-10-28 13:11:39 +00:00
zzz
d085f9ea66 SSU: Fix ACK Sender thread dying on corrupt packet 2014-10-26 22:09:38 +00:00
zzz
e275117569 i2ptunnel: Fix description entered via wizard 2014-10-24 14:25:33 +00:00
zzz
eae277fb77 dont add whitespace to XHTML output 2014-10-24 14:11:40 +00:00
zzz
d7130c15cc SSL: Don't prohibit SSLv3 ciphers if that's all we have 2014-10-23 15:32:07 +00:00
zzz
937a17c5dd SessionKeyManager:
- Raise inbound limit
- Delete oldest tagsets when limit is hit
- Don't delete recent tagsets when limit is hit
- Log tweaks
2014-10-23 15:31:00 +00:00
zzz
b6234e1d5e javadoc fixes 2014-10-23 15:26:03 +00:00
zzz
7955b8ae71 SU3 News: Fix parsing of the XHTMl nodes 2014-10-22 18:20:31 +00:00
zzz
a36ef62358 SU3 News:
- Fix SU3File support (tested)
 - Finish implementation (untested)
 - Output metadata as comments in news.xml
 - Support signed HTML
 - Copy router certs to news
2014-10-22 16:07:18 +00:00
zzz
bcbda3cd27 SSU: Don't resend ACKS that are too old (ticket #772)
untested
2014-10-21 18:37:11 +00:00
zzz
239fe518a9 Update: Partial implementation of su3 news with atom feed.
No spec yet, just followed str4d's testnews.atom.xml proposal.
Atom parsing is tested, su3 part is incomplete and untested.
Todo: add spec to http://i2p-projekt.i2p/en/docs/spec/updates,
finish su3 and test.
2014-10-21 18:35:06 +00:00
zzz
44d6e117d5 Console and Eepsite Jetty:
Switch back to QueuedThreadPool (ticket #1395)
In Jetty 5/6, the default QTP was not concurrent, so we switched to
ThreadPoolExecutor with a fixed-size queue, a set maxThreads,
and a RejectedExecutionPolicy of CallerRuns.
Unfortunately, CallerRuns causes lockups in Jetty NIO.
In addition, no flavor of TPE gives us what QTP does:
- TPE direct handoff (which we were using) never queues.
  This doesn't provide any burst management when maxThreads is reached.
  CallerRuns was an attempt to work around that.
- TPE unbounded queue does not adjust the number of threads.
  This doesn't provide automatic resource management.
- TPE bounded queue does not add threads until the queue is full.
  This doesn't provide good responsiveness to even small bursts.
QTP adds threads as soon as the queue is non-empty.
QTP as of Jetty 7 uses concurrent.
QTP unbounded queue is the default in Jetty.
So switch back to QTP with a bounded queue, which does what we want,
which is first expand the thread pool, then start queueing, then reject.

ref:
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html
https://wiki.eclipse.org/Jetty/Howto/High_Load
2014-10-20 14:01:36 +00:00
zzz
8a12b7cb41 snark HTML fix 2014-10-18 15:22:39 +00:00
zzz
4d4308c486 NTCP: Deadlock fix 3rd try (ticket #1394) 2014-10-17 14:15:40 +00:00
zzz
abcdcf2e8c log tweaks (SSU) 2014-10-16 20:38:12 +00:00
zzz
44b753d1e5 NTCP: Deadlock fix 2nd try (ticket #1394) 2014-10-16 20:21:03 +00:00
zzz
83b3f242a9 Console, I2CP, i2ptunnel, SSLEepGet: Set allowed SSL protocols and ciphers 2014-10-15 20:44:23 +00:00
zzz
86c43f4734 propagate from branch 'i2p.i2p' (head b82e829752729679ee6b9ece7ce8c7279c70aedf)
to branch 'i2p.i2p.zzz.test2' (head 8e441b5ba1384e499901127e10ab79b96f0f0cb5)
2014-10-14 16:47:50 +00:00
zzz
be0cb84f97 Util: Use write-sync-close-rename for config file writing 2014-10-14 16:47:41 +00:00
zzz
3bea7f5ad5 drop unused HarvesterJob 2014-10-14 16:32:41 +00:00
zzz
266a20d55e I2NP: Implement DatabaseLookupMessage search type field,
to replace all-zeros hash, and ease implementation for
separate LS and RI databases, as documented in i2np spec.
2014-10-14 13:57:02 +00:00
zzz
d2c6a80d24 i2ptunnel: Set default sig type to ECDSA P256 for client tunnel
types Standard, IRC, and Socks IRC, if non-shared.
2014-10-13 16:46:58 +00:00
zzz
cd51fbc2a6 doc fix 2014-10-13 16:46:43 +00:00
zzz
73256f6030 Move BundleRouterInfos out of router.jar 2014-10-10 19:40:49 +00:00
zzz
e081f94d9f GeoIP:
- Don't rate peers in some countries as high capacity
   - Don't enable auto-floodfill in some countries
   - Don't prefer floodfills in some countries
2014-10-10 15:26:17 +00:00
zzz
e96cc09d75 Banlist: Remove unused banlist tracking in the profile causing deadlock (ticket #1394) 2014-10-10 15:21:10 +00:00
zzz
d87178fec3 UPnP: Comment out unused parsers 2014-10-08 17:47:19 +00:00
zzz
28ad95f892 findbugs all over 2014-10-07 14:59:49 +00:00
zzz
8270a92a44 SSU: Improve handling of socket that gets closed (ticket #1385) 2014-10-07 12:09:10 +00:00
zzz
088290c544 Startup: Delay ReadConfigJob another minute
- code cleanup
2014-10-07 12:04:55 +00:00
zzz
6685acfef4 i2ptunnel: Handle named sig types from i2ptunnel.config in the GUI 2014-10-07 12:03:00 +00:00
zzz
1d1a05ee7b log tweak 2014-10-07 11:57:03 +00:00
zzz
bbeb429a59 Graphs: Catch an error caused by missing fonts 2014-10-07 11:56:18 +00:00
zzz
55af588c2c CPUID: Remove Intel model 2 again, this is spoofed in the VM 2014-10-07 11:49:51 +00:00
zzz
80d0313fe5 Crypto: EdDSA cleanup
- Remove duplicate load3 and load4 methods
 - Change load3 return type to int
 - Comment out dead stores
 - Re-roll the add, subtract, and negate loops;
   there's no speed benefit or timing reason to unroll them
 - Check for field already set
 - Remove shifts by 0
2014-10-05 12:11:21 +00:00
zzz
853d309960 i2ptunnel: Fix js confirm for delete button 2014-10-04 13:54:09 +00:00
zzz
564400597a i2psnark: Disable changing types for predefined trackers 2014-10-04 13:21:14 +00:00
zzz
1c2b6fc00e CPUID: Fix Intel processor identification 2014-10-03 17:45:34 +00:00
zzz
7b6f32e5b2 Console: New add-to-addressbook links on leaseset page 2014-10-03 17:44:24 +00:00
zzz
dd4acc88a1 i2psnark: Fix adding magnet links with % encoding (ticket #1391) 2014-10-03 17:40:19 +00:00
zzz
6e566f6e3d log tweak 2014-10-03 15:12:38 +00:00
zzz
fff7fbe121 Base64: Catch NPE on bad input to main() decode 2014-10-03 15:11:29 +00:00
zzz
a50afeb5d5 SAM: Fix v3 LS publish, broken in -4 (ticket #1390)
- code cleanup in direction handling
2014-09-30 12:17:56 +00:00
zzz
49eeb99d43 Logs: Fix displayed filename when empty (ticket #1386)
- More synchronization
2014-09-30 12:12:22 +00:00
zzz
bfd51097c9 i2psnark: Show subdirectory in table header on details page 2014-09-29 13:07:08 +00:00
zzz
a21e3cd842 CPUID:
- Fix main() model and family calculation
  - Add model string fetch from processor
  - AMD model string tweaks
2014-09-29 13:05:38 +00:00
zzz
0f298cf48e CPUID:
- Fix model and family calculation
  - Fix most AMD family 15 IDs
  - Add AMD Llano, Jaguar, Bulldozer 2
  - Add Intel Ivy Bridge, Haswell, Broadwell, Penryn, Pineview, Cedarview, Bay Trail, Avoton, and others
  - Set best-guess capabilities for most Intel processors
  - Supply best-guess model string in most cases
  - Processors listed above, and some others, may see crypto speedups as a result
  - Code cleanup, reduce number of JNI calls
  - Merge dup cases
  - Tab removal
  - Javadocs
2014-09-27 19:27:58 +00:00
zzz
4b074b8dcf I meant CREATE
SAM:
 - Don't publish LS for DIRECTION=RECEIVE
 - Set default tunnel name
2014-09-26 20:24:53 +00:00
zzz
2c79853ffe i2psnark:
- Increase default to 3 hops (ticket #966)
   - Reduce upload threshold for auto-stop
   - Revert addition of js mime type, it was already in the default
2014-09-26 14:24:21 +00:00
zzz
72f57255f0 Transport: Hooks for pluggable transports (ticket #1170) 2014-09-26 14:16:08 +00:00
zzz
1053bc8bb0 go back to release w/o geoip 2014-09-25 20:14:28 +00:00
zzz
4835e6fcb9 i2psnark:
- Show info hash on details page
 - Null storage check just in case
2014-09-25 20:11:47 +00:00
zzz
7ec02a1620 NetDB: Increase max age of RIs to reduce number refreshed after restart 2014-09-24 13:57:26 +00:00
zzz
10993cc6ef EdDSA: Use our PRNG by default for keygen 2014-09-24 13:54:33 +00:00
zzz
81409369bc measure keygen time in test 2014-09-24 13:46:38 +00:00
zzz
edb8590da8 move log outside synch 2014-09-24 13:45:50 +00:00
zzz
3a7bfd28fc snark: Don't enable sort-by-remaining link when complete 2014-09-24 13:44:55 +00:00
zzz
36fdb4ee2f Fix junit compile fails due to data structure moves 2014-09-23 14:15:27 +00:00
zzz
b06f772647 history for prop, -2 2014-09-23 13:23:04 +00:00
zzz
012cc740d6 propagate from branch 'i2p.i2p.zzz.test2' (head 6ccd9ca652057494bb2857e87636f18aadcd33f3)
to branch 'i2p.i2p' (head 376f751adc13923cdbf4f659c3f23ca957cf47b3)
2014-09-23 13:06:36 +00:00
zzz
1407cff49d fix anonymous proxy flag 2014-09-23 12:18:23 +00:00
zzz
3331e1c152 SSU: Return unused DH to the queue 2014-09-22 18:49:20 +00:00
zzz
591f48856d add sort links for details page
fix tooltips on images
2014-09-22 17:06:02 +00:00
zzz
479b9691fd snark sorters for details page
no links yet
2014-09-22 15:18:20 +00:00
zzz
0e48557b48 * SSU: Fix 100% CPU after socket failure
* UPnP: Catch reported error on FreeBSD
2014-09-22 13:22:35 +00:00
zzz
3fae6f06dd reduce object churn in ElG decrypt 2014-09-21 22:20:37 +00:00
zzz
7639c24bfe restore dh.calculateSessionTime stat 2014-09-21 21:54:31 +00:00
zzz
39fd1c3ab8 center icons in details first column 2014-09-21 16:12:46 +00:00
zzz
abf9dbae6d itoopie for update files 2014-09-21 15:51:53 +00:00
zzz
98062f830a 0.9.15 2014-09-20 19:17:58 +00:00
zzz
c259347917 javadoc fixes after review 2014-09-20 15:08:55 +00:00
zzz
9c4558d891 Catch SSU packet read errors in one place
IMS PartialBitfield tweaks
Log tweaks
2014-09-20 12:26:45 +00:00
zzz
9e7e2948e3 dont return next IV to cache 2014-09-20 12:20:08 +00:00
zzz
43430da25f bump for review -21-rc 2014-09-19 12:41:01 +00:00
zzz
eca7ac21a0 remove bogus check 2014-09-18 15:48:48 +00:00
zzz
bc463f6d0b NetDB: Don't auto-ff if ARM or ElG decrypt is too slow 2014-09-18 14:48:08 +00:00
zzz
ec2708a1fd Jetty 8.1.16.v20140903 2014-09-18 13:56:48 +00:00
zzz
082922de01 NTCP: Return unused DH keypairs to the pool 2014-09-18 13:32:27 +00:00
zzz
ea02a7c70b Transport DH:
- Add method to return an unused keypair to the pool
2014-09-18 00:16:39 +00:00
zzz
ab7e25bd52 NTCP EstablishState:
- Prep for future enhancements by refactoring to a state machine model
  - Reduce object churn; use SimpleByteCache
  - Synchronization
  - Define some constants
  - More finals
  - Log tweaks
2014-09-17 22:29:03 +00:00
d4876dd25e debian: add 0.9.14.1 changelog 2014-09-17 22:16:22 +00:00
89ee0bbab4 translation updates pulled from transifex (cs, es, fi, fr, ja, nb, pl, ro, ru,
uk), and English po file updates
2014-09-17 22:13:04 +00:00
06ae882064 geoip updates:
Updates to geoip.txt and geoipv6.dat.gz based on the Maxmind GeoLite Country
database from 2014-09-04.
2014-09-17 21:29:42 +00:00
zzz
6517fe7515 set default SSL outproxy 2014-09-17 14:19:25 +00:00
zzz
d510aad2ab fix class 2014-09-17 12:52:20 +00:00
zzz
3db297de95 * i2psnark:
- Forward port from trunk: Don't send HTML-only headers for icons (2nd try)
  - Consolidate HTML header code
  - Set no-cache headers
  - Don't set HTML headers for redirects
2014-09-17 02:21:31 +00:00
zzz
8688f26f15 * i2psnark: Don't send HTML-only headers for icons (2nd try) 2014-09-16 22:32:05 +00:00
zzz
85d38e7af2 I2PTunnelGUI: Deleted, moved to i2p.scripts 2014-09-15 19:17:24 +00:00
zzz
0448348154 javadoc fix 2014-09-15 18:30:59 +00:00
zzz
ceab4f1ffc improve efficiency of addressbook parser 2014-09-15 18:28:35 +00:00
zzz
3781b8db09 sanity check 2014-09-15 18:24:37 +00:00
zzz
7a450c526c exception tweak 2014-09-15 18:23:58 +00:00
zzz
c1e8ea0e4a RoutingKeyGenerator:
- Move from core to RouterKeyGenerator in router.jar
  - Leave RoutingKeyGenerator as a simple abstract class
  - DatabaseEntry now uses timestamp instead of mod data
    to determine if mod data has changed. Don't expose
    mod data to DatabaseEntry any more.
  - I2PAppContext.routingKeyGenerator() now returns null;
    you must be in RouterContext to get a generator.
2014-09-15 18:23:01 +00:00
zzz
f248a33eaa SSU:
- Fix IB ACKBitfield.highestReceived()
- More efficient OMS.acked()
- Log tweaks
2014-09-14 18:54:46 +00:00
zzz
67fb4e7007 SSU InboundMessageState.PartialBitfield, PacketBuilder:
- Add ACKBitfield.highestReceived() for efficiency
- Only write as many partial bitfield bytes as required,
  rather than 10 (for 64 bits) every time.
- Don't allow more than 10 bytes when reading in bitfield
- Don't send an extra byte if (fragments % 7) == 0
- Don't send a corrupt ack packet if the partial ack got completed (race)
- Log tweaks
2014-09-14 17:51:29 +00:00
zzz
0a41052f3f SSU InboundMessageState -
Rewrite PartialBitfield for efficiency, less space and object churn
SSU ACKBitfield: Add ackCount()
PeerState.fetchPartialACKs() improvements
2014-09-14 14:32:23 +00:00
zzz
a7763a08dc SSU OutboundMessageState -
Fix SSU Output Queue errors due to races with PacketBuilder:
   - Remove all buffer caching as it can't be made thread-safe.
     Just allocate buffer in constructor and let GC handle it
   - Do fragmenting in constructor and make all fragment fields final
   - Don't track per-fragment retransmissions as it wasn't used
   - Move ack tracking from an array to a long
   - Sync all ack methods
   - Entire class now thread-safe (thx dg)
2014-09-14 13:04:48 +00:00
zzz
fcfb471a8a log OS version too 2014-09-14 11:55:33 +00:00
zzz
b9e383130e i2psnark: Sort themes in config form
Don't return null from getThemes()
2014-09-14 11:48:56 +00:00
zzz
cd2159b873 i2psnark: Switch from checkbox to radio for tracker configuration form 2014-09-14 11:38:22 +00:00
zzz
e492d5e0cf fixup remaining field on details page 2014-09-13 18:21:58 +00:00
zzz
9a0f6490ba i2psnark: Consolidate code for creating img entities 2014-09-13 18:09:48 +00:00
zzz
5183b44d8b port new styles to the other two themes 2014-09-13 15:32:17 +00:00
zzz
156d86835a propagate from branch 'i2p.i2p' (head 60a9a2297abeaf042645e3f0bc8d106f1ff585bf)
to branch 'i2p.i2p.zzz.test2' (head 6ff6f0bcee835d32aad62449a37f5171afde915a)
2014-09-13 14:50:11 +00:00
zzz
eab4397b0f * i2ptunnel:
- Fixes for stopping client tunnels
   - Fix status display for shared clients
   - Log tweaks
2014-09-13 14:49:38 +00:00
zzz
d808b999c6 better error message 2014-09-13 14:36:21 +00:00
zzz
603b345405 * i2ptunnel: Fix updating session options on a running delay-open client tunnel 2014-09-12 21:48:29 +00:00
zzz
682534f468 * i2psnark: More escape fixes 2014-09-12 18:38:11 +00:00
zzz
42eb43f713 SSU: Implement bundling of multiple fragments in a single data message.
This has always been in the spec and implemented in the receive side
since the beginning, so it is compatible with all versions.
- Switch preparePackets() return value from a "sparse array" to a list
- UDPPacketReader cleanups
- UDPPacket javadocs
2014-09-12 15:17:14 +00:00
zzz
0817b58b9d i2psnark:
- Add file type sorter
 - Cycle through name/type sorters
2014-09-11 16:36:14 +00:00
zzz
9ab766375d i2psnark: Fix downloaded comparator 2014-09-11 15:56:57 +00:00
zzz
6c2799fe53 i2psnark:
- Cycle through downloaded/size sorters
 - Cycle through uploaded/ratio sorters
 - Fix ratio comparator
 - Display ratio when sorted by ratio, and on details page (ticket #1298)
2014-09-11 15:47:53 +00:00
zzz
ef81a575cd i2psnark:
- Add ratio sorter
 - Catch IAE on unstable sort
 - Only sort if necessary
 - toImg() cleanup
2014-09-11 14:42:08 +00:00
zzz
cce0d94fbb - Conditionally enable sort links 2014-09-11 14:13:13 +00:00
zzz
22b5203334 i2psnark:
- Tweak column tooltips
 - Tweak status sort
2014-09-11 13:39:10 +00:00
zzz
d4be5abe67 better shutdown message 2014-09-10 23:30:49 +00:00
zzz
9985a02efc i2psnark:
- Consolidate and clean up parameters code
 - Click to sort by column
2014-09-10 23:28:41 +00:00
zzz
41c2c60ab0 i2psnark:
- Comment out command-line code
 - Clean up ID generation
2014-09-10 23:18:09 +00:00
zzz
f285364f46 icons on buttons when enabled 2014-09-09 20:24:57 +00:00
zzz
1c5e9b7fe3 i2psnark:
- More CSS
 - .js mime type
2014-09-09 19:53:08 +00:00
zzz
12cc501e25 fixup after prop 2014-09-09 19:29:02 +00:00
zzz
49118b8bf1 propagate from branch 'i2p.i2p' (head e606c473eb1e461a477e45419f6295b6430a7353)
to branch 'i2p.i2p.zzz.test2' (head 6212892778308db10a86e58f9f275c838f604973)
2014-09-09 19:27:10 +00:00
zzz
09dfea7dea * i2psnark: Escape fixes
- fix ':' in name (again)
   - Change priority key from file name to file number so we don't hav to escape
2014-09-09 19:23:12 +00:00
zzz
00bd469f8e bump -15-rc 2014-09-09 16:13:49 +00:00
zzz
18e7e56a6c i2psnark:
- Set-all priority buttons (ticket #1376)
 - Move icons to resources dir, add js dir
 - Todo: more CSS
2014-09-09 15:27:53 +00:00
zzz
34d14a720b atomics 2014-09-09 14:22:47 +00:00
c4d7f9924f checkcerts.sh: check for extraneous spaces
(trying to catch the problem noted at http://zzz.i2p/topics/1663)
2014-09-06 22:14:06 +00:00
80d6921a66 fix certificate line endings 2014-09-06 22:11:06 +00:00
3c95144b83 close tag 2014-09-06 22:10:15 +00:00
84ad155ab8 remove extraneous trailing whitespace 2014-09-06 18:21:41 +00:00
zzz
330a5ddd0f NetDB:
- Better handling of unsupported encryption in destinations
 - Implement handling of unsupported encryption in router identities
 - Banlist forever all RIs with unsupported encryption
 - New negative cache of all dests with unsupported encryption
 - New methods for destination lookup that will succeed even if
   the LS is expired or encryption is unsupported
 - Use new dest lookup so client will get the right error code
   later, rather than failing with no LS when we really got it
   but just couldn't verify it.
 - Cleanups and javadocs

OCMOSJ: Detect unsupported encryption on dest and return the correct failure code
   through I2CP to streaming to i2ptunnel

Streaming: Re-enable message status override, but treat LS lookup failure
   as a soft failure for now.

HTTP Client: Add error page for unsupported encryption
2014-09-05 22:52:23 +00:00
zzz
3b2f1d35c4 I2CP: Fix LS keypair check 2014-09-05 22:42:06 +00:00
zzz
0f1036b0e1 better message on EOF reading data 2014-09-04 15:21:03 +00:00
zzz
86935f10a8 update link 2014-09-04 15:14:33 +00:00
zzz
1078c42a14 I2CP: Enforce strict authorization when auth is enabled 2014-09-04 13:28:40 +00:00
zzz
09cf973712 BuildHandler: Enforce request record timestamp
BuildRequestor: Randomize timestamp to prevent hop ID at top of hour
2014-09-04 01:08:23 +00:00
zzz
5af749a226 NetDB: Encrypt exploratory lookups too
SearchUpdateReplyFoundJob: finals
2014-09-03 23:26:34 +00:00
zzz
f84b86a752 * BundleRouterInfos:
- Move to its own class
   - Run GeoIP, exclude bad countries
   - Exclude class K
   - Exclude dup IPs
   - GeoIP mods for use in I2PAppContext
2014-09-03 15:19:18 +00:00
zzz
ca7873eda7 CryptoChecker: add main() 2014-09-03 13:22:56 +00:00
f87ebaf214 re-enable i2p.mooo.com (ticket #1351) 2014-09-02 20:54:49 +00:00
zzz
a9802eb6a7 NetDB: Encrypt RI lookups and request encrypted reply on
faster boxes, as a test, to prevent scraping by OBEPs and IBGWs
2014-09-02 14:23:06 +00:00
zzz
5d5a68cb3e * CryptoChecker: Log tweaks, handle gij 2014-09-02 14:11:22 +00:00
zzz
c6b1f5053f dont bundle IPv6-only RIs 2014-09-02 14:09:41 +00:00
zzz
1d2e01c8cd i2ptunnel filter tweaks 2014-09-02 14:08:41 +00:00
zzz
0c5c18a767 * Build: Add support for bundling router infos in the package 2014-08-31 16:19:46 +00:00
zzz
6826ba05e7 stubs for su3 news 2014-08-31 14:12:18 +00:00
zzz
053ce88743 * I2PTunnel: Allow changing of spoof host and target host/port without
restarting server tunnel
2014-08-31 13:17:44 +00:00
4a216c57d4 Updated EdDSA code from upstream
Source: https://github.com/str4d/ed25519-java
Git commit: f9a9213e1446adb46756d3a23b614fe09324ae16
2014-08-31 00:11:03 +00:00
zzz
03cec7fd5a just check availability once 2014-08-30 20:46:16 +00:00
zzz
1238001add bump -13 2014-08-30 19:38:56 +00:00
zzz
fa1c077fdd * Console: Show unavailable crypto on /logs
* Router: Log warnings for unavailable crypto at startup
2014-08-30 19:00:57 +00:00
zzz
8a7c3390f5 /configclients:
- Re-enable plugin installation by default
 - Don't show configuration section or update-all button if no plugins installed
2014-08-30 16:14:41 +00:00
zzz
2302aee819 su3 plugin key 2014-08-30 14:06:20 +00:00
zzz
a72866ee6a RouterInfo: Backport fix for verification of EdDSA RI sig type
from i2p.i2p.zzz.test2
2014-08-30 12:35:14 +00:00
0f7a3dba87 Catch AIOOB in upnp code (triggered in I2P Android on shutdown) 2014-08-30 02:38:27 +00:00
zzz
5decf18eb5 import, @since 2014-08-29 13:40:53 +00:00
zzz
c318760398 javadoc fixes and package.html files 2014-08-29 13:21:14 +00:00
629eff20dd copy flag icons in preppkg-base target 2014-08-28 23:31:07 +00:00
zzz
f6e508ca14 * Streaming: Fix verify of Ed25519 signatures in CLOSE packets
- cleanup writtenSize()
2014-08-28 13:57:52 +00:00
zzz
588ab86abb * Streaming: Fix P521 and RSA sig types 2014-08-27 22:43:44 +00:00
zzz
387629372b i2psnark: Don't retry announce if we get back HTML 2014-08-27 18:21:58 +00:00
zzz
0a01700e3e NetDB: Don't abort initialization on an unsupported RI sig type
(backport from i2p.i2p.zzz.test2)
2014-08-27 17:44:24 +00:00
zzz
59504deb7f i2psnark:
- Recognize Vuze tracker rejections
 - Don't retry rejected announces unless seeding
 - Better UI handling of announces with ports or full destination
2014-08-27 17:06:44 +00:00
zzz
8ee660c238 i2psnark:
- Persist uploaded count (tickets #1034, #1298)
 - Show uploaded count even when stopped
2014-08-27 16:00:02 +00:00
zzz
176c106427 I2CP: Catch bad private key 2014-08-26 20:12:29 +00:00
zzz
ed4fe56e7e I2CP:
- Verify crypto key pair in LS
 - Verfiy same dest as before in LS
Router: Don't try to use an unavailable sig type for the router,
   even if it's the default
RouterInfo: Work around unsupported raw signatures for
   RI Ed25519 sig type
2014-08-26 19:14:51 +00:00
zzz
310cd54aa0 remove unused EC curves 2014-08-26 13:47:21 +00:00
zzz
3217b4ac90 move radio buttons closer together thx Shinobiwan 2014-08-26 13:47:06 +00:00
zzz
7bf1949061 remove unused method 2014-08-26 13:46:28 +00:00
zzz
51f9d6d421 NTCP RI sig types 2014-08-25 20:33:56 +00:00
zzz
ddb32c65fb add getPadding() 2014-08-25 20:32:47 +00:00
zzz
c5c158e983 PrivateKeyFile: Add validateKeyPairs()
Router: Validate router key pairs read in from file
2014-08-25 16:55:16 +00:00
zzz
f83007e038 KeyGenerator: Add support for converting
all signing key types from private to public
2014-08-25 16:20:39 +00:00
zzz
2b9a368b18 propagate from branch 'i2p.i2p' (head 695c0048cc8ce28df0574a5e188c77c07c9b42ce)
to branch 'i2p.i2p.zzz.test2' (head c116da02ea4b4d01dd028bc58ea02b43ae9af8cd)
2014-08-25 12:05:15 +00:00
zzz
6ad6974452 javadoc warnings about EdDSA raw sigs 2014-08-24 23:11:56 +00:00
zzz
308923448b PrivateKeyFile: New constructor with padding
Router:
 - Use eepPriv.dat format for router keys file (thx orignal)
 - Consolidate router keys readin code
 - Update killKeys file list
RouterPrivateKeyFile: New extension to add getRouterIdentity()
2014-08-24 19:15:26 +00:00
zzz
04ad7de2e1 SSU: Handle RI sig types
TransportManager: Banlist unsupported RI sig types
2014-08-24 14:54:17 +00:00
zzz
54563b0b42 catch swapped args 2014-08-23 23:49:34 +00:00
zzz
593779b54f Router: Prep for RI sig types:
- New router.sigType config
 - Generate / regenerate router keys based on config
 - New router.keys2 file format for sig types and padding
 - Fix RouterInfo.readBytes() signature verification with sig types
 - Catch unset padding in KeysAndCert.writeBytes()
 - Catch key errors in ReadRouterJob
 - Show RI sig type on /netdb in console
 - Move some things from Router to startup classes
 - Startup classes package private
 - Buffer readin of key files
 - Remove configurability of router.info and router.keys file locations
2014-08-23 23:48:16 +00:00
zzz
34d3704680 sig type availability check 2014-08-23 15:09:24 +00:00
zzz
613f90bcf7 SSU: Drop peer tests as Bob from unestablished Alices 2014-08-23 14:22:06 +00:00
zzz
6ff500f7cb increase RI publish interval slightly 2014-08-23 13:49:26 +00:00
zzz
c79e33896e SSU intro key checks 2014-08-23 13:48:13 +00:00
zzz
68b15aadca proxy no LS error pages tweak 2014-08-23 13:46:10 +00:00
zzz
819504f08f console escape fixes and cleanups 2014-08-23 13:44:56 +00:00
zzz
e65ec2a589 i2ptunnel escape fixes 2014-08-23 13:20:25 +00:00
zzz
1bc355b8fd i2psnark escape fixes 2014-08-23 13:19:44 +00:00
zzz
d76164679f move null check to constructor 2014-08-23 13:16:57 +00:00
zzz
efebecfc67 * SigTypes:
- Add isSupportedSince(), use in floodfill selection
  - Handle mixed-case 25519 enum
  - Fix 25519 type code
  - Add dup type code check
2014-08-22 14:34:13 +00:00
7b64586c87 temporarily disable reseed host (ticket #1351) 2014-08-22 10:13:37 +00:00
0fe15b8e1d Use DataHelper instead of TestUtils 2014-08-21 23:43:57 +00:00
a1cb00b5a3 Java implementation of Ed25519
Source: https://github.com/str4d/ed25519-java
Git commit: be161ee7c6da29129b5ec6c4739ec3a99114a846
License: Public domain
2014-08-21 23:27:45 +00:00
5041d819a9 propagate from branch 'i2p.i2p' (head b026fe071e77884ef6d104635c793ef16357ec71)
to branch 'i2p.i2p.str4d.eddsa' (head 0d928736c4a34d8a337e1f55e095fe90564ea1fb)
2014-08-21 23:27:34 +00:00
zzz
02ab6eac62 javadoc 2014-08-21 17:38:35 +00:00
zzz
d7feab116f Core: Move router data structures, and the deprecated RouterAddress sorter, from core to router.
This will break Android and the i2pcontrol plugin but shouldn't affect anything else.
2014-08-21 17:36:06 +00:00
zzz
4f9e13d0f6 unit test fix take 2 2014-08-21 15:01:15 +00:00
zzz
d0b0e6a58e fix clock.skew rates 2014-08-21 14:27:16 +00:00
a12f898096 Corrected Ed25519 SigType name 2014-08-21 13:08:21 +00:00
zzz
c921ecca05 fix unit test 2014-08-21 12:46:11 +00:00
zzz
975378b224 * i2ptunnel:
- Add local SSL support for std. and IRC client tunnels (ticket #1107)
    Keystore goes in ~/.i2p/keystore; pubkey cert goes in ~/.i2p/certificates/i2ptunnel
  - Escape messages to index page
  - Show message for uncaught exception
2014-08-21 12:21:29 +00:00
zzz
915e003355 * i2ptunnel: Use I2PAppThread 2014-08-21 11:58:09 +00:00
zzz
51e45d128a * Tunnels: Debug code and other cleanups 2014-08-21 11:55:03 +00:00
zzz
57650ef058 remove dup conversion 2014-08-21 11:51:05 +00:00
zzz
dee6e16e6c * i2psnark:
- Escape control chars in encodePath()
   - Increase max piece size to 8 MB (ticket #1347)
2014-08-21 11:49:58 +00:00
c860674613 propagate from branch 'i2p.i2p' (head e8883e85a7761bbda9df59b3f6b57601cc01bb5a)
to branch 'i2p.i2p.str4d.eddsa' (head a1cc4ae4a17efaca2825dae64b2cc55aa520ca27)
2014-08-20 02:11:15 +00:00
zzz
33b7f08d5c * i2psnark:
- Don't filter create torrent form, and
     fix exception on ':' in file names (ticket #1342)
   - Don't remap file names on torrents we created, and
     save remap setting in torrent config file (tickets #571, 771)
   - Escaping fixes since names may not be remapped
   - Use better encodePath() from Jetty
   - Don't say create torrent succeeded when it didn't
   - Add more sanity checks for torrent creation
2014-08-19 20:34:46 +00:00
zzz
66bbe21a87 * Tunnels: Use consistent tunnel pair for Delivery Status Message
to reduce network connections (ticket #1350)
2014-08-18 18:57:19 +00:00
zzz
51995cc428 * i2psnark:
- Don't send HTML-only headers for icons
   - Catch IllegalStateException for icons
2014-08-18 18:52:47 +00:00
a3e3a305ce removed notification of port 8887 2014-08-17 14:54:50 +00:00
zzz
15facc72b3 * Console: Escaping fix (ticket #1348) 2014-08-15 11:49:56 +00:00
zzz
3839c8d1c0 * I2CP: Lookup synch cleanups 2014-08-15 11:48:02 +00:00
d5edcbc6e1 * Console, EventLog: Added {BECAME,NOT}_FLOODFILL events. They will now be shown on the console's /events page when the router's ff status changes.
* EventLog: Fix a minor typo.
2014-08-13 21:29:17 +00:00
zzz
eb97ef4cb2 * i2psnark: Fix add torrent NPE 2014-08-13 19:17:26 +00:00
zzz
9c38e1e191 * Console: Escaping fix (ticket #1346) 2014-08-13 19:10:25 +00:00
zzz
7c3d3b4128 fix dependency checking for ministreaming po files 2014-08-13 19:07:39 +00:00
zzz
367cea4b1f new translation files 2014-08-10 19:32:11 +00:00
zzz
a63bfeaeec fix SKM test broken by TSKM move 2014-08-10 15:48:18 +00:00
zzz
41672dde64 include geoip.txt in updater for next release 2014-08-10 14:57:28 +00:00
zzz
3b18cb7eca history for prop, -3 2014-08-10 14:22:16 +00:00
zzz
c9ce1751c1 propagate from branch 'i2p.i2p.zzz.snarkconfig' (head ad48ab1a9e769c58ea2e286337927f5c0e1568be)
to branch 'i2p.i2p' (head 0cd9e265bd38c40839e68de8f51233489acad346)
2014-08-10 14:14:00 +00:00
zzz
4ba40b340a history for prop, -2 2014-08-10 14:08:05 +00:00
zzz
e3be1d1a04 propagate from branch 'i2p.i2p.zzz.test2' (head c182b371bc28158dd47262b89e5bd0cdda29e07b)
to branch 'i2p.i2p' (head 4fc776f7b76b028bb890affccfdcfbefbb932c58)
2014-08-10 13:56:15 +00:00
zzz
6fa2a416be Console: Hide client delete button too 2014-08-10 12:18:18 +00:00
fdb54c315b propagate from branch 'i2p.i2p' (head b8f5da367cf5d16bc1d91aa2097830c350c9ef8a)
to branch 'i2p.i2p.str4d.eddsa' (head 6fcc5b5019abb36251e28fe0f7723fd1a046a8e9)
2014-08-10 11:41:45 +00:00
zzz
22a7757461 Console: Show share options below 30% (ticket #1329) 2014-08-09 18:08:00 +00:00
zzz
0bacbbc553 SigType: Add static isAvailable() methods
SU3File:
 - Add -x option to bypass signature verification
 - Add -k option to use specified private key cert for verification
 - Don't verify signature in showversion
2014-08-09 17:55:17 +00:00
zzz
03d8314842 dir for plugin certs 2014-08-08 16:41:27 +00:00
zzz
fe4d98f0df javadoc 2014-08-08 16:40:56 +00:00
zzz
b1d60122a3 better msg to client on unsupported sigtype 2014-08-08 16:40:48 +00:00
zzz
c9e20c5d23 log tweak 2014-08-07 21:22:18 +00:00
zzz
381f494754 SU3File: Fix NPE on EOF reading input 2014-08-07 20:17:51 +00:00
zzz
506419964b Plugins: SU3 support in form, type checking,
don't require DSA key in SU3
2014-08-07 19:27:53 +00:00
zzz
35bb8c5348 Plugins: partial SU3 support 2014-08-07 19:06:41 +00:00
zzz
79fe799aeb Plugins: Stub out SU3 support 2014-08-07 18:45:04 +00:00
zzz
2878a6487e KeysAndCert: Change hashcode to prevent possible collisions
caused by apps with zeroed pubkey
2014-08-07 17:05:25 +00:00
zzz
9655e79d26 UPnP: Disable external entities in XML parser 2014-08-06 18:13:54 +00:00
zzz
d1a2e24f0e SSU: Speed up introductions by responding to HolePunch (ticket #1333) 2014-08-06 16:35:08 +00:00
zzz
086381d958 SU3File: Add support for XML and NEWS types 2014-08-06 16:32:10 +00:00
zzz
89764c12e7 bob finals, synch 2014-07-23 13:12:32 +00:00
zzz
328d7d0008 SAM:
- Don't spawn a thread for each transmitted datagram
 - Set protocol field for raw and signed datagrams
 - Enforce a 60s timeout for HELLO
 - Use naming service cache to reduce Destination object churn
 - Get Log object from the log manager
 - Log spelling fixes
2014-07-22 14:52:08 +00:00
zzz
cca5bef8c1 propagate from branch 'i2p.i2p' (head 79d0ad4538a0adc4ced6ac26cb725abe3d5ccee3)
to branch 'i2p.i2p.zzz.test2' (head 73032545b42f6f9caffffca08d0a8b97f5cf7e3a)
2014-07-22 14:38:28 +00:00
2cfe5e678a propagate from branch 'i2p.i2p' (head e02e6d733a703970e20e732e5156cbabc394e88e)
to branch 'i2p.i2p.str4d.eddsa' (head 3910d01bed7c5a216f52bfd1d9fd96b59f058745)
2014-07-10 09:29:34 +00:00
zzz
d48991f71f Crypto: Move TransientSessionKeyManager from core to router.
I2PAppContext will return the dummy SessionKeyManager which
is sufficient for non-tag uses (e.g. Bote).
Client use of end-to-end encryption using SessionTags was
disabled in release 0.6, 2005-07-27.
2014-07-09 13:52:26 +00:00
zzz
8f2dc67430 - Fix files not found in listing at top level of torrent
- Fix loading of files outside of snark dir
2014-06-25 13:58:34 +00:00
888ef37808 propagate from branch 'i2p.i2p' (head 5a3ad2a39b0e0f06e70cb8b4d4f7b1d6461afc1a)
to branch 'i2p.i2p.str4d.eddsa' (head b2a13496a248ebfdac0aa3a8528a27ceff091b6b)
2014-06-24 02:14:05 +00:00
zzz
c987a9735d fixup after prop 2014-06-21 13:16:38 +00:00
zzz
3b9549c2c1 propagate from branch 'i2p.i2p' (head 1f9b91f318a0f2369243844a3cf7f485528492d7)
to branch 'i2p.i2p.zzz.snarkconfig' (head 37b27b6d354d62487294fd9276504b98a23f1057)
2014-06-21 13:02:22 +00:00
zzz
91408cbdce SigUtil: Catch EdDSA IAE
SU3File: Hide EdDSA and unavailable sig types from help text
2014-05-05 19:49:24 +00:00
97c1ba2d02 merge of '477b2b4e4f6f8a2e406fb9729cd603d8caeadb40'
and 'ef12e90467e2bdbf5e64a9e55230ce56121d7347'
2014-05-04 14:52:06 +00:00
zzz
284802bfa5 add caching of EdDSA keys 2014-05-04 14:09:02 +00:00
zzz
48b6e0693e finals 2014-05-02 19:43:21 +00:00
d867f9f36e Fix for SigType.isAvailable() 2014-04-27 01:56:01 +00:00
55d92fc9f2 Support "raw" EdDSA signatures (in reality they are double-hashed) 2014-04-26 13:03:38 +00:00
2e2d3c39e6 Added Ed25519-SHA-512 to I2PTunnel advanced UI 2014-04-26 12:11:02 +00:00
3cd01acb73 Fixed Ed25519-SHA-512 algorithm name 2014-04-26 12:10:18 +00:00
02c0ddb3d3 Generalized to support any EdDSA parameter spec 2014-04-26 11:59:16 +00:00
ce397f5858 Added EdDSA support (directly, not using Provider) 2014-04-26 11:24:31 +00:00
611f991fdd Added a security provider for I2P-internal crypto 2014-04-22 07:20:30 +00:00
zzz
47712a39ac i2psnark:
- Support arbitrary location for torrent data. Save location in
   per-torrent config file. TODO: Fix torrent browse pages
   (ticket #1028)
 - Enhance idle shutdown message
 - Javadocs
2014-01-27 13:41:38 +00:00
zzz
18146daad8 i2psnark:
- Add missing nonce protection for file priority setting
 - Add torrent mime type
 - String append cleanup
2014-01-26 14:26:16 +00:00
zzz
a2e7fa8b7b another minor dir listing speedup 2013-12-22 14:23:01 +00:00
zzz
30ccf1b334 i2psnark:
- Refactor file deletion in prep for better file name handling (ticket #571)
 - Don't use canonical files in directory listings,
   for speed and to avoid file comparison problems (tickets #1079, #1148)
 - Set base file/dir in Storage constructor, make final,
   in prep for arbitrary locations (ticket #1028)
2013-12-22 13:52:35 +00:00
zzz
01b153488a i2psnark:
- Move config file and DHT persistence file to a config dir
   - Move per-torrent configuration from "zmeta" in the main config file
     to a per-torrent config file (ticket #1132)
   - Split timestamp and bitfield into separate configs
   - Fix misspelling of autoStart config
   - Remove two unused SnarkManager methods
2013-12-16 16:12:32 +00:00
1369 changed files with 206019 additions and 121004 deletions

View File

@ -12,9 +12,11 @@ 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.nn = apps/i2ptunnel/locale/messages_nn.po
trans.pl = apps/i2ptunnel/locale/messages_pl.po
trans.pt = apps/i2ptunnel/locale/messages_pt.po
trans.pt_BR = apps/i2ptunnel/locale/messages_pt_BR.po
trans.ro = apps/i2ptunnel/locale/messages_ro.po
trans.ru_RU = apps/i2ptunnel/locale/messages_ru.po
trans.sk = apps/i2ptunnel/locale/messages_sk.po
trans.sv_SE = apps/i2ptunnel/locale/messages_sv.po
@ -31,6 +33,8 @@ 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
;; Java converts id to in
trans.id = apps/i2ptunnel/locale-proxy/messages_in.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
@ -39,6 +43,7 @@ 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.sk = apps/i2ptunnel/locale-proxy/messages_sk.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
@ -78,10 +83,16 @@ 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.fi = apps/routerconsole/locale-news/messages_fi.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
;; Java converts id to in
trans.id = apps/routerconsole/locale-news/messages_in.po
trans.it = apps/routerconsole/locale-news/messages_it.po
trans.ja = apps/routerconsole/locale-news/messages_ja.po
trans.ko = apps/routerconsole/locale-news/messages_ko.po
trans.mg = apps/routerconsole/locale-news/messages_mg.po
trans.nb = apps/routerconsole/locale-news/messages_nb.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
@ -89,14 +100,17 @@ 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.sk = apps/routerconsole/locale-news/messages_sk.po
trans.sq = apps/routerconsole/locale-news/messages_sq.po
trans.sv_SE = apps/routerconsole/locale-news/messages_sv.po
trans.tr_TR = apps/routerconsole/locale-news/messages_tr.po
trans.uk_UA = apps/routerconsole/locale-news/messages_uk.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.ca = apps/routerconsole/locale-countries/messages_ca.po
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
@ -107,6 +121,7 @@ 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.mg = apps/routerconsole/locale-countries/messages_mg.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
@ -115,7 +130,9 @@ 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.sk = apps/routerconsole/locale-countries/messages_sk.po
trans.sq = apps/routerconsole/locale-countries/messages_sq.po
trans.sv_SE = apps/routerconsole/locale-countries/messages_sv.po
trans.uk_UA = apps/routerconsole/locale-countries/messages_uk.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
@ -134,6 +151,7 @@ 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.pt_BR = apps/i2psnark/locale/messages_pt_bR.po
trans.ro = apps/i2psnark/locale/messages_ro.po
trans.ru_RU = apps/i2psnark/locale/messages_ru.po
trans.sk = apps/i2psnark/locale/messages_sk.po
@ -161,6 +179,7 @@ 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.tr_TR = apps/susidns/locale/messages_tr.po
trans.uk_UA = apps/susidns/locale/messages_uk.po
trans.vi = apps/susidns/locale/messages_vi.po
trans.zh_CN = apps/susidns/locale/messages_zh.po
@ -194,19 +213,25 @@ trans.zh_CN = apps/desktopgui/locale/messages_zh.po
source_file = apps/susimail/locale/messages_en.po
source_lang = en
trans.cs = apps/susimail/locale/messages_cs.po
trans.da = apps/susimail/locale/messages_da.po
trans.de = apps/susimail/locale/messages_de.po
trans.es = apps/susimail/locale/messages_es.po
trans.fi = apps/susimail/locale/messages_fi.po
trans.fr = apps/susimail/locale/messages_fr.po
trans.hu = apps/susimail/locale/messages_hu.po
;; Java converts id to in
trans.id = apps/susimail/locale/messages_in.po
trans.it = apps/susimail/locale/messages_it.po
trans.ja = apps/susimail/locale/messages_ja.po
trans.mg = apps/susimail/locale/messages_mg.po
trans.nl = apps/susimail/locale/messages_nl.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.ru_RU = apps/susimail/locale/messages_ru.po
trans.sq = apps/susimail/locale/messages_sq.po
trans.sv_SE = apps/susimail/locale/messages_sv.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
@ -218,16 +243,21 @@ trans.cs = debian/po/cs.po
trans.de = debian/po/de.po
trans.el = debian/po/el.po
trans.es = debian/po/es.po
trans.fi = debian/po/fi.po
trans.fr = debian/po/fr.po
trans.id = debian/po/id.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.nl = debian/po/nl.po
trans.pl = debian/po/pl.po
trans.pt = debian/po/pt.po
trans.pt_BR = debian/po/pt_BR.po
trans.ro = debian/po/ro.po
trans.ru_RU = debian/po/ru.po
trans.sk = debian/po/sk.po
trans.sq = debian/po/sq.po
trans.sv_SE = debian/po/sv.po
trans.uk_UA = debian/po/uk.po
trans.tr_TR = debian/po/tr.po
@ -236,12 +266,21 @@ trans.zh_CN = debian/po/zh.po
[I2P.i2prouter-script]
source_file = installer/resources/locale/po/messages_en.po
source_lang = en
;; currently fails check
;;trans.ca = installer/resources/locale/po/messages_ca.po
trans.de = installer/resources/locale/po/messages_de.po
trans.es = installer/resources/locale/po/messages_es.po
;; currently fails check
;;trans.fi = installer/resources/locale/po/messages_fi.po
trans.fr = installer/resources/locale/po/messages_fr.po
trans.id = installer/resources/locale/po/messages_id.po
trans.it = installer/resources/locale/po/messages_it.po
trans.pl = installer/resources/locale/po/messages_pl.po
trans.ja = installer/resources/locale/po/messages_ja.po
;; currently fails check
;;trans.ko = installer/resources/locale/po/messages_ko.po
trans.nl = installer/resources/locale/po/messages_nl.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
@ -249,6 +288,8 @@ trans.ru_RU = installer/resources/locale/po/messages_ru.po
trans.sk = installer/resources/locale/po/messages_sk.po
trans.sv_SE = installer/resources/locale/po/messages_sv.po
trans.tr_TR = installer/resources/locale/po/messages_tr.po
;; currently fails check
;;trans.uk_UA = installer/resources/locale/po/messages_uk.po
trans.zh_CN = installer/resources/locale/po/messages_zh.po
[I2P.getopt]
@ -258,22 +299,46 @@ 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.fi = core/java/src/gnu/getopt/MessagesBundle_fi.properties
trans.fr = core/java/src/gnu/getopt/MessagesBundle_fr.properties
trans.hu = core/java/src/gnu/getopt/MessagesBundle_hu.properties
;; Java converts id to in
trans.id = core/java/src/gnu/getopt/MessagesBundle_in.properties
trans.it = core/java/src/gnu/getopt/MessagesBundle_it.properties
trans.ja = core/java/src/gnu/getopt/MessagesBundle_ja.properties
trans.ko = core/java/src/gnu/getopt/MessagesBundle_ko.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
;; currently corrupt, non-UTF-8
;;trans.pt = core/java/src/gnu/getopt/MessagesBundle_pt.properties
;; currently corrupt, non-UTF-8
;;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.sk = core/java/src/gnu/getopt/MessagesBundle_sk.properties
;; currently corrupt, non-UTF-8
;;trans.sq = core/java/src/gnu/getopt/MessagesBundle_sq.properties
trans.uk_UA = core/java/src/gnu/getopt/MessagesBundle_uk.properties
trans.zh_CN = core/java/src/gnu/getopt/MessagesBundle_zh.properties
[I2P.streaming]
source_file = apps/ministreaming/locale/messages_en.po
source_lang = en
trans.ca = apps/ministreaming/locale/messages_ca.po
trans.de = apps/ministreaming/locale/messages_de.po
trans.es = apps/ministreaming/locale/messages_es.po
trans.fr = apps/ministreaming/locale/messages_fr.po
;; Java converts id to in
trans.id = apps/ministreaming/locale/messages_in.po
trans.it = apps/ministreaming/locale/messages_it.po
trans.nb = apps/ministreaming/locale/messages_nb.po
trans.pl = apps/ministreaming/locale/messages_pl.po
trans.ro = apps/ministreaming/locale/messages_ro.po
trans.ru_RU = apps/ministreaming/locale/messages_ru.po
trans.sv_SE = apps/ministreaming/locale/messages_sv.po
trans.uk_UA = apps/ministreaming/locale/messages_uk.po
trans.zh_CN = apps/ministreaming/locale/messages_zh.po
[main]
host = https://www.transifex.com

View File

@ -80,6 +80,10 @@ Public domain except as listed below:
Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
See licenses/LICENSE-LGPLv2.1.txt
HostnameVerifier:
From Apache HttpClient 4.4.1 and HttpCore 4.4.1
See licenses/LICENSE-Apache2.0.txt
Router (router.jar):
Public domain except as listed below:
@ -87,7 +91,7 @@ Public domain except as listed below:
From freenet
See licenses/LICENSE-GPLv2.txt
UPnP subsystem (CyberLink) 2.1:
UPnP subsystem (CyberLink) 3.0:
Copyright (C) 2003-2010 Satoshi Konno
See licenses/LICENSE-UPnP.txt
@ -137,7 +141,7 @@ Installer:
Java Service Wrapper Community Edition 32-bit 3.5.19:
Java Service Wrapper Community Edition 32-bit 3.5.25:
Copyright (C) 1999-2011 Tanuki Software, Ltd. All Rights Reserved.
See licenses/LICENSE-Wrapper.txt
@ -182,7 +186,7 @@ Applications:
By welterde.
See licenses/LICENSE-GPLv2.txt
Jetty 8.1.15.v20140411:
Jetty 8.1.17.v20150415:
See licenses/ABOUT-Jetty.html
See licenses/NOTICE-Jetty.html
See licenses/LICENSE-Apache2.0.txt
@ -248,8 +252,8 @@ Applications:
Bundles systray4j-2.4.1:
See licenses/LICENSE-LGPLv2.1.txt
Tomcat 6.0.41:
Copyright 1999-2014 The Apache Software Foundation
Tomcat 6.0.44:
Copyright 1999-2015 The Apache Software Foundation
See licenses/LICENSE-Apache2.0.txt
See licenses/NOTICE-Tomcat.txt

View File

@ -19,7 +19,8 @@ To build:
Documentation:
https://geti2p.net/how
API: run 'ant javadoc' then start at build/javadoc/index.html
API: http://docs.i2p-projekt.de/javadoc/
or run 'ant javadoc' then start at build/javadoc/index.html
Latest release:
https://geti2p.net/download
@ -34,6 +35,15 @@ Need help?
IRC irc.freenode.net #i2p
http://forum.i2p/
Bug reports:
https://trac.i2p2.de/report/1
Contact information, security issues, press inquiries:
https://geti2p.net/en/contact
Twitter:
@i2p, @geti2p
Licenses:
See LICENSE.txt

View File

@ -38,7 +38,6 @@ import net.i2p.I2PAppContext;
import net.i2p.app.*;
import net.i2p.client.I2PClient;
import net.i2p.util.I2PAppThread;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer2;
/**
@ -119,15 +118,16 @@ public class BOB implements Runnable, ClientApp {
public final static String PROP_BOB_HOST = "BOB.host";
public final static String PROP_CFG_VER = "BOB.CFG.VER";
/** unused when started via the ClientApp interface */
private static BOB _bob;
private NamedDB database;
private Properties props = new Properties();
private AtomicBoolean spin = new AtomicBoolean(true);
private final NamedDB database;
private final Properties props = new Properties();
private final 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 AtomicBoolean lock = new AtomicBoolean(false);
private final AtomicBoolean lock = new AtomicBoolean(false);
// no longer used.
// private static int maxConnections = 0;
@ -143,8 +143,9 @@ public class BOB implements Runnable, ClientApp {
* Stop BOB gracefully
* @deprecated unused
*/
public static void stop() {
_bob.shutdown(null);
public synchronized static void stop() {
if (_bob != null)
_bob.shutdown(null);
}
/**
@ -189,7 +190,7 @@ public class BOB implements Runnable, ClientApp {
*
* @param args
*/
public static void main(String[] args) {
public synchronized static void main(String[] args) {
try {
_bob = new BOB(I2PAppContext.getGlobalContext(), null, args);
_bob.startup();
@ -212,9 +213,7 @@ public class BOB implements Runnable, ClientApp {
// Re-reading the config file in each thread is pretty damn stupid.
String configLocation = System.getProperty(PROP_CONFIG_LOCATION, "bob.config");
// This is here just to ensure there is no interference with our threadgroups.
SimpleScheduler Y1 = SimpleScheduler.getInstance();
SimpleTimer2 Y2 = SimpleTimer2.getInstance();
i = Y1.hashCode();
i = Y2.hashCode();
{
File cfg = new File(configLocation);
@ -339,7 +338,7 @@ public class BOB implements Runnable, ClientApp {
if (g) {
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
Thread t = new Thread(conn_c);
Thread t = new I2PAppThread(conn_c);
t.setName("BOB.DoCMDS " + i);
t.start();
i++;

View File

@ -25,12 +25,13 @@ import java.util.Locale;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PClientFactory;
//import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
//import net.i2p.i2ptunnel.I2PTunnel;
import net.i2p.util.I2PAppThread;
// needed only for debugging.
// import java.util.logging.Level;
// import java.util.logging.Logger;
@ -1307,7 +1308,7 @@ public class DoCMDS implements Runnable {
// wait
}
tunnel = new MUXlisten(lock, database, nickinfo, _log);
Thread t = new Thread(tunnel);
Thread t = new I2PAppThread(tunnel);
t.start();
// try {
// Thread.sleep(1000 * 10); // Slow down the startup.

View File

@ -18,10 +18,12 @@ package net.i2p.BOB;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
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.I2PAppThread;
/**
* Listen on I2P and connect to TCP
@ -30,16 +32,15 @@ import net.i2p.client.streaming.I2PSocketManager;
*/
public class I2Plistener implements Runnable {
private NamedDB info, database;
private Logger _log;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private AtomicBoolean lives;
private final NamedDB info, database;
private final Logger _log;
private final I2PServerSocket serverSocket;
private final AtomicBoolean lives;
/**
* Constructor
* @param SS
* @param S
* @param S unused
* @param info
* @param database
* @param _log
@ -48,7 +49,6 @@ public class I2Plistener implements Runnable {
this.database = database;
this.info = info;
this._log = _log;
this.socketManager = S;
this.serverSocket = SS;
this.lives = lives;
}
@ -79,7 +79,7 @@ public class I2Plistener implements Runnable {
conn++;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
Thread t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
t.start();
}

View File

@ -19,7 +19,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.util.I2PAppThread;
/**
* Process I2P->TCP
@ -111,8 +113,8 @@ public class I2PtoTCP implements Runnable {
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout, lives); // app -> I2P
TCPio conn_a = new TCPio(Iin, out, lives); // I2P -> app
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new I2PAppThread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();

View File

@ -21,11 +21,13 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PException;
import net.i2p.client.I2PClient;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
/**
@ -201,14 +203,14 @@ public class MUXlisten implements Runnable {
// I2P -> TCP
SS = socketManager.getServerSocket();
I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log, lives);
t = new Thread(tg, conn, "BOBI2Plistener " + N);
t = new I2PAppThread(tg, conn, "BOBI2Plistener " + N);
t.start();
}
if (come_in) {
// TCP -> I2P
TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log, lives);
q = new Thread(tg, conn, "BOBTCPlistener " + N);
q = new I2PAppThread(tg, conn, "BOBTCPlistener " + N);
q.start();
}

View File

@ -15,7 +15,6 @@
*/
package net.i2p.BOB;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer2;
/**
@ -31,12 +30,10 @@ public class Main {
*/
public static void main(String[] args) {
// THINK THINK THINK THINK THINK THINK
SimpleScheduler Y1 = SimpleScheduler.getInstance();
SimpleTimer2 Y2 = SimpleTimer2.getInstance();
BOB.main(args);
Y2.stop();
Y1.stop();
}
}

View File

@ -64,7 +64,7 @@ public class NamedDB {
}
/**
* Find objects in the array, returns it's index or throws exception
* Find objects in the array, returns its index or throws exception
* @param key
* @return an objects index
* @throws ArrayIndexOutOfBoundsException when key does not exist

View File

@ -20,8 +20,10 @@ import java.net.ServerSocket;
import java.net.Socket;
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.I2PAppThread;
/**
* Listen on TCP port and connect to I2P
@ -30,12 +32,11 @@ import net.i2p.client.streaming.I2PSocketManager;
*/
public class TCPlistener implements Runnable {
private NamedDB info, database;
private Logger _log;
public I2PSocketManager socketManager;
public I2PServerSocket serverSocket;
private ServerSocket listener;
private AtomicBoolean lives;
private final NamedDB info, database;
private final Logger _log;
private final I2PSocketManager socketManager;
private final ServerSocket listener;
private final AtomicBoolean lives;
/**
* Constructor
@ -76,7 +77,7 @@ public class TCPlistener implements Runnable {
conn++;
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
Thread t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}

View File

@ -24,13 +24,14 @@ import java.net.NoRouteToHostException;
import java.net.Socket;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
//import net.i2p.i2ptunnel.I2PTunnel;
import net.i2p.I2PAppContext;
import net.i2p.util.I2PAppThread;
/**
*
@ -158,8 +159,8 @@ public class TCPtoI2P implements Runnable {
// setup to cross the streams
TCPio conn_c = new TCPio(in, Iout, lives); // app -> I2P
TCPio conn_a = new TCPio(Iin, out, lives); // I2P -> app
t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB");
t = new I2PAppThread(conn_c, Thread.currentThread().getName() + " TCPioA");
q = new I2PAppThread(conn_a, Thread.currentThread().getName() + " TCPioB");
// Fire!
t.start();
q.start();

View File

@ -34,15 +34,17 @@ import net.i2p.util.Log;
* The skeletal frame is here, just needs to be finished.
*
* @author sponge
* @deprecated incomplete, unused
*/
public class UDPIOthread implements I2PSessionListener, Runnable {
private NamedDB info;
private Log _log;
private Socket socket;
private final NamedDB info;
private final Log _log;
private final Socket socket;
private DataInputStream in;
private DataOutputStream out;
private I2PSession _session;
private final I2PSession _session;
// FIXME never set
private Destination _peerDestination;
private boolean up;
@ -58,7 +60,6 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
this._log = _log;
this.socket = socket;
this._session = _session;
}
/**

View File

@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Pattern;
import net.i2p.I2PAppContext;
import net.i2p.util.EepGet;
@ -49,6 +50,26 @@ class AddressBook {
private boolean modified;
private static final boolean DEBUG = false;
private static final int MIN_DEST_LENGTH = 516;
private static final int MAX_DEST_LENGTH = MIN_DEST_LENGTH + 100; // longer than any known cert type for now
/**
* 5-67 chars lower/upper case
*/
private static final Pattern HOST_PATTERN =
Pattern.compile("^[0-9a-zA-Z\\.-]{5,67}$");
/**
* 52 chars lower/upper case
* Always ends in 'a' or 'q'
*/
private static final Pattern B32_PATTERN =
Pattern.compile("^[2-7a-zA-Z]{51}[aAqQ]$");
/** not a complete qualification, just a quick check */
private static final Pattern B64_PATTERN =
Pattern.compile("^[0-9a-zA-Z~-]{" + MIN_DEST_LENGTH + ',' + MAX_DEST_LENGTH + "}={0,2}$");
/**
* Construct an AddressBook from the contents of the Map addresses.
*
@ -159,8 +180,13 @@ class AddressBook {
* @since 0.8.7
*/
public Iterator<Map.Entry<String, String>> iterator() {
if (this.subFile != null)
return new ConfigIterator(this.subFile);
if (this.subFile != null) {
try {
return new ConfigIterator(this.subFile);
} catch (IOException ioe) {
return new ConfigIterator();
}
}
return this.addresses.entrySet().iterator();
}
@ -201,9 +227,6 @@ class AddressBook {
return "Map containing " + this.addresses.size() + " entries";
}
private static final int MIN_DEST_LENGTH = 516;
private static final int MAX_DEST_LENGTH = MIN_DEST_LENGTH + 100; // longer than any known cert type for now
/**
* Do basic validation of the hostname
* hostname was already converted to lower case by ConfigParser.parse()
@ -220,9 +243,10 @@ class AddressBook {
host.indexOf("..") < 0 &&
// IDN - basic check, not complete validation
(host.indexOf("--") < 0 || host.startsWith("xn--") || host.indexOf(".xn--") > 0) &&
host.replaceAll("[a-z0-9.-]", "").length() == 0 &&
HOST_PATTERN.matcher(host).matches() &&
// Base32 spoofing (52chars.i2p)
(! (host.length() == 56 && host.substring(0,52).replaceAll("[a-z2-7]", "").length() == 0)) &&
// We didn't do it this way, we use a .b32.i2p suffix, but let's prohibit it anyway
(! (host.length() == 56 && B32_PATTERN.matcher(host.substring(0,52)).matches())) &&
// ... or maybe we do Base32 this way ...
(! host.equals("b32.i2p")) &&
(! host.endsWith(".b32.i2p")) &&
@ -246,7 +270,7 @@ class AddressBook {
(dest.length() > MIN_DEST_LENGTH && dest.length() <= MAX_DEST_LENGTH)) &&
// B64 comes in groups of 2, 3, or 4 chars, but never 1
((dest.length() % 4) != 1) &&
dest.replaceAll("[a-zA-Z0-9~-]", "").length() == 0
B64_PATTERN.matcher(dest).matches()
;
}
@ -332,4 +356,27 @@ class AddressBook {
protected void finalize() {
delete();
}
/****
public static void main(String[] args) {
String[] tests = { "foo.i2p",
"3bnipzzu67cdq2rcygyxz52xhvy6ylokn4zfrk36ywn6pixmaoza.b32.i2p",
"9rhEy4dT9fMlcSOhDzfWRxCV2aen4Zp4eSthOf5f9gVKMa4PtQJ-wEzm2KEYeDXkbM6wEDvMQ6ou4LIniSE6bSAwy7fokiXk5oabels-sJmftnQWRbZyyXEAsLc3gpJJvp9km7kDyZ0z0YGL5tf3S~OaWdptB5tSBOAOjm6ramcYZMWhyUqm~xSL1JyXUqWEHRYwhoDJNL6-L516VpDYVigMBpIwskjeFGcqK8BqWAe0bRwxIiFTPN6Ck8SDzQvS1l1Yj-zfzg3X3gOknzwR8nrHUkjsWtEB6nhbOr8AR21C9Hs0a7MUJvSe2NOuBoNTrtxT76jDruI78JcG5r~WKl6M12yM-SqeBNE9hQn2QCHeHAKju7FdRCbqaZ99IwyjfwvZbkiYYQVN1xlUuGaXrj98XDzK7GORYdH-PrVGfEbMXQ40KLHUWHz8w4tQXAOQrCHEichod0RIzuuxo3XltCWKrf1xGZhkAo9bk2qXi6digCijvYNaKmQdXZYWW~RtAAAA",
"6IZTYacjlXjSAxu-uXEO5oGsj-f4tfePHEvGjs5pu-AMXMwD7-xFdi8kdobDMJp9yRAl96U7yLl~0t9zHeqqYmNeZnDSkTmAcSC2PT45ZJDXBobKi1~a77zuqfPwnzEatYfW3GL1JQAEkAmiwNJoG7ThTZ3zT7W9ekVJpHi9mivpTbaI~rALLfuAg~Mvr60nntZHjqhEZuiU4dTXrmc5nykl~UaMnBdwHL4jKmoN5CotqHyLYZfp74fdD-Oq4SkhuBhU8wkBIM3lz3Ul1o6-s0lNUMdYJq1CyxnyP7jeekdfAlSx4P4sU4M0dPaYvPdOFWPWwBuEh0pCs5Mj01B2xeEBhpV~xSLn6ru5Vq98TrmaR33KHxd76OYYFsWwzVbBuMVSd800XpBghGFucGw01YHYsPh3Afb01sXbf8Nb1bkxCy~DsrmoH4Ww3bpx66JhRTWvg5al3oWlCX51CnJUqaaK~dPL-pBvAyLKIA5aYvl8ca66jtA7AFDxsOb2texBBQAEAAcAAA==",
"te9Ky7XvVcLLr5vQqvfmOasg915P3-ddP3iDqpMMk7v5ufFKobLAX~1k-E4WVsJVlkYvkHVOjxix-uT1IdewKmLd81s5wZtz0GQ3ZC6p0C3S2cOxz7kQqf7QYSR0BrhZC~2du3-GdQO9TqNmsnHrah5lOZf0LN2JFEFPqg8ZB5JNm3JjJeSqePBRk3zAUogNaNK3voB1MVI0ZROKopXAJM4XMERNqI8tIH4ngGtV41SEJJ5pUFrrTx~EiUPqmSEaEA6UDYZiqd23ZlewZ31ExXQj97zvkuhKCoS9A9MNkzZejJhP-TEXWF8~KHur9f51H--EhwZ42Aj69-3GuNjsMdTwglG5zyIfhd2OspxJrXzCPqIV2sXn80IbPgwxHu0CKIJ6X43B5vTyVu87QDI13MIRNGWNZY5KmM5pilGP7jPkOs4xQDo4NHzpuJR5igjWgJIBPU6fI9Pzq~BMzjLiZOMp8xNWey1zKC96L0eX4of1MG~oUvq0qmIHGNa1TlUwBQAEAAEAAA==",
"(*&(*&(*&(*",
"9rhEy4dT9fMlcSOhDzfWRxCV2aen4Zp4eSthOf5f9gVKMa4PtQJ-wEzm2KEYeDXkbM6wEDvMQ6ou4LIniSE6bSAwy7fokiXk5oabels-sJmftnQWRbZyyXEAsLc3gpJJvp9km7kDyZ0z0YGL5tf3S~OaWdptB5tSBOAOjm6ramcYZMWhyUqm~xSL1JyXUqWEHRYwhoDJNL6-L516VpDYVigMBpIwskjeFGcqK8BqWAe0bRwxIiFTPN6Ck8SDzQvS1l1Yj-zfzg3X3gOknzwR8nrHUkjsWtEB6nhbOr8AR21C9Hs0a7MUJvSe2NOuBoNTrtxT76jDruI78JcG5r~WKl6M12yM-SqeBNE9hQn2QCHeHAKju7FdRCbqaZ99IwyjfwvZbkiYYQVN1xlUuGaXrj98XDzK7GORYdH-PrVGfEbMXQ40KLHUWHz8w4tQXAOQrCHEichod0RIzuuxo3XltCWKrf1xGZhkAo9bk2qXi6digCijvYNaKmQdXZYWW~RtAAA",
"6IZTYacjlXjSAxu-uXEO5oGsj-f4tfePHEvGjs5pu-AMXMwD7-xFdi8kdobDMJp9yRAl96U7yLl~0t9zHeqqYmNeZnDSkTmAcSC2PT45ZJDXBobKi1~a77zuqfPwnzEatYfW3GL1JQAEkAmiwNJoG7ThTZ3zT7W9ekVJpHi9mivpTbaI~rALLfuAg~Mvr60nntZHjqhEZuiU4dTXrmc5nykl~UaMnBdwHL4jKmoN5CotqHyLYZfp74fdD-Oq4SkhuBhU8wkBIM3lz3Ul1o6-s0lNUMdYJq1CyxnyP7jeekdfAlSx4P4sU4M0dPaYvPdOFWPWwBuEh0pCs5Mj01B2xeEBhpV~xSLn6ru5Vq98TrmaR33KHxd76OYYFsWwzVbBuMVSd800XpBghGFucGw01YHYsPh3Afb01sXbf8Nb1bkxCy~DsrmoH4Ww3bpx66JhRTWvg5al3oWlCX51CnJUqaaK~dPL-pBvAyLKIA5aYvl8ca66jtA7AFDxsOb2texBBQAEAAcAAA===",
"!e9Ky7XvVcLLr5vQqvfmOasg915P3-ddP3iDqpMMk7v5ufFKobLAX~1k-E4WVsJVlkYvkHVOjxix-uT1IdewKmLd81s5wZtz0GQ3ZC6p0C3S2cOxz7kQqf7QYSR0BrhZC~2du3-GdQO9TqNmsnHrah5lOZf0LN2JFEFPqg8ZB5JNm3JjJeSqePBRk3zAUogNaNK3voB1MVI0ZROKopXAJM4XMERNqI8tIH4ngGtV41SEJJ5pUFrrTx~EiUPqmSEaEA6UDYZiqd23ZlewZ31ExXQj97zvkuhKCoS9A9MNkzZejJhP-TEXWF8~KHur9f51H--EhwZ42Aj69-3GuNjsMdTwglG5zyIfhd2OspxJrXzCPqIV2sXn80IbPgwxHu0CKIJ6X43B5vTyVu87QDI13MIRNGWNZY5KmM5pilGP7jPkOs4xQDo4NHzpuJR5igjWgJIBPU6fI9Pzq~BMzjLiZOMp8xNWey1zKC96L0eX4of1MG~oUvq0qmIHGNa1TlUwBQAEAAEAAA==",
"x"
};
for (String s : tests) {
test(s);
}
}
public static void test(String s) {
System.out.println(s + " valid host? " + isValidKey(s) + " valid dest? " + isValidDest(s));
}
****/
}

View File

@ -22,6 +22,7 @@
package net.i2p.addressbook;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@ -41,7 +42,7 @@ import java.util.NoSuchElementException;
*
* @since 0.8.7
*/
class ConfigIterator implements Iterator<Map.Entry<String, String>> {
class ConfigIterator implements Iterator<Map.Entry<String, String>>, Closeable {
private BufferedReader input;
private ConfigEntry next;
@ -54,11 +55,9 @@ class ConfigIterator implements Iterator<Map.Entry<String, String>> {
/**
* An iterator over the key/value pairs in the file.
*/
public ConfigIterator(File file) {
try {
public ConfigIterator(File file) throws IOException {
FileInputStream fileStream = new FileInputStream(file);
input = new BufferedReader(new InputStreamReader(fileStream));
} catch (IOException ioe) {}
input = new BufferedReader(new InputStreamReader(fileStream, "UTF-8"));
}
public boolean hasNext() {

View File

@ -64,10 +64,11 @@ class ConfigParser {
if (inputLine.startsWith(";")) {
return "";
}
if (inputLine.split("#").length > 0) {
return inputLine.split("#")[0];
int hash = inputLine.indexOf('#');
if (hash >= 0) {
return inputLine.substring(0, hash);
} else {
return "";
return inputLine;
}
}
@ -115,7 +116,7 @@ class ConfigParser {
public static Map<String, String> parse(File file) throws IOException {
FileInputStream fileStream = new FileInputStream(file);
BufferedReader input = new BufferedReader(new InputStreamReader(
fileStream));
fileStream, "UTF-8"));
Map<String, String> rv = parse(input);
try {
fileStream.close();
@ -204,7 +205,7 @@ class ConfigParser {
public static List<String> parseSubscriptions(File file) throws IOException {
FileInputStream fileStream = new FileInputStream(file);
BufferedReader input = new BufferedReader(new InputStreamReader(
fileStream));
fileStream, "UTF-8"));
List<String> rv = parseSubscriptions(input);
try {
fileStream.close();

View File

@ -25,6 +25,7 @@ import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.client.naming.NamingServiceUpdater;
import net.i2p.util.I2PAppThread;
/**
* A thread that waits five minutes, then runs the addressbook daemon.
@ -32,7 +33,7 @@ import net.i2p.client.naming.NamingServiceUpdater;
* @author Ragnarok
*
*/
public class DaemonThread extends Thread implements NamingServiceUpdater {
public class DaemonThread extends I2PAppThread implements NamingServiceUpdater {
private String[] args;

View File

@ -23,8 +23,9 @@ package net.i2p.addressbook;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Date;
/**
@ -56,8 +57,8 @@ class Log {
public void append(String entry) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(this.file,
true));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.file,
true), "UTF-8"));
String timestamp = new Date().toString();
bw.write(timestamp + " -- " + entry);
bw.newLine();

View File

@ -26,6 +26,7 @@ import java.util.Iterator;
import java.util.List;
import net.i2p.I2PAppContext;
import net.i2p.util.PortMapper;
/**
* An iterator over the subscriptions in a SubscriptionList. Note that this iterator
@ -69,11 +70,14 @@ class SubscriptionIterator implements Iterator<AddressBook> {
* Yes, the EepGet fetch() is done in here in next().
*
* see java.util.Iterator#next()
* @return an AddressBook (empty if the minimum delay has not been met)
* @return non-null AddressBook (empty if the minimum delay has not been met,
* or there is no proxy tunnel, or the fetch otherwise fails)
*/
public AddressBook next() {
Subscription sub = this.subIterator.next();
if (sub.getLastFetched() + this.delay < I2PAppContext.getGlobalContext().clock().now()) {
if (sub.getLastFetched() + this.delay < I2PAppContext.getGlobalContext().clock().now() &&
I2PAppContext.getGlobalContext().portMapper().getPort(PortMapper.SVC_HTTP_PROXY) >= 0 &&
!I2PAppContext.getGlobalContext().getBooleanProperty("i2p.vmCommSystem")) {
//System.err.println("Fetching addressbook from " + sub.getLocation());
return new AddressBook(sub, this.proxyHost, this.proxyPort);
} else {

View File

@ -0,0 +1,11 @@
<html>
<body>
<p>
The addressbook application, which fetches hosts.txt files from subscription URLS via
HTTP and adds new hosts to the local database.
While implemented as a webapp, this application contains no user interface.
May also be packaged as a jar, as is done for Android.
The webapp named 'addressbook' in the console is actually SusiDNS.
</p>
</body>
</html>

View File

@ -28,4 +28,11 @@
<url-pattern>/*</url-pattern>
</servlet-mapping>
<!-- this webapp doesn't actually use sessions or cookies -->
<session-config>
<session-timeout>30</session-timeout>
<cookie-config>
<http-only>true</http-only>
</cookie-config>
</session-config>
</web-app>

View File

@ -0,0 +1,99 @@
# Last Modified: Sun Apr 12 22:08:32 2015
# vim:syntax=apparmor et ts=8 sw=4
#include <tunables/global>
$INSTALL_PATH/{i2prouter,runplain.sh} flags=(complain) {
#include <abstractions/base>
#include <abstractions/fonts>
#include <abstractions/nameservice>
#include <abstractions/ssl_certs>
capability sys_ptrace,
network inet stream,
network inet6 stream,
$INSTALL_PATH/ r,
$INSTALL_PATH/{i2psvc,wrapper} rmix,
owner $INSTALL_PATH/** rwklm,
# Needed for Java
owner @{PROC} r,
owner @{PROC}/[0-9]*/ r,
owner @{PROC}/[0-9]*/status r,
owner @{PROC}/[0-9]*/stat r,
owner @{PROC}/[0-9]*/cmdline r,
@{PROC}/uptime r,
@{PROC}/sys/kernel/pid_max r,
/sys/devices/system/cpu/ r,
/sys/devices/system/cpu/** r,
/dev/random r,
/dev/urandom r,
@{PROC}/1/comm r,
/etc/ssl/certs/java/** r,
/etc/timezone r,
/usr/share/javazi/** r,
# Debian
/etc/java-{6,7,8}-openjdk/** r,
/usr/lib/jvm/default-java/jre/bin/java rix,
# Debian, Ubuntu, openSUSE
/usr/lib{,32,64}/jvm/java-*-openjdk-*/jre/bin/java rix,
/usr/lib{,32,64}/jvm/java-*-openjdk-*/jre/bin/keytool rix,
# Raspbian
/usr/lib/jvm/jdk-*-oracle-*/jre/bin/java rix,
/usr/lib/jvm/jdk-*-oracle-*/jre/bin/keytool rix,
# Fonts are needed for I2P's graphs
/usr/share/java/java-atk-wrapper.jar r,
# Used by some plugins
/usr/share/java/eclipse-ecj-*.jar r,
/{,var/}tmp/ rwm,
owner /{,var/}tmp/** rwklm,
/{,usr/}bin/{,b,d}ash rix,
/{,usr/}bin/cat rix,
/{,usr/}bin/cut rix,
/{,usr/}bin/dirname rix,
/{,usr/}bin/expr rix,
/{,usr/}bin/{,g,m}awk rix,
/{,usr/}bin/grep rix,
/{,usr/}bin/id rix,
/{,usr/}bin/ldd rix,
/{,usr/}bin/ls rix,
/{,usr/}bin/mkdir rix,
/{,usr/}bin/nohup rix,
/{,usr/}bin/ps rix,
/{,usr/}bin/rm rix,
/{,usr/}bin/sed rix,
/{,usr/}bin/sleep rix,
/{,usr/}bin/tail rix,
/{,usr/}bin/tr rix,
/{,usr/}bin/uname rix,
/{,usr/}bin/which rix,
@{HOME}/.java/fonts/** r,
owner @{HOME}/.i2p/ rw,
owner @{HOME}/.i2p/** rwk,
# Prevent spamming the logs
deny owner @{HOME}/.java/ wk,
deny @{HOME}/.fontconfig/ wk,
deny @{HOME}/.java/fonts/** w,
deny /dev/tty rw,
deny /dev/pts/[0-9]* rw,
deny @{PROC}/[0-9]*/fd/ r,
deny /usr/local/share/fonts/ r,
deny /var/cache/fontconfig/ wk,
# Used by some versions of the Tanuki wrapper but never used by I2P
deny /usr/share/java/hamcrest*.jar r,
deny /usr/share/java/junit*.jar r,
}

View File

@ -26,12 +26,12 @@ then
fi
# on windows, one must specify the path of commnad find
# since windows has its own retarded version of find.
# since windows has its own version of find.
if which find|grep -q -i windows ; then
export PATH=.:/bin:/usr/local/bin:$PATH
fi
# Fast mode - update ondemond
# set LG2 to the language you need in envrionment varibales to enable this
# set LG2 to the language you need in environment variables to enable this
# add ../java/ so the refs will work in the po file
JPATHS="src"
@ -64,19 +64,19 @@ do
echo "Updating the $i file from the tags..."
# extract strings from java and jsp files, and update messages.po files
# translate calls must be one of the forms:
# _("foo")
# _t("foo")
# _x("foo")
# intl._("foo")
# intl._t("foo")
# intl.title("foo")
# handler._("foo")
# formhandler._("foo")
# handler._t("foo")
# formhandler._t("foo")
# net.i2p.router.web.Messages.getString("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find $JPATHS -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 --add-comments\
--keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=_t --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=handler._ --keyword=formhandler._ \
--keyword=net.i2p.router.web.Messages.getString \
-o ${i}t

View File

@ -3,20 +3,22 @@
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# <b790979@klzlk.com>, 2011.
# Translators:
# PolishAnon <b790979@klzlk.com>, 2011
# polacco <polacco@i2pmail.org>, 2015
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: 2011-05-25 18:36+0000\n"
"Last-Translator: PolishAnon <b790979@klzlk.com>\n"
"Language-Team: Polish (http://www.transifex.net/projects/p/I2P/team/pl/)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-09 19:27+0000\n"
"PO-Revision-Date: 2015-02-17 20:54+0000\n"
"Last-Translator: polacco <polacco@i2pmail.org>\n"
"Language-Team: Polish (http://www.transifex.com/projects/p/I2P/language/pl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 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 +34,7 @@ msgstr "Uruchamianie"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "Uruchom Przeglądarke I2P"
msgstr "Uruchom przeglądarkę I2P"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
@ -46,12 +48,10 @@ msgstr "Zrestartuj I2P"
msgid "Stop I2P"
msgstr "Zatrzymaj I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Konfiguracja ikony zasobnika"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr "Czy ikona zasobnika powinna być aktywna?"

View File

@ -4,16 +4,17 @@
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# Denis Blank <gribua@gmail.com>, 2011
# Denis Lysenko <gribua@gmail.com>, 2011
# LinuxChata, 2014
# madjong <madjong@i2pmail.org>, 2014
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-09 19:27+0000\n"
"PO-Revision-Date: 2014-06-22 10:20+0000\n"
"Last-Translator: LinuxChata\n"
"Language-Team: Ukrainian (Ukraine) (http://www.transifex.com/projects/p/I2P/language/uk_UA/)\n"
"PO-Revision-Date: 2015-08-07 16:31+0000\n"
"Last-Translator: Denis Lysenko <gribua@gmail.com>\n"
"Language-Team: Ukrainian (Ukraine) (http://www.transifex.com/otf/I2P/language/uk_UA/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -50,7 +51,7 @@ msgstr "Зупинити I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Настройка трей-іконки"
msgstr "Налаштування трей-іконки"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"

View File

@ -20,7 +20,7 @@ public class ExternalTrayManager extends TrayManager {
@Override
public PopupMenu getMainMenu() {
PopupMenu popup = new PopupMenu();
MenuItem startItem = new MenuItem(_("Start I2P"));
MenuItem startItem = new MenuItem(_t("Start I2P"));
startItem.addActionListener(new ActionListener() {
@Override
@ -35,7 +35,7 @@ public class ExternalTrayManager extends TrayManager {
@Override
protected void done() {
trayIcon.displayMessage(_("Starting"), _("I2P is starting!"), TrayIcon.MessageType.INFO);
trayIcon.displayMessage(_t("Starting"), _t("I2P is starting!"), TrayIcon.MessageType.INFO);
//Hide the tray icon.
//We cannot stop the desktopgui program entirely,
//since that risks killing the I2P process as well.

View File

@ -23,7 +23,7 @@ public class InternalTrayManager extends TrayManager {
public PopupMenu getMainMenu() {
PopupMenu popup = new PopupMenu();
MenuItem browserLauncher = new MenuItem(_("Launch I2P Browser"));
MenuItem browserLauncher = new MenuItem(_t("Launch I2P Browser"));
browserLauncher.addActionListener(new ActionListener() {
@Override
@ -47,7 +47,7 @@ public class InternalTrayManager extends TrayManager {
}.execute();
}
});
MenuItem desktopguiConfigurationLauncher = new MenuItem(_("Configure desktopgui"));
MenuItem desktopguiConfigurationLauncher = new MenuItem(_t("Configure desktopgui"));
desktopguiConfigurationLauncher.addActionListener(new ActionListener() {
@Override
@ -64,7 +64,7 @@ public class InternalTrayManager extends TrayManager {
}
});
MenuItem restartItem = new MenuItem(_("Restart I2P"));
MenuItem restartItem = new MenuItem(_t("Restart I2P"));
restartItem.addActionListener(new ActionListener() {
@Override
@ -82,7 +82,7 @@ public class InternalTrayManager extends TrayManager {
}
});
MenuItem stopItem = new MenuItem(_("Stop I2P"));
MenuItem stopItem = new MenuItem(_t("Stop I2P"));
stopItem.addActionListener(new ActionListener() {
@Override

View File

@ -78,7 +78,7 @@ public abstract class TrayManager {
return image;
}
protected static String _(String s) {
return DesktopguiTranslator._(s);
protected static String _t(String s) {
return DesktopguiTranslator._t(s);
}
}

View File

@ -40,10 +40,10 @@ public class DesktopguiConfigurationFrame extends javax.swing.JFrame {
cancelButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(_("Tray icon configuration"));
setTitle(_t("Tray icon configuration"));
desktopguiEnabled.setSelected(true);
desktopguiEnabled.setText(_("Should tray icon be enabled?"));
desktopguiEnabled.setText(_t("Should tray icon be enabled?"));
desktopguiEnabled.setActionCommand("shouldDesktopguiBeEnabled");
okButton.setText("OK");
@ -98,8 +98,8 @@ public class DesktopguiConfigurationFrame extends javax.swing.JFrame {
configureDesktopgui();
}//GEN-LAST:event_okButtonMouseReleased
protected static String _(String s) {
return DesktopguiTranslator._(s);
protected static String _t(String s) {
return DesktopguiTranslator._t(s);
}
private void configureDesktopgui() {

View File

@ -16,11 +16,11 @@ public class DesktopguiTranslator {
return ctx;
}
public static String _(String s) {
public static String _t(String s) {
return Translate.getString(s, getRouterContext(), BUNDLE_NAME);
}
public static String _(String s, Object o) {
public static String _t(String s, Object o) {
return Translate.getString(s, o, getRouterContext(), BUNDLE_NAME);
}
}

View File

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

View File

@ -1,24 +0,0 @@
- I2PSnark:
- add multitorrent support by checking the metainfo hash in the
PeerAcceptor and feeding it off to the appropriate coordinator
- add a web interface
- BEncode
- Byte array length indicator can overflow.
- Support really big BigNums (only 256 chars allowed now)
- Better BEValue toString(). Uses stupid heuristic now for debugging.
- Implemented bencoding.
- Remove application level hack to calculate sha1 hash for metainfo
(But can it be done as efficiently?)
- Storage
- Check file name filter.
- TrackerClient
- Support undocumented &numwant= request.
- PeerCoordinator
- Disconnect from other seeds as soon as you are a seed yourself.
- Text UI
- Make it completely silent.

View File

@ -100,15 +100,15 @@
<target name="war" depends="jar, bundle, warUpToDate, listChangedFiles" unless="war.uptodate" >
<!-- set if unset -->
<property name="workspace.changes.tr" value="" />
<copy todir="build/icons/.icons" >
<fileset dir="../icons/" />
<copy todir="build/resources/.resources" >
<fileset dir="../resources/" />
</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/*" />
<fileset dir="build/icons/" />
<fileset dir="build/resources/" />
<manifest>
<attribute name="Implementation-Version" value="${full.version}" />
<attribute name="Built-By" value="${build.built-by}" />
@ -121,7 +121,7 @@
<target name="warUpToDate">
<uptodate property="war.uptodate" targetfile="../i2psnark.war" >
<srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../icons/* ../web.xml" />
<srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../resources/**/* ../web.xml" />
</uptodate>
</target>

View File

@ -25,12 +25,12 @@ then
fi
# on windows, one must specify the path of commnad find
# since windows has its own retarded version of find.
# since windows has its own version of find.
if which find|grep -q -i windows ; then
export PATH=.:/bin:/usr/local/bin:$PATH
fi
# Fast mode - update ondemond
# set LG2 to the language you need in envrionment varibales to enable this
# set LG2 to the language you need in environment variables to enable this
# add ../java/ so the refs will work in the po file
JPATHS="../java/src"
@ -63,13 +63,13 @@ do
echo "Updating the $i file from the tags..."
# extract strings from java and jsp files, and update messages.po files
# translate calls must be one of the forms:
# _("foo")
# _t("foo")
# _x("foo")
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean poupdate.
find $JPATHS -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 --add-comments\
--keyword=_ --keyword=_x \
--keyword=_t --keyword=_x \
-o ${i}t
if [ $? -ne 0 ]
then

View File

@ -20,6 +20,8 @@
package org.klomp.snark;
import java.util.Arrays;
/**
* Container of a byte array representing set and unset bits.
@ -66,7 +68,7 @@ public class BitField
/**
* This returns the actual byte array used. Changes to this array
* effect this BitField. Note that some bits at the end of the byte
* affect this BitField. Note that some bits at the end of the byte
* array are supposed to be always unset if they represent bits
* bigger then the size of the bitfield.
*/
@ -105,6 +107,37 @@ public class BitField
}
}
/**
* Sets the given bit to false.
*
* @exception IndexOutOfBoundsException if bit is smaller then zero
* bigger then size (inclusive).
* @since 0.9.22
*/
public void clear(int bit)
{
if (bit < 0 || bit >= size)
throw new IndexOutOfBoundsException(Integer.toString(bit));
int index = bit/8;
int mask = 128 >> (bit % 8);
synchronized(this) {
if ((bitfield[index] & mask) != 0) {
count--;
bitfield[index] &= ~mask;
}
}
}
/**
* Sets all bits to true.
*
* @since 0.9.21
*/
public void setAll() {
Arrays.fill(bitfield, (byte) 0xff);
count = size;
}
/**
* Return true if the bit is set or false if it is not.
*

View File

@ -54,7 +54,15 @@ public interface CompleteListener {
*/
public void gotPiece(Snark snark);
// not really listeners but the easiest way to get back to an optional SnarkManager
/** not really listeners but the easiest way to get back to an optional SnarkManager */
public long getSavedTorrentTime(Snark snark);
public BitField getSavedTorrentBitField(Snark snark);
/**
* @since 0.9.15
*/
public boolean getSavedPreserveNamesSetting(Snark snark);
/**
* @since 0.9.15
*/
public long getSavedUploaded(Snark snark);
}

View File

@ -24,6 +24,7 @@ import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ConnectException;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
@ -213,6 +214,20 @@ class ConnectionAcceptor implements Runnable
}
}
}
catch (ConnectException ioe)
{
// This is presumed to be due to socket closing by I2PSnarkUtil.disconnect(),
// which does not currently call our halt(), although it should
if (_log.shouldWarn())
_log.warn("Error while accepting", ioe);
synchronized(this) {
if (!stop) {
locked_halt();
thread = null;
stop = true;
}
}
}
catch (IOException ioe)
{
int level = stop ? Log.WARN : Log.ERROR;

View File

@ -90,17 +90,20 @@ abstract class ExtensionHandler {
peer.setHandshakeMap(map);
Map<String, BEValue> msgmap = map.get("m").getMap();
if (msgmap.get(TYPE_PEX) != null) {
if (log.shouldLog(Log.DEBUG))
log.debug("Peer supports PEX extension: " + peer);
// peer state calls peer listener calls sendPEX()
}
if (log.shouldLog(Log.DEBUG))
log.debug("Peer " + peer + " supports extensions: " + msgmap.keySet());
if (msgmap.get(TYPE_DHT) != null) {
if (log.shouldLog(Log.DEBUG))
log.debug("Peer supports DHT extension: " + peer);
// peer state calls peer listener calls sendDHT()
}
//if (msgmap.get(TYPE_PEX) != null) {
// if (log.shouldLog(Log.DEBUG))
// log.debug("Peer supports PEX extension: " + peer);
// // peer state calls peer listener calls sendPEX()
//}
//if (msgmap.get(TYPE_DHT) != null) {
// if (log.shouldLog(Log.DEBUG))
// log.debug("Peer supports DHT extension: " + peer);
// // peer state calls peer listener calls sendDHT()
//}
MagnetState state = peer.getMagnetState();
@ -204,30 +207,31 @@ abstract class ExtensionHandler {
if (log.shouldLog(Log.DEBUG))
log.debug("Got request for " + piece + " from: " + peer);
byte[] pc;
int totalSize;
synchronized(state) {
pc = state.getChunk(piece);
totalSize = state.getSize();
}
sendPiece(peer, piece, pc);
sendPiece(peer, piece, pc, totalSize);
// Do this here because PeerConnectionOut only reports for PIECE messages
peer.uploaded(pc.length);
listener.uploaded(peer, pc.length);
} else if (type == TYPE_DATA) {
int size = map.get("total_size").getInt();
if (log.shouldLog(Log.DEBUG))
log.debug("Got data for " + piece + " length " + size + " from: " + peer);
// On close reading of BEP 9, this is the total metadata size.
// Prior to 0.9.21, we sent the piece size, so we can't count on it.
// just ignore it. The actual length will be verified in saveChunk()
//int size = map.get("total_size").getInt();
//if (log.shouldLog(Log.DEBUG))
// log.debug("Got data for " + piece + " length " + size + " from: " + peer);
boolean done;
int chk = -1;
synchronized(state) {
if (state.isComplete())
return;
int len = is.available();
if (len != size) {
// probably fatal
if (log.shouldLog(Log.WARN))
log.warn("total_size " + size + " but avail data " + len);
}
peer.downloaded(len);
listener.downloaded(peer, len);
// this checks the size
done = state.saveChunk(piece, bs, bs.length - len, len);
if (log.shouldLog(Log.INFO))
log.info("Got chunk " + piece + " from " + peer);
@ -290,11 +294,15 @@ abstract class ExtensionHandler {
}
}
private static void sendPiece(Peer peer, int piece, byte[] data) {
private static void sendPiece(Peer peer, int piece, byte[] data, int totalSize) {
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));
// BEP 9
// "This key has the same semantics as the 'metadata_size' in the extension header"
// which apparently means the same value. Fixed in 0.9.21.
//map.put("total_size", Integer.valueOf(data.length));
map.put("total_size", Integer.valueOf(totalSize));
byte[] dict = BEncoder.bencode(map);
byte[] payload = new byte[dict.length + data.length];
System.arraycopy(dict, 0, payload, 0, dict.length);

View File

@ -3,14 +3,18 @@ package org.klomp.snark;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PClient;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.streaming.I2PServerSocket;
@ -71,8 +75,6 @@ public class I2PSnarkUtil {
private static final int EEPGET_CONNECT_TIMEOUT_SHORT = 5*1000;
public static final int DEFAULT_STARTUP_DELAY = 3;
public static final boolean DEFAULT_USE_OPENTRACKERS = true;
public static final String DEFAULT_OPENTRACKERS = "http://tracker.welterde.i2p/a";
public static final int DEFAULT_MAX_UP_BW = 8; //KBps
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;
@ -95,18 +97,17 @@ public class I2PSnarkUtil {
setI2CPConfig("127.0.0.1", 7654, null);
_banlist = new ConcurrentHashSet<Hash>();
_maxUploaders = Snark.MAX_TOTAL_UPLOADERS;
_maxUpBW = DEFAULT_MAX_UP_BW;
_maxUpBW = SnarkManager.DEFAULT_MAX_UP_BW;
_maxConnections = MAX_CONNECTIONS;
_startupDelay = DEFAULT_STARTUP_DELAY;
_shouldUseOT = DEFAULT_USE_OPENTRACKERS;
// FIXME split if default has more than one
_openTrackers = Collections.singletonList(DEFAULT_OPENTRACKERS);
_openTrackers = Collections.emptyList();
_shouldUseDHT = DEFAULT_USE_DHT;
// 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(), baseName);
FileUtil.rmdir(_tmpDir, false);
_tmpDir = new SecureDirectory(ctx.getTempDir(), baseName + '-' + ctx.random().nextInt());
//FileUtil.rmdir(_tmpDir, false);
_tmpDir.mkdirs();
}
@ -135,6 +136,7 @@ public class I2PSnarkUtil {
public boolean configured() { return _configured; }
@SuppressWarnings({"unchecked", "rawtypes"})
public void setI2CPConfig(String i2cpHost, int i2cpPort, Map opts) {
if (i2cpHost != null)
_i2cpHost = i2cpHost;
@ -255,6 +257,8 @@ public class I2PSnarkUtil {
opts.setProperty("i2p.streaming.disableRejectLogging", "true");
if (opts.getProperty("i2p.streaming.answerPings") == null)
opts.setProperty("i2p.streaming.answerPings", "false");
if (opts.getProperty(I2PClient.PROP_SIGTYPE) == null)
opts.setProperty(I2PClient.PROP_SIGTYPE, "EdDSA_SHA512_Ed25519");
_manager = I2PSocketManagerFactory.createManager(_i2cpHost, _i2cpPort, opts);
_connecting = false;
}
@ -328,7 +332,7 @@ public class I2PSnarkUtil {
return rv;
} catch (I2PException ie) {
_banlist.add(dest);
_context.simpleScheduler().addEvent(new Unbanlist(dest), 10*60*1000);
_context.simpleTimer2().addEvent(new Unbanlist(dest), 10*60*1000);
IOException ioe = new IOException("Unable to reach the peer " + peer);
ioe.initCause(ie);
throw ioe;
@ -456,7 +460,7 @@ public class I2PSnarkUtil {
return null;
}
String getOurIPString() {
public String getOurIPString() {
Destination dest = getMyDestination();
if (dest != null)
return dest.toBase64();
@ -565,12 +569,12 @@ public class I2PSnarkUtil {
return rv;
}
/** @param ot non-null */
/** @param ot non-null list of announce URLs */
public void setOpenTrackers(List<String> ot) {
_openTrackers = ot;
}
/** List of open trackers to use as backups
/** List of open tracker announce URLs to use as backups
* @return non-null, possibly unmodifiable, empty if disabled
*/
public List<String> getOpenTrackers() {
@ -580,7 +584,22 @@ public class I2PSnarkUtil {
}
/**
* List of open trackers to use as backups even if disabled
* Is this announce URL probably for an open tracker?
*
* @since 0.9.17
*/
public boolean isKnownOpenTracker(String url) {
try {
URL u = new URL(url);
String host = u.getHost();
return host != null && SnarkManager.KNOWN_OPENTRACKERS.contains(host);
} catch (MalformedURLException mue) {
return false;
}
}
/**
* List of open tracker announce URLs to use as backups even if disabled
* @return non-null
* @since 0.9.4
*/
@ -642,7 +661,7 @@ public class I2PSnarkUtil {
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* @param o parameter, not translated.
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
* To translate parameter also, use _t("foo {0} bar", _t("baz"))
* Do not double the single quotes in the parameter.
* Use autoboxing to call with ints, longs, floats, etc.
*/

View File

@ -29,6 +29,9 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
private int _consec;
private int _consecNotRunning;
private boolean _isIdle;
private String _lastIn = "3";
private String _lastOut = "3";
private final Object _lock = new Object();
private static final long CHECK_TIME = 63*1000;
private static final int MAX_CONSEC_IDLE = 4;
@ -46,16 +49,19 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
}
public void timeReached() {
synchronized (_lock) {
locked_timeReached();
}
}
private void locked_timeReached() {
if (_util.connected()) {
boolean torrentRunning = false;
boolean hasPeers = false;
int peerCount = 0;
for (PeerCoordinator pc : _pcs) {
if (!pc.halted()) {
torrentRunning = true;
if (pc.getPeers() > 0) {
hasPeers = true;
break;
}
peerCount += pc.getPeers();
}
}
@ -66,25 +72,29 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
if (_log.shouldLog(Log.WARN))
_log.warn("Closing tunnels on idle");
_util.disconnect();
_mgr.addMessage(_util.getString("I2P tunnel closed."));
_mgr.addMessage(_util.getString("No more torrents running.") + ' ' +
_util.getString("I2P tunnel closed."));
schedule(3 * CHECK_TIME);
return;
}
}
if (hasPeers) {
if (_isIdle)
restoreTunnels();
if (peerCount > 0) {
restoreTunnels(peerCount);
} else {
if (!_isIdle) {
if (_consec++ >= MAX_CONSEC_IDLE)
reduceTunnels();
else
restoreTunnels(1); // pretend we have one peer for now
}
}
} else {
_isIdle = false;
_consec = 0;
_consecNotRunning = 0;
_lastIn = "3";
_lastOut = "3";
}
schedule(CHECK_TIME);
}
@ -100,12 +110,13 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
}
/**
* Restore tunnel count
* Restore or adjust tunnel count based on current peer count
* @param peerCount greater than zero
*/
private void restoreTunnels() {
_isIdle = false;
if (_log.shouldLog(Log.INFO))
private void restoreTunnels(int peerCount) {
if (_isIdle && _log.shouldLog(Log.INFO))
_log.info("Restoring tunnels on activity");
_isIdle = false;
Map<String, String> opts = _util.getI2CPOptions();
String i = opts.get("inbound.quantity");
if (i == null)
@ -119,7 +130,30 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
String ob= opts.get("outbound.backupQuantity");
if (ob == null)
ob = "0";
setTunnels(i, o, ib, ob);
// we don't need more tunnels than we have peers, reduce if so
// reduce to max(peerCount / 2, 2)
int in, out;
try {
in = Integer.parseInt(i);
} catch (NumberFormatException nfe) {
in = 3;
}
try {
out = Integer.parseInt(o);
} catch (NumberFormatException nfe) {
out = 3;
}
int target = Math.max(peerCount / 2, 2);
if (target < in && in > 2) {
in = target;
i = Integer.toString(in);
}
if (target < out && out > 2) {
out = target;
o = Integer.toString(out);
}
if (!(_lastIn.equals(i) && _lastOut.equals(o)))
setTunnels(i, o, ib, ob);
}
/**
@ -131,12 +165,16 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
if (mgr != null) {
I2PSession sess = mgr.getSession();
if (sess != null) {
if (_log.shouldLog(Log.INFO))
_log.info("New tunnel settings " + i + " / " + o + " / " + ib + " / " + ob);
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);
_lastIn = i;
_lastOut = o;
}
}
}

View File

@ -42,7 +42,7 @@ public class MagnetURI {
name = util.getString("Magnet") + ' ' + ihash;
String dn = getParam("dn", url);
if (dn != null)
name += " (" + Storage.filterName(dn) + ')';
name += " (" + dn + ')';
} else if (url.startsWith(MAGGOT)) {
// maggot://0691e40aae02e552cfcb57af1dca56214680c0c5:0b557bbdf8718e95d352fbe994dec3a383e2ede7
ihash = url.substring(MAGGOT.length()).trim();
@ -82,7 +82,7 @@ public class MagnetURI {
}
/**
* @return pretty name or null
* @return pretty name or null, NOT HTML escaped
*/
public String getName() {
return _name;
@ -175,18 +175,25 @@ public class MagnetURI {
}
/**
* Decode %xx encoding, convert to UTF-8 if necessary
* Copied from i2ptunnel LocalHTTPServer
* Decode %xx encoding, convert to UTF-8 if necessary.
* Copied from i2ptunnel LocalHTTPServer.
* Also converts '+' to ' ' so the dn parameter comes out right
* These are coming in via a application/x-www-form-urlencoded form so
* the pluses are in there...
* hopefully any real + is encoded as %2B.
*
* @since 0.9.1
*/
private static String decode(String s) {
if (!s.contains("%"))
if (!(s.contains("%") || s.contains("+")))
return s;
StringBuilder buf = new StringBuilder(s.length());
boolean utf8 = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c != '%') {
if (c == '+') {
buf.append(' ');
} else if (c != '%') {
buf.append(c);
} else {
try {

View File

@ -55,11 +55,13 @@ class Message
byte type;
// Used for HAVE, REQUEST, PIECE and CANCEL messages.
// Also SUGGEST, REJECT, ALLOWED_FAST
// low byte used for EXTENSION message
// low two bytes used for PORT message
int piece;
// Used for REQUEST, PIECE and CANCEL messages.
// Also REJECT
int begin;
int length;
@ -104,15 +106,18 @@ class Message
int datalen = 1;
// piece is 4 bytes.
if (type == HAVE || type == REQUEST || type == PIECE || type == CANCEL)
if (type == HAVE || type == REQUEST || type == PIECE || type == CANCEL ||
type == SUGGEST || type == REJECT || type == ALLOWED_FAST)
datalen += 4;
// begin/offset is 4 bytes
if (type == REQUEST || type == PIECE || type == CANCEL)
if (type == REQUEST || type == PIECE || type == CANCEL ||
type == REJECT)
datalen += 4;
// length is 4 bytes
if (type == REQUEST || type == CANCEL)
if (type == REQUEST || type == CANCEL ||
type == REJECT)
datalen += 4;
// msg type is 1 byte
@ -131,15 +136,18 @@ class Message
dos.writeByte(type & 0xFF);
// Send additional info (piece number)
if (type == HAVE || type == REQUEST || type == PIECE || type == CANCEL)
if (type == HAVE || type == REQUEST || type == PIECE || type == CANCEL ||
type == SUGGEST || type == REJECT || type == ALLOWED_FAST)
dos.writeInt(piece);
// Send additional info (begin/offset)
if (type == REQUEST || type == PIECE || type == CANCEL)
if (type == REQUEST || type == PIECE || type == CANCEL ||
type == REJECT)
dos.writeInt(begin);
// Send additional info (length); for PIECE this is implicit.
if (type == REQUEST || type == CANCEL)
if (type == REQUEST || type == CANCEL ||
type == REJECT)
dos.writeInt(length);
if (type == EXTENSION)
@ -173,21 +181,32 @@ class Message
case UNINTERESTED:
return "UNINTERESTED";
case HAVE:
return "HAVE(" + piece + ")";
return "HAVE(" + piece + ')';
case BITFIELD:
return "BITFIELD";
case REQUEST:
return "REQUEST(" + piece + "," + begin + "," + length + ")";
return "REQUEST(" + piece + ',' + begin + ',' + length + ')';
case PIECE:
return "PIECE(" + piece + "," + begin + "," + length + ")";
return "PIECE(" + piece + ',' + begin + ',' + length + ')';
case CANCEL:
return "CANCEL(" + piece + "," + begin + "," + length + ")";
return "CANCEL(" + piece + ',' + begin + ',' + length + ')';
case PORT:
return "PORT(" + piece + ")";
return "PORT(" + piece + ')';
case EXTENSION:
return "EXTENSION(" + piece + ',' + data.length + ')';
// fast extensions below here
case SUGGEST:
return "SUGGEST(" + piece + ')';
case HAVE_ALL:
return "HAVE_ALL";
case HAVE_NONE:
return "HAVE_NONE";
case REJECT:
return "REJECT(" + piece + ',' + begin + ',' + length + ')';
case ALLOWED_FAST:
return "ALLOWED_FAST(" + piece + ')';
default:
return "<UNKNOWN>";
return "UNKNOWN (" + type + ')';
}
}
}

View File

@ -74,10 +74,11 @@ public class MetaInfo
* @param files null for single-file torrent
* @param lengths null for single-file torrent
* @param announce_list may be null
* @param created_by 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,
List<List<String>> announce_list)
List<List<String>> announce_list, String created_by)
{
this.announce = announce;
this.name = name;
@ -91,8 +92,8 @@ public class MetaInfo
this.privateTorrent = privateTorrent;
this.announce_list = announce_list;
this.comment = null;
this.created_by = null;
this.creation_date = 0;
this.created_by = created_by;
this.creation_date = I2PAppContext.getGlobalContext().clock().now();
// TODO if we add a parameter for other keys
//if (other != null) {
@ -444,7 +445,7 @@ public class MetaInfo
/**
* The creation date (ms) or zero.
* Not available for locally-created torrents.
* As of 0.9.19, available for locally-created torrents.
* @since 0.9.7
*/
public long getCreationDate() {
@ -595,6 +596,14 @@ public class MetaInfo
m.put("announce", announce);
if (announce_list != null)
m.put("announce-list", announce_list);
// misc. optional top-level stuff
if (comment != null)
m.put("comment", comment);
if (created_by != null)
m.put("created by", created_by);
if (creation_date != 0)
m.put("creation date", creation_date / 1000);
Map<String, BEValue> info = createInfoMap();
m.put("info", info);
// don't save this locally, we should only do this once

View File

@ -108,7 +108,8 @@ class PartialPiece implements Comparable<PartialPiece> {
/**
* Convert this PartialPiece to a request for the next chunk.
* Used by PeerState only.
* Used by PeerState only. This depends on the downloaded value
* as set by setDownloaded() or read().
*/
public Request getRequest() {
@ -128,14 +129,16 @@ class PartialPiece implements Comparable<PartialPiece> {
}
/**
* How many bytes are good - only valid by setDownloaded()
* How many bytes are good - as set by setDownloaded() or read()
*/
public int getDownloaded() {
return this.off;
}
/**
* Call this before returning a PartialPiece to the PeerCoordinator
* Call this if necessary before returning a PartialPiece to the PeerCoordinator.
* We do not use a bitmap to track individual chunks received.
* Any chunks after a 'hole' will be lost.
* @since 0.9.1
*/
public void setDownloaded(int offset) {
@ -191,11 +194,20 @@ class PartialPiece implements Comparable<PartialPiece> {
/**
* Blocking.
* If offset matches the previous downloaded amount
* (as set by a previous call to read() or setDownlaoded()),
* the downloaded amount will be incremented by len.
*
* @since 0.9.1
*/
public void read(DataInputStream din, int off, int len) throws IOException {
public void read(DataInputStream din, int offset, int len) throws IOException {
if (bs != null) {
din.readFully(bs, off, len);
din.readFully(bs, offset, len);
synchronized (this) {
// only works for in-order chunks
if (this.off == offset)
this.off += len;
}
} else {
// read in fully before synching on raf
ByteArray ba;
@ -211,8 +223,11 @@ class PartialPiece implements Comparable<PartialPiece> {
synchronized (this) {
if (raf == null)
createTemp();
raf.seek(off);
raf.seek(offset);
raf.write(tmp);
// only works for in-order chunks
if (this.off == offset)
this.off += len;
}
if (ba != null)
_cache.release(ba, false);

View File

@ -57,8 +57,8 @@ public class Peer implements Comparable<Peer>
private DataOutputStream dout;
/** running counters */
private long downloaded;
private long uploaded;
private final AtomicLong downloaded = new AtomicLong();
private final AtomicLong uploaded = new AtomicLong();
// Keeps state for in/out connections. Non-null when the handshake
// was successful, the connection setup and runs
@ -79,15 +79,15 @@ public class Peer implements Comparable<Peer>
private long uploaded_old[] = {-1,-1,-1};
private long downloaded_old[] = {-1,-1,-1};
// bytes per bt spec: 0011223344556677
static final long OPTION_EXTENSION = 0x0000000000100000l;
static final long OPTION_FAST = 0x0000000000000004l;
static final long OPTION_DHT = 0x0000000000000001l;
// bytes per bt spec: 0011223344556677
private static final long OPTION_EXTENSION = 0x0000000000100000l;
private static final long OPTION_FAST = 0x0000000000000004l;
//private static final long OPTION_DHT = 0x0000000000000001l;
/** we use a different bit since the compact format is different */
/* no, let's use an extension message
static final long OPTION_I2P_DHT = 0x0000000040000000l;
*/
static final long OPTION_AZMP = 0x1000000000000000l;
//private static final long OPTION_AZMP = 0x1000000000000000l;
private long options;
/**
@ -297,7 +297,7 @@ public class Peer implements Comparable<Peer>
if (_log.shouldLog(Log.DEBUG))
_log.debug("Start running the reader with " + toString());
// Use this thread for running the incomming connection.
// Use this thread for running the incoming connection.
// The outgoing connection creates its own Thread.
out.startup();
Thread.currentThread().setName("Snark reader from " + peerID);
@ -338,6 +338,9 @@ public class Peer implements Comparable<Peer>
dout.write("BitTorrent protocol".getBytes("UTF-8"));
// Handshake write - options
long myOptions = OPTION_EXTENSION;
// we can't handle HAVE_ALL or HAVE_NONE if we don't know the number of pieces
if (metainfo != null)
myOptions |= OPTION_FAST;
// FIXME get util here somehow
//if (util.getDHT() != null)
// myOptions |= OPTION_I2P_DHT;
@ -385,15 +388,15 @@ public class Peer implements Comparable<Peer>
if (options != 0) {
// send them something in runConnection() above
if (_log.shouldLog(Log.DEBUG))
_log.debug("Peer supports options 0x" + Long.toString(options, 16) + ": " + toString());
_log.debug("Peer supports options 0x" + Long.toHexString(options) + ": " + toString());
}
return bs;
}
/** @since 0.8.4 */
public long getOptions() {
return options;
/** @since 0.9.21 */
public boolean supportsFast() {
return (options & OPTION_FAST) != 0;
}
/** @since 0.8.4 */
@ -618,7 +621,7 @@ public class Peer implements Comparable<Peer>
* @since 0.8.4
*/
public void downloaded(int size) {
downloaded += size;
downloaded.addAndGet(size);
}
/**
@ -626,7 +629,7 @@ public class Peer implements Comparable<Peer>
* @since 0.8.4
*/
public void uploaded(int size) {
uploaded += size;
uploaded.addAndGet(size);
}
/**
@ -635,7 +638,7 @@ public class Peer implements Comparable<Peer>
*/
public long getDownloaded()
{
return downloaded;
return downloaded.get();
}
/**
@ -644,7 +647,7 @@ public class Peer implements Comparable<Peer>
*/
public long getUploaded()
{
return uploaded;
return uploaded.get();
}
/**
@ -652,8 +655,8 @@ public class Peer implements Comparable<Peer>
*/
public void resetCounters()
{
downloaded = 0;
uploaded = 0;
downloaded.set(0);
uploaded.set(0);
}
public long getInactiveTime() {

View File

@ -75,6 +75,8 @@ class PeerCheckerTask implements Runnable
List<Peer> removed = new ArrayList<Peer>();
int uploadLimit = coordinator.allowedUploaders();
boolean overBWLimit = coordinator.overUpBWLimit();
if (_log.shouldLog(Log.DEBUG))
_log.debug("peers: " + peerList.size() + " limit: " + uploadLimit + " overBW? " + overBWLimit);
DHT dht = _util.getDHT();
for (Peer peer : peerList) {
@ -265,7 +267,23 @@ class PeerCheckerTask implements Runnable
// close out unused files, but we don't need to do it every time
Storage storage = coordinator.getStorage();
if (storage != null && (_runCount % 4) == 0) {
if (storage != null) {
// The more files a torrent has, the more often we call the cleaner,
// to keep from running out of FDs
int files = storage.getFileCount();
int skip;
if (files == 1)
skip = 6;
else if (files <= 4)
skip = 4;
else if (files <= 20)
skip = 3;
else if (files <= 50)
skip = 2;
else
skip = 1;
if ((_runCount % skip) == 0)
storage.cleanRAFs();
}

View File

@ -98,44 +98,48 @@ class PeerConnectionIn implements Runnable
}
byte b = din.readByte();
Message m = new Message();
m.type = b;
switch (b)
{
case 0:
case Message.CHOKE:
ps.chokeMessage(true);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received choke from " + peer);
break;
case 1:
case Message.UNCHOKE:
ps.chokeMessage(false);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received unchoke from " + peer);
break;
case 2:
case Message.INTERESTED:
ps.interestedMessage(true);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received interested from " + peer);
break;
case 3:
case Message.UNINTERESTED:
ps.interestedMessage(false);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received not interested from " + peer);
break;
case 4:
case Message.HAVE:
piece = din.readInt();
ps.haveMessage(piece);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received havePiece(" + piece + ") from " + peer);
break;
case 5:
case Message.BITFIELD:
byte[] bitmap = new byte[i-1];
din.readFully(bitmap);
ps.bitfieldMessage(bitmap);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received bitmap from " + peer + ": size=" + (i-1) /* + ": " + ps.bitfield */ );
break;
case 6:
case Message.REQUEST:
piece = din.readInt();
begin = din.readInt();
len = din.readInt();
@ -143,7 +147,8 @@ class PeerConnectionIn implements Runnable
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received request(" + piece + "," + begin + ") from " + peer);
break;
case 7:
case Message.PIECE:
piece = din.readInt();
begin = din.readInt();
len = i-9;
@ -165,7 +170,8 @@ class PeerConnectionIn implements Runnable
_log.debug("Received UNWANTED data(" + piece + "," + begin + ") from " + peer);
}
break;
case 8:
case Message.CANCEL:
piece = din.readInt();
begin = din.readInt();
len = din.readInt();
@ -173,13 +179,15 @@ class PeerConnectionIn implements Runnable
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received cancel(" + piece + "," + begin + ") from " + peer);
break;
case 9: // PORT message
case Message.PORT:
int port = din.readUnsignedShort();
ps.portMessage(port);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received port message from " + peer);
break;
case 20: // Extension message
case Message.EXTENSION:
int id = din.readUnsignedByte();
byte[] payload = new byte[i-2];
din.readFully(payload);
@ -187,6 +195,43 @@ class PeerConnectionIn implements Runnable
_log.debug("Received extension message from " + peer);
ps.extensionMessage(id, payload);
break;
// fast extensions below here
case Message.SUGGEST:
piece = din.readInt();
ps.suggestMessage(piece);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received suggest(" + piece + ") from " + peer);
break;
case Message.HAVE_ALL:
ps.haveMessage(true);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received have_all from " + peer);
break;
case Message.HAVE_NONE:
ps.haveMessage(false);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received have_none from " + peer);
break;
case Message.REJECT:
piece = din.readInt();
begin = din.readInt();
len = din.readInt();
ps.rejectMessage(piece, begin, len);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received reject(" + piece + ',' + begin + ',' + len + ") from " + peer);
break;
case Message.ALLOWED_FAST:
piece = din.readInt();
ps.allowedFastMessage(piece);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Received allowed_fast(" + piece + ") from " + peer);
break;
default:
byte[] bs = new byte[i-1];
din.readFully(bs);

View File

@ -22,15 +22,15 @@ package org.klomp.snark;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
//import net.i2p.util.SimpleScheduler;
//import net.i2p.util.SimpleTimer;
class PeerConnectionOut implements Runnable
@ -43,7 +43,7 @@ class PeerConnectionOut implements Runnable
private boolean quit;
// Contains Messages.
private final List<Message> sendQueue = new ArrayList<Message>();
private final BlockingQueue<Message> sendQueue = new LinkedBlockingQueue<Message>();
private static final AtomicLong __id = new AtomicLong();
private final long _id;
@ -125,6 +125,16 @@ class PeerConnectionOut implements Runnable
if (state.choking) {
it.remove();
//SimpleTimer.getInstance().removeEvent(nm.expireEvent);
if (peer.supportsFast()) {
Message r = new Message();
r.type = Message.REJECT;
r.piece = nm.piece;
r.begin = nm.begin;
r.length = nm.length;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Send " + peer + ": " + r);
r.sendMessage(dout);
}
}
nm = null;
}
@ -142,8 +152,8 @@ class PeerConnectionOut implements Runnable
it.remove();
}
}
if (m == null && !sendQueue.isEmpty()) {
m = sendQueue.remove(0);
if (m == null) {
m = sendQueue.poll();
//SimpleTimer.getInstance().removeEvent(m.expireEvent);
}
}
@ -160,6 +170,8 @@ class PeerConnectionOut implements Runnable
lastSent = System.currentTimeMillis();
// Remove all piece messages after sending a choke message.
// FiXME this causes REJECT messages to be sent before sending the CHOKE;
// BEP 6 recommends sending them after.
if (m.type == Message.CHOKE)
removeMessage(Message.PIECE);
@ -234,7 +246,7 @@ class PeerConnectionOut implements Runnable
{
synchronized(sendQueue)
{
sendQueue.add(m);
sendQueue.offer(m);
sendQueue.notifyAll();
}
}
@ -278,11 +290,22 @@ class PeerConnectionOut implements Runnable
while (it.hasNext())
{
Message m = it.next();
if (m.type == type)
{
if (m.type == type) {
it.remove();
removed = true;
}
if (type == Message.PIECE && peer.supportsFast()) {
Message r = new Message();
r.type = Message.REJECT;
r.piece = m.piece;
r.begin = m.begin;
r.length = m.length;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Send " + peer + ": " + r);
try {
r.sendMessage(dout);
} catch (IOException ioe) {}
}
}
}
sendQueue.notifyAll();
}
@ -297,7 +320,7 @@ class PeerConnectionOut implements Runnable
synchronized(sendQueue)
{
if(sendQueue.isEmpty())
sendQueue.add(m);
sendQueue.offer(m);
sendQueue.notifyAll();
}
}
@ -350,12 +373,19 @@ class PeerConnectionOut implements Runnable
void sendBitfield(BitField bitfield)
{
Message m = new Message();
m.type = Message.BITFIELD;
m.data = bitfield.getFieldBytes();
m.off = 0;
m.len = m.data.length;
addMessage(m);
boolean fast = peer.supportsFast();
if (fast && bitfield.complete()) {
sendHaveAll();
} else if (fast && bitfield.count() <= 0) {
sendHaveNone();
} else {
Message m = new Message();
m.type = Message.BITFIELD;
m.data = bitfield.getFieldBytes();
m.off = 0;
m.len = m.data.length;
addMessage(m);
}
}
/** reransmit requests not received in 7m */
@ -480,7 +510,6 @@ class PeerConnectionOut implements Runnable
m.len = length;
// since we have the data already loaded, queue a timeout to remove it
// no longer prefetched
//SimpleScheduler.getInstance().addEvent(new RemoveTooSlow(m), SEND_TIMEOUT);
addMessage(m);
}
@ -511,7 +540,8 @@ class PeerConnectionOut implements Runnable
}
/**
* Remove all Request messages from the queue
* Remove all Request messages from the queue.
* Does not send a cancel message.
* @since 0.8.2
*/
void cancelRequestMessages() {
@ -523,9 +553,12 @@ class PeerConnectionOut implements Runnable
}
}
// Called by the PeerState when the other side doesn't want this
// request to be handled anymore. Removes any pending Piece Message
// from out send queue.
/**
* Called by the PeerState when the other side doesn't want this
* request to be handled anymore. Removes any pending Piece Message
* from out send queue.
* Does not send a cancel message.
*/
void cancelRequest(int piece, int begin, int length)
{
synchronized (sendQueue)
@ -561,4 +594,50 @@ class PeerConnectionOut implements Runnable
m.piece = port;
addMessage(m);
}
/**
* Unused
* @since 0.9.21
*/
void sendSuggest(int piece) {
Message m = new Message();
m.type = Message.SUGGEST;
m.piece = piece;
addMessage(m);
}
/** @since 0.9.21 */
private void sendHaveAll() {
Message m = new Message();
m.type = Message.HAVE_ALL;
addMessage(m);
}
/** @since 0.9.21 */
private void sendHaveNone() {
Message m = new Message();
m.type = Message.HAVE_NONE;
addMessage(m);
}
/** @since 0.9.21 */
void sendReject(int piece, int begin, int length) {
Message m = new Message();
m.type = Message.REJECT;
m.piece = piece;
m.begin = begin;
m.length = length;
addMessage(m);
}
/**
* Unused
* @since 0.9.21
*/
void sendAllowedFast(int piece) {
Message m = new Message();
m.type = Message.ALLOWED_FAST;
m.piece = piece;
addMessage(m);
}
}

View File

@ -25,14 +25,15 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;
import net.i2p.data.ByteArray;
@ -52,7 +53,7 @@ import org.klomp.snark.dht.DHT;
*/
class PeerCoordinator implements PeerListener
{
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(PeerCoordinator.class);
private final Log _log;
/**
* External use by PeerMonitorTask only.
@ -87,8 +88,8 @@ class PeerCoordinator implements PeerListener
// final static int MAX_DOWNLOADERS = MAX_CONNECTIONS;
// int downloaders = 0;
private long uploaded;
private long downloaded;
private final AtomicLong uploaded = new AtomicLong();
private final AtomicLong downloaded = new AtomicLong();
final static int RATE_DEPTH = 3; // make following arrays RATE_DEPTH long
private final long uploaded_old[] = {-1,-1,-1};
private final long downloaded_old[] = {-1,-1,-1};
@ -98,7 +99,7 @@ class PeerCoordinator implements PeerListener
* This is a Queue, not a Set, because PeerCheckerTask keeps things in order for choking/unchoking.
* External use by PeerMonitorTask only.
*/
final Queue<Peer> peers;
final Deque<Peer> peers;
/**
* Peers we heard about via PEX
@ -144,6 +145,7 @@ class PeerCoordinator implements PeerListener
{
_util = util;
_random = util.getContext().random();
_log = util.getContext().logManager().getLog(PeerCoordinator.class);
this.id = id;
this.infohash = infohash;
this.metainfo = metainfo;
@ -154,7 +156,7 @@ class PeerCoordinator implements PeerListener
wantedPieces = new ArrayList<Piece>();
setWantedPieces();
partialPieces = new ArrayList<PartialPiece>(getMaxConnections() + 1);
peers = new LinkedBlockingQueue<Peer>();
peers = new LinkedBlockingDeque<Peer>();
magnetState = new MagnetState(infohash, metainfo);
pexPeers = new ConcurrentHashSet<PeerID>();
@ -278,7 +280,15 @@ class PeerCoordinator implements PeerListener
*/
public long getUploaded()
{
return uploaded;
return uploaded.get();
}
/**
* Sets the initial total of uploaded bytes of all peers (from a saved status)
* @since 0.9.15
*/
public void setUploaded(long up) {
uploaded.set(up);
}
/**
@ -286,7 +296,7 @@ class PeerCoordinator implements PeerListener
*/
public long getDownloaded()
{
return downloaded;
return downloaded.get();
}
/**
@ -312,16 +322,22 @@ class PeerCoordinator implements PeerListener
*/
public long getDownloadRate()
{
if (halted)
return 0;
return getRate(downloaded_old);
}
public long getUploadRate()
{
if (halted)
return 0;
return getRate(uploaded_old);
}
public long getCurrentUploadRate()
{
if (halted)
return 0;
// no need to synchronize, only one value
long r = uploaded_old[0];
if (r <= 0)
@ -514,7 +530,10 @@ class PeerCoordinator implements PeerListener
// Can't add to beginning since we converted from a List to a Queue
// We can do this in Java 6 with a Deque
//peers.add(0, peer);
peers.add(peer);
if (_util.getContext().random().nextInt(4) == 0)
peers.push(peer);
else
peers.add(peer);
peerCount = peers.size();
unchokePeer();
@ -901,6 +920,7 @@ class PeerCoordinator implements PeerListener
* Returns a byte array containing the requested piece or null of
* the piece is unknown.
*
* @return bytes or null for errors such as not having the piece yet
* @throws RuntimeException on IOE getting the data
*/
public ByteArray gotRequest(Peer peer, int piece, int off, int len)
@ -932,7 +952,7 @@ class PeerCoordinator implements PeerListener
*/
public void uploaded(Peer peer, int size)
{
uploaded += size;
uploaded.addAndGet(size);
//if (listener != null)
// listener.peerChange(this, peer);
@ -943,7 +963,7 @@ class PeerCoordinator implements PeerListener
*/
public void downloaded(Peer peer, int size)
{
downloaded += size;
downloaded.addAndGet(size);
//if (listener != null)
// listener.peerChange(this, peer);
@ -964,8 +984,9 @@ class PeerCoordinator implements PeerListener
}
int piece = pp.getPiece();
synchronized(wantedPieces)
{
// try/catch outside the synch to avoid deadlock in the catch
try {
synchronized(wantedPieces) {
Piece p = new Piece(piece);
if (!wantedPieces.contains(p))
{
@ -981,8 +1002,7 @@ class PeerCoordinator implements PeerListener
}
}
try
{
// try/catch moved outside of synch
// this takes forever if complete, as it rechecks
if (storage.putPiece(pp))
{
@ -991,26 +1011,38 @@ class PeerCoordinator implements PeerListener
}
else
{
// so we will try again
markUnrequested(peer, piece);
// just in case
removePartialPiece(piece);
// Oops. We didn't actually download this then... :(
downloaded -= metainfo.getPieceLength(piece);
_log.warn("Got BAD piece " + piece + "/" + metainfo.getPieces() + " from " + peer + " for " + metainfo.getName());
downloaded.addAndGet(0 - metainfo.getPieceLength(piece));
// Mark this peer as not having the piece. PeerState will update its bitfield.
for (Piece pc : wantedPieces) {
if (pc.getId() == piece) {
pc.removePeer(peer);
break;
}
}
if (_log.shouldWarn())
_log.warn("Got BAD piece " + piece + "/" + metainfo.getPieces() + " from " + peer + " for " + metainfo.getName());
return false; // No need to announce BAD piece to peers.
}
}
catch (IOException ioe)
{
wantedPieces.remove(p);
wantedBytes -= metainfo.getPieceLength(p.getId());
} // synch
} catch (IOException ioe) {
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());
}
// deadlock was here
snark.stopTorrent();
throw new RuntimeException(msg, ioe);
}
wantedPieces.remove(p);
wantedBytes -= metainfo.getPieceLength(p.getId());
}
}
// just in case
removePartialPiece(piece);
@ -1122,8 +1154,9 @@ class PeerCoordinator implements PeerListener
*
* Also mark the piece unrequested if this peer was the only one.
*
* @param peer partials, must include the zero-offset (empty) ones too
* No dup pieces, piece.setDownloaded() must be set
* @param peer partials, must include the zero-offset (empty) ones too.
* No dup pieces, piece.setDownloaded() must be set.
* len field in Requests is ignored.
* @since 0.8.2
*/
public void savePartialPieces(Peer peer, List<Request> partials)
@ -1453,8 +1486,8 @@ class PeerCoordinator implements PeerListener
public int allowedUploaders()
{
if (listener != null && listener.overUploadLimit(uploaders)) {
// if (_log.shouldLog(Log.DEBUG))
// _log.debug("Over limit, uploaders was: " + uploaders);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Over limit, uploaders was: " + uploaders);
return uploaders - 1;
} else if (uploaders < MAX_UPLOADERS)
return uploaders + 1;

View File

@ -21,6 +21,7 @@
package org.klomp.snark;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@ -155,15 +156,28 @@ class PeerState implements DataLoader
setInteresting(true);
}
void bitfieldMessage(byte[] bitmap)
{
synchronized(this)
{
if (_log.shouldLog(Log.DEBUG))
_log.debug(peer + " rcv bitfield");
void bitfieldMessage(byte[] bitmap) {
bitfieldMessage(bitmap, false);
}
/**
* @param bitmap null to use the isAll param
* @param isAll only if bitmap == null: true for have_all, false for have_none
* @since 0.9.21
*/
private void bitfieldMessage(byte[] bitmap, boolean isAll) {
if (_log.shouldLog(Log.DEBUG)) {
if (bitmap != null)
_log.debug(peer + " rcv bitfield bytes: " + bitmap.length);
else if (isAll)
_log.debug(peer + " rcv bitfield HAVE_ALL");
else
_log.debug(peer + " rcv bitfield HAVE_NONE");
}
synchronized(this) {
if (bitfield != null)
{
// XXX - Be liberal in what you except?
// XXX - Be liberal in what you accept?
if (_log.shouldLog(Log.WARN))
_log.warn("Got unexpected bitfield message from " + peer);
return;
@ -172,10 +186,24 @@ class PeerState implements DataLoader
// XXX - Check for weird bitfield and disconnect?
// FIXME will have to regenerate the bitfield after we know exactly
// how many pieces there are, as we don't know how many spare bits there are.
if (metainfo == null)
bitfield = new BitField(bitmap, bitmap.length * 8);
else
bitfield = new BitField(bitmap, metainfo.getPieces());
if (metainfo == null) {
if (bitmap != null) {
bitfield = new BitField(bitmap, bitmap.length * 8);
} else {
// we can't handle this situation
if (_log.shouldLog(Log.WARN))
_log.warn("have_x w/o metainfo: " + isAll);
return;
}
} else {
if (bitmap != null) {
bitfield = new BitField(bitmap, metainfo.getPieces());
} else {
bitfield = new BitField(metainfo.getPieces());
if (isAll)
bitfield.setAll();
}
}
}
if (metainfo == null)
return;
@ -198,14 +226,21 @@ class PeerState implements DataLoader
+ piece + ", " + begin + ", " + length + ") ");
if (metainfo == null)
return;
if (choking)
{
if (_log.shouldLog(Log.INFO))
_log.info("Request received, but choking " + peer);
if (choking) {
if (peer.supportsFast()) {
if (_log.shouldInfo())
_log.info("Request received, sending reject to choked " + peer);
out.sendReject(piece, begin, length);
} else {
if (_log.shouldInfo())
_log.info("Request received, but choking " + peer);
}
return;
}
}
// Sanity check
// There is no check here that we actually have the piece;
// this will be caught in loadData() below
if (piece < 0
|| piece >= metainfo.getPieces()
|| begin < 0
@ -219,6 +254,8 @@ class PeerState implements DataLoader
+ ", " + begin
+ ", " + length
+ "' message from " + peer);
if (peer.supportsFast())
out.sendReject(piece, begin, length);
return;
}
@ -227,8 +264,14 @@ class PeerState implements DataLoader
// Todo: limit number of requests also? (robert 64 x 4KB)
if (out.queuedBytes() + length > MAX_PIPELINE_BYTES)
{
if (_log.shouldLog(Log.WARN))
_log.warn("Discarding request over pipeline limit from " + peer);
if (peer.supportsFast()) {
if (_log.shouldWarn())
_log.warn("Rejecting request over pipeline limit from " + peer);
out.sendReject(piece, begin, length);
} else {
if (_log.shouldWarn())
_log.warn("Discarding request over pipeline limit from " + peer);
}
return;
}
@ -243,7 +286,8 @@ class PeerState implements DataLoader
/**
* This is the callback that PeerConnectionOut calls
*
* @return bytes or null for errors
* @return bytes or null for errors such as not having the piece yet
* @throws RuntimeException on IOE getting the data
* @since 0.8.2
*/
public ByteArray loadData(int piece, int begin, int length) {
@ -253,6 +297,8 @@ class PeerState implements DataLoader
// XXX - Protocol error-> diconnect?
if (_log.shouldLog(Log.WARN))
_log.warn("Got request for unknown piece: " + piece);
if (peer.supportsFast())
out.sendReject(piece, begin, length);
return null;
}
@ -265,6 +311,8 @@ class PeerState implements DataLoader
+ ", " + begin
+ ", " + length
+ "' message from " + peer);
if (peer.supportsFast())
out.sendReject(piece, begin, length);
return null;
}
@ -322,6 +370,11 @@ class PeerState implements DataLoader
{
if (_log.shouldLog(Log.WARN))
_log.warn("Got BAD " + req.getPiece() + " from " + peer);
synchronized(this) {
// so we don't ask again
if (bitfield != null)
bitfield.clear(req.getPiece());
}
}
}
@ -455,7 +508,12 @@ class PeerState implements DataLoader
for (Integer p : pcs) {
Request req = getLowestOutstandingRequest(p.intValue());
if (req != null) {
req.getPartialPiece().setDownloaded(req.off);
PartialPiece pp = req.getPartialPiece();
synchronized(pp) {
int dl = pp.getDownloaded();
if (req.off != dl)
req = new Request(pp, dl, 1);
}
rv.add(req);
}
}
@ -536,6 +594,89 @@ class PeerState implements DataLoader
listener.gotPort(peer, port, port + 1);
}
/////////// fast message handlers /////////
/**
* BEP 6
* Treated as "have" for now
* @since 0.9.21
*/
void suggestMessage(int piece) {
if (_log.shouldInfo())
_log.info("Handling suggest as have(" + piece + ") from " + peer);
haveMessage(piece);
}
/**
* BEP 6
* @param isAll true for have_all, false for have_none
* @since 0.9.21
*/
void haveMessage(boolean isAll) {
bitfieldMessage(null, isAll);
}
/**
* BEP 6
* If the peer rejects lower chunks but not higher ones, thus creating holes,
* we won't figure it out and the piece will fail, since we don't currently
* keep a chunk bitmap in PartialPiece.
* As long as the peer rejects all the chunks, or rejects only the last chunks,
* no holes are created and we will be fine. The reject messages may be in any order,
* just don't make a hole when it's over.
*
* @since 0.9.21
*/
void rejectMessage(int piece, int begin, int length) {
if (_log.shouldInfo())
_log.info("Got reject(" + piece + ',' + begin + ',' + length + ") from " + peer);
out.cancelRequest(piece, begin, length);
synchronized(this) {
Request deletedRequest = null;
// for this piece only
boolean haveMoreRequests = false;
for (Iterator<Request> iter = outstandingRequests.iterator(); iter.hasNext(); ) {
Request req = iter.next();
if (req.getPiece() == piece) {
if (req.off == begin && req.len == length) {
iter.remove();
deletedRequest = req;
} else {
haveMoreRequests = true;
}
}
}
if (deletedRequest != null && !haveMoreRequests) {
// We must return the piece to the coordinator
// Create a new fake request so we can set the offset correctly
PartialPiece pp = deletedRequest.getPartialPiece();
int downloaded = pp.getDownloaded();
Request req;
if (deletedRequest.off == downloaded)
req = deletedRequest;
else
req = new Request(pp, downloaded, 1);
List<Request> pcs = Collections.singletonList(req);
listener.savePartialPieces(this.peer, pcs);
if (_log.shouldWarn())
_log.warn("Returned to coord. w/ offset " + pp.getDownloaded() + " due to reject(" + piece + ',' + begin + ',' + length + ") from " + peer);
}
if (lastRequest != null && lastRequest.getPiece() == piece &&
lastRequest.off == begin && lastRequest.len == length)
lastRequest = null;
}
}
/**
* BEP 6
* Ignored for now
* @since 0.9.21
*/
void allowedFastMessage(int piece) {
if (_log.shouldInfo())
_log.info("Ignoring allowed_fast(" + piece + ") from " + peer);
}
void unknownMessage(int type, byte[] bs)
{
if (_log.shouldLog(Log.WARN))
@ -543,6 +684,8 @@ class PeerState implements DataLoader
+ " length: " + bs.length);
}
/////////// end message handlers /////////
/**
* We now have this piece.
* Tell the peer and cancel any requests for the piece.

View File

@ -43,13 +43,13 @@ class Request
*/
Request(PartialPiece piece, int off, int len)
{
// Sanity check
if (off < 0 || len <= 0 || off + len > piece.getLength())
throw new IndexOutOfBoundsException("Illegal Request " + toString());
this.piece = piece;
this.off = off;
this.len = len;
// Sanity check
if (off < 0 || len <= 0 || off + len > piece.getLength())
throw new IndexOutOfBoundsException("Illegal Request " + toString());
}
/**

View File

@ -27,13 +27,13 @@ import java.io.InputStream;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import java.util.StringTokenizer;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.data.Destination;
import net.i2p.util.Log;
import net.i2p.util.SecureFile;
/**
* Main Snark program startup class.
@ -221,7 +221,7 @@ public class Snark
private PeerCoordinator coordinator;
private ConnectionAcceptor acceptor;
private TrackerClient trackerclient;
private String rootDataDir = ".";
private final File rootDataDir;
private final CompleteListener completeListener;
private volatile boolean stopped;
private volatile boolean starting;
@ -236,15 +236,27 @@ public class Snark
private volatile boolean _autoStoppable;
// String indicating main activity
private volatile String activity = "Not started";
private final long savedUploaded;
/** from main() via parseArguments() single torrent */
/**
* from main() via parseArguments() single torrent
*
* @deprecated unused
*/
/****
Snark(I2PSnarkUtil util, String torrent, String ip, int user_port,
StorageListener slistener, CoordinatorListener clistener) {
this(util, torrent, ip, user_port, slistener, clistener, null, null, null, true, ".");
}
****/
/** single torrent - via router */
/**
* single torrent - via router
*
* @deprecated unused
*/
/****
public Snark(I2PAppContext ctx, Properties opts, String torrent,
StorageListener slistener, boolean start, String rootDir) {
this(new I2PSnarkUtil(ctx), torrent, null, -1, slistener, null, null, null, null, false, rootDir);
@ -274,12 +286,32 @@ public class Snark
if (start)
this.startTorrent();
}
****/
/** multitorrent */
/**
* multitorrent
* @throws RuntimeException via fatal()
*/
public Snark(I2PSnarkUtil util, String torrent, String ip, int user_port,
StorageListener slistener, CoordinatorListener clistener,
CompleteListener complistener, PeerCoordinatorSet peerCoordinatorSet,
ConnectionAcceptor connectionAcceptor, boolean start, String rootDir)
{
this(util, torrent, ip, user_port, slistener, clistener, complistener,
peerCoordinatorSet, connectionAcceptor, start, rootDir, null);
}
/**
* multitorrent
*
* @param baseFile if null, use rootDir/torrentName; if non-null, use it instead
* @throws RuntimeException via fatal()
* @since 0.9.11
*/
public Snark(I2PSnarkUtil util, String torrent, String ip, int user_port,
StorageListener slistener, CoordinatorListener clistener,
CompleteListener complistener, PeerCoordinatorSet peerCoordinatorSet,
ConnectionAcceptor connectionAcceptor, boolean start, String rootDir, File baseFile)
{
if (slistener == null)
slistener = this;
@ -291,7 +323,7 @@ public class Snark
acceptor = connectionAcceptor;
this.torrent = torrent;
this.rootDataDir = rootDir;
this.rootDataDir = new File(rootDir);
stopped = true;
activity = "Network setup";
@ -394,13 +426,22 @@ public class Snark
try
{
activity = "Checking storage";
storage = new Storage(_util, meta, slistener);
boolean shouldPreserve = completeListener != null && completeListener.getSavedPreserveNamesSetting(this);
if (baseFile == null) {
String base = meta.getName();
if (!shouldPreserve)
base = Storage.filterName(base);
if (_util.getFilesPublic())
baseFile = new File(rootDataDir, base);
else
baseFile = new SecureFile(rootDataDir, base);
}
storage = new Storage(_util, baseFile, meta, slistener, shouldPreserve);
if (completeListener != null) {
storage.check(rootDataDir,
completeListener.getSavedTorrentTime(this),
storage.check(completeListener.getSavedTorrentTime(this),
completeListener.getSavedTorrentBitField(this));
} else {
storage.check(rootDataDir);
storage.check();
}
// have to figure out when to reopen
// if (!start)
@ -428,6 +469,7 @@ public class Snark
trackerclient = new TrackerClient(meta, coordinator);
*/
savedUploaded = (completeListener != null) ? completeListener.getSavedUploaded(this) : 0;
if (start)
startTorrent();
}
@ -438,6 +480,7 @@ public class Snark
* @param torrent a fake name for now (not a file name)
* @param ih 20-byte info hash
* @param trackerURL may be null
* @throws RuntimeException via fatal()
* @since 0.8.4
*/
public Snark(I2PSnarkUtil util, String torrent, byte[] ih, String trackerURL,
@ -452,7 +495,8 @@ public class Snark
this.torrent = torrent;
this.infoHash = ih;
this.additionalTrackerURL = trackerURL;
this.rootDataDir = rootDir;
this.rootDataDir = rootDir != null ? new File(rootDir) : null; // null only for FetchAndAdd extension
savedUploaded = 0;
stopped = true;
id = generateID();
@ -477,24 +521,21 @@ public class Snark
// Create a new ID and fill it with something random. First nine
// zeros bytes, then three bytes filled with snark and then
// sixteen random bytes.
// eight random bytes.
byte snark = (((3 + 7 + 10) * (1000 - 8)) / 992) - 17;
byte[] rv = new byte[20];
Random random = I2PAppContext.getGlobalContext().random();
int i;
for (i = 0; i < 9; i++)
rv[i] = 0;
rv[i++] = snark;
rv[i++] = snark;
rv[i++] = snark;
while (i < 20)
rv[i++] = (byte)random.nextInt(256);
rv[9] = snark;
rv[10] = snark;
rv[11] = snark;
I2PAppContext.getGlobalContext().random().nextBytes(rv, 12, 8);
return rv;
}
/**
* Start up contacting peers and querying the tracker.
* Blocks if tunnel is not yet open.
*
* @throws RuntimeException via fatal()
*/
public synchronized void startTorrent() {
starting = true;
@ -521,6 +562,7 @@ public class Snark
_log.info("Starting PeerCoordinator, ConnectionAcceptor, and TrackerClient");
activity = "Collecting pieces";
coordinator = new PeerCoordinator(_util, id, infoHash, meta, storage, this, this);
coordinator.setUploaded(savedUploaded);
if (_peerCoordinatorSet != null) {
// multitorrent
_peerCoordinatorSet.add(coordinator);
@ -547,7 +589,7 @@ public class Snark
} else if (trackerclient.halted()) {
if (storage != null) {
try {
storage.reopen(rootDataDir);
storage.reopen();
} catch (IOException ioe) {
try { storage.close(); } catch (IOException ioee) {
ioee.printStackTrace();
@ -575,7 +617,6 @@ public class Snark
* @since 0.9.1
*/
public synchronized void stopTorrent(boolean fast) {
stopped = true;
TrackerClient tc = trackerclient;
if (tc != null)
tc.halt(fast);
@ -583,17 +624,28 @@ public class Snark
if (pc != null)
pc.halt();
Storage st = storage;
if (!fast)
// HACK: Needed a way to distinguish between user-stop and
// shutdown-stop. stopTorrent(true) is in stopAllTorrents().
// (#766)
stopped = true;
if (st != null) {
boolean changed = storage.isChanged();
// TODO: Cache the config-in-mem to compare vs config-on-disk
// (needed for auto-save to not double-save in some cases)
//boolean changed = storage.isChanged() || getUploaded() != savedUploaded;
boolean changed = true;
if (changed && completeListener != null)
completeListener.updateStatus(this);
try {
storage.close();
} catch (IOException ioe) {
System.out.println("Error closing " + torrent);
ioe.printStackTrace();
}
if (changed && completeListener != null)
completeListener.updateStatus(this);
}
if (fast)
// HACK: See above if(!fast)
stopped = true;
if (pc != null && _peerCoordinatorSet != null)
_peerCoordinatorSet.remove(pc);
if (_peerCoordinatorSet == null)
@ -693,6 +745,18 @@ public class Snark
return storage != null && storage.isChecking();
}
/**
* If checking is in progress, return completion 0.0 ... 1.0,
* else return 1.0.
* @since 0.9.23
*/
public double getCheckingProgress() {
if (storage != null && storage.isChecking())
return storage.getCheckingProgress();
else
return 1.0d;
}
/**
* Disk allocation (ballooning) in progress.
* @since 0.9.3
@ -738,7 +802,7 @@ public class Snark
PeerCoordinator coord = coordinator;
if (coord != null)
return coord.getUploaded();
return 0;
return savedUploaded;
}
/**
@ -762,6 +826,7 @@ public class Snark
}
/**
* Not HTML escaped.
* @return String returned from tracker, or null if no error
* @since 0.8.4
*/
@ -834,7 +899,7 @@ public class Snark
}
/**
* Bytes still wanted. DOES account for skipped files.
* Bytes still wanted. DOES account for (i.e. does not include) skipped files.
* FIXME -1 when not running.
* @return exact value. or -1 if no storage yet or when not running.
* @since 0.9.1
@ -847,7 +912,7 @@ public class Snark
}
/**
* Does not account for skipped files.
* Does not account (i.e. includes) for skipped files.
* @return number of pieces still needed (magnet mode or not), or -1 if unknown
* @since 0.8.4
*/
@ -918,6 +983,7 @@ public class Snark
* non-valid argument list. The given listeners will be
* passed to all components that take one.
*/
/****
private static Snark parseArguments(String[] args,
StorageListener slistener,
CoordinatorListener clistener)
@ -932,6 +998,7 @@ public class Snark
int i = 0;
while (i < args.length)
{
****/
/*
if (args[i].equals("--debug"))
{
@ -953,7 +1020,9 @@ public class Snark
catch (NumberFormatException nfe) { }
}
}
else */ if (args[i].equals("--port"))
else */
/****
if (args[i].equals("--port"))
{
if (args.length - 1 < i + 1)
usage("--port needs port number to listen on");
@ -1059,6 +1128,7 @@ public class Snark
System.out.println
(" \tor (with --share) a file to share.");
}
****/
/**
* Aborts program abnormally.
@ -1102,9 +1172,15 @@ public class Snark
*/
public void gotMetaInfo(PeerCoordinator coordinator, MetaInfo metainfo) {
try {
String base = Storage.filterName(metainfo.getName());
File baseFile;
if (_util.getFilesPublic())
baseFile = new File(rootDataDir, base);
else
baseFile = new SecureFile(rootDataDir, base);
// The following two may throw IOE...
storage = new Storage(_util, metainfo, this);
storage.check(rootDataDir);
storage = new Storage(_util, baseFile, metainfo, this, false);
storage.check();
// ... so don't set meta until here
meta = metainfo;
if (completeListener != null) {
@ -1200,7 +1276,8 @@ public class Snark
public void setWantedPieces(Storage storage)
{
coordinator.setWantedPieces();
if (coordinator != null)
coordinator.setWantedPieces();
}
///////////// End StorageListener methods
@ -1209,7 +1286,7 @@ public class Snark
/** SnarkSnutdown callback unused */
public void shutdown()
{
// Should not be necessary since all non-deamon threads should
// Should not be necessary since all non-daemon threads should
// have died. But in reality this does not always happen.
//System.exit(0);
}
@ -1239,7 +1316,8 @@ public class Snark
totalUploaders += c.uploaders;
}
int limit = _util.getMaxUploaders();
// debug("Total uploaders: " + totalUploaders + " Limit: " + limit, Snark.DEBUG);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Total uploaders: " + totalUploaders + " Limit: " + limit);
return totalUploaders > limit;
}

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
package org.klomp.snark;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -32,10 +33,14 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import gnu.getopt.Getopt;
import net.i2p.I2PAppContext;
import net.i2p.crypto.SHA1;
import net.i2p.data.ByteArray;
@ -48,10 +53,11 @@ import net.i2p.util.SystemVersion;
/**
* Maintains pieces on disk. Can be used to store and retrieve pieces.
*/
public class Storage
public class Storage implements Closeable
{
private final MetaInfo metainfo;
private final List<TorrentFile> _torrentFiles;
private final File _base;
private final StorageListener listener;
private final I2PSnarkUtil _util;
private final Log _log;
@ -63,35 +69,42 @@ public class Storage
private final int piece_size;
private final int pieces;
private final long total_length;
private final boolean _preserveFileNames;
private boolean changed;
private volatile boolean _isChecking;
private final AtomicInteger _allocateCount = new AtomicInteger();
private final AtomicInteger _checkProgress = new AtomicInteger();
/** The default piece size. */
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;
public static final int MAX_PIECE_SIZE = 16*1024*1024;
/** The maximum number of pieces in a torrent. */
public static final int MAX_PIECES = 10*1024;
public static final int MAX_PIECES = 20*1024;
public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES;
private static final Map<String, String> _filterNameCache = new ConcurrentHashMap<String, String>();
private static final boolean _isWindows = SystemVersion.isWindows();
private static final boolean _isARM = SystemVersion.isARM();
private static final int BUFSIZE = PeerState.PARTSIZE;
private static final ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
/**
* Creates a new storage based on the supplied MetaInfo. This will
* Creates a new storage based on the supplied MetaInfo.
*
* Does not check storage. Caller MUST call check(), which will
* try to create and/or check all needed files in the MetaInfo.
*
* Does not check storage. Caller MUST call check()
* @param baseFile the torrent data file or dir
* @param preserveFileNames if true, do not remap names to a 'safe' charset
*/
public Storage(I2PSnarkUtil util, MetaInfo metainfo, StorageListener listener)
public Storage(I2PSnarkUtil util, File baseFile, MetaInfo metainfo, StorageListener listener, boolean preserveFileNames)
{
_util = util;
_log = util.getContext().logManager().getLog(Storage.class);
_base = baseFile;
this.metainfo = metainfo;
this.listener = listener;
needed = metainfo.getPieces();
@ -102,6 +115,7 @@ public class Storage
List<List<String>> files = metainfo.getFiles();
int sz = files != null ? files.size() : 1;
_torrentFiles = new ArrayList<TorrentFile>(sz);
_preserveFileNames = preserveFileNames;
}
/**
@ -113,16 +127,20 @@ public class Storage
*
* @param announce may be null
* @param listener may be null
* @param created_by may be null
* @throws IOException when creating and/or checking files fails.
*/
public Storage(I2PSnarkUtil util, File baseFile, String announce,
List<List<String>> announce_list,
String created_by,
boolean privateTorrent, StorageListener listener)
throws IOException
{
_util = util;
_base = baseFile;
_log = util.getContext().logManager().getLog(Storage.class);
this.listener = listener;
_preserveFileNames = true;
// Create names, rafs and lengths arrays.
_torrentFiles = getFiles(baseFile);
@ -183,7 +201,7 @@ public class Storage
byte[] piece_hashes = fast_digestCreate();
metainfo = new MetaInfo(announce, baseFile.getName(), null, files,
lengthsList, piece_size, piece_hashes, total, privateTorrent,
announce_list);
announce_list, created_by);
}
@ -295,6 +313,18 @@ public class Storage
return _isChecking;
}
/**
* If checking is in progress, return completion 0.0 ... 1.0,
* else return 1.0.
* @since 0.9.23
*/
public double getCheckingProgress() {
if (_isChecking)
return _checkProgress.get() / (double) pieces;
else
return 1.0d;
}
/**
* Disk allocation (ballooning) in progress.
* Always false on Windows.
@ -305,39 +335,48 @@ public class Storage
}
/**
* @param file canonical path (non-directory)
* Get index to pass to remaining(), getPriority(), setPriority()
*
* @param file non-canonical path (non-directory)
* @return internal index of file; -1 if unknown file
* @since 0.9.15
*/
public int indexOf(File file) {
for (int i = 0; i < _torrentFiles.size(); i++) {
File f = _torrentFiles.get(i).RAFfile;
if (f.equals(file))
return i;
}
return -1;
}
/**
* @param fileIndex as obtained from indexOf
* @return number of bytes remaining; -1 if unknown file
* @since 0.7.14
*/
public long remaining(String file) {
/****
public long remaining(int fileIndex) {
if (fileIndex < 0 || fileIndex >= _torrentFiles.size())
return -1;
if (complete())
return 0;
long bytes = 0;
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) {
try {
canonical = f.getCanonicalPath();
} catch (IOException ioe) {
f = null;
}
}
if (f != null && canonical.equals(file)) {
if (complete())
return 0;
int psz = piece_size;
for (int i = 0; i < _torrentFiles.size(); i++) {
TorrentFile tf = _torrentFiles.get(i);
if (i == fileIndex) {
long start = bytes;
long end = start + tf.length;
int pc = (int) (bytes / psz);
int pc = (int) (bytes / piece_size);
long rv = 0;
if (!bitfield.get(pc))
rv = Math.min(psz - (start % psz), tf.length);
for (int j = pc + 1; (((long)j) * psz) < end && j < pieces; j++) {
rv = Math.min(piece_size - (start % piece_size), tf.length);
for (int j = pc + 1; (((long)j) * piece_size) < end && j < pieces; j++) {
if (!bitfield.get(j)) {
if (((long)(j+1))*psz < end)
rv += psz;
if (((long)(j+1))*piece_size < end)
rv += piece_size;
else
rv += end - (((long)j) * psz);
rv += end - (((long)j) * piece_size);
}
}
return rv;
@ -346,51 +385,66 @@ public class Storage
}
return -1;
}
****/
/**
* @param file canonical path (non-directory)
* For efficiency, calculate remaining bytes for all files at once
*
* @return number of bytes remaining for each file, use indexOf() to get index for a file
* @since 0.9.23
*/
public long[] remaining() {
long[] rv = new long[_torrentFiles.size()];
if (complete())
return rv;
long bytes = 0;
for (int i = 0; i < _torrentFiles.size(); i++) {
TorrentFile tf = _torrentFiles.get(i);
long start = bytes;
long end = start + tf.length;
int pc = (int) (bytes / piece_size);
long rvi = 0;
if (!bitfield.get(pc))
rvi = Math.min(piece_size - (start % piece_size), tf.length);
for (int j = pc + 1; (((long)j) * piece_size) < end && j < pieces; j++) {
if (!bitfield.get(j)) {
if (((long)(j+1))*piece_size < end)
rvi += piece_size;
else
rvi += end - (((long)j) * piece_size);
}
}
rv[i] = rvi;
bytes += tf.length;
}
return rv;
}
/**
* @param fileIndex as obtained from indexOf
* @since 0.8.1
*/
public int getPriority(String file) {
public int getPriority(int fileIndex) {
if (complete() || metainfo.getFiles() == null)
return 0;
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 tf.priority;
} catch (IOException ioe) {}
}
}
return 0;
if (fileIndex < 0 || fileIndex >= _torrentFiles.size())
return 0;
return _torrentFiles.get(fileIndex).priority;
}
/**
* Must call Snark.updatePiecePriorities()
* (which calls getPiecePriorities()) after calling this.
* @param file canonical path (non-directory)
* @param fileIndex as obtained from indexOf
* @param pri default 0; <0 to disable
* @since 0.8.1
*/
public void setPriority(String file, int pri) {
public void setPriority(int fileIndex, int pri) {
if (complete() || metainfo.getFiles() == null)
return;
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)) {
tf.priority = pri;
return;
}
} catch (IOException ioe) {}
}
}
if (fileIndex < 0 || fileIndex >= _torrentFiles.size())
return;
_torrentFiles.get(fileIndex).priority = pri;
}
/**
@ -448,9 +502,8 @@ public class Storage
int file = 0;
long pcEnd = -1;
long fileEnd = _torrentFiles.get(0).length - 1;
int psz = piece_size;
for (int i = 0; i < rv.length; i++) {
pcEnd += psz;
pcEnd += piece_size;
int pri = _torrentFiles.get(file).priority;
while (fileEnd <= pcEnd && file < _torrentFiles.size() - 1) {
file++;
@ -483,31 +536,37 @@ public class Storage
* @since 0.7.14
*/
public String getBaseName() {
return filterName(metainfo.getName());
return optFilterName(metainfo.getName());
}
/** @since 0.9.15 */
public boolean getPreserveFileNames() {
return _preserveFileNames;
}
/**
* Creates (and/or checks) all files from the metainfo file list.
* Only call this once, and only after the constructor with the metainfo.
* Use recheck() to check again later.
*
* @throws IllegalStateException if called more than once
*/
public void check(String rootDir) throws IOException
public void check() throws IOException
{
check(rootDir, 0, null);
check(0, null);
}
/**
* 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.
* Use recheck() to check again later.
*
* @throws IllegalStateException if called more than once
*/
public void check(String rootDir, long savedTime, BitField savedBitField) throws IOException
public void check(long savedTime, BitField savedBitField) throws IOException
{
File base;
boolean areFilesPublic = _util.getFilesPublic();
if (areFilesPublic)
base = new File(rootDir, filterName(metainfo.getName()));
else
base = new SecureFile(rootDir, filterName(metainfo.getName()));
boolean useSavedBitField = savedTime > 0 && savedBitField != null;
if (!_torrentFiles.isEmpty())
@ -517,18 +576,18 @@ public class Storage
{
// Create base as file.
if (_log.shouldLog(Log.INFO))
_log.info("Creating/Checking file: " + base);
_log.info("Creating/Checking file: " + _base);
// createNewFile() can throw a "Permission denied" IOE even if the file exists???
// so do it second
if (!base.exists() && !base.createNewFile())
throw new IOException("Could not create file " + base);
if (!_base.exists() && !_base.createNewFile())
throw new IOException("Could not create file " + _base);
_torrentFiles.add(new TorrentFile(base, base, metainfo.getTotalLength()));
_torrentFiles.add(new TorrentFile(_base, _base, metainfo.getTotalLength()));
if (useSavedBitField) {
long lm = base.lastModified();
long lm = _base.lastModified();
if (lm <= 0 || lm > savedTime)
useSavedBitField = false;
else if (base.length() != metainfo.getTotalLength())
else if (_base.length() != metainfo.getTotalLength())
useSavedBitField = false;
}
}
@ -536,9 +595,9 @@ public class Storage
{
// Create base as dir.
if (_log.shouldLog(Log.INFO))
_log.info("Creating/Checking directory: " + base);
if (!base.mkdir() && !base.isDirectory())
throw new IOException("Could not create directory " + base);
_log.info("Creating/Checking directory: " + _base);
if (!_base.mkdir() && !_base.isDirectory())
throw new IOException("Could not create directory " + _base);
List<Long> ls = metainfo.getLengths();
int size = files.size();
@ -546,7 +605,7 @@ public class Storage
for (int i = 0; i < size; i++)
{
List<String> path = files.get(i);
File f = createFileFromNames(base, path, areFilesPublic);
File f = createFileFromNames(_base, path, areFilesPublic);
// dup file name check after filtering
for (int j = 0; j < i; j++) {
if (f.equals(_torrentFiles.get(j).RAFfile)) {
@ -562,12 +621,12 @@ public class Storage
else
lastPath = '_' + lastPath;
path.set(last, lastPath);
f = createFileFromNames(base, path, areFilesPublic);
f = createFileFromNames(_base, path, areFilesPublic);
j = 0;
}
}
long len = ls.get(i).longValue();
_torrentFiles.add(new TorrentFile(base, f, len));
_torrentFiles.add(new TorrentFile(_base, f, len));
total += len;
if (useSavedBitField) {
long lm = f.lastModified();
@ -611,10 +670,9 @@ public class Storage
* Doesn't really reopen the file descriptors for a restart.
* Just does an existence check but no length check or data reverification
*
* @param rootDir ignored
* @throws IOE on fail
*/
public void reopen(String rootDir) throws IOException
public void reopen() throws IOException
{
if (_torrentFiles.isEmpty())
throw new IOException("Storage not checked yet");
@ -637,6 +695,19 @@ public class Storage
0x2028, 0x2029
};
/**
* Filter the name, but only if configured to do so.
* We will do so on torrents received from others, but not
* on those we created ourselves, so we do not lose track of files.
*
* @since 0.9.15
*/
private String optFilterName(String name) {
if (_preserveFileNames)
return name;
return filterName(name);
}
/**
* Removes 'suspicious' characters from the given file name.
* http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
@ -690,14 +761,16 @@ public class Storage
* Note that filtering each path element individually may lead to
* things going in the wrong place if there are duplicates
* in intermediate path elements after filtering.
*
* @param names path elements
*/
private static File createFileFromNames(File base, List<String> names, boolean areFilesPublic) throws IOException
private File createFileFromNames(File base, List<String> names, boolean areFilesPublic) throws IOException
{
File f = null;
Iterator<String> it = names.iterator();
while (it.hasNext())
{
String name = filterName(it.next());
String name = optFilterName(it.next());
if (it.hasNext())
{
// Another dir in the hierarchy.
@ -725,15 +798,73 @@ public class Storage
return f;
}
public static File getFileFromNames(File base, List<String> names)
{
Iterator<String> it = names.iterator();
while (it.hasNext())
{
String name = filterName(it.next());
base = new File(base, name);
/**
* The base file or directory.
* @return the File
* @since 0.9.15
*/
public File getBase() {
return _base;
}
/**
* Does not include directories. Unsorted.
* @return a new List
* @since 0.9.15
*/
public List<File> getFiles() {
List<File> rv = new ArrayList<File>(_torrentFiles.size());
for (TorrentFile tf : _torrentFiles) {
rv.add(tf.RAFfile);
}
return base;
return rv;
}
/**
* Does not include directories.
* @since 0.9.23
*/
public int getFileCount() {
return _torrentFiles.size();
}
/**
* Includes the base for a multi-file torrent.
* Sorted bottom-up for easy deletion.
* Slow. Use for deletion only.
* @return a new Set or null for a single-file torrent
* @since 0.9.15
*/
public SortedSet<File> getDirectories() {
if (!_base.isDirectory())
return null;
SortedSet<File> rv = new TreeSet<File>(Collections.reverseOrder());
rv.add(_base);
for (TorrentFile tf : _torrentFiles) {
File f = tf.RAFfile;
do {
f = f.getParentFile();
} while (f != null && rv.add(f));
}
return rv;
}
/**
* Blocking. Holds lock.
* Recommend running only when stopped.
* Caller should thread.
* Calls listener.setWantedPieces() on completion if anything changed.
*
* @return true if anything changed, false otherwise
* @since 0.9.23
*/
public boolean recheck() throws IOException {
int previousNeeded = needed;
checkCreateFiles(true);
boolean changed = previousNeeded != needed;
if (listener != null && changed)
listener.setWantedPieces(this);
return changed;
}
/**
@ -760,6 +891,7 @@ public class Storage
private void locked_checkCreateFiles(boolean recheck) throws IOException
{
_checkProgress.set(0);
// Whether we are resuming or not,
// if any of the files already exists we assume we are resuming.
boolean resume = false;
@ -776,13 +908,16 @@ 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()
long lengthProgress = 0;
for (TorrentFile tf : _torrentFiles)
{
long length = tf.RAFfile.length();
lengthProgress += tf.length;
if(tf.RAFfile.exists() && length == tf.length)
{
if (listener != null)
listener.storageAllocated(this, length);
_checkProgress.set(0);
resume = true; // XXX Could dynamicly check
}
else if (length == 0) {
@ -794,6 +929,8 @@ public class Storage
tf.closeRAF();
} catch (IOException ioe) {}
}
if (!resume)
_checkProgress.set((int) (pieces * lengthProgress / total_length));
} else {
String msg = "File '" + tf.name + "' exists, but has wrong length (expected " +
tf.length + " but found " + length + ") - repairing corruption";
@ -802,6 +939,7 @@ public class Storage
_log.error(msg);
changed = true;
resume = true;
_checkProgress.set(0);
_probablyComplete = false; // to force RW
synchronized(tf) {
RandomAccessFile raf = tf.checkRAF();
@ -822,17 +960,16 @@ public class Storage
long pieceEnd = 0;
for (int i = 0; i < pieces; i++)
{
_checkProgress.set(i);
int length = getUncheckedPiece(i, piece);
boolean correctHash = metainfo.checkPiece(i, piece, 0, length);
// close as we go so we don't run out of file descriptors
pieceEnd += length;
while (fileEnd <= pieceEnd) {
TorrentFile tf = _torrentFiles.get(file);
synchronized(tf) {
try {
tf.closeRAF();
} catch (IOException ioe) {}
}
try {
tf.closeRAF();
} catch (IOException ioe) {}
if (++file >= _torrentFiles.size())
break;
fileEnd += _torrentFiles.get(file).length;
@ -848,6 +985,7 @@ public class Storage
}
}
_checkProgress.set(pieces);
_probablyComplete = complete();
// close all the files so we don't end up with a zillion open ones;
// we will reopen as needed
@ -904,9 +1042,7 @@ public class Storage
for (TorrentFile tf : _torrentFiles)
{
try {
synchronized(tf) {
tf.closeRAF();
}
} catch (IOException ioe) {
_log.error("Error closing " + tf, ioe);
// gobble gobble
@ -1131,17 +1267,15 @@ public class Storage
return length;
}
private static final long RAFCloseDelay = 4*60*1000;
private static final long RAF_CLOSE_DELAY = 4*60*1000;
/**
* Close unused RAFs - call periodically
*/
public void cleanRAFs() {
long cutoff = System.currentTimeMillis() - RAFCloseDelay;
long cutoff = System.currentTimeMillis() - RAF_CLOSE_DELAY;
for (TorrentFile tf : _torrentFiles) {
synchronized(tf) {
tf.closeRAF(cutoff);
}
}
}
@ -1267,7 +1401,9 @@ public class Storage
// 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)
// Also don't ballon on ARM, as a proxy for solid state disk, where fragmentation doesn't matter too much.
// Actual detection of SSD is almost impossible.
if (!_isWindows && !_isARM)
isSparse = true;
}
@ -1324,18 +1460,44 @@ public class Storage
* @since 0.9.4
*/
public static void main(String[] args) {
if (args.length < 1 || args.length > 2) {
System.err.println("Usage: Storage file-or-dir [announceURL]");
boolean error = false;
String created_by = null;
String announce = null;
Getopt g = new Getopt("Storage", args, "a:c:");
try {
int c;
while ((c = g.getopt()) != -1) {
switch (c) {
case 'a':
announce = g.getOptarg();
break;
case 'c':
created_by = g.getOptarg();
break;
case '?':
case ':':
default:
error = true;
break;
} // switch
} // while
} catch (Exception e) {
e.printStackTrace();
error = true;
}
if (error || args.length - g.getOptind() != 1) {
System.err.println("Usage: Storage [-a announceURL] [-c created-by] file-or-dir");
System.exit(1);
}
File base = new File(args[0]);
String announce = args.length == 2 ? args[1] : null;
File base = new File(args[g.getOptind()]);
I2PAppContext ctx = I2PAppContext.getGlobalContext();
I2PSnarkUtil util = new I2PSnarkUtil(ctx);
File file = null;
FileOutputStream out = null;
try {
Storage storage = new Storage(util, base, announce, null, false, null);
Storage storage = new Storage(util, base, announce, null, created_by, false, null);
MetaInfo meta = storage.getMetaInfo();
file = new File(storage.getBaseName() + ".torrent");
out = new FileOutputStream(file);

View File

@ -36,7 +36,9 @@ import java.util.Locale;
import java.util.Random;
import java.util.Set;
import net.i2p.crypto.SigType;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.Hash;
import net.i2p.util.ConvertToHash;
import net.i2p.util.I2PAppThread;
@ -72,8 +74,8 @@ public class TrackerClient implements Runnable {
private static final String STOPPED_EVENT = "stopped";
private static final String NOT_REGISTERED = "torrent not registered"; //bytemonsoon
private static final String NOT_REGISTERED_2 = "torrent not found"; // diftracker
/** this is our equivalent to router.utorrent.com for bootstrap */
private static final String DEFAULT_BACKUP_TRACKER = "http://tracker.welterde.i2p/a";
private static final String NOT_REGISTERED_3 = "torrent unauthorised"; // vuze
private static final String ERROR_GOT_HTML = "received html"; // fake return
private final static int SLEEP = 5; // 5 minutes.
private final static int DELAY_MIN = 2000; // 2 secs.
@ -88,6 +90,8 @@ public class TrackerClient implements Runnable {
private static final int DHT_ANNOUNCE_PEERS = 4;
public static final int PORT = 6881;
private static final int MAX_TRACKERS = 12;
// tracker.welterde.i2p
private static final Hash DSA_ONLY_TRACKER = ConvertToHash.getHash("cfmqlafjfmgkzbt4r3jsfyhgsr5abgxryl6fnz3d3y5a365di5aa.b32.i2p");
private final I2PSnarkUtil _util;
private final MetaInfo meta;
@ -156,6 +160,7 @@ public class TrackerClient implements Runnable {
consecutiveFails = 0;
runStarted = false;
_fastUnannounce = false;
snark.setTrackerProblems(null);
_thread = new I2PAppThread(this, _threadName + " #" + (++_runCount), true);
_thread.start();
started = true;
@ -342,7 +347,9 @@ public class TrackerClient implements Runnable {
_log.debug("Backup announce: [" + url + "] for infoHash: " + infoHash);
}
if (backupTrackers.isEmpty()) {
backupTrackers.add(new TCTracker(DEFAULT_BACKUP_TRACKER, false));
backupTrackers.add(new TCTracker(SnarkManager.DEFAULT_BACKUP_TRACKER, false));
} else if (trackers.size() > 1) {
Collections.shuffle(backupTrackers, _util.getContext().random());
}
}
this.completed = coordinator.getLeft() == 0;
@ -360,12 +367,21 @@ public class TrackerClient implements Runnable {
if (h == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("Bad announce URL: [" + ann + ']');
return false;
return false;
}
// comment this out if tracker.welterde.i2p upgrades
if (h.equals(DSA_ONLY_TRACKER)) {
Destination dest = _util.getMyDestination();
if (dest != null && dest.getSigType() != SigType.DSA_SHA1) {
if (_log.shouldLog(Log.WARN))
_log.warn("Skipping incompatible tracker: " + ann);
return false;
}
}
if (existing.size() >= MAX_TRACKERS) {
if (_log.shouldLog(Log.INFO))
_log.info("Not using announce URL, we have enough: [" + ann + ']');
return false;
return false;
}
boolean rv = existing.add(h);
if (!rv) {
@ -526,9 +542,9 @@ public class TrackerClient implements Runnable {
!snark.isChecking() &&
info.getSeedCount() > 100 &&
coordinator.getPeerCount() <= 0 &&
_util.getContext().clock().now() > _startedOn + 2*60*60*1000 &&
_util.getContext().clock().now() > _startedOn + 30*60*1000 &&
snark.getTotalLength() > 0 &&
uploaded >= snark.getTotalLength() * 3 / 2) {
uploaded >= snark.getTotalLength() / 2) {
if (_log.shouldLog(Log.WARN))
_log.warn("Auto stopping " + snark.getBaseName());
snark.setAutoStoppable(false);
@ -577,14 +593,20 @@ public class TrackerClient implements Runnable {
if (tr.isPrimary)
snark.setTrackerProblems(tr.trackerProblems);
String tplc = tr.trackerProblems.toLowerCase(Locale.US);
if (tplc.startsWith(NOT_REGISTERED) || tplc.startsWith(NOT_REGISTERED_2)) {
if (tplc.startsWith(NOT_REGISTERED) || tplc.startsWith(NOT_REGISTERED_2) ||
tplc.startsWith(NOT_REGISTERED_3) || tplc.startsWith(ERROR_GOT_HTML)) {
// Give a guy some time to register it if using opentrackers too
//if (trckrs.size() == 1) {
// stop = true;
// snark.stopTorrent();
//} else { // hopefully each on the opentrackers list is really open
if (tr.registerFails++ > MAX_REGISTER_FAILS ||
!completed || // no use retrying if we aren't seeding
tplc.startsWith(ERROR_GOT_HTML) || // fake msg from doRequest()
(!tr.isPrimary && tr.registerFails > MAX_REGISTER_FAILS / 2))
if (_log.shouldLog(Log.WARN))
_log.warn("Not longer announcing to " + tr.announce + " : " +
tr.trackerProblems + " after " + tr.registerFails + " failures");
tr.stop = true;
//
}
@ -797,10 +819,15 @@ public class TrackerClient implements Runnable {
tr.lastRequestTime = System.currentTimeMillis();
// Don't wait for a response to stopped when shutting down
boolean fast = _fastUnannounce && event.equals(STOPPED_EVENT);
byte[] fetched = _util.get(s, true, fast ? -1 : 0, small ? 128 : 1024, small ? 1024 : 8*1024);
if (fetched == null) {
throw new IOException("Error fetching " + s);
}
byte[] fetched = _util.get(s, true, fast ? -1 : 0, small ? 128 : 1024, small ? 1024 : 32*1024);
if (fetched == null)
throw new IOException("Error fetching");
if (fetched.length == 0)
throw new IOException("No data");
// The HTML check only works if we didn't exceed the maxium fetch size specified in get(),
// otherwise we already threw an IOE.
if (fetched[0] == '<')
throw new IOException(ERROR_GOT_HTML);
InputStream in = new ByteArrayInputStream(fetched);
@ -885,7 +912,7 @@ public class TrackerClient implements Runnable {
if (path == null || path.length() < 517 ||
!path.startsWith("/"))
return null;
String[] parts = path.substring(1).split("/?&;", 2);
String[] parts = path.substring(1).split("[/\\?&;]", 2);
return ConvertToHash.getHash(parts[0]);
}
return null;

View File

@ -196,6 +196,9 @@ class TrackerInfo
return complete;
}
/**
* Not HTML escaped.
*/
public String getFailureReason()
{
return failure_reason;

View File

@ -6,6 +6,7 @@ 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;
@ -109,7 +110,7 @@ class UpdateRunner implements UpdateTask, CompleteListener {
_umgr.notifyAttemptFailed(this, "No tracker, no DHT, no OT", null);
continue;
}
_snark = _smgr.addMagnet(name, ih, trackerURL, true, true, this);
_snark = _smgr.addMagnet(name, ih, trackerURL, true, true, null, this);
if (_snark != null) {
updateStatus("<b>" + _smgr.util().getString("Updating from {0}", linkify(updateURL)) + "</b>");
new Timeout();
@ -290,12 +291,21 @@ class UpdateRunner implements UpdateTask, CompleteListener {
return _smgr.getSavedTorrentBitField(snark);
}
public boolean getSavedPreserveNamesSetting(Snark snark) {
return _smgr.getSavedPreserveNamesSetting(snark);
}
public long getSavedUploaded(Snark snark) {
return _smgr.getSavedUploaded(snark);
}
//////// 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>";
String durl = url.length() <= 28 ? DataHelper.escapeHTML(url) :
DataHelper.escapeHTML(url.substring(0, 25)) + "&hellip;";
// TODO urlEncode instead
return "<a target=\"_blank\" href=\"" + DataHelper.escapeHTML(url) + "\"/>" + durl + "</a>";
}
private void updateStatus(String s) {

View File

@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map;
import net.i2p.data.Base64;
import net.i2p.data.DataHelper;
/**
* Holds different types that a bencoded byte array can represent.
@ -208,7 +209,7 @@ public class BEValue
} else if (bin) {
buf.append(bs.length).append(" bytes: ").append(Base64.encode(bs));
} else {
buf.append('"').append(new String(bs)).append('"');
buf.append('"').append(DataHelper.getUTF8(bs)).append('"');
}
valueString = buf.toString();
} else

View File

@ -106,6 +106,7 @@ class DHTTracker {
* @param noSeeds true if we do not want seeds in the result
* @return list or empty list (never null)
*/
@SuppressWarnings({"unchecked", "rawtypes"})
List<Hash> getPeers(InfoHash ih, int max, boolean noSeeds) {
Peers peers = _torrents.get(ih);
if (peers == null || max <= 0)

View File

@ -40,6 +40,7 @@ import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
import org.klomp.snark.SnarkManager;
import org.klomp.snark.TrackerClient;
import org.klomp.snark.bencode.BDecoder;
import org.klomp.snark.bencode.BEncoder;
@ -152,7 +153,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
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_SUFFIX = ".dht.dat";
public static final String DHT_FILE_SUFFIX = ".dht.dat";
private static final int SEND_CRYPTO_TAGS = 8;
private static final int LOW_CRYPTO_TAGS = 4;
@ -185,8 +186,14 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
_myNID = new NID(_myID);
}
_myNodeInfo = new NodeInfo(_myNID, session.getMyDestination(), _qPort);
_dhtFile = new File(ctx.getConfigDir(), baseName + DHT_FILE_SUFFIX);
_backupDhtFile = baseName.equals("i2psnark") ? null : new File(ctx.getConfigDir(), "i2psnark" + DHT_FILE_SUFFIX);
File conf = new File(ctx.getConfigDir(), baseName + ".config" + SnarkManager.CONFIG_DIR_SUFFIX);
_dhtFile = new File(conf, "i2psnark" + DHT_FILE_SUFFIX);
if (baseName.equals("i2psnark")) {
_backupDhtFile = null;
} else {
File bconf = new File(ctx.getConfigDir(), "i2psnark.config" + SnarkManager.CONFIG_DIR_SUFFIX);
_backupDhtFile = new File(bconf, "i2psnark" + DHT_FILE_SUFFIX);
}
_knownNodes = new DHTNodes(ctx, _myNID);
start();
@ -236,6 +243,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param maxWait how long to wait for each to reply (not total) must be > 0
* @param parallel how many outstanding at once (unimplemented, always 1)
*/
@SuppressWarnings("unchecked")
private void explore(NID target, int maxNodes, long maxWait, int parallel) {
List<NodeInfo> nodes = _knownNodes.findClosest(target, maxNodes);
if (nodes.isEmpty()) {
@ -320,6 +328,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param noSeeds true if we do not want seeds in the result
* @return possibly empty (never null)
*/
@SuppressWarnings("unchecked")
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait,
int annMax, long annMaxWait,
boolean isSeed, boolean noSeeds) {
@ -835,7 +844,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
if (_log.shouldLog(Log.INFO))
_log.info("Sending error " + msg + " to: " + nInfo);
Map<String, Object> map = new HashMap<String, Object>(4);
List<Object> error = new ArrayList(2);
List<Object> error = new ArrayList<Object>(2);
error.add(Integer.valueOf(err));
error.add(msg);
map.put("e", error);
@ -851,6 +860,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param repliable true for all but announce
* @return null on error
*/
@SuppressWarnings("unchecked")
private ReplyWaiter sendQuery(NodeInfo nInfo, Map<String, Object> map, boolean repliable) {
if (nInfo.equals(_myNodeInfo))
throw new IllegalArgumentException("wtf don't send to ourselves");
@ -900,6 +910,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param toPort the query port, we will increment here
* @return success
*/
@SuppressWarnings("unchecked")
private boolean sendResponse(NodeInfo nInfo, MsgID msgID, Map<String, Object> map) {
if (nInfo.equals(_myNodeInfo))
throw new IllegalArgumentException("wtf don't send to ourselves");
@ -1287,7 +1298,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
} else {
List<byte[]> hashes;
if (peers.isEmpty()) {
hashes = Collections.EMPTY_LIST;
hashes = Collections.emptyList();
} else {
hashes = new ArrayList<byte[]>(peers.size());
for (Hash peer : peers) {

View File

@ -87,6 +87,8 @@ abstract class PersistDHT {
out.println(ni.toPersistentString());
count++;
}
if (out.checkError())
throw new IOException("Failed write to " + file);
} catch (IOException ioe) {
if (log.shouldLog(Log.WARN))
log.warn("Error writing the DHT File", ioe);

View File

@ -0,0 +1,8 @@
<html>
<body>
<p>
I2P version of the snark bittorrent client, imported in 2005 and heavily enhanced
to add a web UI, DHT support, and other features.
</p>
</body>
</html>

View File

@ -181,11 +181,10 @@ class BasicServlet extends HttpServlet
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);
} else {
File f = getResource(pathInContext);
// exists && !directory
if (f.isFile())
if (f != null && f.isFile())
r = new FileContent(f);
}
return r;
@ -283,7 +282,12 @@ class BasicServlet extends HttpServlet
{
if (content.getLastModified()/1000 <= ifmsl/1000)
{
response.reset();
try {
response.reset();
} catch (IllegalStateException ise) {
// committed
return true;
}
response.setStatus(304);
response.flushBuffer();
return false;
@ -354,6 +358,7 @@ class BasicServlet extends HttpServlet
writeHeaders(response, content, content_length);
response.setStatus(416);
response.setHeader("Content-Range", InclusiveByteRange.to416HeaderRangeString(content_length));
in.close();
return;
}
@ -555,14 +560,17 @@ class BasicServlet extends HttpServlet
/**
* 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());
}
protected static String encodePath(String path) /* throws MalformedURLException */ {
// Does NOT handle a ':' correctly, throws MUE.
// Can't convert to %3a before hand or the % gets escaped
//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());
//}
return URIUtil.encodePath(path);
}
/**

View File

@ -50,6 +50,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
private final String _url;
private final byte[] _fakeHash;
private final String _name;
private final File _dataDir;
private volatile long _remaining = -1;
private volatile long _total = -1;
private volatile long _transferred;
@ -65,8 +66,10 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
/**
* Caller should call _mgr.addDownloader(this), which
* will start things off.
*
* @param dataDir null to default to snark data directory
*/
public FetchAndAdd(I2PAppContext ctx, SnarkManager mgr, String url) {
public FetchAndAdd(I2PAppContext ctx, SnarkManager mgr, String url, File dataDir) {
// magnet constructor
super(mgr.util(), "Torrent download",
null, null, null, null, null, false, null);
@ -74,7 +77,8 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
_log = ctx.logManager().getLog(FetchAndAdd.class);
_mgr = mgr;
_url = url;
_name = _("Download torrent file from {0}", url);
_name = _t("Download torrent file from {0}", url);
_dataDir = dataDir;
byte[] fake = null;
try {
fake = SHA1.getInstance().digest(url.getBytes("ISO-8859-1"));
@ -86,7 +90,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
* Set off by startTorrent()
*/
public void run() {
_mgr.addMessageNoEscape(_("Fetching {0}", urlify(_url)));
_mgr.addMessageNoEscape(_t("Fetching {0}", urlify(_url)));
File file = get();
if (!_isRunning) // stopped?
return;
@ -96,7 +100,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
_mgr.deleteMagnet(this);
add(file);
} else {
_mgr.addMessageNoEscape(_("Torrent was not retrieved from {0}", urlify(_url)) +
_mgr.addMessageNoEscape(_t("Torrent was not retrieved from {0}", urlify(_url)) +
((_failCause != null) ? (": " + DataHelper.stripHTML(_failCause)) : ""));
}
if (file != null)
@ -123,7 +127,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
out.deleteOnExit();
if (!_mgr.util().connected()) {
_mgr.addMessage(_("Opening the I2P tunnel"));
_mgr.addMessage(_t("Opening the I2P tunnel"));
if (!_mgr.util().connect())
return null;
}
@ -150,7 +154,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
* This Snark may then be deleted.
*/
private void add(File file) {
_mgr.addMessageNoEscape(_("Torrent fetched from {0}", urlify(_url)));
_mgr.addMessageNoEscape(_t("Torrent fetched from {0}", urlify(_url)));
FileInputStream in = null;
try {
in = new FileInputStream(file);
@ -159,7 +163,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
try { in.close(); } catch (IOException ioe) {}
Snark snark = _mgr.getTorrentByInfoHash(fileInfoHash);
if (snark != null) {
_mgr.addMessage(_("Torrent with this info hash is already running: {0}", snark.getBaseName()));
_mgr.addMessage(_t("Torrent with this info hash is already running: {0}", snark.getBaseName()));
return;
}
@ -171,12 +175,12 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
if (torrentFile.exists()) {
if (_mgr.getTorrent(canonical) != null)
_mgr.addMessage(_("Torrent already running: {0}", name));
_mgr.addMessage(_t("Torrent already running: {0}", name));
else
_mgr.addMessage(_("Torrent already in the queue: {0}", name));
_mgr.addMessage(_t("Torrent already in the queue: {0}", name));
} else {
// This may take a LONG time to create the storage.
_mgr.copyAndAddTorrent(file, canonical);
_mgr.copyAndAddTorrent(file, canonical, _dataDir);
snark = _mgr.getTorrentByBaseName(originalName);
if (snark != null)
snark.startTorrent();
@ -184,9 +188,9 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
throw new IOException("Unknown error - check logs");
}
} catch (IOException ioe) {
_mgr.addMessageNoEscape(_("Torrent at {0} was not valid", urlify(_url)) + ": " + DataHelper.stripHTML(ioe.getMessage()));
_mgr.addMessageNoEscape(_t("Torrent at {0} was not valid", urlify(_url)) + ": " + DataHelper.stripHTML(ioe.getMessage()));
} catch (OutOfMemoryError oom) {
_mgr.addMessageNoEscape(_("ERROR - Out of memory, cannot create torrent from {0}", urlify(_url)) + ": " + DataHelper.stripHTML(oom.getMessage()));
_mgr.addMessageNoEscape(_t("ERROR - Out of memory, cannot create torrent from {0}", urlify(_url)) + ": " + DataHelper.stripHTML(oom.getMessage()));
} finally {
try { if (in != null) in.close(); } catch (IOException ioe) {}
}
@ -341,11 +345,11 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
// End of EepGet status listeners
private String _(String s) {
private String _t(String s) {
return _mgr.util().getString(s);
}
private String _(String s, String o) {
private String _t(String s, String o) {
return _mgr.util().getString(s, o);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,643 @@
package org.klomp.snark.web;
import java.io.File;
import java.io.Serializable;
import java.text.Collator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.klomp.snark.MetaInfo;
import org.klomp.snark.Snark;
import org.klomp.snark.Storage;
/**
* Comparators for various columns
*
* @since 0.9.16 from TorrentNameComparator, moved from I2PSnarkservlet
*/
class Sorters {
/**
* See below
*/
private static final Pattern PATTERN_DE, PATTERN_EN, PATTERN_ES, PATTERN_FR,
PATTERN_IT, PATTERN_NL, PATTERN_PT;
private static Pattern _pattern;
/**
* Negative is reverse
*
*<ul>
*<li>0, 1: Name
*<li>2: Status
*<li>3: Peers
*<li>4: ETA
*<li>5: Size
*<li>6: Downloaded
*<li>7: Uploaded
*<li>8: Down rate
*<li>9: Up rate
*<li>10: Remaining (needed)
*<li>11: Upload ratio
*<li>12: File type
*</ul>
*
* @param servlet for file type callback only
*/
public static Comparator<Snark> getComparator(int type, I2PSnarkServlet servlet) {
boolean rev = type < 0;
Comparator<Snark> rv;
switch (type) {
case -1:
case 0:
case 1:
default:
rv = new TorrentNameComparator();
if (rev)
rv = Collections.reverseOrder(rv);
break;
case -2:
case 2:
rv = new StatusComparator(rev);
break;
case -3:
case 3:
rv = new PeersComparator(rev);
break;
case -4:
case 4:
rv = new ETAComparator(rev);
break;
case -5:
case 5:
rv = new SizeComparator(rev);
break;
case -6:
case 6:
rv = new DownloadedComparator(rev);
break;
case -7:
case 7:
rv = new UploadedComparator(rev);
break;
case -8:
case 8:
rv = new DownRateComparator(rev);
break;
case -9:
case 9:
rv = new UpRateComparator(rev);
break;
case -10:
case 10:
rv = new RemainingComparator(rev);
break;
case -11:
case 11:
rv = new RatioComparator(rev);
break;
case -12:
case 12:
rv = new FileTypeComparator(rev, servlet);
break;
}
return rv;
}
/**
* Sort alphabetically in current locale, ignore case, ignore leading
* articles such as "the" if the pattern is set by setPattern()
* @since 0.7.14
*/
private static class TorrentNameComparator implements Comparator<Snark>, Serializable {
public int compare(Snark l, Snark r) {
return comp(l, r);
}
public static int comp(Snark l, Snark r) {
// put downloads and magnets first
if (l.getStorage() == null && r.getStorage() != null)
return -1;
if (l.getStorage() != null && r.getStorage() == null)
return 1;
String ls = l.getBaseName();
String rs = r.getBaseName();
Pattern p = _pattern;
if (p != null) {
Matcher m = p.matcher(ls);
if (m.matches())
ls = ls.substring(m.group(1).length());
m = p.matcher(rs);
if (m.matches())
rs = rs.substring(m.group(1).length());
}
return Collator.getInstance().compare(ls, rs);
}
}
/**
* Forward or reverse sort, but the fallback is always forward
*/
private static abstract class Sort implements Comparator<Snark>, Serializable {
private final boolean _rev;
public Sort(boolean rev) {
_rev = rev;
}
public int compare(Snark l, Snark r) {
int rv = compareIt(l, r);
if (rv != 0)
return _rev ? 0 - rv : rv;
return TorrentNameComparator.comp(l, r);
}
protected abstract int compareIt(Snark l, Snark r);
protected static int compLong(long l, long r) {
if (l < r)
return -1;
if (l > r)
return 1;
return 0;
}
}
private static class StatusComparator extends Sort {
private StatusComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
int rv = getStatus(l) - getStatus(r);
if (rv != 0)
return rv;
// use reverse remaining as first tie break
return compLong(r.getNeededLength(), l.getNeededLength());
}
private static int getStatus(Snark snark) {
long remaining = snark.getRemainingLength();
if (snark.isStopped()) {
if (remaining < 0)
return 0;
if (remaining > 0)
return 5;
return 10;
}
if (snark.isStarting())
return 15;
if (snark.isAllocating())
return 20;
if (remaining < 0)
return 15; // magnet
if (remaining == 0)
return 100;
if (snark.isChecking())
return 95;
if (snark.getNeededLength() <= 0)
return 90;
if (snark.getPeerCount() <= 0)
return 40;
if (snark.getDownloadRate() <= 0)
return 50;
return 60;
}
}
private static class PeersComparator extends Sort {
public PeersComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return l.getPeerCount() - r.getPeerCount();
}
}
private static class RemainingComparator extends Sort {
public RemainingComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return compLong(l.getNeededLength(), r.getNeededLength());
}
}
private static class ETAComparator extends Sort {
public ETAComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return compLong(eta(l), eta(r));
}
private static long eta(Snark snark) {
long needed = snark.getNeededLength();
if (needed <= 0)
return 0;
long total = snark.getTotalLength();
if (needed > total)
needed = total;
long downBps = snark.getDownloadRate();
if (downBps > 0)
return needed / downBps;
return Long.MAX_VALUE;
}
}
private static class SizeComparator extends Sort {
public SizeComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return compLong(l.getTotalLength(), r.getTotalLength());
}
}
private static class DownloadedComparator extends Sort {
public DownloadedComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
long ld = l.getTotalLength() - l.getRemainingLength();
long rd = r.getTotalLength() - r.getRemainingLength();
return compLong(ld, rd);
}
}
private static class UploadedComparator extends Sort {
public UploadedComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return compLong(l.getUploaded(), r.getUploaded());
}
}
private static class DownRateComparator extends Sort {
public DownRateComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return compLong(l.getDownloadRate(), r.getDownloadRate());
}
}
private static class UpRateComparator extends Sort {
public UpRateComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
return compLong(l.getUploadRate(), r.getUploadRate());
}
}
private static class RatioComparator extends Sort {
private static final long M = 128 * 1024 * 1024;
public RatioComparator(boolean rev) { super(rev); }
public int compareIt(Snark l, Snark r) {
long lt = l.getTotalLength();
long ld = lt > 0 ? ((M * l.getUploaded()) / lt) : 0;
long rt = r.getTotalLength();
long rd = rt > 0 ? ((M * r.getUploaded()) / rt) : 0;
return compLong(ld, rd);
}
}
private static class FileTypeComparator extends Sort {
private final I2PSnarkServlet servlet;
public FileTypeComparator(boolean rev, I2PSnarkServlet servlet) {
super(rev);
this.servlet = servlet;
}
public int compareIt(Snark l, Snark r) {
String ls = toName(l);
String rs = toName(r);
return ls.compareTo(rs);
}
private String toName(Snark snark) {
MetaInfo meta = snark.getMetaInfo();
if (meta == null)
return "0";
if (meta.getFiles() != null)
return "1";
// arbitrary sort based on icon name
return servlet.toIcon(meta.getName());
}
}
////////////// Comparators for details page below
/**
* Class to precompute and efficiently sort data
* on a torrent file entry.
*/
public static class FileAndIndex {
public final File file;
public final boolean isDirectory;
public final long length;
public final long remaining;
public final int priority;
public final int index;
/**
* @param storage may be null
* @param remainingArray precomputed, non-null iff storage is non-null
*/
public FileAndIndex(File file, Storage storage, long[] remainingArray) {
this.file = file;
index = storage != null ? storage.indexOf(file) : -1;
if (index >= 0) {
isDirectory = false;
remaining = remainingArray[index];
priority = storage.getPriority(index);
} else {
isDirectory = file.isDirectory();
remaining = -1;
priority = -999;
}
length = isDirectory ? 0 : file.length();
}
}
/**
* Negative is reverse
*
*<ul>
*<li>0, 1: Name
*<li>5: Size
*<li>10: Remaining (needed)
*<li>12: File type
*<li>13: Priority
*</ul>
*
* @param servlet for file type callback only
*/
public static Comparator<FileAndIndex> getFileComparator(int type, I2PSnarkServlet servlet) {
boolean rev = type < 0;
Comparator<FileAndIndex> rv;
switch (type) {
case -1:
case 0:
case 1:
default:
rv = new FileNameComparator();
if (rev)
rv = Collections.reverseOrder(rv);
break;
case -5:
case 5:
rv = new FAISizeComparator(rev);
break;
case -10:
case 10:
rv = new FAIRemainingComparator(rev);
break;
case -12:
case 12:
rv = new FAITypeComparator(rev, servlet);
break;
case -13:
case 13:
rv = new FAIPriorityComparator(rev);
break;
}
return rv;
}
/**
* Sort alphabetically in current locale, ignore case,
* directories first
* @since 0.9.6 moved from I2PSnarkServlet in 0.9.16
*/
private static class FileNameComparator implements Comparator<FileAndIndex>, Serializable {
public int compare(FileAndIndex l, FileAndIndex r) {
return comp(l, r);
}
public static int comp(FileAndIndex l, FileAndIndex r) {
boolean ld = l.isDirectory;
boolean rd = r.isDirectory;
if (ld && !rd)
return -1;
if (rd && !ld)
return 1;
return Collator.getInstance().compare(l.file.getName(), r.file.getName());
}
}
/**
* Forward or reverse sort, but the fallback is always forward
*/
private static abstract class FAISort implements Comparator<FileAndIndex>, Serializable {
private final boolean _rev;
public FAISort(boolean rev) {
_rev = rev;
}
public int compare(FileAndIndex l, FileAndIndex r) {
int rv = compareIt(l, r);
if (rv != 0)
return _rev ? 0 - rv : rv;
return FileNameComparator.comp(l, r);
}
protected abstract int compareIt(FileAndIndex l, FileAndIndex r);
protected static int compLong(long l, long r) {
if (l < r)
return -1;
if (l > r)
return 1;
return 0;
}
}
private static class FAIRemainingComparator extends FAISort {
public FAIRemainingComparator(boolean rev) { super(rev); }
public int compareIt(FileAndIndex l, FileAndIndex r) {
return compLong(l.remaining, r.remaining);
}
}
private static class FAISizeComparator extends FAISort {
public FAISizeComparator(boolean rev) { super(rev); }
public int compareIt(FileAndIndex l, FileAndIndex r) {
return compLong(l.length, r.length);
}
}
private static class FAITypeComparator extends FAISort {
private final I2PSnarkServlet servlet;
public FAITypeComparator(boolean rev, I2PSnarkServlet servlet) {
super(rev);
this.servlet = servlet;
}
public int compareIt(FileAndIndex l, FileAndIndex r) {
String ls = toName(l);
String rs = toName(r);
return ls.compareTo(rs);
}
private String toName(FileAndIndex fai) {
if (fai.isDirectory)
return "0";
// arbitrary sort based on icon name
return servlet.toIcon(fai.file.getName());
}
}
private static class FAIPriorityComparator extends FAISort {
public FAIPriorityComparator(boolean rev) { super(rev); }
/** highest first */
public int compareIt(FileAndIndex l, FileAndIndex r) {
return r.priority - l.priority;
}
}
/*
* Match an indefinite or definite article in the language,
* followed by one or more whitespace, '.', or '_'.
* Does not match "partitive" articles.
*
* https://en.wikipedia.org/wiki/Article_%28grammar%29
* http://www.loc.gov/marc/bibliographic/bdapndxf.html
*/
static {
PATTERN_DE = Pattern.compile(
// can't make the non-capturing innner group work
//"^((?:" +
"^((" +
"der|die|das|des|dem|den|ein|eine|einer|eines|einem|einen" +
")[\\s\\._]+).*",
Pattern.CASE_INSENSITIVE);
PATTERN_EN = Pattern.compile(
"^((" +
"a|an|the" +
")[\\s\\._]+).*",
Pattern.CASE_INSENSITIVE);
PATTERN_ES = Pattern.compile(
"^((" +
"el|la|lo|los|las|un|una|unos|unas" +
")[\\s\\._]+).*",
Pattern.CASE_INSENSITIVE);
PATTERN_FR = Pattern.compile(
// note l' doesn't require whitespace after
"^(l'|((" +
"le|la|les|un|une|des" +
")[\\s\\._]+)).*",
Pattern.CASE_INSENSITIVE);
PATTERN_IT = Pattern.compile(
// note l' and un' don't require whitespace after
"^(l'|un'|((" +
"il|lo|la|i|gli|le|uno|una|un" +
")[\\s\\._]+)).*",
Pattern.CASE_INSENSITIVE);
PATTERN_NL = Pattern.compile(
"^((" +
"de|het|het'n|een|een'n" +
")[\\s\\._]+).*",
Pattern.CASE_INSENSITIVE);
PATTERN_PT = Pattern.compile(
"^((" +
"o|a|os|as|um|uma|uns|umas" +
")[\\s\\._]+).*",
Pattern.CASE_INSENSITIVE);
}
/**
* Sets static field, oh well
* @param lang null for none
* @since 0.9.23
*/
public static void setPattern(String lang) {
Pattern p;
if (lang == null)
p = null;
else if (lang.equals("de"))
p = PATTERN_DE;
else if (lang.equals("en"))
p = PATTERN_EN;
else if (lang.equals("es"))
p = PATTERN_ES;
else if (lang.equals("fr"))
p = PATTERN_FR;
else if (lang.equals("it"))
p = PATTERN_IT;
else if (lang.equals("nl"))
p = PATTERN_NL;
else if (lang.equals("pt"))
p = PATTERN_PT;
else
p = null;
_pattern = p;
}
/****
public static final void main(String[] args) {
if (args.length != 2) {
System.out.println("Usage: Sorters lang 'string'");
System.exit(1);
}
String lang = args[0];
setPattern(lang);
if (_pattern == null) {
System.out.println("Unsupported " + lang);
System.exit(1);
}
String s = args[1];
Matcher m = _pattern.matcher(s);
if (m.matches()) {
System.out.println("Match is \"" + m.group(1) + '"');
} else {
System.out.println("No match for \"" + s + '"');
}
}
****/
}

View File

@ -0,0 +1,250 @@
//
// ========================================================================
// Copyright (c) 1995-2014 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.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import net.i2p.data.DataHelper;
/** URI Holder.
* This class assists with the decoding and encoding or HTTP URI's.
* It differs from the java.net.URL class as it does not provide
* communications ability, but it does assist with query string
* formatting.
* <P>UTF-8 encoding is used by default for % encoded characters. This
* may be overridden with the org.eclipse.jetty.util.URI.charset system property.
* see UrlEncoded
*
* I2P modded from Jetty 8.1.15
* @since 0.9.15
*/
class URIUtil
{
/** Encode a URI path.
* This is the same encoding offered by URLEncoder, except that
* the '/' character is not encoded.
* @param path The path the encode
* @return The encoded path
*/
public static String encodePath(String path)
{
if (path==null || path.length()==0)
return path;
StringBuilder buf = encodePath(null,path);
return buf==null?path:buf.toString();
}
/** Encode a URI path.
*
* Somewhat oddly, this encodes all chars >= 0x80 if buf is null, (strict RFC 2396)
* but only the control, space, and special chars if buf is non-null.
*
* @param path The path the encode
* @param buf StringBuilder to encode path into (or null)
* @return The StringBuilder or null if no substitutions required.
*/
public static StringBuilder encodePath(StringBuilder buf, String path)
{
byte[] bytes=null;
if (buf==null)
{
loop:
for (int i=0;i<path.length();i++)
{
char c=path.charAt(i);
switch(c)
{
case '%':
case '?':
case ';':
case '#':
case '\'':
case '"':
case '<':
case '>':
case ' ':
case ':':
case '[':
case ']':
buf=new StringBuilder(path.length()*2);
break loop;
default:
if (c >= 0x7f || c <= 0x1f)
{
bytes = DataHelper.getUTF8(path);
buf=new StringBuilder(path.length()*2);
break loop;
}
}
}
if (buf==null)
return null;
}
//synchronized(buf)
//{
if (bytes!=null)
{
for (int i=0;i<bytes.length;i++)
{
byte c=bytes[i];
switch(c)
{
case '%':
buf.append("%25");
continue;
case '?':
buf.append("%3F");
continue;
case ';':
buf.append("%3B");
continue;
case '#':
buf.append("%23");
continue;
case '"':
buf.append("%22");
continue;
case '\'':
buf.append("%27");
continue;
case '<':
buf.append("%3C");
continue;
case '>':
buf.append("%3E");
continue;
case ' ':
buf.append("%20");
continue;
case 0x7f:
buf.append("%7F");
continue;
case ':':
buf.append("%3A");
continue;
case '[':
buf.append("%5B");
continue;
case ']':
buf.append("%5D");
continue;
default:
if (c <= 0x1f) // includes negative
toHex(c,buf);
else
buf.append((char)c);
continue;
}
}
}
else
{
for (int i=0;i<path.length();i++)
{
char c=path.charAt(i);
switch(c)
{
case '%':
buf.append("%25");
continue;
case '?':
buf.append("%3F");
continue;
case ';':
buf.append("%3B");
continue;
case '#':
buf.append("%23");
continue;
case '"':
buf.append("%22");
continue;
case '\'':
buf.append("%27");
continue;
case '<':
buf.append("%3C");
continue;
case '>':
buf.append("%3E");
continue;
case ' ':
buf.append("%20");
continue;
case ':':
buf.append("%3A");
continue;
case '[':
buf.append("%5B");
continue;
case ']':
buf.append("%5D");
continue;
default:
if (c <= 0x1f || (c >= 0x7f && c <= 0x9f) || Character.isSpaceChar(c))
toHex(c,buf);
else
buf.append(c);
continue;
}
}
}
//}
return buf;
}
/**
* Modded from Jetty TypeUtil
*/
private static void toHex(byte b, StringBuilder buf)
{
buf.append('%');
int d=0xf&((0xF0&b)>>4);
buf.append((char)((d>9?('A'-10):'0')+d));
d=0xf&b;
buf.append((char)((d>9?('A'-10):'0')+d));
}
/**
* UTF-8
*/
private static void toHex(char c, StringBuilder buf)
{
if (c > 0x7f) {
byte[] b = DataHelper.getUTF8(Character.toString(c));
for (int i = 0; i < b.length; i++) {
toHex(b[i], buf);
}
} else {
toHex((byte) c, buf);
}
}
}

View File

@ -0,0 +1,7 @@
<html>
<body>
<p>
The i2psnark user interface, implemented as a webapp in i2psnark.war.
</p>
</body>
</html>

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

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

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

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

View File

@ -3,13 +3,16 @@
7z = application/x-7z-compressed
ape = audio/x-monkeys-audio
bz2 = application/x-bzip2
cue = application/x-cue
dmg = application/apple-diskimage
epub = application/epub+zip
flac = audio/flac
flv = video/x-flv
iso = application/x-iso9660-image
m4a = audio/mp4a-latm
m4b = audio/mp4a-latm
m4v = video/x-m4v
mka = audio/x-matroska
mkv = video/x-matroska
mobi = application/x-mobipocket-ebook
mp4 = video/mp4
@ -24,8 +27,10 @@ su2 = application/zip
su3 = application/zip
sud = application/zip
tbz = application/x-bzip2
torrent = application/x-bittorrent
txt = text/plain
war = application/java-archive
webm = video/webm
wma = audio/x-ms-wma
wmv = video/x-ms-wmv
xz = application/x-xz

View File

@ -1,6 +1,4 @@
To run I2PSnark from the command line, run "java -jar lib/i2psnark.jar", but
to run it with the web UI, run "launch-i2psnark". I2PSnark is
GPL'ed software, based on Snark (http://www.klomp.org/) to run on top of I2P
(http://www.i2p2.de/) within a webserver (such as the bundled Jetty from
http://jetty.mortbay.org/). For more information about I2PSnark, get in touch
with the folks at http://forum.i2p2.de/
i2psnark is packaged as a webapp running in the router console.
Command line and standalone operation of i2psnark are not currently supported.
See http://trac.i2p2.i2p/ticket/1191 or http://trac.i2p2.de/ticket/1191
for the status of restoring standalone support.

View File

@ -1,11 +1,9 @@
This is an I2P port of snark [http://klomp.org/snark], a GPL'ed bittorrent client
This is i2psnark, an I2P port of snark http://klomp.org/snark/ , a GPLv2 bittorrent client.
It contains significant enhancements including a web UI and support for
multitorrent, magnet, PEX and DHT.
The build in tracker has been removed for simplicity.
i2psnark is packaged as a webapp running in the router console.
Example usage:
java -jar lib/i2psnark.jar myFile.torrent
or, a more verbose setting:
java -jar lib/i2psnark.jar --eepproxy 127.0.0.1 4444 \
--i2cp 127.0.0.1 7654 "inbound.length=2 outbound.length=2" \
--debug 6 myFile.torrent
See http://i2p-projekt.i2p/en/docs/applications/bittorrent
or https://geti2p.net/en/docs/applications/bittorrent
for the specification of the protocols for bittorrent over I2P.

View File

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

View File

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

View File

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 882 B

View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

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