Compare commits

...

845 Commits

Author SHA1 Message Date
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
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
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
15137d9b62 NetDB: Exclude A1/A2 "countries" from auto-floodfill 2014-11-17 14:19:00 +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
c7de4e46c1 0.9.14.1 2014-08-09 21:24:18 +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
fbdc535287 * i2psnark: Fix more escaped messages 2014-08-08 20:05:42 +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
64ec9f6a00 GeoIP db updates
Updates to geoip.txt and geoipv6.dat.gz based on Maxmind GeoLite Country
database from 2014-08-06
2014-08-07 23:28:51 +00:00
2d6f71dc12 debian: changelog update 2014-08-07 23:26:17 +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
d4722e0d2c * i2psnark: Fix excaped message 2014-08-07 13:39:24 +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
7187f6f714 * Console: Display full path to config file
* i2ptunnel: More escaping
2014-08-06 13:40:25 +00:00
e10e05166f refresh patch 2014-08-06 09:03:18 +00:00
b0f8d84a7f updated debian/po/uk.po 2014-08-06 09:03:02 +00:00
zzz
0e9ceba057 * i2ptunnel: Fix filtering of custom options 2014-08-05 21:26:48 +00:00
zzz
fe3059f0ab * Plugins: Enforce signing key matches that in plugin.config 2014-08-05 21:23:48 +00:00
bd566f52cf Adding SWAT's reseed(su3) certificate. 2014-08-05 09:27:24 +00:00
zzz
b7e0dabe61 fix manual wrapper URL 2014-08-04 15:49:46 +00:00
zzz
2d2348f671 payload bounds check 2014-08-03 14:36:20 +00:00
zzz
b28eb708a4 * Console:
- Fix update buttons
   - Don't filter parameter names starting with "nofilter_"
   - Re-allow configadvanced, news URL, and unsigned update URL if routerconsole.advanced=true
   - Re-allow plugin install if routerconsole.advanced=true or routerconsole.enablePluginInstall=true
   - Only allow whitelisted plugin signers, unless routerconsole.allowUntrustedPlugins=true
   - Re-allow clients.config changes if routerconsole.advanced=true or routerconsole.enableClientChange=true
   - More escaping
 * i2psnark: Fix add torrent form
2014-08-03 13:58:51 +00:00
bf9c4b2346 new su3 cert as pwd for old lost, old one not in use till yet 2014-07-31 19:11:48 +00:00
zzz
d33aa097fe bump 2014-07-31 14:56:04 +00:00
zzz
8673c232b6 Whitelist of known plugin public keys
Compiled by kytv from plugins.i2p
todo: implementation
2014-07-31 14:51:02 +00:00
zzz
d3ea5d2122 drop ExecNamingService, moving to i2p.scripts 2014-07-31 14:44:52 +00:00
zzz
370d2555c7 Notes and logging re: compiling with Java 8 2014-07-31 14:42:51 +00:00
zzz
5332cee3e8 update credit as requested 2014-07-27 11:02:59 +00:00
zzz
1246e1c498 0.9.14 2014-07-26 20:32:26 +00:00
zzz
d6b0b1b93c refresh tweaks
another escape html
2014-07-26 20:14:01 +00:00
zzz
1e0c970c95 remove add client button 2014-07-26 19:31:36 +00:00
zzz
db9f49c7d4 updates after review:
Disable clients.config editing in UI
Strip single quotes too
Fix double-escaping in susimail folder page
2014-07-26 18:58:58 +00:00
zzz
1603353ae8 Susimail escaping from psi plus some more 2014-07-26 16:50:58 +00:00
zzz
6753d23309 Add filtering for getParameterMap()
Don't return null entries in getParameterValues() array
Log in getParameterValues() too
static
2014-07-26 15:09:40 +00:00
zzz
ca5755b0fd javadoc move new classes 2014-07-26 13:51:48 +00:00
zzz
2c8223274d filter pattern tweaks 2014-07-26 13:43:52 +00:00
zzz
f0dd09cf9c filter logging 2014-07-26 12:18:35 +00:00
zzz
4746d9eb80 Fix CSP to allow inline style and refresh
Add filter to all webapps
2014-07-26 11:01:16 +00:00
zzz
99401c5639 fix link 2014-07-26 10:51:42 +00:00
zzz
58578d9020 Console:
XSSFilter patch from str4d:
  XSSFilter and XSSRequestWrapper were from http://ricardozuasti.com/2012/stronger-anti-cross-site-scripting-xss-filter-for-java-web-apps/
  No provided license, but it is clearly intended for public consumption.
  But most of it is boilerplate provided by the Servlet Filter system.
  In fact, now that I have stripped out his JS-specific patterns and replaced it with the whitelist,
  it is effectively identical to what I would have written from scratch.
2014-07-26 09:39:31 +00:00
zzz
af575d6c95 * Console:
- Fix several XSS issues (thx Aaron Portnoy of Exodus Intel)
  - Add Content-Security-Policy and X-XSS-Protection headers
  - Disable changing news feed URL from UI
  - Disable plugin install from UI
  - Disable setting unsigned update URL from UI
  - Disable /configadvanced
* DataHelper: Disallow \r in storeProps() (thx joernchen of Phenoelit)
* ExecNamingService: Disable (thx joernchen of Phenoelit)
* Startup: Add susimail.config to migrated files
2014-07-26 09:32:26 +00:00
e9c8748c0b Updated Eclipse settings 2014-07-26 02:48:49 +00:00
08409d016b translation updates from Transifex 2014-07-23 13:55:58 +00:00
42bfbfc60b geoip database updates 2014-07-23 13:54:36 +00:00
c7c087d964 fix poupdate target 2014-07-23 13:49:09 +00:00
zzz
89764c12e7 bob finals, synch 2014-07-23 13:12:32 +00:00
bd45d5483f Added new reseed host, thanks to Backup.
Notes: Only HTTPS and SU3 (v2) support.
2014-07-22 17:56:50 +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
zzz
ce4874d825 better logging of reseed su3 errors 2014-07-21 20:05:05 +00:00
9b408b67ef Adding Matt's SU3 reseed key. 2014-07-21 18:07:02 +00:00
zzz
c3bf100082 readme_fr.html thx hummingbird 2014-07-21 13:24:13 +00:00
zzz
b282ccd890 increment error count on exception 2014-07-21 13:23:14 +00:00
f38b741813 Adding sindu's reseed key. ( i2p-netdb.innovatio.no ) 2014-07-21 01:47:37 +00:00
3a899d52d1 Don't grab the ClientApp if we don't need to 2014-07-19 23:55:43 +00:00
zzz
a2567b0ee2 * SusiMail: Better error message on decode fail
http://forum.i2p/viewtopic.php?t=11469
2014-07-19 16:31:59 +00:00
zzz
4b0019c732 * SAM: Add support for RAW on the bridge socket in v3 (ticket #1334)
log fixes
2014-07-19 15:43:51 +00:00
zzz
5d21738410 * i2psnark: Don't prefer leeches during end game, to
prevent slowdowns or stalls
2014-07-19 12:48:16 +00:00
zzz
df81006b42 javadoc 2014-07-19 12:40:23 +00:00
zzz
2c7006e9bd Streaming; Disable fail-fast for now. It's failing on leaseset lookup
far too often. Need to fix that first.
2014-07-19 12:39:37 +00:00
b1caa8d5a3 fix URL in initialNews: It's i2p-projekt not i2p-project
(thanks to SeekingFor for the heads-up)
2014-07-15 23:46:08 +00:00
zzz
8b2ffada10 - fix test
- final
- last week's history
2014-07-15 14:30:19 +00:00
0998738e94 Updated history 2014-07-15 12:59:56 +00:00
c04062bbdf Forgot to update @since 2014-07-15 12:58:58 +00:00
0c7a3a3a39 Stubs for I2CP connections over Unix domain sockets 2014-07-15 12:54:22 +00:00
zzz
f364a83f4f mtn.i2p-projekt.i2p 2014-07-14 20:40:36 +00:00
zzz
9dabc75866 * SU3File: Disable the X.509 CN checking of local certs on Android,
as the javax.naming classes are not available.
   Any issues with local certs will be discovered in non-Android testing.
2014-07-13 13:29:55 +00:00
zzz
2c185ea76c * Datagrams:
- Redefine the repliable datagram signature for non-DSA_SHA1 sig types;
    was the sig of the SHA-256 of the payload, now the sig of the payload itself.
    This is an incompatible change but nobody is yet using the new
    sig types for datagram applications.
  - Don't pollute the hash cache with hashes of payloads
  - Check for too-big datagrams
  - Remove assertion check
  - Cleanups
2014-07-11 19:31:44 +00:00
zzz
39e859c368 javadoc 2014-07-11 19:29:44 +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
dfbe3c4eb1 signing key type check 2014-07-09 13:29:52 +00:00
zzz
b8170a544b add reseed cert 2014-07-09 13:27:57 +00:00
4e7f92ec89 Removing certificate + added it to delete list 2014-07-09 00:46:18 +00:00
292683268b Thanks for the past support in reseeding pkol!
Removing reseed host after request.


From: pkol <pkol@mail.i2p>
To: Meeh <meeh@mail.i2p>
Subject: Reseed server shutdown
X-Mailer: smtp.postman.i2p - Official I2P Mailer

Hi meeh,

I wanted to announce the discontinuation of my reseed server
(reseed.pkol.de) at the end of July/beginning of August.

Thanks for your support during the initial setup.

Cheers
pkol
2014-07-09 00:29:59 +00:00
zzz
dc14abd4d3 BFNS: Trim whitespace from hosts.txt when importing
DataStructureImpl: Throw unique exception on bad base 64
2014-07-05 21:58:48 +00:00
zzz
dd782f08f7 hosts.txt: Remove trailing whitespace causing test failure 2014-07-05 21:44:23 +00:00
zzz
d57dc9a8a2 * Reseed: Check su3 version as date code 2014-07-05 19:15:26 +00:00
zzz
4e463d57ce * Reseed: Send If-Modified-Since in fetches
* EepGet: Fixes for adding etag or lastmod headers before fetch
2014-07-05 18:41:09 +00:00
zzz
e0c0cc8b63 Avoid publishing null IP when using forced address config 2014-07-05 17:02:44 +00:00
zzz
cc50d47376 log warning on very low MTU 2014-07-05 17:01:29 +00:00
zzz
4da7548caa * Reseed:
- Fix URLs without trailing /
   - Cleanups of su3 code
2014-07-05 13:39:51 +00:00
zzz
91a676cb36 public constructors for SKM 2014-07-05 13:37:53 +00:00
zzz
48a32fb3b8 spacing 2014-07-05 13:37:35 +00:00
zzz
845b45a57d javadoc 2014-07-05 13:36:29 +00:00
zzz
7b7a620999 * Console: Add event log viewer (ticket #1117) 2014-07-03 13:13:57 +00:00
zzz
82217d5ebc increase default refresh on graphs page 2014-07-03 13:08:24 +00:00
zzz
b95ec70d7d Console: Check wrapper version before calling WrapperManager.getProperties() 2014-07-03 13:07:41 +00:00
zzz
aa3d3670a4 * PrivateKeyFile: Check for key type mismatch 2014-07-03 13:06:21 +00:00
zzz
8198c83982 * Base64:
- Catch numerous decoding errors that were previously misdecoded (ticket #1318)
  - Improve decoding efficiency, reduce copies
  - encode(String) now uses UTF-8 encoding
  - decode() now accepts short strings without trailing '='
  - whitespace in decode will now cause an error, was previously ignored
  - Cleanups
2014-07-03 13:03:56 +00:00
75ff7987b8 re-enable reseed.pkol.de:443 (ticket #1326) as it seems to be working again 2014-07-02 22:02:27 +00:00
9c87685c02 fix date in history.txt 2014-07-02 13:57:24 +00:00
ce2bb85440 Update Java Service Wrapper to v3.5.25
- Windows: x86 and x64 versions self-compiled with VS2010 in
  Windows 7. The icon has been changed from Tanuki's default to Itoopie.
- Linux ARMv6: Compiled on a RaspberryPi using gcc 4.6.3-14+rpi1,
  Oracle Java 1.7.0+update40 and stripped
- All other binaries are from the "community edition" deltapack offered by
  Tanuki.
2014-07-02 13:54:47 +00:00
43fdff2292 postinstall: remove some redundancy, update comments 2014-07-02 13:51:17 +00:00
zzz
06525adf3d Chinese eepsite help from xkimo 2014-06-30 13:23:06 +00:00
zzz
cff4210dfd merge of 'a88d14e53014d9ab4a5d6e156e3abe2e496284c2'
and 'bcf2bb5bf040195d80e26c4bf643ba0df8386f8a'
2014-06-29 11:44:37 +00:00
zzz
d855c5de50 * NetDB: Add more su3 checks
* SU3File: Improve CLI help
2014-06-29 11:43:57 +00:00
f1a738340f checkcerts.sh: remove unnecessary echos 2014-06-29 11:37:24 +00:00
9827c48527 checkremotecerts.sh: support for ports 2014-06-29 11:27:57 +00:00
367d68e552 Adding three reseed hosts, all with reseed-v2 support
* uk.reseed.i2p2.no
* us.reseed.i2p2.no
* jp.reseed.i2p2.no
2014-06-29 02:15:26 +00:00
1498ed361e Added my reseed key 2014-06-29 02:13:02 +00:00
zzz
91bc16ce05 * NetDB: Fix handling reseed URLs with ports (ticket #1278)
by fixing the dup host check
2014-06-29 00:44:31 +00:00
861a1e26d7 merge of '2542a527f53e4df3896ae26f5b0cf7d0a45128ff'
and '4944f31a9bec7dcacd3a97f6e451fd4eaf5f4096'
2014-06-28 21:58:50 +00:00
a5b2f9a5e9 temporarily disable reseed.pkol.de:443 (ticket #1326) 2014-06-28 21:55:24 +00:00
9550484037 checkremotecerts.sh: fix regex so that commented out hosts are not matched
(//" was needed and  // " would pass through)
2014-06-28 21:51:09 +00:00
b33284bb8e added echelon su3 reseed cert 2014-06-28 20:01:03 +00:00
zzz
ce2694e8fb * NetDB: Add support for reseeding with su3 files (ticket #934) 2014-06-28 19:37:59 +00:00
44073732e2 build.xml: copy built binaries to build/ in the build* targets
This will hopefully make it easier for apps to use bits of I2P as build-deps.
2014-06-28 16:51:38 +00:00
zzz
fef591412e SAM: Cherrypick from patch in ticket #1318:
- Add SIGNATURE_TYPE support to GENERATE and CREATE
   - Don't NPE checking dest+privkeys
   - Simplify HELLO checking
   - Don't require two params in HELLO message
   - Make MIN parameter optional too
   - Version checking fixes
   - Bump version to 3.1, only visible if requested
   - Cleanups, javadocs
2014-06-28 14:14:39 +00:00
f191e50b14 Custom target so I2P-Bote can be built against source 2014-06-28 05:57:34 +00:00
zzz
3379432e5f SAM: Cherrypick from patch in ticket #1318:
- Check for extra bytes in private key string
   - checkPrivateDestination() returns boolean instead of throws
2014-06-27 21:05:54 +00:00
zzz
bb9129b61b SAM: Cherrypick from patch in ticket #1318:
- Fix empty properties check
   - Overrides
   - Statics
2014-06-27 20:53:01 +00:00
zzz
0fc3029aaa SAM:
Version handling (ticket #1318)
   - MAX param now optional
   - 1-digit versions now accepted for MIN and MAX
   - Use VersionComparator for version tests
   - Don't require a minor version of 0
   - Fix empty properties check
   - Overrides
   - Prep for version 3.1
  Throw exception on null option key (ticket #1325)
2014-06-27 20:36:34 +00:00
zzz
d8c8586ccf SAM: No synch needed for finals;
Move fields to top
2014-06-27 16:53:05 +00:00
zzz
38a4728283 SAM: Use SAMHandler.writeString() where possible,
Use DataHelper.getASCII() for byte conversion
2014-06-27 16:46:57 +00:00
zzz
7888705b01 final 2014-06-27 16:31:24 +00:00
zzz
31938f49d6 SAM: Fix checkPrivateDestination() for key certs (ticket #1318) 2014-06-27 16:19:07 +00:00
zzz
c95ed2ea96 SAM: Rename exceptions, make serialVersionUID private,
add new SAMException constructor
2014-06-27 16:15:22 +00:00
zzz
b5ed247a53 SAM: more Log conditionals, javadocs 2014-06-27 15:55:12 +00:00
zzz
22aff49747 SAM: Log conditionals, javadocs 2014-06-27 15:53:16 +00:00
zzz
e4430f05e4 2 more pkg private 2014-06-27 15:32:56 +00:00
zzz
1047691c64 SAM: Make all classes package private except the SAMBridge entry point 2014-06-27 15:26:44 +00:00
zzz
f3180b3f6f SAM client logging cleanup 2014-06-27 15:14:21 +00:00
zzz
616866cc9e Build: Move remaining jars to Java 6, as we will require
API 9 in the next Android release.
2014-06-27 13:57:43 +00:00
58512b8230 build.xml: add new macros for use in the release target
Also move away from using external binaries when an ant task can do the job.
2014-06-26 20:01:07 +00:00
zzz
ca4555c496 lint redundant cast all over 2014-06-26 15:26:58 +00:00
zzz
bc99bc7206 javadoc fixes 2014-06-26 12:51:33 +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
zzz
1420c773a6 * Streaming; Drop the preliminary channel implementations,
as added by 'dream' in late 2011. Testing couldn't have happened,
   as they don't work and can't ever work as designed.
   Channels must have underlying file descriptors unless you implement
   your own Selector and that would probably require JNI.
   See http://zzz.i2p/topics/1229 for details.
   Also http://stackoverflow.com/questions/911780/how-do-i-define-my-own-selectablechannel
2014-06-24 12:49:18 +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
690b40ed77 * Tunnels: Reject participating tunnels when hidden (ticket #1314) 2014-06-23 20:23:32 +00:00
zzz
986de4c1d6 Streaming: Fix connection error message 2014-06-23 20:12:12 +00:00
zzz
01da32364f Streaming: Bundle I2PSocketException messages for translation 2014-06-23 20:10:11 +00:00
zzz
8b1abc08db Add Destination.toBase32() 2014-06-23 20:06:03 +00:00
69e56f8f6b 'Home': (temporarily?) disable salt.i2p.
At this point it's been offline for a month with no sign of returning.
2014-06-23 08:19:30 +00:00
b611d0238a build.xml: minor tweaks to comments, indentation 2014-06-22 00:45:50 +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
2dcc9b7a1e i2psnark:
- Display webapp name in html title (ticket #1311)
  - Use tracker from magnet link in display (ticket #1313)
  - Clarify auto-start (ticket #1293)
  - Include tracker in magnet link on details page (ticket #964)
  - Recognize .azw4 extension as ebook
  - Cleanups
2014-06-21 02:30:25 +00:00
zzz
3e54b5d544 New Spanish eepsite help page from 'lati2p' 2014-06-19 01:13:17 +00:00
zzz
8845ce6e1c Findbugs all over:
- Serializable
 - hashCode()
 - Make DataStructureImpl Serializable (removed from DataStructure in 2005)
2014-06-15 16:14:13 +00:00
ff189e796c slackbuild: minor changes to the comments 2014-06-14 09:15:55 +00:00
89c07ac969 slackbuild: remove gettext as a run-time requirement as it's not *strictly* req'd 2014-06-14 09:15:14 +00:00
a8e878f894 SlackBuild: version extraction using awk (thanks 'ihavei2p') (ticket #1310) 2014-06-14 00:08:49 +00:00
1f8f3eb4d9 Fix up the included SlackBuild (ticket #1310) 2014-06-13 22:44:42 +00:00
zzz
8fd2a05bf9 duh 2014-06-13 22:12:38 +00:00
zzz
002d057c92 findbugs all over 2014-06-13 21:37:18 +00:00
ab44488e4c i2prouter: don't use uname -p to determine the arch
- This came from the script from Tanuki but it does return useful information
  (as far as its use in the script) in my testing. uname -m is better for our
  needs. (The problem is only seen on certain CPUs when *all* available wrapper
  binaries are present and the script tries to resolve the correct binary to use..
2014-06-13 20:55:36 +00:00
653ffbc82e build.xml: add jbigi-linux-x86-only target 2014-06-13 20:28:02 +00:00
zzz
95fd0291e3 * Tunnels: Don't get stuck only building tunnels for an empty pool (ticket #1300) 2014-06-13 13:40:52 +00:00
zzz
2a269ff1a9 * Transports: Disallow Carrier Grade NAT (RFC 6598) addresses 2014-06-13 13:39:15 +00:00
zzz
83ccfb4596 * i2psnark: Fix NPE when fetching invalid torrent (ticket #1307) 2014-06-13 13:38:30 +00:00
e968828916 i2prouter: add amdfx* as an x64 CPU / move ldd check 2014-06-12 00:41:14 +00:00
ed85a2b82b Executables get 755, not 744
While this may be the primary cause of the problem mentioned in ticket #1310,
plenty of other fixes/changes will be forthcoming.
2014-06-11 19:27:54 +00:00
e692e21dc9 updates to SlackBuild READMEs 2014-06-11 19:24:58 +00:00
zzz
662fe3ebc2 * i2psnark: Fix decoding of negative numbers (ticket #1307) 2014-06-10 19:54:05 +00:00
zzz
1bf8fd92e4 * NewsFetcher: Only treat correct status codes as success
The last-modified date was getting updated even when
   the server returned e.g. 503, preventing routers from
   getting the latest file on a subsequent fetch.
2014-06-10 19:52:55 +00:00
zzz
4dd8a6421a Tomcat: Bundle a stripped tomcat-coyote.jar with the utils
required to precompile jsps with tags (SusiDNS and Bote).
As of 6.0.39, these utils are required but they are not bundled
in the Tomcat deployer package, the main package is required.
This checkin has only the classes required from the jar.
2014-06-10 00:17:19 +00:00
zzz
884b285bf5 * Jetty 8.1.15.v20140411
* Tomcat 6.0.41
2014-06-09 20:39:49 +00:00
zzz
cb340152df * i2psnark:
- Linkify all announce URLs on details page
   - Sanitize announce URLs
2014-06-09 14:14:01 +00:00
zzz
299a44e7eb i2psnark: display peer version when available 2014-06-07 17:07:44 +00:00
zzz
40e5bcbdbb * NetDB: Reduce negative lookup cache time
* OCMOSJ:
   - Increase timeout if we must lookup leaseset
 * Streaming:
   - Shorter expire time in TCBCache
   - Don't fail a connection once it is up
   - Log tweaks
2014-06-07 13:23:38 +00:00
zzz
d328e78727 * SusiMail: Extend times on background checker (still disabled by default) 2014-06-07 13:17:40 +00:00
zzz
1bcb9b24b6 * Console: Fix NPE in summary bar 2014-06-07 13:16:19 +00:00
zzz
3c1c130bf0 * i2psnark: Fix errors when checking read-only files 2014-06-07 13:15:13 +00:00
zzz
df3442563c * Eepsite: Updated French help page (thx hummingbird) 2014-06-07 13:13:33 +00:00
zzz
331b1fa742 fix test breakage 2014-06-01 18:04:04 +00:00
zzz
b97a53177e * i2psnark:
- Store seed/leech status in DHT tracker (ticket #1280)
   - Increase max received DHT nodes (Vuze sends more than K)
   - Recognize not-registered message from diftracker
   - Fix bug in DHT unannounce()
2014-06-01 17:13:00 +00:00
zzz
633b71ba19 history for prop, -2 2014-05-31 16:58:05 +00:00
zzz
f3dd42143d cleanups 2014-05-29 12:44:27 +00:00
zzz
7c79f5d5e5 propagate from branch 'i2p.i2p.zzz.test2' (head 9aee013cf961ba795a6b5333481634c52d43abc5)
to branch 'i2p.i2p' (head e439e67c49695a624fabdf6f3cd1a8f7a3fd7ea5)
2014-05-29 12:31:49 +00:00
zzz
af5c0bd8a7 Console, i2psnark, susimail: Recognize emacs-w3m as a text-mode browser
As reported at http://zzz.i2p/topics/1630
untested
2014-05-28 21:25:35 +00:00
c07bfe34ab s/www\.i2p2\.i2p/i2p-projekt.i2p/g 2014-05-27 12:55:53 +00:00
49681415e2 Change "view source" link from Trac to Github. 2014-05-27 12:54:46 +00:00
190e8c01b7 update irc servers mentioned in the router console
- remove freshcoffee, add dg and echelon
2014-05-27 12:48:01 +00:00
zzz
6ae86f7d81 * i2psnark: Support ports in announce URLs, 2nd try (ticket #1283) 2014-05-27 12:06:59 +00:00
0aeb3ca75e s/i2plugins/plugins/ since i2plugins hasn't existed for years 2014-05-26 14:28:41 +00:00
1d3e12abb7 router console: fix links to i2p project pages
Some pages, such as Arabic linked to the German version.
Most pages mentioned "i2p-projekt and its mirror i2p-projekt.i2p"
2014-05-26 14:27:55 +00:00
5e8428ef6c router console: s;forum\.i2p2\.de;forum.i2p;g 2014-05-26 14:18:59 +00:00
19e3064529 remove #i2p-help from the router console (merged into #i2p) 2014-05-26 14:10:47 +00:00
f9dbd74ad8 update links to syndie to point to its eepsite 2014-05-26 13:59:22 +00:00
zzz
ff837cf66e i2ptunnel: Define standard tunnel properties and types in one place 2014-05-26 13:36:41 +00:00
zzz
e0914c358e susimail: fix NPE (ticket #1296) 2014-05-25 23:17:19 +00:00
zzz
0e9bb23c7b i2psnark:
- Respond to get_peers with an empty peers list instead of
    a nodes list if the requester was the only peer (ticket #1279)
  - Fix sendError() (still unused)
2014-05-25 21:41:43 +00:00
zzz
7ff5d36f07 i2psnark DHT tweaks (ticket #1281)
- Extend DHT tracker expire time from 45m to 3h
  - Extend DHT announce interval from 10m to 40m
  - Increase announces from 1 peer to 4
2014-05-25 20:38:39 +00:00
zzz
5a3eab0c7c i2psnark:
- Change "private" value in infohash from string to number,
    to match what everybody else does
  - Send seed/leech status in DHT announces (ticket #1280)
2014-05-25 19:41:01 +00:00
zzz
c28f707f55 cleanup 2014-05-25 19:23:04 +00:00
zzz
ef96c88719 HTTP Client:
- Add GUI options for user-agent, referer, accept
  - Fix SSL (initial socket data in I2PTunnelRunner)
  - Disable SSL to i2p addresses by default, add GUI option
  - Fix NPE in error handler
2014-05-25 19:17:36 +00:00
faa2435e33 checkremotecerts: fail if CN doesn't match
Since all reseed hosts now have proper certificates with matching CNs, I'm
making this script enforce a stricter policy, requiring matching CNs.
2014-05-24 13:13:35 +00:00
0537a221d3 temporarily disabling uk.reseed.i2p2.no 2014-05-24 10:08:58 +00:00
99c5a1978f merge of 'be06d7987687efb0d6b027f04a2efbf702218677'
and 'f6541fdc88966f2e0e510c2291b33cf716a3a62a'
2014-05-22 18:09:55 +00:00
zzz
d106f483a1 0.9.13 2014-05-22 14:59:02 +00:00
dee84e70ae Eclipse project for entire routerconsole dir 2014-05-22 01:51:05 +00:00
09995b77b4 Eclipse project for entire installer dir 2014-05-21 02:02:36 +00:00
06894f9f0b Export jstl.jar and standard.jar in Eclipse 2014-05-20 21:34:45 +00:00
zzz
73943b1a08 javadocs 2014-05-20 13:23:31 +00:00
zzz
b573dab05f javadocs 2014-05-20 13:22:07 +00:00
zzz
a766eca283 Crypto: Don't start YK thread in constructor (ticket #973) 2014-05-20 13:14:55 +00:00
zzz
a65edbef92 SSU: Fix peer test deadlock (ticket #1286) 2014-05-20 12:35:48 +00:00
zzz
7479aa235e fixes after review 2014-05-20 12:03:19 +00:00
zzz
4167cd955b Console: Cheap workaround for old wrappers (ticket #1285) 2014-05-18 23:24:03 +00:00
zzz
d1bd893a7b * I2PTunnel:
- Display custom error pages for I2PSocketExceptions (ticket #788)
   - Tag I2PSocketException text for translation (no bundles yet)
   - Move methods from superclasses to I2PTunnelHTTPClientBase
   - Fix connect client error pages, but they aren't displayed anyway
   - Don't start I2PTunnelRunner threads in constructor (ticket #973)
   - Synch close() in I2PTunnelServer
   - Cleanups and javadocs
2014-05-18 21:13:22 +00:00
zzz
2467856011 * Streaming: Cleanup, don't fail hard on no tunnels (ticket #788) 2014-05-18 00:44:51 +00:00
zzz
d32b4e9f24 * I2CP: Per-message status codes back through streaming (ticket #788)
- New I2PSessionException
   - Streaming PacketQueue requests status for SYNs on outbound conns
   - PacketQueue throws I2PSessionException in streams
2014-05-18 00:05:13 +00:00
zzz
1acd5caaa8 * HTTP client: Fix 'connection reset' browser messages
after an error in the first line (ticket #1277)
   - A SocketException is an IOE
   - out can't be null
2014-05-17 23:44:16 +00:00
zzz
f69b757305 * i2psnark: Support ports in announce URLs (ticket #1283) 2014-05-17 22:10:10 +00:00
d2db41bc89 remove cert from delete list 2014-05-16 14:04:45 +00:00
f3b4377ee1 re-add netdb.i2p2.no.crt 2014-05-16 13:58:51 +00:00
551a8091a9 GeoIP db updates; Japanese Susimail translation, -21-rc 2014-05-15 23:22:40 +00:00
f994590ad7 Translation updates
sk, ja, de, fr, it zh, nl, uk, nb
2014-05-15 23:14:38 +00:00
zzz
8371b8f806 * I2CP: Client-side prep for asynch status for sent messages (ticket #788)
- Clean up and reuse MessageState for asynch notification
   - New I2PSession sendMessage() method and listener
   - Move VerifyUsage from SimpleScheduler to SimpleTimer2 for efficiency
   - Fix up javadocs
2014-05-15 20:11:21 +00:00
5d04f8db89 checkremotecerts.sh fix test logic
Script would return 0 even connecting to the remote host failed.
2014-05-15 03:38:29 +00:00
06de347373 -20-rc 2014-05-14 14:18:24 +00:00
2bf2eb482e update outbound UA to match TBB's 2014-05-14 14:14:23 +00:00
zzz
a93666cd36 * I2CP: Prep for per-message reliability settings (ticket #788)
Router side:
     Store message nonce in ClientMessage, so we may send
     a MessageStatusMessage with a failure code to the client
     without sending an ACCEPTED MessageStatusMessage first.
     All MessageStatusMessages sent in response to outbound messages will now have a valid nonce.
2014-05-14 13:49:42 +00:00
zzz
dbb7eb3d88 * I2CP: Prep for per-message reliability settings (ticket #788)
Add bounds checks for flags
2014-05-14 12:15:57 +00:00
zzz
39169f0450 reveal key cert settings in i2ptunnel 2014-05-14 12:13:43 +00:00
zzz
df71308664 Susimail: Don't let an exception on one mail break others 2014-05-13 21:36:06 +00:00
zzz
e393f82eb7 * i2psnark: Escaping fixes on details page 2014-05-13 21:35:12 +00:00
zzz
8480a204ea * BOB, SAM, i2psnark: Fix datagram NPE (ticket #1275)
This could only happen on an extremely overloaded router.
2014-05-13 18:45:54 +00:00
zzz
197be5f60f * SusiMail: AIOOBE fix 3nd try (ticket #1269) 2014-05-13 18:39:56 +00:00
zzz
5621e9b390 * SusiMail: AIOOBE fix 2nd try (ticket #1269) 2014-05-12 20:46:30 +00:00
485d785e0b merge of 'dcf98ef995380862d3e668685caaa0acd403f068'
and 'f9fdb1592f632ef5de78e3dc7dac3f75ce4e3c39'
2014-05-10 15:38:20 +00:00
8d71d496be new self signed certificate which fits to the host name reseed.i2p.projekt.de 2014-05-10 15:21:54 +00:00
zzz
738bae46d2 * SusiMail:
- Remove deleted messages from memory too
   - Disable delete button when really-delete button shown
2014-05-10 14:47:46 +00:00
zzz
d519228efb change exception type 2014-05-10 14:44:09 +00:00
zzz
72c404c4d4 * NTCP: Fix NPE (ticket #996)
(hopefully)
2014-05-10 14:42:13 +00:00
zzz
d2e3547a2e * Crypto: JVM AES only faster for larger data size 2014-05-09 19:13:28 +00:00
zzz
8d9790fd77 * CPUID:
- Add hasAES()
   - Fix bugs in unused hasSSE3(), hasSSE41(), hasSSE42()
 * Crypto: Use JVM AES when faster
 * SystemVersion: Add isJava7() and isX86()
2014-05-09 15:28:54 +00:00
zzz
cd91a6b2a4 * SusiMail: Add more locking (ticket #1269) 2014-05-09 12:15:12 +00:00
zzz
e165c1805d unnecessary cast 2014-05-09 12:14:19 +00:00
292b0a81c0 remove debugging cruft 2014-05-09 10:33:01 +00:00
b9e9c07d95 checkremotecerts.sh: clean-ups, compatibility updates
It now works with either gnutls or openssl, and both gnutls v2 and gnutls v3.
2014-05-09 10:21:15 +00:00
837bf9eafe add i2pdocs.str4d.i2p to hosts.txt
It's linked on the website but wasn't in any of the default lists.
2014-05-09 10:11:22 +00:00
zzz
cfdbef05c5 set GPG key ID in release target 2014-05-08 19:23:15 +00:00
47b10e9771 checkremotecerts.sh: explicit check that cert exists 2014-05-08 17:56:37 +00:00
1b5a2ddef3 updated cert for ieb9oopo per email in ticket #1266 2014-05-08 17:55:41 +00:00
c161649ed5 Add script to check reseeder host certificate validity 2014-05-08 13:31:32 +00:00
c9b5c03e1b remove certs that are no longer used 2014-05-08 12:47:46 +00:00
c4c04d7ec5 rename i2pproject cert
The other self-signed certs are named after the host that they're being used
for. Maintaining this naming scheme will make automated testing easier.
2014-05-08 12:46:44 +00:00
b4e03fa969 Removing netdb.i2p2.* certs
These have not been used for some time. netdb.i2p2.no is using an *.i2p2.de
cert from Commodo.
2014-05-08 12:45:31 +00:00
zzz
1cdcf1cb0a i2ptunnel: Display warning for duplicate client ports (ticket #1265) 2014-05-07 16:00:38 +00:00
zzz
56b6992ca8 i2psnark: Add log message if directory does not exist (ticket #1263) 2014-05-07 15:58:24 +00:00
zzz
2beaea4a86 Tunnels: Revert expl. OB default back to 2 + 0-1 for now 2014-05-07 14:50:45 +00:00
zzz
2dc97b160a i2psnark: Allow click on entire table cell for viewing torrent details 2014-05-07 14:48:42 +00:00
zzz
a014918c0d Transports: Use constant time method for HMAC verification 2014-05-07 14:47:15 +00:00
zzz
fb9a4eb87a SSU: Extend establishment phase retx timeout 2014-05-07 14:43:46 +00:00
zzz
cd83c48526 DSAEngine: Minor cleanup 2014-05-07 14:41:28 +00:00
zzz
5b2766ddfb Data: Use Arrays.equals() directly, same as DataHelper.eq() 2014-05-07 14:40:03 +00:00
zzz
f912b01137 Fix console getting disabled when saving client config (ticket #1260)
Router: Add warning at startup if console is disabled
2014-05-07 14:36:41 +00:00
zzz
b0db4e4fff * SusiMail:
- Don't fetch headers from folder sorters
   - Update debug setting when saving config
2014-05-07 14:34:51 +00:00
zzz
649f76fb06 add hiddengate.i2p 2014-05-07 14:33:20 +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
zzz
67ea2f3717 SusiMail: Remove dups in war 2014-05-01 17:05:57 +00:00
zzz
e9e535cb94 * SusiMail:
- Move js to resources
   - js for delete boxes in folder view
2014-05-01 14:34:02 +00:00
zzz
7822b5c3ac SusiMail: header padding 2014-05-01 13:13:20 +00:00
zzz
767bd05ce1 SusiMail: new sorter base class 2014-05-01 13:02:44 +00:00
zzz
36ebe19cd7 SusiMail po update for TX 2014-05-01 12:04:10 +00:00
zzz
943ea957a2 * Plugins: Retry deletion at restart if it fails (ticket #1257) 2014-04-30 14:22:25 +00:00
zzz
04a3673366 remove UTF8 in commented-out test 2014-04-30 11:28:13 +00:00
zzz
1dfbe73b73 * SusiMail:
- Add print css
   - Add some divs
   - Hide header and footer in mobile css
   - Fix 'from' address in compose
   - Boolean config parse cleanup
   - Config textarea row count
2014-04-29 19:50:28 +00:00
zzz
87889bb322 * UDP:
- Locking fixes on peer testing
   - More locking fixes on rebuilding address
   - Slow down peer test frequency, esp. when firewalled
* Transports:
   - Deprecate unused recheckReachability()
2014-04-27 18:46:11 +00:00
zzz
aa0616d7c5 * UDP:
- Locking fixes on rebuilding address
   - Don't rapidly churn address when we don't have enough introducers
2014-04-27 15:47:43 +00:00
zzz
611ff6357e * NTCP: Remove published NTCP address if SSU becomes firewalled,
to fix the "Firewalled with NTCP enabled" message
2014-04-27 15:01:01 +00:00
zzz
91d7a0ab98 * SusiMail:
- Add locking for disk cache
   - Remove cancel button from login page
   - New configuration page
   - Move set page form to configuration page
   - Theme and folder js enhancements
   - Wrench icon from Silk, same license as the others
2014-04-27 14:57:28 +00:00
zzz
f5661da595 * Router: Set killVMOnEnd before runRouter() (for azi2phelper)
* RoutingKeyGenerator: Don't assume UTC (for azi2phelper)
2014-04-27 14:53:15 +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
zzz
3f56ce206d * SusiMail:
- Subject sort enhancements
   - Tag Re: and Fwd:
2014-04-25 20:05:23 +00:00
zzz
8a2308b411 * SusiMail:
- Send delete to server for mails already downloaded
   - Fix idle closer waiting for deletions
   - Add tooltips for icons
   - Add new options to properties resource
   - Add feedback when reload config button pushed (ticket #1158)
   - Reset page size when config reloaded
   - Remove max page size limit
   - Show page nav buttons on bottom too if page is big
   - Set title to subject on message view
   - Log tweaks
2014-04-25 18:47:47 +00:00
zzz
04cabf40b5 * SusiMail:
- Move delete and confirmation button in folder view to bottom left,
     page size form to bottom right
   - Attachment finals and cleanup
   - Increase max size for full download again
   - Fix repeated re-saves of mail to disk
   - Enable auto-deletion of downloaded mails
   - Consolidate check box processing
   - Button spacing tweaks
2014-04-25 16:11:35 +00:00
zzz
4e0c4f6f98 * SusiMail:
- Tweak sort button display based on current sort
   - Secondary sort based on date
   - Ignore "Re:" in subject sort
2014-04-25 14:09:28 +00:00
zzz
75bd235eb2 * SusiMail:
- Add raw attachment download method
   - Display image attachments inline
   - Don't rezip certain attachment types, just offer link
   - Handle attachment sending directly, don't put ref in session
2014-04-25 13:04:04 +00:00
zzz
05236b093a * SusiMail:
- Fix sorting buttons, broken by POST check
2014-04-25 04:15:50 +00:00
zzz
260ebe512c * SusiMail:
- Add icon for new mail
     (from Silk icons, same license as others)
   - Attachment logic tweak
2014-04-25 04:09:14 +00:00
zzz
c2dab16c8c * SusiMail:
- Add icons for attachments and spam
     (from Silk icons, same license as others)
   - Add checks for POST for XSS prevention
2014-04-25 03:42:18 +00:00
zzz
945d455f33 * SusiMail:
- Different colors for new mail and spam
2014-04-24 21:33:43 +00:00
zzz
c8f8f6ff34 * SusiMail:
- Add background mail checker, not yet enabled
   - Add idle timeout connection closer
   - Rely on idle checker for most delayed deletions
   - Cleanup resources better when shutting down session
   - Don't add deleted mails to folder, caused errors after deletions
   - Set socket soTimeouts so things don't hang forever
   - Display errors after check mail button pushed
   - More IOE debug logging
2014-04-24 20:54:22 +00:00
zzz
0d4f597a59 SusiDNS: Fix subscription edit page, thx bubbles 2014-04-24 14:26:21 +00:00
zzz
775047fbc2 * SusiMail:
- Fix HeaderLine decoder going past the headers,
     which was causing corruption in forwarded mails
   - More efficient output buffer allocation in HeaderLine decoder
2014-04-24 01:25:50 +00:00
zzz
1e4b43314c * SusiMail:
- Fix fetching of new mail
   - More Folder cleanup
   - Prep for not leaving on server
   - Prep for background checker
2014-04-23 22:46:57 +00:00
zzz
b365817c99 * SusiMail:
- Queue deletions for a delayed background thread
   - Synch all folder access
   - NPE fixes
   - Javadoc fixes
2014-04-23 19:40:57 +00:00
zzz
bbb04774d1 compile fix 2014-04-22 20:52:08 +00:00
zzz
1823e5e641 * SusiMail:
- Load all mails from disk at startup
   - Add offline mode
   - MailCache now has the total UIDL view
   - Copy silk folder icon from snark to console for use by susimail
2014-04-22 20:01:24 +00:00
zzz
4d2dc1c8e8 * SusiMail:
- Show sender name in folder view
   - Add support for configured sender name
   - Add HTML escaping of '&'
   - Fix Folder sorting so UP is up and DOWN is down
   - Use replace() instead of replaceAll() where appropriate
   - Fix capture by show page after back button
2014-04-22 18:45:09 +00:00
zzz
6986f90bf8 * SusiMail:
- Fix encoding in sent mails on non-UTF8 platforms (thx cryptosynthesis)
   - Clean up all other getBytes() calls
   - Tweak spacing on up buttons
2014-04-22 11:48:45 +00:00
zzz
b43ebd2486 * SusiMail:
- Add persistent cache
   - Remove ID sorter
   - Mail size getter/setter
   - Set mail size when setting body
   - Only send CAPA once
   - Tagged string tweaks
2014-04-22 11:18:56 +00:00
611f991fdd Added a security provider for I2P-internal crypto 2014-04-22 07:20:30 +00:00
zzz
7bf3ea5200 * SusiMail:
- Pipeline all deletes and quit
   - Don't reconnect after delete and quit
   - Verify connected before each POP3 operation
   - Null check in comparators
   - Don't clear messages if a reconnection fails
   - Use locale-based sorting for strings
   - Increase limit for full fetch again
   - Increase default page size back again
2014-04-21 23:00:46 +00:00
490727b401 fix i2ptunnel 2014-04-21 20:59:29 +00:00
zzz
49f4f3398d * SusiMail:
- Add MailPart constructor, make fields final
   - Add ReadBuffer constructor, make fields final
   - Move decoding to MailPart method
   - Setters/getters for Mail header, body, part
   - Classes package private
   - Finals, constructors
2014-04-21 20:17:08 +00:00
b84682fdc9 * findbugs: mostly stream closure fixes in router, apps, core 2014-04-21 10:54:52 +00:00
zzz
b9491b269b * SusiMail:
- Pipeline initial fetch of messages, huge speedup
2014-04-20 22:22:22 +00:00
zzz
b70cbb28b2 * SusiMail:
- Send CAPA
   - Pipeline STAT, UIDL, and LIST
2014-04-20 19:31:28 +00:00
zzz
673c14287a * SusiMail:
- Rework in POP3 in prep for more pipelining
2014-04-20 18:38:54 +00:00
zzz
b4a0ffdbbd * SusiMail:
- Don't require an attachment to be "uploaded" to send it
   - Move delete attachment button, hide if no attachments
   - Icon for delete attachment button
   - Fix html error in bccToSelf input
2014-04-20 17:12:21 +00:00
zzz
3b2e5bded2 * SusiMail:
- Don't store encoding class names in config
   - New susimail.debug setting in config
   - Use DataHelper to load config file
   - Close any open POP3 socket when session is unbound
   - Don't keep returning user to compose page (ticket #1252)
   - Add javascript capture of back button from compose page
2014-04-20 15:19:30 +00:00
67eb3cc140 unblocking USERS (ticket #1249) and various safe Inspircd commands 2014-04-20 11:53:39 +00:00
zzz
5a683149ab * SusiMail:
- New reply button icon (from Silk, same license as the others)
   - Save BCC-to-self preference in the session
   - Tweak the BCC-to-self layout
   - Fix date format in reply
2014-04-20 02:45:01 +00:00
zzz
b75ad1ca5a * SusiMail:
- Use pipelining in SMTP
   - Rewrite SMTP response processing
   - Translate SMTP error messages
   - Right-justify msg size in folder view
   - String.compareTo() cleanup
2014-04-20 01:26:11 +00:00
zzz
552ab31559 Console: Remove the classpath workarounds for SusiMail,
since it isn't using the jetty classes any more
2014-04-19 20:46:31 +00:00
zzz
4abfde4047 SusiMail:
- CSS padding in inputs
   - Flush writes in SMTP
   - Don't wait for SMTP response after QUIT
   - Translate the "login failed" message
   - Show "no messages" in folder view if none
   - Message view attachment cleanups
   - Fix the message view layout in CSS
   - Pipeline USER and PASS to save a round-trip at startup
   - Better synchronization in POP3
   - Properly de-byte-stuff in POP3
   - Flush writes in POP3 for speedup
   - Remove unnecessary caching in POP3, this is handled in MailCache
   - More efficient handling of POP3 server responses
   - Remove 60s timeout for fetching a message,
     so retrieval of large messages doesn't fail
   - Don't allow line breaks in date/time or size in folder view
   - Use DataHelper.formatSize2() for message size
   - Identify susimail log messages in wrapper
   - Debug log tweaks
2014-04-19 20:44:50 +00:00
zzz
6ecfedba37 SusiMail:
- Increase max size of mails that are fetched in full,
     previous limit was so small it never happened.
   - Move page nav to top of folder view, hide if only one page
   - Put message nav buttons on second line
   - Refuse to send mail with no "to"
   - Reduce default page size as it slows startup
   - Remove unnecessary casts
   - Right justify some input fields
2014-04-19 16:57:56 +00:00
zzz
43883a90d2 SusiMail: Successfully extend session expiration (ticket #1253)
by renaming the cookie, so we don't have a common session ID
with the base context and get it expired there.
2014-04-18 21:32:45 +00:00
zzz
3930113f00 I2PTunnel IRC Client: Prevent AIOOBE (ticket #1254) 2014-04-18 16:44:39 +00:00
zzz
029198c213 * SusiMail:
- Don't force reconnection on folder view (ticket #1253)
   - Only show logout button on folder view
   - Switch subject and date headers on message view
   - Button theme tweaks
   - Debug logging
   - Fix NPE when RELEASE=false
   - Synch tweaks
   - hellip
   - Footer tweak
2014-04-18 16:43:07 +00:00
zzz
493788f4f8 merge of '9f159df098940fb0feecf6eae0c990c62736bb9c'
and 'ba82e9e4c57bd8d9f567c9252fe7b5815972e370'
2014-04-18 01:50:14 +00:00
zzz
028776de88 * SusiMail:
- Extend session expiration (ticket #1253)
   - Handle non-UTF8 encoding on header lines (ticket #508)
   - Display dates in current locale and time zone
   - Display sender name on message view
   - Remove sort-by-ID buttons
   - Hide "reload config" button unless config file is present
   - Increase default page size
   - Add dependency tracking to build
2014-04-18 01:48:03 +00:00
705de68aa3 allow PROTOCTL and LINKS through the filter.
http://www.unrealircd.com/files/docs/technical/protoctl.txt

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

	addressbook.war
	BOB.jar
	i2p.jar
	i2ptunnel.jar
	mstreaming.jar
	router.jar
	streaming.jar
2014-02-03 23:59:48 +00:00
zzz
001b127258 * Jetty:
- Update to Jetty 8.x, Servlet 3.0, JSP 2.2
   - Require Java 6
   - Use Servlet and JSP jars from Jetty instead of Tomcat
   - Tomcat remains at 6.0.37 supporting Servlet 2.5 / JSP 2.1
   - Remove Jetty dependency in console error pages
   - Build files for Jetty 8.1.14
   - Doc updates
   - Delete Jetty 7.6.14
   - Jetty 8.1.14 not yet checked in,
     waiting to see if a new version is released soon,
     but build will download it for testing
2014-02-03 23:24:45 +00:00
zzz
7c00a5165f Build: Honor require.gettext=false for i2prouter translations 2014-02-03 20:43:02 +00:00
zzz
e1c3e2c1c7 * Getopt bundle fixes for Java Properties standard:
Fix comment lines
   Encoding conversion to UTF-8 with escapes
   Add unicode escapes for all chars over 0x7f
   Change Transifex type to PROPERTIES
   Also:
    - Remove BOMs
    - Remove \r
    - Remove blank lines
   Encodings were as follows:
     cs: marked ISO-8859-2
     pl: marked ISO-8859-2, possibly corrupt, ?? in two strings
     de, es, fr: marked ISO-8859-1
     hu: detected as ISO-8859-2
     it: apparently ISO-8859-1
     ja: Unicode escaped already
     nb, nl: ASCII
     ro: marked ISO-8859-2 but actually UTF-8
     zh: detected as GB2312 w/ CRLF
     zh_TW: UTF-8 w/ BOM w/ CRLF
2014-02-02 21:05:14 +00:00
zzz
e9b3577eec snark: cache PeerID.toString() 2014-02-02 17:19:06 +00:00
zzz
3622501471 * Streaming:
- Set ports on many packets that were missing them
   - Use connection throttling methods on pings too (ticket #1142)
   - Add methods to set ports on pings
   - Argument checking on ping methods
2014-02-02 16:47:29 +00:00
zzz
b7207fd29f Use getopt lib in SU3File (ticket #1173) 2014-02-02 15:14:00 +00:00
zzz
4dc1241d2f Add lightweight getopt command line parsing lib
(ticket #1173)
This is Java getopt 1.0.14 (released 2012/02/08)
Source was retrieved from https://github.com/arenn/java-getopt
Previous version 1.0.13 (released 2006/08/29)
is available at http://www.urbanophile.com/arenn/hacking/getopt/
Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com),
LGPL v2.
Include the small translation files, add to build.xml and to .tx/config
Fixes:
  Simplified Chinese
    MessagesBundle_chs.properties renamed to MessagesBundle_zh.properties
  Traditional Chinese
    MessagesBundle_cht.properties renamed to MessagesBundle_zh_TW.properties
  Norwegian Bokmaal
    MessagesBundle_no.properties renamed to MessagesBundle_nb.properties
2014-02-02 15:12:44 +00:00
zzz
c59603d31b fix swapped Dutch and Norwegian on /configui 2014-02-02 14:39:41 +00:00
zzz
3ab149a399 streaming javadoc fixes 2014-02-01 12:37:45 +00:00
zzz
99f28519fb * SOCKS: Remove static logs 2014-01-31 18:38:15 +00:00
zzz
05aa88b4e8 * /logs: Fix encoding of wrapper log section (ticket #1193)
- remove a cast in FileUtil
2014-01-31 18:34:27 +00:00
zzz
887f953efb * NetDB: Fix cases where corrupt RouterInfo files were not deleted (ticket #1190) 2014-01-31 18:32:22 +00:00
zzz
5e16c42e4e * InboundMessageDistributor: Set reply flag on LeaseSets 2014-01-30 13:02:16 +00:00
2cea7cdb30 fix 2014-01-29 21:41:52 +00:00
e60da8e8ff Added new https reseed, i2p-netdb.innovatio.no (Sindu) 2014-01-29 19:45:10 +00:00
zzz
be12995753 * Tunnels: Change expl. IB default to 2 + 0-1 2014-01-28 22:50:51 +00:00
zzz
c30419107f * /configclients: Add link to plugins.i2p; don't show delete button for console 2014-01-28 22:48:52 +00:00
zzz
2cacded182 datagram sigtype bugfix 2014-01-28 22:40:36 +00:00
zzz
ec22a1dafc - Only store LS with more than 6 leases to routers that support it 2014-01-28 22:35:33 +00:00
434bf13be9 * I2PSnark: Make 'kitty.png' transparent. 2014-01-28 21:11:39 +00:00
236df32f30 volatiles 2014-01-28 17:42:14 +00:00
zzz
28575dbdae * Key certs:
- Hide setting in i2ptunnel edit pages unless advanced user
  - Only store LS with key certs to routers that support it
2014-01-28 14:21:54 +00:00
zzz
5b9d669d79 * I2CP: Use client tunnels for b32 lookups (ticket #1166)
- convert some calls to use getDestHash()
   - javadocs
2014-01-28 13:27:44 +00:00
zzz
b2f4fde7e5 history for prop, -6 2014-01-27 18:50:44 +00:00
zzz
9eefe1e935 propagate from branch 'i2p.i2p.zzz.i2cp' (head d4ac8162a4ba299ac912640f19076c3c90afdc67)
to branch 'i2p.i2p' (head adc5102c93383e01c74b87f04449dc9c307f6e75)
2014-01-27 16:47:22 +00:00
zzz
b91f041ad7 I2CP:
- Add missing session ID assignments in HostLookup/Reply constructors
2014-01-27 16:38:00 +00:00
zzz
ba96f72899 help tweak 2014-01-27 16:37:39 +00:00
5d322245d8 Ticket #1183 - move message serialization later in the SSU pipeline 2014-01-27 14:47:58 +00:00
zzz
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
6b16907e40 * i2ptunnel HTTP Proxy: Fix default enable for outproxy plugin 2014-01-27 13:32:24 +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
0c326f989e Remove outproxy hook vestiges in context, history for prop, -3 2014-01-25 18:23:46 +00:00
zzz
e0a499dd0f propagate from branch 'i2p.i2p.zzz.outproxy' (head 02da481346e0bf35b289f00b32f50871da202afb)
to branch 'i2p.i2p' (head eb2820957208e17c76e8c10a2c36e59e0da61895)
2014-01-25 18:16:38 +00:00
zzz
0f862124fe - Tweak display name of HTTP client tunnel
- Show outproxy plugin status on i2ptunnel index page
2014-01-25 17:56:35 +00:00
zzz
d00be4ceee update error pages for HTTPS 2014-01-25 15:52:04 +00:00
zzz
ec8354860e * NetDB: Fix NPE after client shutdown (ticket #1174) 2014-01-25 15:08:56 +00:00
zzz
f9144f2fbf * StatisticsManager: Lower frequency for publishing stats again 2014-01-25 15:07:57 +00:00
zzz
5d2ff5e648 * Installer: Update links
* Update release checklist
2014-01-25 15:06:51 +00:00
zzz
ce475d2cd6 sort imports 2014-01-25 15:05:43 +00:00
zzz
72bd1fe91b * i2psnark: Lower threshold for auto-stop
* Update: All updates via torrent
2014-01-25 14:58:34 +00:00
747d833392 Fix 2014-01-25 00:59:42 +00:00
3427464de6 Move OutNetMessage buffer preparation to the Writer threads
(Ticket #1184)
 Up version to -1
2014-01-25 00:46:30 +00:00
zzz
9ca625a64e - Fix up the header processing for SSL thru HTTP proxy
- Fix the CONNECT line output
- Set use-plugin default to true
- Log tweaks
- rename a variable
2014-01-24 16:52:29 +00:00
9e87fd9b13 Sync fix for NTCPConnection._currentOutbound 2014-01-24 15:35:55 +00:00
zzz
576984badc I2CP:
- Add SessionID to HostLookup/Reply messages, for future
    use when we have multiple sessions
  - New SessionID constructor w/ value
  - Throw IAE on invalid SessionID values
  - Bump all comments from 0.9.10 to 0.9.11
2014-01-10 02:24:15 +00:00
zzz
c20c697126 RouterAppManager: Allow registration of untracked ClientApps,
required for orchid plugin
2014-01-08 15:17:09 +00:00
zzz
b16e66d39a Add GUI outproxy plugin enable setting for all tunnel proxies
(only implemented in HTTP)
More SSL support in I2PTunnelHTTPClient
  - Add separate config for SSL outproxy
2014-01-06 16:56:00 +00:00
zzz
0bc6c23ac9 Remove outproxy hook in context, use ClientAppManager:
- Add clientAppManager() to I2PAppContext so it can be used there
  - Add routerAppManager() to RouterContext for convenience inside router

Start of SSL support in I2PTunnelHTTPClient
  - Add initialSocketData support back to I2PTunnelOutproxyRunner
  - Works for orchid (and in-net?)
  - TODO Doesn't work for in-net proxy
  - Need separate config for SSL proxy
2014-01-06 13:57:45 +00:00
zzz
17e63b054c add sigtype to i2ptunnel client gui too 2014-01-05 16:38:39 +00:00
zzz
0fae0640d6 missing file 2014-01-05 02:55:46 +00:00
zzz
d054e12952 New interface and context hooks for in-jvm outproxy
Support in HTTP client proxy
All preliminary, maybe better to use ClientAppManager?
2014-01-05 00:52:00 +00:00
zzz
fba209ca7d restore method used by bote 2014-01-04 17:32:38 +00:00
zzz
41e071efe5 * Key cert GUI support:
- Add setting in i2ptunnel server edit page
  - Comment out cert setting on i2ptunnel server edit page
  - Show key type on susidns details page
  - Show key type on LS debug page
2014-01-03 15:31:08 +00:00
zzz
e8e239616f * Crypto: More implementation for key certs
- Support i2cp.destination.sigType option in TunnelController and
    I2PSocketManagerFactory
  - Fixup of Destination.create() and Destination.size()
  - Add generic off/len methods in DSAEngine, needed for streaming
  - Fixup of sign/verify in streaming Packet
  - Javadocs
2014-01-03 00:22:44 +00:00
zzz
5842e25205 Initial support for key certificates and arbitrary types and lengths
of signing keys and signatures in RouterIdentities and Destinations.
Untested, not even for regressions, except with command line
using PrivateKeyFile.
Based on preliminary spec at http://zzz.i2p/topics/1442?page=1#p7524
Not done:
 - Transport handshake signing
 - Configuration of default type
 - Specification of type in options to I2PSocketManagerFactory
 - Specification of type in i2ptunnel
 - Fix up caching of SigningPublicKey and P256 key cert
 - Any non-default crypto type in the key cert
 - Documentation
2013-12-24 16:41:05 +00:00
zzz
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
5219791673 I2CP:
- Add support for b64 conversion in destLookup()
  - Catch invalid message length sooner
I2Ping:
  - Extend I2PTunnelClientBase so non-shared-client,
    I2CP options, and other features will work
  - Fixes for fields and threading
Streaming:
  - Send LS with ping (broken since 0.9.2)
  - Set the NO_ACK flag on pings and pongs
2013-12-21 18:10:59 +00:00
zzz
cc97a19d3c I2CP:
- Add support for hostname lookups over I2CP with new
    HostLookup and HostReply messages.
  - Move username / password from CreateSession
    to GetDate for early authentication;
    this is an incompatible chage.
    Outside router context with authentication enabled,
    new clients will not work with old routers.
    Early authentication is not yet enforced, enable with
    i2cp.strictAuth=true. Will change default to true in a later release.
  - Block all actions before authentication.
  - Better disconnect messages to clients for diagnostics
  - Improve lookup command, add auth command in i2ptunnel CLI for testing
  - Don't start ClientWriterRunner thread in constructor
  - Don't flush in ClientWriterRunner unless necessary
  - Send GetDate even in SimpleSession outside of RouterContext
  - Improve SetDate wait logic to reduce locks and break out when
    Disconnect received
  - Add Disconnect handler to SimpleSession
  - I2Ping cleanups
  - Javadocs
2013-12-21 00:21:48 +00:00
zzz
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
1232 changed files with 168241 additions and 108839 deletions

48
.gitignore vendored Normal file
View File

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

View File

@ -16,10 +16,12 @@ _jsp\.java$
\.sig$
\.sud$
\.su2$
.\su3$
\.tar$
\.war$
.\deb$
\.zip$
\.torrent$
^\.
~$
web-fragment.xml
@ -31,13 +33,14 @@ web-out.xml
/build
/classes
/dist
/mo
^installer/resources/locale/mo
/tmp
^apps/jetty/jettylib
# Debian-related
^debian/copyright
^debian/changelog
^.pc/
# Build property overrides
override.properties

View File

@ -12,10 +12,13 @@ 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
trans.uk_UA = apps/i2ptunnel/locale/messages_uk.po
trans.vi = apps/i2ptunnel/locale/messages_vi.po
@ -38,6 +41,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,22 +82,28 @@ trans.ar = apps/routerconsole/locale-news/messages_ar.po
trans.de = apps/routerconsole/locale-news/messages_de.po
trans.es = apps/routerconsole/locale-news/messages_es.po
trans.fr = apps/routerconsole/locale-news/messages_fr.po
trans.ja = apps/routerconsole/locale-news/messages_ja.po
trans.he = apps/routerconsole/locale-news/messages_he.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.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
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.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
@ -111,7 +121,10 @@ trans.pt = apps/routerconsole/locale-countries/messages_pt.po
trans.pt_BR = apps/routerconsole/locale-countries/messages_pt_BR.po
trans.ro = apps/routerconsole/locale-countries/messages_ro.po
trans.ru_RU = apps/routerconsole/locale-countries/messages_ru.po
trans.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
@ -130,8 +143,10 @@ 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
trans.sv_SE = apps/i2psnark/locale/messages_sv.po
trans.vi = apps/i2psnark/locale/messages_vi.po
trans.zh_CN = apps/i2psnark/locale/messages_zh.po
@ -156,6 +171,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
@ -178,6 +194,7 @@ trans.pl = apps/desktopgui/locale/messages_pl.po
trans.pt_BR = apps/desktopgui/locale/messages_pt_BR.po
trans.ro = apps/desktopgui/locale/messages_ro.po
trans.ru_RU = apps/desktopgui/locale/messages_ru.po
trans.sk = apps/desktopgui/locale/messages_sk.po
trans.sv_SE = apps/desktopgui/locale/messages_sv.po
trans.uk_UA = apps/desktopgui/locale/messages_uk.po
trans.tr_TR = apps/desktopgui/locale/messages_tr.po
@ -188,11 +205,13 @@ 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.fr = apps/susimail/locale/messages_fr.po
trans.hu = apps/susimail/locale/messages_hu.po
trans.it = apps/susimail/locale/messages_it.po
trans.ja = apps/susimail/locale/messages_ja.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
@ -214,10 +233,13 @@ trans.es = debian/po/es.po
trans.fr = debian/po/fr.po
trans.it = debian/po/it.po
trans.hu = debian/po/hu.po
trans.ja = debian/po/ja.po
trans.ko = debian/po/ko.po
trans.pl = debian/po/pl.po
trans.pt = debian/po/pt.po
trans.ro = debian/po/ro.po
trans.ru_RU = debian/po/ru.po
trans.sk = debian/po/sk.po
trans.sv_SE = debian/po/sv.po
trans.uk_UA = debian/po/uk.po
trans.tr_TR = debian/po/tr.po
@ -230,14 +252,50 @@ trans.de = installer/resources/locale/po/messages_de.po
trans.es = installer/resources/locale/po/messages_es.po
trans.fr = installer/resources/locale/po/messages_fr.po
trans.it = installer/resources/locale/po/messages_it.po
trans.pl = installer/resources/locale/po/messages_pl.po
trans.ja = installer/resources/locale/po/messages_ja.po
trans.pl = installer/resources/locale/po/messages_pl.po
trans.pt = installer/resources/locale/po/messages_pt.po
trans.pt_BR = installer/resources/locale/po/messages_pt_BR.po
trans.ro = installer/resources/locale/po/messages_ro.po
trans.sv_SE = installer/resources/locale/po/messages_sv.po
trans.ru_RU = installer/resources/locale/po/messages_ru.po
trans.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
trans.zh_CN = installer/resources/locale/po/messages_zh.po
[I2P.getopt]
source_file = core/java/src/gnu/getopt/MessagesBundle.properties
source_lang = en
type = PROPERTIES
trans.cs = core/java/src/gnu/getopt/MessagesBundle_cs.properties
trans.de = core/java/src/gnu/getopt/MessagesBundle_de.properties
trans.es = core/java/src/gnu/getopt/MessagesBundle_es.properties
trans.fr = core/java/src/gnu/getopt/MessagesBundle_fr.properties
trans.hu = core/java/src/gnu/getopt/MessagesBundle_hu.properties
trans.it = core/java/src/gnu/getopt/MessagesBundle_it.properties
trans.ja = core/java/src/gnu/getopt/MessagesBundle_ja.properties
trans.nl = core/java/src/gnu/getopt/MessagesBundle_nl.properties
trans.nb = core/java/src/gnu/getopt/MessagesBundle_nb.properties
trans.pl = core/java/src/gnu/getopt/MessagesBundle_pl.properties
trans.pt_BR = core/java/src/gnu/getopt/MessagesBundle_pt_BR.properties
trans.ro = core/java/src/gnu/getopt/MessagesBundle_ro.properties
trans.ru_RU = core/java/src/gnu/getopt/MessagesBundle_ru.properties
trans.sk = core/java/src/gnu/getopt/MessagesBundle_sk.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.de = apps/ministreaming/locale/messages_de.po
trans.es = apps/ministreaming/locale/messages_es.po
trans.fr = apps/ministreaming/locale/messages_fr.po
trans.it = apps/ministreaming/locale/messages_it.po
trans.nb = apps/ministreaming/locale/messages_nb.po
trans.ru_RU = apps/ministreaming/locale/messages_ru.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

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

View File

@ -36,7 +36,7 @@ Public domain except as listed below:
Copyright (c) 2003, TheCrypto
See licenses/LICENSE-ElGamalDSA.txt
SHA256 and HMAC-SHA256:
SHA256 and HMAC:
Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
See licenses/LICENSE-SHA256.txt
@ -76,6 +76,11 @@ Public domain except as listed below:
Copyright 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
See licenses/LICENSE-Apache2.0.txt
Getopt:
Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
See licenses/LICENSE-LGPLv2.1.txt
Router (router.jar):
Public domain except as listed below:
UPnP.java:
@ -132,7 +137,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
@ -177,7 +182,7 @@ Applications:
By welterde.
See licenses/LICENSE-GPLv2.txt
Jetty 7.6.14.v20131031:
Jetty 8.1.16.v20140903:
See licenses/ABOUT-Jetty.html
See licenses/NOTICE-Jetty.html
See licenses/LICENSE-Apache2.0.txt
@ -243,8 +248,8 @@ Applications:
Bundles systray4j-2.4.1:
See licenses/LICENSE-LGPLv2.1.txt
Tomcat 6.0.37:
Copyright 1999-2013 The Apache Software Foundation
Tomcat 6.0.41:
Copyright 1999-2014 The Apache Software Foundation
See licenses/LICENSE-Apache2.0.txt
See licenses/NOTICE-Tomcat.txt

View File

@ -15,20 +15,20 @@ To build:
ant installer-osx
Run 'ant' with no arguments to see other build options.
See INSTALL.txt or http://www.i2p2.de/download.html for installation instructions.
See INSTALL.txt or https://geti2p.net/download for installation instructions.
Documentation:
http://www.i2p2.de/how
https://geti2p.net/how
API: run 'ant javadoc' then start at build/javadoc/index.html
Latest release:
http://www.i2p2.de/download
https://geti2p.net/download
To get development branch from source control:
http://www.i2p2.de/newdevelopers
https://geti2p.net/newdevelopers
FAQ:
http://www.i2p2.de/faq
https://geti2p.net/faq
Need help?
IRC irc.freenode.net #i2p

View File

@ -1,30 +1,70 @@
ou will need atleast monotone > = 0.41 to get the most recent build source
and connect it to an already running i2p router.
Getting the sources
===================
OR:
Monotone
--------
You may download the actual "stable" source from
http://code.google.com/p/i2p/downloads/list
The bleeding-edge source code is available both within and outside of I2P. The
I2P project uses Monotone to maintain the codebase.
You will need to follwing tools to build the i2p and i2p-base packages:
Information on retrieving the source with monotone is available within I2P at
http://i2p-projekt.i2p/monotone and from the internet at https://geti2p.net/monotone.
bash >= 3.1.017
requiredbuilder >= 0.16.3 ( http://www.stabellini.net/requiredbuilder.html )
jre >= 6u11
jdk >= 6u11
apache-ant >= 1.7.1
perl >= 5.10.0
python >= 2.5.2
Monotone 1.0 Slackbuilds are available at http://slackbuilds.org/.
Reccomended:
monotone >= 0.41 ( http://pkgs.dr.ea.ms )
Git
---
See also:
Git is also an option to retrieve the I2P source code. That said, the I2P
Monotone servers are *the* authoritative source.
i2p/readme.txt
Public Git repositories hosting the I2P source and managed by I2P project team members include
AND
- https://github.com/i2p/i2p.i2p
- http://git.repo.i2p/w/i2p.i2p.git (mirrored from Github)
- http://sourceforge.net/p/i2p/code/
i2p-base/readme.txt
for information and handy tips.
Tarball
-------
The latest stable release is always available from the I2P homepage at
https://geti2p.net/get/.
This SlackBuild
===============
Requirements
-------------
The following are needed to build the i2p package:
* jre >= 6
* jdk >= 6
* gettext
* apache-ant >= 1.7.1
If you don't care about bundling the translations, the gettext requirement can
be avoided by adding -Drequire.gettext=false to the ant lines in
i2p/i2p.SlackBuild
A JRE >= v6 is the only requirement to run I2P.
Building
--------
As the root user, run either $I2PSRC/Slackware/i2p/i2p.SlackBuild or `ant slackpkg` to create a package
in $I2PSRC/Slackware/i2p which can be installed using the Slackware packaging tools.
See also
========
Please also take a look at
* i2p/README
* eepget(1)
* i2prouter(1)
* http://i2p-projekt.i2p / https://geti2p.net
for additional information and tips.

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project basedir="." default="slackpkg">
<target name="slackpkg">
<echo message="Building Slackware package." />
<exec executable="./i2p-base.SlackBuild">
</exec>
</target>
</project>

View File

@ -1,157 +0,0 @@
#!/bin/sh
#
#
# Now in the future we only need to look for '#I2P' and '#/I2P'
# for modifications to rc.local and rc.local_shutdown.
# I was a moron for not doing it this way in the first place :-) -- Sponge
#
#
touch /etc/rc.d/rc.local
touch /etc/rc.d/rc.local_shutdown
echo
echo -n "Check 1: /etc/rc.d/rc.local "
I2PRCA=`grep -c /etc/rc.d/rc.local -e '/etc/rc.d/rc.i2p'`
if [ $I2PRCA -eq 0 ] ; then
echo '#I2P' >> /etc/rc.d/rc.local
echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo '#/I2P' >> /etc/rc.d/rc.local
echo "modified."
else
echo -n "looks OK so far,"
# Fix old installs, or where people have modified.
echo -n " Check 1A: "
I2PRCC=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'`
if [ $I2PRCC -eq 0 ] ; then
DATA=$(cat /etc/rc.d/rc.local | sed -re 's/if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/#I2P\n\( cd \/tmp ; rm -Rf i2p-*.tmp \)\nif \[ -x \/etc\/rc.d\/rc.i2p \] ; then/')
echo "${DATA}" > /etc/rc.d/rc.local
echo -n "additional modifications applied,"
else
echo -n "looks OK so far,"
fi
echo -n " Check 1B: "
I2PRCE=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'`
if [ $I2PRCE -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/i2p-\*\.tmp/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/i2p-\*\.tmp/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local
echo '#I2P' >> /etc/rc.d/rc.local
echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo '#/I2P' >> /etc/rc.d/rc.local
echo "${DATABOT}" >> /etc/rc.d/rc.local
echo -n "additional modifications applied,"
else
echo -n "looks ok so far,"
fi
echo -n " Check 1C: "
I2PRCF=`grep -c /etc/rc.d/rc.local -e '#/I2P'`
if [ $I2PRCF -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/^#I2P/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local
echo '#I2P' >> /etc/rc.d/rc.local
echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local
echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo '#/I2P' >> /etc/rc.d/rc.local
echo "${DATABOT}" >> /etc/rc.d/rc.local
echo -n "additional modifications applied,"
else
echo -n "looks ok so far,"
fi
echo " Done."
fi
echo -n "Check 2: /etc/rc.d/rc.local_shutdown "
I2PRCB=`grep -c /etc/rc.d/rc.local_shutdown -e '/etc/rc.d/rc.i2p'`
if [ $I2PRCB -eq 0 ] ; then
echo "#I2P" >> /etc/rc.d/rc.local_shutdown
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
echo "fi" >> /etc/rc.d/rc.local_shutdown
echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
echo "modified."
else
echo -n "looks OK so far,"
# Fix old installs
echo -n " Check 1A: "
I2PRCG=`grep -c /etc/rc.d/rc.local_shutdown -e '#I2P'`
if [ $I2PRCG -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown
echo '#I2P' >> /etc/rc.d/rc.local_shutdown
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
echo "fi" >> /etc/rc.d/rc.local_shutdown
echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown
echo -n "additional modifications applied,"
else
echo -n "looks OK so far,"
fi
echo -n " Check 1B: "
I2PRCH=`grep -c /etc/rc.d/rc.local_shutdown -e '#/I2P'`
if [ $I2PRCH -eq 0 ] ; then
DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^#I2P/p' | sed '$d' )
DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d")
echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown
echo '#I2P' >> /etc/rc.d/rc.local_shutdown
echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown
echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown
echo "fi" >> /etc/rc.d/rc.local_shutdown
echo "#/I2P" >> /etc/rc.d/rc.local_shutdown
echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown
echo -n "additional modifications applied,"
else
echo -n "looks OK so far,"
fi
echo " Done."
fi
if [ -f /etc/rc.d/rc.i2p ] ; then
if [ -x /etc/rc.d/rc.i2p ] ; then
chmod +x /etc/rc.d/rc.i2p.new
fi
# Hopefully get admin's attention.
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -e "\007" ; sleep 0.3
echo "It apears that you already have /etc/rc.d/rc.i2p"
echo "You should replace it with /etc/rc.d/rc.i2p.new as soon as possible"
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -ne "\007" ; sleep 0.3
echo -e "\007" ; sleep 0.3
else
mv /etc/rc.d/rc.i2p.new /etc/rc.d/rc.i2p
echo
echo "Installation finished. The i2p start/stop script has been"
echo "installed in /etc/rc.d . You should chmod +x"
echo '/etc/rc.d/rc.i2p to start it on boot.'
echo
fi
exit

View File

@ -1,57 +0,0 @@
#!/bin/sh
#
# Heavily based on the Slackware 12.2 SlackBuild
# Slackware build script for I2P
#
# PLEASE READ THIS:
# How to start I2P:
# After installpkg command, doinst.sh will execute a post-installation script
# needed by I2P. After that you have to chmod +x /etc/rc.d/rc.i2p and start
# I2P service with /etc/rc.d/rc.i2p start.
#
# Now tell your browser to user this proxy: localhost on port 4444 and open
# this page: http://localhost:7657/index.jsp
#
# Here you can configure I2P, watch network status and navigate anonimously.
# It's suggested to subscribe to various dns host, like i2host.i2p
# For any additional information, visit i2host.i2p and forum.i2p
#
CWD=$(pwd)
TMP=/tmp
PKG=/$TMP/package-base-i2p
NAME=i2p-base
VERSION=0.0.4
BUILD=1sponge
ARCH=noarch
INSTALL_DIR=opt
# Less than slackware 13?
SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/")
if [ $SLKPLT -lt 13 ] ; then
EXT=tgz
else
EXT=txz
fi
rm -rf $PKG
mkdir -p $PKG
cd $PKG
chown -R root:root .
mkdir -p $PKG/etc/rc.d
mkdir -p $PKG/install
sed "s|directory|/$INSTALL_DIR/i2p/i2prouter|g" "$CWD/rc.i2p_def" > $PKG/etc/rc.d/rc.i2p.new
chmod 644 $PKG/etc/rc.d/rc.i2p.new
cat "$CWD/doinst.sh" > $PKG/install/doinst.sh
cat "$CWD/slack-desc" > $PKG/install/slack-desc
cd $PKG
#
# Not really that important to exec this
# as there aren't any deps we don't know.
#
# requiredbuilder -v -y -s $CWD $PKG
#
cat "$CWD/slack-required" > $PKG/install/slack-required
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT

View File

@ -1,68 +0,0 @@
#!/bin/sh
# Start/stop i2p service.
i2p_start() {
# Check if router is up first!
/bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory status )'" > /dev/null
if [ $? -eq 0 ] ; then {
# I2p is already running, so tell the user.
echo "I2P is already running..."
i2p_status
}
else
{
# Just in-case there are leftover junk in /tmp...
rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping
# Now that all junk is cleaned up, start.
/bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory start )'"
}
fi
}
i2p_stop() {
/bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory stop )'"
rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping
}
i2p_restart() {
# We want a FULL cycle here, not the wrappers idea of this!
i2p_stop
i2p_start
}
i2p_status() {
/bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory status )'"
}
i2p_console() {
/bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory console )'"
}
i2p_dump() {
/bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory dump )'"
}
case "$1" in
'start')
i2p_start
;;
'stop')
i2p_stop
;;
'restart')
i2p_restart
;;
'status')
i2p_status
;;
'console')
i2p_console
;;
'dump')
i2p_dump
;;
*)
echo "usage $0 start|stop|restart|status|console|dump"
;;
esac

View File

@ -1,10 +0,0 @@
An rc file called rc.i2p has been placed into the /etc/rc.d directory.
If you want to change installation dir, change the variable INSTALL_DIR
on base-i2p.SlackBuild and rebuild the package. You also will need to do the
same for the i2p package.
The install script will insert everything needed into /etc/rc.d/rc.local and
into /etc/rc.d/rc.local_shutdown automatically.
If you want to start I2P at boot you have to chmod +x /etc/rc.d/rc.i2p

View File

@ -1,19 +0,0 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
base-i2p: base-i2p (I2P anonymizing network base config files)
base-i2p:
base-i2p: I2P is an anonymizing network, offering a simple layer that
base-i2p: identity-sensitive applications can use to securely communicate. All
base-i2p: data is wrapped with several layers of encryption, and the network is
base-i2p: both distributed and dynamic, with no trusted parties.
base-i2p: Many applications are available that interface with I2P, including
base-i2p: mail, peer-peer file sharing, IRC chat, and others.
base-i2p:
base-i2p: This package provides the startup files.
base-i2p:

View File

@ -1 +0,0 @@
bash >= 3.1.017

89
Slackware/i2p/README Normal file
View File

@ -0,0 +1,89 @@
The I2P package will be installed to /opt/i2p.
To install to another location, set the variable INSTALL_DIR in i2p.SlackBuild
and rebuild the package.
Installing and Upgrading:
=========================
I2P has an auto-update function but generally speaking packages are managed by
packaging systems. Changing a package's files outside of the package system can
cause problems. To upgrade when there's a new I2P release, retrieve the new
source, re-run the SlackBuild, then use upgradepkg to update.
To ignore all this and upgrade "in-network", simply change the permissions of the installation
directory (/opt/i2p by default). Something like the following would suffice:
chown -R USERNAME /opt/i2p
Starting and using I2P
======================
Using the initscript
--------------------
To start I2P at boot, set the executable bit on /etc/rc.d/rc.i2p, add this
script to rc.local*, and set the variable "RUN_AS_USER" in /etc/rc.d/rc.i2p.
Optionally, create a new user/group with limited rights to run I2P.
Something like the following would work to start I2P at system boot, running under the
"i2p" account:
echo '[ -x /etc/rc.d/rc.i2p ] && /etc/rc.d/rc.i2p start' >> /etc/rc.d/rc.local
echo '[ -x /etc/rc.d/rc.i2p ] && /etc/rc.d/rc.i2p stop' >> /etc/.rc.d/rc.local_shutdown
sed -i .bak 's/^.*\(RUN_AS_USER\)=.*/\1=i2p/' /etc/rc.d/rc.i2p
chmod 755 /etc/rc.d/rc.i2p
Unless running as a user named "i2psvc", I2P's config directory defaults to
$HOME/.i2p. In the case of the "i2psvc" user, the default config directory is
/var/lib/i2p/i2p-config.
It should not need to be said that using the "root" account is not recommended.
When running using the initscript, I2P will write its logs to /var/log/i2p.
Starting I2P "on-demand"
------------------------
As with a normal installation, I2P can be started with "i2prouter start". The
i2prouter and eepget scripts hve been installed to /usr/bin so they'll be
accessible in the default system PATH.
When running using the i2prouter script, I2P will write its logs to $HOME/.i2p.
Configuring your browser
------------------------
In order to access eepSites (I2P-internal web sites) your web browser needs to
be configured. Set the HTTP Proxy to 127.0.0.1 and port 4444. For more information, see
https://geti2p.net/en/about/browser-config
The I2P router console is reachable at http://127.0.0.1:7657.
Addressbook subscriptions
-------------------------
Please see the FAQs at http://i2p-projekt.i2p/faq or https://geti2p.net/faq for information about
the various addressbook services.
Chatting on IRC
---------------
I2P comes preconfigured with a tunnel pointing to the I2P-only IRC network,
Irc2P. Signing on is easy, just connect to 127.0.0.1 on port 6668. Do not
configure a proxy in your IRC client.
Additional information
======================
Within I2P: http://i2p-projekt.i2p/, http://forum.i2p/, http://zzz.i2p/, http://trac.i2p2.i2p/
On the Internet: https://geti2p.net/, https://trac.i2p2.de
Manpages: i2prouter(1), eepget(1)

View File

@ -2,7 +2,7 @@
<project basedir="." default="slackpkg">
<target name="slackpkg">
<echo message="Building Slackware package." />
<exec executable="./i2p.SlackBuild">
</exec>
<chmod file="./i2p.Slackbuild" perm="755" />
<exec executable="./i2p.SlackBuild" failifexecutionfails="true" />
</target>
</project>

View File

@ -1,72 +1,60 @@
#!/bin/bash
#!/bin/sh
# Abort on error or unset variables
set -e
set -u
# This is changed by i2p.SlackBuild
INST_DIR=directory
PKGNAME="%pkg"
( cd install
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ ! -r $NEW ]; then
# If we get here there's a flaw in the packaging. We'll just return so that
# we don't emit a spurious error for the user. (It's not the user's problem).
return
fi
echo
for i in *.config ; {
if [ -f $INST_DIR/$i ] ; then
echo "Please check ${INST_DIR}${i}, as there is a new version."
cp $i $INST_DIR/$i.new
else
cp $i $INST_DIR/$i
fi
# If this file doesn't exist yet, drop the .new extension.
if [ ! -r $OLD ]; then
mv $NEW $OLD
return
elif [ "$(md5sum $OLD | cut -d' ' -f1)" = "$(md5sum $NEW | cut -d' ' -f1)" ]; then
# If there are no differences in the files, remove the file with the .new extension.
rm $NEW
return
fi
# Alert the admin if they differ, but let's not be terribly obnoxious about it.
echo "WARNING: The files $OLD and $NEW differ." >&2
}
)
# Unlike previous versions of the package, we install i2prouter and eepget to /usr/bin
# to make them available within the system PATH.
( cd $INST_DIR
if [ -f blocklist.txt ] ; then
echo "Please check ${INST_DIR}blocklist.txt, as there is a new version."
else
mv blocklist.txt.new blocklist.txt
fi
)
# Users might still want to /opt/i2p/i2prouter or /opt/i2p/eepget so we'll create symlinks
# in the installation directory.
ln -sf /usr/bin/eepget $INST_DIR
ln -sf /usr/bin/i2prouter $INST_DIR
(cd /usr/doc/$PKGNAME; ln -sf $INST_DIR/history.txt changelog)
( cd $INST_DIR/eepsite
if [ -f jetty.xml ] ; then
echo "Please check ${INST_DIR}/eepsite, as there are new files."
else
find $PKG/$INSTALL_DIR/i2p -name "*.xml.new" -exec sh -c 'mv "$0" "${0/.new}"' {} \;
fi
)
( cd $INST_DIR/eepsite/docroot
if [ -f index.html ] ; then
rm index.html.new
else
mv index.html.new index.html
fi
if [ -f favicon.ico ] ; then
rm favicon.ico.new
else
mv favicon.ico.new favicon.ico
fi
)
echo
echo "FINISHING I2P INSTALLATION. PLEASE WAIT."
cd $INST_DIR
OS_ARCH=`uname -m`
X86_64=`echo "$OS_ARCH" | grep x86_64`
if [ "X$X86_64" = "X" ]; then
wrapperpath="./lib/wrapper/linux"
if $(uname -m | grep -q '64'); then
(cd $INST_DIR; ln -sf i2psvc-linux-x86-64 i2psvc)
else
wrapperpath="./lib/wrapper/linux64"
(cd $INST_DIR; ln -sf i2psvc-linux-x86-32 i2psvc)
fi
cp $wrapperpath/libwrapper.so ./lib/
cp $wrapperpath/wrapper.jar ./lib/
cp $wrapperpath/i2psvc .
rm -rf ./lib/wrapper
chmod 744 ./i2psvc
echo
echo "Installation finished."
echo
config /etc/rc.d/rc.i2p.new
config $INST_DIR/wrapper.config.new
exit
if [ -e /var/log/packages/i2p-base* ]; then
echo "Warning: This package supercedes the 'i2p-base' package." >&2
echo
echo "You may want to 'removepkg i2p-base'" >&2
echo "and check the contents of /etc/rc.d/rc.local*" >&2
echo "for correctness" >&2
fi
# Remove extraneous 'sh' from sponge's set-up
sed -i 's|sh /etc/rc\.d/rc\.i2p|/etc/rc.d/rc.i2p|g' /etc/rc.d/rc.local*

View File

@ -3,135 +3,124 @@
# Heavily based on the Slackware 12.2 SlackBuild
# Slackware build script for I2P
#
# PLEASE READ THIS:
# Probably you will never have to update I2P packages with upgradepkg,
# just because I2P has an auto-update function.
# Really you should not ever use any "upgrade" method.
#
# The correct way to upgrade is to:
# 1: install the upgrade
# 2: remove the old package
#
# It is a terrible shame that upgradepkg doesn't do this, infact,
# it would actually be the correct way for *any* package!
# Packages are generally prohibited from being updated outside
# of the package manager; this I2P SlackBuild is no different.
#
# If you'd like to use the I2P "in-network" updates anyway, you'll need to
# grant the user that I2P will run as write permission to the installation directory
# (/opt/i2p by default).
#
# For safety's sake, a user's I2P config files will *never* be overwritten by any upgrade method.
# In the future this SlackBuild may alert when a default config file is updated.
##
BUILD=1sponge
# Make sure makepkg and friends can be found
PATH=$PATH:/sbin
# abort on error and unset variables (same as set -e and set -u, respectively)
set -o errexit
set -o nounset
if [ $(id -ur) -ne 0 ]; then
echo "ERROR: SlackBuilds require root access." >&2
exit 1
fi
BUILD=1kytv
# INSTALL_DIR is referenced from /, don't prefix it with a '/'
INSTALL_DIR=opt
NAME=i2p
ARCH=noarch
# Less than slackware 13?
SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/")
if [ $SLKPLT -lt 13 ] ; then
EXT=tgz
else
EXT=txz
fi
#
# This mess is here due to the totally moronic way i2p does versioning.
# We correct it here.
#
ROUTER=$(echo -ne "_")$(cat ../../router/java/src/net/i2p/router/RouterVersion.java | grep -e "public final static long BUILD" | cut -f2 -d"=" | cut -f1 -d";" | sed -re "s/ //g")
if [ "$ROUTER" == "_" ] ; then
ROUTER="_0"
fi
#
# That was the easy one, now for the tough one.
#
CORE=$(cat ../../core/java/src/net/i2p/CoreVersion.java | grep -e "public final static String VERSION" | cut -f2 -d'"' | sed -re "s/ //g")
CORE1=$(echo -n $CORE.x.x | sed -re "s/(.*)\.(.*)\.(.*)\.(.*)/\1/")
CORE2=$(echo -n $CORE.x | sed -re "s/(.*)\.(.*)\.(.*)\.(.*)/\1/")
if [ "$CORE.x.x" == "$CORE1" ] ; then
CORE=$(echo -ne $CORE".0.0")
fi
if [ "$CORE.x" == "$CORE2" ] ; then
CORE=$(echo -ne $CORE".0")
fi
VERSION=$(echo $CORE$ROUTER)
#
# Whew!
# OK, let's build i2p
#
CWD=$(pwd)
CWD=$(readlink -m $(dirname $0))
I2PSRC=$(readlink -m $CWD/../../)
TMP=/tmp
PKG=$TMP/package-i2p
rm -rf $PKG
mkdir -p $PKG
cd $CWD/../../
if [ -e "/etc/slackware-version" ]; then
# Older than Slackware 13?
SLACKVER=$(sed -e "s/Slackware\s\+\([0-9]\+\)\.\?\([0-9]\+\)\?/\1/" /etc/slackware-version)
if [ $SLACKVER -lt 13 ] ; then
EXT=tgz
else
EXT=txz
fi
else
echo "ERROR: This script is only intended for use on Slackware systems.">&2
exit 1
fi
# Extract version strings
I2PBUILD=$(sed -e '/^.\+long\s\+BUILD/!d' -e 's/^.\+long\s\+BUILD\s\+=\s\+\([0-9]\+\);/\1/' $I2PSRC/router/java/src/net/i2p/router/RouterVersion.java)
# Thanks to user "ihavei2p" for the second awk statement
# If the version is x.y, it'll be set to x.y.0. Otherwise the version string will be unchanged
CORE=$(awk -F'"' '/static\s+String\s+VERSION/{print $2}' $I2PSRC/core/java/src/net/i2p/CoreVersion.java | \
awk -F. '{ if (NF > 3) { print; exit } else if ($3 == "") { $3=0; print $1"."$2"."$3 } else print }')
VERSION="${CORE}_${I2PBUILD}"
[ -d $PKG ] && rm -rf $PKG
mkdir -p $PKG/$INSTALL_DIR $PKG/install
cd "$I2PSRC"
ant distclean
#ant dist
ant tarball
ant jbigi-linux-x86-only preppkg-unix
tar xjvf i2p.tar.bz2 -C $TMP
chown -R root:root $I2PSRC/pkg-temp
cp -a $I2PSRC/pkg-temp $PKG/$INSTALL_DIR/i2p
cd $TMP/i2p
chown -R root:root .
mkdir -p $PKG/$INSTALL_DIR/
cp -a ../i2p $PKG/$INSTALL_DIR/
mkdir -p $PKG/install
#############################################################################
# Preconfigureation to make package smaller, and...
# we keep as much as reasonable in the installation directory.
# This makes the install map fairly well to the standard installation.
# It also makes it easier to find the log and pid files!
#############################################################################
# $INSTALL_DIR is used by this SlackBuild.
# [%$]INSTALL_PATH , [%$]SYSTEM_java_io_tmpdir, and [%$]USER_HOME have the correct paths set
# by the IzPack installer.
cd $PKG/$INSTALL_DIR/i2p
for file in wrapper.config eepget i2prouter runplain.sh; do
sed -i "s|[%$]INSTALL_PATH|/$INSTALL_DIR/i2p|g;s|[$%]SYSTEM_java_io_tmpdir|$TMP|g;s/[%$]USER_HOME/\$HOME/g" $file
done
mv wrapper.config wrapper.config.new
# wrapper.config $INSTALL_PATH and $SYSTEM_java_io_tmpdir
sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" wrapper.config > a
sed "s|\$SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > wrapper.config
# eepget %INSTALL_PATH
sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" eepget > a
rm eepget
mv a eepget
# runplain.sh %INSTALL_PATH and %SYSTEM_java_io_tmpdir
sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" runplain.sh > a
sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > runplain.sh
# i2prouter %INSTALL_PATH and %SYSTEM_java_io_tmpdir
sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" i2prouter > a
rm i2prouter
mv a i2prouter
sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" i2prouter > a
sed "s|#ALLOW_ROOT=true|ALLOW_ROOT=true|g" a > i2prouter
install -d $PKG/usr/bin
install -d $PKG/usr/doc/$NAME-$VERSION
install -d $PKG/etc/rc.d
mv licenses LICENSE.txt -t $PKG/usr/doc/$NAME-$VERSION
chmod 744 ./i2prouter
chmod 744 ./osid
chmod 744 ./runplain.sh
chmod 744 ./eepget
chmod 744 ./scripts/i2pbench.sh
chmod 744 ./scripts/i2ptest.sh
rm -Rf ./lib/*.dll ./*.bat ./*.exe ./installer ./icons ./a postinstall.sh
# runplain.sh will live in the installation directory. eepget and i2prouter will go to /usr/bin
# with symlinks in INST_DIR (created in doinst.sh)
install -m755 i2prouter $PKG/usr/bin
install -m755 eepget $PKG/usr/bin
chmod 755 ./runplain.sh
mv $PKG/$INSTALL_DIR/i2p/*.config $PKG/install
mv $PKG/$INSTALL_DIR/i2p/blocklist.txt $PKG/$INSTALL_DIR/i2p/blocklist.txt.new
find $PKG/$INSTALL_DIR/i2p -name "*.xml" -exec mv {} {}.new \;
mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html.new
mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico.new
sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
if [ $INSTALL_DIR != 'opt' ]; then
sed "s|\(The I2P package\)\s\+will be\s\+\(installed to\).+|\1 has been \2 $INSTALL_DIR/i2p|g" $CWD/README > $PKG/usr/doc/$NAME-$VERSION/README
else
sed "s|will be installed|has been installed|" $CWD/README > $PKG/usr/doc/$NAME-$VERSION/README
fi
install -d $PKG/usr/man/man1
gzip -9 man/*.1
install -m644 man/*.1.gz $PKG/usr/man/man1
rm -rf ./man
# We install all x86 wrapper binaries.
# The i2prouter script will try to determine the OS (linux), the bits (32 VS 64) and should be able
# to figure out the correct wrapper binary to use.
# However: In case the i2prouter script's detection fails, "$INST_DIR/i2psvc" will point to
# what 'we' think the correct binary is.
#
# A good reason for installing all binaries: in case the user, for whatever reason, switches from an
# x64 JRE to an x86 JRE, I2P should continue to work without needing to be reinstalled.
install -m755 $I2PSRC/installer/lib/wrapper/linux/i2psvc ./i2psvc-linux-x86-32
install -m644 $I2PSRC/installer/lib/wrapper/linux/libwrapper.so ./lib/libwrapper-linux-x86-32.so
install -m755 $I2PSRC/installer/lib/wrapper/linux64/i2psvc ./i2psvc-linux-x86-64
install -m644 $I2PSRC/installer/lib/wrapper/linux64/libwrapper.so ./lib/libwrapper-linux-x86-64.so
install -m644 $I2PSRC/installer/lib/wrapper/all/wrapper.jar ./lib/wrapper.jar
install -m644 $I2PSRC/build/jbigi.jar $PKG/$INSTALL_DIR/i2p/lib/jbigi.jar
rm -f ./postinstall.sh ./osid ./INSTALL-*.txt
sed "s|directory|/$INSTALL_DIR/i2p|" $CWD/doinst.sh > $PKG/install/doinst.sh
sed -i "s|%pkg|$NAME-$VERSION|" $PKG/install/doinst.sh
sed "s|%INST_DIR|/$INSTALL_DIR/i2p|" $CWD/rc.i2p> $PKG/etc/rc.d/rc.i2p.new
cp $CWD/slack-desc $PKG/install/slack-desc
cd $PKG
#
# requiredbuilder messes up REALLY bad, and thinks java is perl?!
# It also did not catch the shell requirements! BOOOOOOOOOOO! HISSSSSSSS!
#
# requiredbuilder -v -y -s $CWD $PKG
#
cat $CWD/slack-required > $PKG/install/slack-required
cp $CWD/slack-required $PKG/install/slack-required
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT

185
Slackware/i2p/rc.i2p Normal file
View File

@ -0,0 +1,185 @@
#!/bin/sh
# Abort on errors
set -e
##
# This *must* be configured. Set this to the user that will run I2P.
# Note: If you don't want I2P to start automatically at boot,
# use "i2prouter start" as a non-root user to start I2P.
#RUN_AS_USER=
##
##
# Set the locale as desired.
# Note: this is not the same as the language shown in the I2P router console.
# This affects the locale used in wrapper.log. For best results, use a
# unicode enabled locale. This is especially important for foreign language torrents.
#
# If not set the user's configured locale will be used.
#RCLOCALE=
##
#####################################################
# Nothing below this point should need to be edited #
#####################################################
# %INST_DIR is set by i2p.SlackBuild
INSTALL_DIR="%INST_DIR"
# Make sure the package is installed and that the wrapper can be found
[ -d $INSTALL_DIR ] && [ -x $INSTALL_DIR/i2psvc ] || (echo "The I2P package is not installed" >&2 ; exit 1)
if [ -z $RUN_AS_USER ]; then
echo "ERROR: RUN_AS_USER not configured in $0" >&2
exit 1
fi
if [ $(id -ur) -ne 0 ]; then
echo 'ERROR: You must be root to start this service.' >&2
echo
exit 1
fi
if [ -z $RCLOCALE ]; then
if [ ! $(locale -a |grep -q "en_US\.utf8") ]; then
RCLOCALE="en_US.utf8"
fi
fi
# Abort this script if any referenced variables haven't been set
set -u
if $(uname -m |grep -q '64'); then
BITS='64'
else
BITS=''
fi
PATH="$PATH:/usr/lib$BITS/java/bin:/usr/lib$BITS/java/jre/bin"
RUN=/var/run/i2p
PIDFILE="$RUN/i2p.pid"
WRAPPER_CONF="$INSTALL_DIR/wrapper.config"
WRAPPERLOG=/var/log/i2p/wrapper.log
I2PTEMP="/tmp/i2p-daemon"
DESC="The I2P daemon"
JAVABINARY=$(awk -F'=' '/^ *wrapper\.java\.command/{print $2}' "$WRAPPER_CONF")
if [ ! $(which $JAVABINARY 2>/dev/null) ]; then
for rc in /etc/profile.d/*jdk*.sh /etc/profile.d/*java*.sh; do
[ -r $rc ] && . $rc
done
if [ ! $(which $JAVABINARY 2>/dev/null) ]; then
echo "ERROR: Cannot find java. Please set the path to java in $WRAPPER_CONF" >&2
exit 1
fi
fi
JAVA=$(which $JAVABINARY 2>/dev/null)
I2P_ARGS="$WRAPPER_CONF \
wrapper.java.additional.1=-DloggerFilenameOverride=/var/log/i2p/log-router-@.txt \
wrapper.java.additional.10=-Dwrapper.logfile=$WRAPPERLOG \
wrapper.java.additional.11=-Di2p.dir.pid=$RUN \
wrapper.java.additional.12=-Di2p.dir.temp=$I2PTEMP \
wrapper.java.command=$JAVA \
wrapper.logfile=$WRAPPERLOG \
wrapper.pidfile=$PIDFILE \
wrapper.daemonize=TRUE"
LC_ALL=$RCLOCALE
LANG=$RCLOCALE
export LC_ALL LANG
is_running() {
if [ -r $PIDFILE ]; then
PID="$(cat ${PIDFILE})" 2>/dev/null 2>&1
if ! kill -0 $PID >/dev/null 2>&1; then
rm "$PIDFILE"
return 1
else
return 0
fi
else
return 1
fi
}
start() {
if is_running; then
echo "ERROR: $DESC is already running." >&2
fi
for DIR in $RUN $I2PTEMP; do
test -d $DIR && rm -rf $DIR
mkdir -p $DIR
chown -R $RUN_AS_USER $DIR
done
[ -d /var/log/i2p ] || mkdir /var/log/i2p
chown -R $RUN_AS_USER /var/log/i2p
echo -n "Starting $DESC..."
TZ=UTC su $RUN_AS_USER -c "$INSTALL_DIR/i2psvc $I2P_ARGS"
is_running
echo "[pid: $PID]"
}
stop(){
if is_running; then
echo -n "Stopping $DESC [pid: $PID] (this could take a while)."
kill "$PID" >/dev/null 2>&1
while kill -0 "$PID" > /dev/null 2>&1; do
echo -n .
sleep 1
done
rm -rf "$RUN" "$I2PTEMP"
echo done.
return 0
else
echo "$DESC is not running." >&2
return 1
fi
}
# Unset +u to allow the 'usage' text to be displayed
set +u
case "$1" in
start)
start
;;
status)
if is_running; then
echo "$DESC is running [pid: $PID]" >&2
else
echo "$DESC is not running." >&2
fi
;;
stop)
stop
;;
graceful)
if is_running; then
kill -HUP $PID
echo "Graceful shutdown of $DESC initiated." >&2
echo "This may take up to 11 minutes." >&2
fi
;;
dump)
if is_running; then
kill -3 $PID
echo "Threads dumped to $WRAPPERLOG" >&2
else
echo "$DESC is not running." >&2
fi
;;
restart)
if is_running; then
stop
start
else
echo "$DESC is not running." >&2
fi
;;
*)
echo "usage: $0 start|stop|status|restart|graceful|dump"
;;
esac

View File

@ -1,47 +0,0 @@
Building:
The i2p package will be installed in /opt/i2p
If you want to change installation dir, change the variable INSTALL_DIR
on i2p.SlackBuild and rebuild the package. You will also need to do the same
in the base-i2p package.
Installation and Upgrade:
Probably you will never have to update i2p packages. However if you do,
be sure to installpkg first, then removepkg or custom config files can
be lost with upgradepkg. I2P has an auto-update function. However using
installpkg then removepkg lowers the demand on the I2P network as a
whole, and is by far faster.
After installpkg command, doinst.sh will execute a postinstallation script
needed by I2P. Be sure to also install the base-i2p package.
Optional:
chmod +x /etc/rc.d/rc.i2p only if you want it to start on boot and stop on
shutdown.
How to start I2P:
Start I2P service with-
sh /etc/rc.d/rc.i2p start
Now tell your browser to user this proxy: localhost on port 4444 and open
this page: http://localhost:7657/index.jsp
Here you can configure I2P, watch network status and navigate anonimously.
It's suggested to subscribe to various addressbook hosts so that you can
get to the many available eepsites and other service on I2P. These are not
set up by default for security reasons.
Please see the faqs on http://www.i2p2.i2p/ or http://www.i2p2.de/ on how
to subscribe to the various addressbook services.
To stop I2P:
/etc/rc.d/rc.i2p stop
For any additional information:
Within I2P- http://www.i2p2.i2p/, http://forum.i2p/, http://zzz.i2p
Internet (not reccomended!) - http://www.i2p2.de/, http://forum.i2p2.de/

View File

@ -6,7 +6,7 @@
# leave one space after the ':'.
|-----handy-ruler----------------------------------------------------------|
i2p: i2p (an anonymizing network)
i2p: I2P (an anonymizing network)
i2p:
i2p: I2P is an anonymizing network, offering a simple layer that
i2p: identity-sensitive applications can use to securely communicate. All
@ -14,6 +14,6 @@ i2p: data is wrapped with several layers of encryption, and the network is
i2p: both distributed and dynamic, with no trusted parties.
i2p: Many applications are available that interface with I2P, including
i2p: mail, peer-peer file sharing, IRC chat, and others.
i2p: WARNING: To upgrade installpkg FIRST _THEN_ removepkg.
i2p: For more information, see: http://www.i2p2.de/
i2p:
i2p: For more information, see: https://geti2p.net/
i2p:

View File

@ -1,4 +1 @@
jre >= 5
i2p-base >= 0.0.1
bash >= 3.1.017
jre >= 6

View File

@ -119,15 +119,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 +144,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 +191,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();
@ -221,15 +223,17 @@ public class BOB implements Runnable, ClientApp {
if (!cfg.isAbsolute()) {
cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
}
FileInputStream fi = null;
try {
FileInputStream fi = new FileInputStream(cfg);
fi = new FileInputStream(cfg);
props.load(fi);
fi.close();
} catch (FileNotFoundException fnfe) {
_log.warn("Unable to load up the BOB config file " + cfg.getAbsolutePath() + ", Using defaults.", fnfe);
save = true;
} catch (IOException ioe) {
_log.warn("IOException on BOB config file " + cfg.getAbsolutePath() + ", using defaults.", ioe);
} finally {
if (fi != null) try { fi.close(); } catch (IOException ioe) {}
}
}
// Global router and client API configurations that are missing are set to defaults here.
@ -276,13 +280,15 @@ public class BOB implements Runnable, ClientApp {
if (!cfg.isAbsolute()) {
cfg = new File(I2PAppContext.getGlobalContext().getConfigDir(), configLocation);
}
FileOutputStream fo = null;
try {
_log.warn("Writing new defaults file " + cfg.getAbsolutePath());
FileOutputStream fo = new FileOutputStream(cfg);
fo = new FileOutputStream(cfg);
props.store(fo, cfg.getAbsolutePath());
fo.close();
} catch (IOException ioe) {
_log.error("IOException on BOB config file " + cfg.getAbsolutePath(), ioe);
} finally {
if (fo != null) try { fo.close(); } catch (IOException ioe) {}
}
}
}

View File

@ -106,8 +106,10 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
// _log.debug("Message available: id = " + msgId + " size = " + size);
try {
byte msg[] = session.receiveMessage(msgId);
out.write(msg);
out.flush();
if (msg != null) {
out.write(msg);
out.flush();
}
} catch (I2PSessionException ise) {
up = false;
} catch (IOException ioe) {

View File

@ -7,6 +7,7 @@
<property name="jar" value="addressbook.jar"/>
<property name="war" value="addressbook.war"/>
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.6" />
<target name="init">
<mkdir dir="${build}"/>
@ -24,6 +25,18 @@
<typefound name="depend" />
</condition>
<target name="depend" if="depend.available">
<depend
cache="../../build"
srcdir="${src}"
destdir="${build}" >
<!-- Depend on classes instead of jars where available -->
<classpath>
<pathelement location="../../core/java/build/obj" />
</classpath>
</depend>
</target>
<target name="dependServlet" if="depend.available">
<depend
cache="../../build"
srcdir="${src}"
@ -37,9 +50,22 @@
</target>
<target name="compile" depends="init, depend">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
includeAntRuntime="false"
srcdir="${src}" destdir="${build}">
srcdir="${src}" destdir="${build}"
excludes="net/i2p/addressbook/Servlet.java">
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../core/java/build/i2p.jar" />
</classpath>
</javac>
</target>
<target name="compileServlet" depends="init, dependServlet, compile">
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
includeAntRuntime="false"
srcdir="${src}" destdir="${build}"
includes="net/i2p/addressbook/Servlet.java">
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../core/java/build/i2p.jar" />
@ -48,11 +74,11 @@
</javac>
</target>
<!-- unused for now, as we oddly ship addressbook as a .war -->
<!-- unused for now (except for Android), as we oddly ship addressbook as a .war -->
<target name="jar" depends="compile, changes">
<jar basedir="${build}" destfile="${dist}/${jar}">
<!-- set if unset -->
<property name="workspace.changes" value="" />
<jar basedir="${build}" destfile="${dist}/${jar}">
<manifest>
<attribute name="Main-Class" value="addressbook.Daemon"/>
<attribute name="Implementation-Version" value="${full.version}" />
@ -64,7 +90,7 @@
</jar>
</target>
<target name="war" depends="compile, changes, warUpToDate" unless="war.uptodate">
<target name="war" depends="compileServlet, changes, warUpToDate" unless="war.uptodate">
<mkdir dir="${dist}/tmp"/>
<mkdir dir="${dist}/tmp/WEB-INF"/>
<mkdir dir="${dist}/tmp/WEB-INF/classes"/>

View File

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

View File

@ -50,6 +50,9 @@ public class Daemon {
private static final Daemon _instance = new Daemon();
private volatile boolean _running;
private static final boolean DEBUG = false;
private static final String DEFAULT_SUB = "http://i2p-projekt.i2p/hosts.txt";
/** @since 0.9.12 */
static final String OLD_DEFAULT_SUB = "http://www.i2p2.i2p/hosts.txt";
/**
* Update the router and published address books using remote data from the
@ -253,7 +256,7 @@ public class Daemon {
List<String> defaultSubs = new LinkedList<String>();
// defaultSubs.add("http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/hosts.txt");
defaultSubs.add("http://www.i2p2.i2p/hosts.txt");
defaultSubs.add(DEFAULT_SUB);
SubscriptionList subscriptions = new SubscriptionList(subscriptionFile,
etagsFile, lastModifiedFile, lastFetchedFile, delay, defaultSubs, settings

View File

@ -41,7 +41,9 @@ import javax.servlet.http.HttpServletResponse;
*
*/
public class Servlet extends HttpServlet {
private DaemonThread thread;
private static final long serialVersionUID = 1L;
private transient DaemonThread thread;
//private String nonce;
//private static final String PROP_NONCE = "addressbook.nonce";

View File

@ -4,6 +4,15 @@
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<filter>
<filter-name>XSSFilter</filter-name>
<filter-class>net.i2p.servlet.filters.XSSFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>XSSFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>addressbook</servlet-name>
<servlet-class>net.i2p.addressbook.Servlet</servlet-class>

View File

@ -3,7 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" kind="src" path="/i2p_router"/>
<classpathentry combineaccessrules="false" kind="src" path="/i2p_sdk"/>
<classpathentry kind="lib" path="/lib/wrapper/all/wrapper.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/installer"/>
<classpathentry kind="output" path="build"/>
</classpath>

View File

@ -7,12 +7,13 @@
<property name="jar" value="desktopgui.jar"/>
<property name="resources" value="resources"/>
<property name="javadoc" value="javadoc"/>
<property name="javac.compilerargs" value=""/>
<property name="javac.version" value="1.6" />
<property name="require.gettext" value="true" />
<condition property="no.bundle">
<isfalse value="${require.gettext}" />
</condition>
<property name="javac.compilerargs" value=""/>
<property name="require.gettext" value="true" />
<target name="init">
<mkdir dir="${build}"/>
@ -27,7 +28,7 @@
</target>
<target name="compile" depends="init">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
includeAntRuntime="false"
srcdir="${src}" destdir="${build}">
<compilerarg line="${javac.compilerargs}" />

View File

@ -4,14 +4,15 @@
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# testsubject67 <deborinha97@hotmail.com>, 2014
# blueboy, 2013
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
"PO-Revision-Date: 2013-11-23 16:31+0000\n"
"Last-Translator: blueboy\n"
"POT-Creation-Date: 2014-01-09 19:27+0000\n"
"PO-Revision-Date: 2014-07-05 17:40+0000\n"
"Last-Translator: testsubject67 <deborinha97@hotmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/I2P/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -33,11 +34,11 @@ msgstr "Conectando"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr ""
msgstr "Lançar o navegador I2P "
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
msgstr ""
msgstr "Configurar desktopgui"
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
msgid "Restart I2P"
@ -47,10 +48,10 @@ msgstr "Reinicializar o roteador I2P"
msgid "Stop I2P"
msgstr "Interromper o roteador I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr ""
msgstr "Configuração de ícone de bandeja"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr ""
msgstr "Ativar ícone de bandeja?"

View File

@ -0,0 +1,57 @@
# I2P
# Copyright (C) 2009 The I2P Project
# This file is distributed under the same license as the desktopgui package.
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# Krantišek <jaksrn@gmail.com>, 2014
# Svistwarrior273 <romanbeno273@gmail.com>, 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-04-20 09:56+0000\n"
"Last-Translator: Svistwarrior273 <romanbeno273@gmail.com>\n"
"Language-Team: Slovak (http://www.transifex.com/projects/p/I2P/language/sk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sk\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
msgstr "Spustiť I2P"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "I2P is starting!"
msgstr "I2P sa spúšťa!"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
msgid "Starting"
msgstr "Spúšťa sa"
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
msgid "Launch I2P Browser"
msgstr "Spustiť I2P prehliadač"
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
msgid "Configure desktopgui"
msgstr "Nakonfigurovať desktopgui"
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
msgid "Restart I2P"
msgstr "Reštartovať I2P"
#: src/net/i2p/desktopgui/InternalTrayManager.java:85
msgid "Stop I2P"
msgstr "Zastaviť I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Konfigurácia ikony v lište"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr "Mala by byť ikona v lište povolená?"

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
#
# <gribua@gmail.com>, 2011.
# Translators:
# Denis Blank <gribua@gmail.com>, 2011
# LinuxChata, 2014
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-06-19 14:01+0000\n"
"Last-Translator: Pharmasolin <gribua@gmail.com>\n"
"Language-Team: Ukrainian (Ukraine) (http://www.transifex.net/projects/p/I2P/team/uk_UA/)\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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk_UA\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
msgid "Start I2P"
@ -46,12 +48,10 @@ msgstr "Перезапустити I2P"
msgid "Stop I2P"
msgstr "Зупинити I2P"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:43
msgid "Tray icon configuration"
msgstr "Настройка трей-іконки"
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:46
msgid "Should tray icon be enabled?"
msgstr "Чм повинна трей-іконка бути включена?"
msgstr "Чи повинна трей-іконка бути включена?"

View File

@ -78,7 +78,7 @@ public class ConfigurationManager {
* @return The value of a configuration: true if found, defaultValue if not found.
*/
public boolean getBooleanConfiguration(String arg, boolean defaultValue) {
Boolean value = ((Boolean) booleanConfigurations.get("startWithI2P"));
Boolean value = booleanConfigurations.get("startWithI2P");
System.out.println(value);
if(value != null) {
return value;

View File

@ -17,29 +17,28 @@
<classpath>
<pathelement location="../../../core/java/build/obj" />
<pathelement location="../../ministreaming/java/build/obj" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../jetty/jettylib/jetty-servlet.jar" />
<pathelement location="../../jetty/jettylib/jetty-util.jar" />
</classpath>
</depend>
</target>
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.6" />
<property name="require.gettext" value="true" />
<condition property="no.bundle">
<isfalse value="${require.gettext}" />
</condition>
<property name="javac.compilerargs" value="" />
<property name="require.gettext" value="true" />
<target name="compile" depends="depend">
<mkdir dir="./build" />
<mkdir dir="./build/obj" />
<javac
srcdir="./src"
debug="true" deprecation="on" source="1.5" target="1.5"
debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
destdir="./build/obj"
includeAntRuntime="false"
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../jetty/jettylib/jetty-servlet.jar:../../jetty/jettylib/jetty-util.jar:../../ministreaming/java/build/mstreaming.jar" >
classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>
@ -101,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}" />
@ -122,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

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

@ -31,7 +31,7 @@ abstract class ExtensionHandler {
public static final int ID_DHT = 3;
/** not using the option bit since the compact format is different */
public static final String TYPE_DHT = "i2p_dht";
/** Pieces * SHA1 Hash length, + 25% extra for file names, benconding overhead, etc */
/** Pieces * SHA1 Hash length, + 25% extra for file names, bencoding overhead, etc */
private static final int MAX_METADATA_SIZE = Storage.MAX_PIECES * 20 * 5 / 4;
private static final int PARALLEL_REQUESTS = 3;

View File

@ -3,12 +3,15 @@ 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.I2PSession;
@ -71,7 +74,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";
@ -99,8 +101,7 @@ public class I2PSnarkUtil {
_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.
@ -565,12 +566,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 +581,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
*/

View File

@ -66,7 +66,8 @@ 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;
}

View File

@ -187,7 +187,7 @@ class MagnetState {
* @return true if this was the last piece
* @throws NPE, IllegalArgumentException, IOException, ...
*/
public MetaInfo buildMetaInfo() throws Exception {
private MetaInfo buildMetaInfo() throws Exception {
// top map has nothing in it but the info map (no announce)
Map<String, BEValue> map = new HashMap<String, BEValue>();
InputStream is = new ByteArrayInputStream(metainfoBytes);

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

@ -220,7 +220,9 @@ public class MetaInfo
Object o = val.getValue();
// Is it supposed to be a number or a string?
// i2psnark does it as a string. BEP 27 doesn't say.
// Transmission does numbers.
// Transmission does numbers. So does libtorrent.
// We handle both as of 0.9.9.
// We switch to storing as number as of 0.9.14.
privateTorrent = "1".equals(o) ||
((o instanceof Number) && ((Number) o).intValue() == 1);
} else {
@ -515,9 +517,10 @@ public class MetaInfo
sha1.update(bs, off, length);
byte[] hash = sha1.digest();
for (int i = 0; i < 20; i++)
for (int i = 0; i < 20; i++) {
if (hash[i] != piece_hashes[20 * piece + i])
return false;
}
return true;
}
@ -537,9 +540,10 @@ public class MetaInfo
_log.warn("Error checking", ioe);
return false;
}
for (int i = 0; i < 20; i++)
for (int i = 0; i < 20; i++) {
if (hash[i] != piece_hashes[20 * piece + i])
return false;
}
return true;
}
@ -621,7 +625,9 @@ public class MetaInfo
info.put("name.utf-8", new BEValue(DataHelper.getUTF8(name_utf8)));
// BEP 27
if (privateTorrent)
info.put("private", new BEValue(DataHelper.getUTF8("1")));
// switched to number in 0.9.14
//info.put("private", new BEValue(DataHelper.getUTF8("1")));
info.put("private", new BEValue(Integer.valueOf(1)));
info.put("piece length", new BEValue(Integer.valueOf(piece_length)));
info.put("pieces", new BEValue(piece_hashes));

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
@ -194,9 +194,8 @@ public class Peer implements Comparable<Peer>
* Compares the PeerIDs.
* @deprecated unused?
*/
public int compareTo(Peer o)
public int compareTo(Peer p)
{
Peer p = (Peer)o;
int rv = peerID.compareTo(p.peerID);
if (rv == 0) {
if (_id > p._id) return 1;
@ -619,7 +618,7 @@ public class Peer implements Comparable<Peer>
* @since 0.8.4
*/
public void downloaded(int size) {
downloaded += size;
downloaded.addAndGet(size);
}
/**
@ -627,7 +626,7 @@ public class Peer implements Comparable<Peer>
* @since 0.8.4
*/
public void uploaded(int size) {
uploaded += size;
uploaded.addAndGet(size);
}
/**
@ -636,7 +635,7 @@ public class Peer implements Comparable<Peer>
*/
public long getDownloaded()
{
return downloaded;
return downloaded.get();
}
/**
@ -645,7 +644,7 @@ public class Peer implements Comparable<Peer>
*/
public long getUploaded()
{
return uploaded;
return uploaded.get();
}
/**
@ -653,8 +652,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

@ -221,7 +221,8 @@ class PeerCheckerTask implements Runnable
peer.keepAlive();
// announce them to local tracker (TrackerClient does this too)
if (dht != null && (_runCount % 5) == 0) {
dht.announce(coordinator.getInfoHash(), peer.getPeerID().getDestHash());
dht.announce(coordinator.getInfoHash(), peer.getPeerID().getDestHash(),
peer.isCompleted());
}
}
@ -270,7 +271,7 @@ class PeerCheckerTask implements Runnable
// announce ourselves to local tracker (TrackerClient does this too)
if (dht != null && (_runCount % 16) == 0) {
dht.announce(coordinator.getInfoHash());
dht.announce(coordinator.getInfoHash(), coordinator.completed());
}
}
}

View File

@ -135,7 +135,7 @@ class PeerConnectionOut implements Runnable
nm = null;
}
if (m == null && nm != null)
if (nm != null)
{
m = nm;
//SimpleTimer.getInstance().removeEvent(nm.expireEvent);

View File

@ -281,6 +281,14 @@ class PeerCoordinator implements PeerListener
return uploaded;
}
/**
* Sets the initial total of uploaded bytes of all peers (from a saved status)
* @since 0.9.15
*/
public void setUploaded(long up) {
uploaded = up;
}
/**
* Returns the total number of downloaded bytes of all peers.
*/
@ -1202,22 +1210,23 @@ class PeerCoordinator implements PeerListener
boolean skipped = false;
for(Piece piece : wantedPieces) {
if (piece.getId() == savedPiece) {
if (peer.isCompleted() && piece.getPeerCount() > 1) {
if (peer.isCompleted() && piece.getPeerCount() > 1 &&
wantedPieces.size() > 2*END_GAME_THRESHOLD) {
// Try to preserve rarest-first
// by not requesting a partial piece that non-seeders also have
// by not requesting a partial piece that at least two non-seeders also have
// from a seeder
boolean nonSeeds = false;
int nonSeeds = 0;
for (Peer pr : peers) {
PeerState state = pr.state;
if (state == null) continue;
BitField bf = state.bitfield;
if (bf == null) continue;
if (bf.get(savedPiece) && !pr.isCompleted()) {
nonSeeds = true;
break;
if (++nonSeeds > 1)
break;
}
}
if (nonSeeds) {
if (nonSeeds > 1) {
skipped = true;
break;
}

View File

@ -42,7 +42,7 @@ import org.klomp.snark.bencode.InvalidBEncodingException;
* and the PeerID is not required.
* Equality is now determined solely by the dest hash.
*/
class PeerID implements Comparable<PeerID>
public class PeerID implements Comparable<PeerID>
{
private byte[] id;
private Destination address;
@ -52,6 +52,7 @@ class PeerID implements Comparable<PeerID>
private boolean triedDestLookup;
private final int hash;
private final I2PSnarkUtil util;
private String _toStringCache;
public PeerID(byte[] id, Destination address)
{
@ -216,13 +217,15 @@ class PeerID implements Comparable<PeerID>
}
/**
* Returns the String "id@address" where id is the base64 encoded id
* and address is the base64 dest (was the base64 hash of the dest) which
* Returns the String "id@address" where id is the first 4 chars of the base64 encoded id
* and address is the first 6 chars of the base64 dest (was the base64 hash of the dest) which
* should match what the bytemonsoon tracker reports on its web pages.
*/
@Override
@Override
public String toString()
{
if (_toStringCache != null)
return _toStringCache;
if (id == null || address == null)
return "unkn@" + Base64.encode(destHash).substring(0, 6);
int nonZero = 0;
@ -232,7 +235,8 @@ class PeerID implements Comparable<PeerID>
break;
}
}
return Base64.encode(id, nonZero, id.length-nonZero).substring(0,4) + "@" + address.toBase64().substring(0,6);
_toStringCache = Base64.encode(id, nonZero, id.length-nonZero).substring(0,4) + "@" + address.toBase64().substring(0,6);
return _toStringCache;
}
/**

View File

@ -37,8 +37,8 @@ class PeerMonitorTask implements Runnable
private final PeerCoordinator coordinator;
private long lastDownloaded = 0;
private long lastUploaded = 0;
//private long lastDownloaded = 0;
//private long lastUploaded = 0;
PeerMonitorTask(PeerCoordinator coordinator)
{

View File

@ -163,7 +163,7 @@ class PeerState implements DataLoader
_log.debug(peer + " rcv bitfield");
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;

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.
@ -69,8 +69,6 @@ public class Snark
"Commands: 'info', 'list', 'quit'.";
****/
// String indicating main activity
String activity = "Not started";
/****
private static class OOMListener implements I2PThread.OOMEventListener {
@ -223,11 +221,11 @@ 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;
private byte[] id;
private final byte[] id;
private final byte[] infoHash;
private String additionalTrackerURL;
protected final I2PSnarkUtil _util;
@ -236,15 +234,29 @@ public class Snark
private volatile String trackerProblems;
private volatile int trackerSeenPeers;
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,30 @@ public class Snark
if (start)
this.startTorrent();
}
****/
/** multitorrent */
/**
* multitorrent
*/
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
* @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 +321,7 @@ public class Snark
acceptor = connectionAcceptor;
this.torrent = torrent;
this.rootDataDir = rootDir;
this.rootDataDir = new File(rootDir);
stopped = true;
activity = "Network setup";
@ -317,7 +347,6 @@ public class Snark
*/
// Figure out what the torrent argument represents.
meta = null;
File f = null;
InputStream in = null;
byte[] x_infoHash = null;
@ -395,13 +424,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)
@ -429,6 +467,7 @@ public class Snark
trackerclient = new TrackerClient(meta, coordinator);
*/
savedUploaded = (completeListener != null) ? completeListener.getSavedUploaded(this) : 0;
if (start)
startTorrent();
}
@ -453,7 +492,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();
@ -478,18 +518,13 @@ 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;
}
@ -522,6 +557,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);
@ -548,7 +584,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();
@ -585,7 +621,7 @@ public class Snark
pc.halt();
Storage st = storage;
if (st != null) {
boolean changed = storage.isChanged();
boolean changed = storage.isChanged() || getUploaded() != savedUploaded;
try {
storage.close();
} catch (IOException ioe) {
@ -739,7 +775,7 @@ public class Snark
PeerCoordinator coord = coordinator;
if (coord != null)
return coord.getUploaded();
return 0;
return savedUploaded;
}
/**
@ -763,6 +799,7 @@ public class Snark
}
/**
* Not HTML escaped.
* @return String returned from tracker, or null if no error
* @since 0.8.4
*/
@ -835,7 +872,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
@ -848,7 +885,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
*/
@ -919,6 +956,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)
@ -933,6 +971,7 @@ public class Snark
int i = 0;
while (i < args.length)
{
****/
/*
if (args[i].equals("--debug"))
{
@ -954,7 +993,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");
@ -1060,6 +1101,7 @@ public class Snark
System.out.println
(" \tor (with --share) a file to share.");
}
****/
/**
* Aborts program abnormally.
@ -1103,9 +1145,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) {
@ -1152,8 +1200,8 @@ public class Snark
// System.out.println(); // We have all the disk space we need.
}
private boolean allChecked = false;
private boolean checking = false;
private boolean allChecked;
private boolean checking;
//private boolean prechecking = true;
public void storageChecked(Storage storage, int num, boolean checked)
@ -1230,6 +1278,7 @@ public class Snark
*/
final static int MIN_TOTAL_UPLOADERS = 4;
final static int MAX_TOTAL_UPLOADERS = 10;
public boolean overUploadLimit(int uploaders) {
if (_peerCoordinatorSet == null || uploaders <= 0)
return false;

View File

@ -7,6 +7,7 @@ import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -14,6 +15,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -24,6 +26,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import net.i2p.I2PAppContext;
import net.i2p.app.ClientAppManager;
import net.i2p.crypto.SigType;
import net.i2p.data.Base64;
import net.i2p.data.DataHelper;
import net.i2p.update.*;
@ -38,6 +42,7 @@ import net.i2p.util.SimpleTimer;
import net.i2p.util.SimpleTimer2;
import org.klomp.snark.dht.DHT;
import org.klomp.snark.dht.KRPC;
/**
* Manage multiple snarks
@ -53,7 +58,10 @@ public class SnarkManager implements CompleteListener {
/** used to prevent DirMonitor from deleting torrents that don't have a torrent file yet */
private final Set<String> _magnets;
private final Object _addSnarkLock;
private /* FIXME final FIXME */ File _configFile;
private File _configFile;
private File _configDir;
/** one lock for all config, files for simplicity */
private final Object _configLock = new Object();
private Properties _config;
private final I2PAppContext _context;
private final String _contextPath;
@ -79,14 +87,22 @@ public class SnarkManager implements CompleteListener {
public static final String PROP_UPLOADERS_TOTAL = "i2psnark.uploaders.total";
public static final String PROP_UPBW_MAX = "i2psnark.upbw.max";
public static final String PROP_DIR = "i2psnark.dir";
public static final String PROP_META_PREFIX = "i2psnark.zmeta.";
public static final String PROP_META_BITFIELD_SUFFIX = ".bitfield";
public static final String PROP_META_PRIORITY_SUFFIX = ".priority";
public static final String PROP_META_MAGNET_PREFIX = "i2psnark.magnet.";
private static final String PROP_META_PREFIX = "i2psnark.zmeta.";
private static final String PROP_META_STAMP = "stamp";
private static final String PROP_META_BASE = "base";
private static final String PROP_META_BITFIELD = "bitfield";
private static final String PROP_META_PRIORITY = "priority";
private static final String PROP_META_PRESERVE_NAMES = "preserveFileNames";
private static final String PROP_META_UPLOADED = "uploaded";
//private static final String PROP_META_BITFIELD_SUFFIX = ".bitfield";
//private static final String PROP_META_PRIORITY_SUFFIX = ".priority";
private static final String PROP_META_MAGNET_PREFIX = "i2psnark.magnet.";
private static final String CONFIG_FILE_SUFFIX = ".config";
private static final String CONFIG_FILE = "i2psnark" + CONFIG_FILE_SUFFIX;
public static final String PROP_FILES_PUBLIC = "i2psnark.filesPublic";
public static final String PROP_AUTO_START = "i2snark.autoStart"; // oops
public static final String PROP_OLD_AUTO_START = "i2snark.autoStart"; // oops
public static final String PROP_AUTO_START = "i2psnark.autoStart"; // convert in migration to new config file
public static final String DEFAULT_AUTO_START = "false";
//public static final String PROP_LINK_PREFIX = "i2psnark.linkPrefix";
//public static final String DEFAULT_LINK_PREFIX = "file:///";
@ -107,10 +123,16 @@ public class SnarkManager implements CompleteListener {
public static final int DEFAULT_STARTUP_DELAY = 3;
public static final int DEFAULT_REFRESH_DELAY_SECS = 60;
private static final int DEFAULT_PAGE_SIZE = 50;
public static final String CONFIG_DIR_SUFFIX = ".d";
private static final String SUBDIR_PREFIX = "s";
private static final String B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~";
/**
* "name", "announceURL=websiteURL" pairs
* '=' in announceURL must be escaped as &#44;
*
* Please use host name, not b32 or full dest, in announce URL. Ensure in default hosts.txt.
* Please use host name, not b32 or full dest, in website URL. Ensure in default hosts.txt.
*/
private static final String DEFAULT_TRACKERS[] = {
// "Postman", "http://YRgrgTLGnbTq2aZOZDJQ~o6Uk5k6TK-OZtx0St9pb0G-5EGYURZioxqYG8AQt~LgyyI~NCj6aYWpPO-150RcEvsfgXLR~CxkkZcVpgt6pns8SRc3Bi-QSAkXpJtloapRGcQfzTtwllokbdC-aMGpeDOjYLd8b5V9Im8wdCHYy7LRFxhEtGb~RL55DA8aYOgEXcTpr6RPPywbV~Qf3q5UK55el6Kex-6VCxreUnPEe4hmTAbqZNR7Fm0hpCiHKGoToRcygafpFqDw5frLXToYiqs9d4liyVB-BcOb0ihORbo0nS3CLmAwZGvdAP8BZ7cIYE3Z9IU9D1G8JCMxWarfKX1pix~6pIA-sp1gKlL1HhYhPMxwyxvuSqx34o3BqU7vdTYwWiLpGM~zU1~j9rHL7x60pVuYaXcFQDR4-QVy26b6Pt6BlAZoFmHhPcAuWfu-SFhjyZYsqzmEmHeYdAwa~HojSbofg0TMUgESRXMw6YThK1KXWeeJVeztGTz25sL8AAAA.i2p/announce.php=http://tracker.postman.i2p/"
@ -123,17 +145,40 @@ public class SnarkManager implements CompleteListener {
// , "mastertracker", "http://VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT8JD7i-C2xzYFa4jT5U2aqHzHI-Jre4HL3Ri5hFtZrLk2ax3ji7Qfb6qPnuYkuiF2E2UDmKUOppI8d9Ye7tjdhQVCy0izn55tBaB-U7UWdcvSK2i85sauyw3G0Gfads1Rvy5-CAe2paqyYATcDmGjpUNLoxbfv9KH1KmwRTNH6k1v4PyWYYnhbT39WfKMbBjSxVQRdi19cyJrULSWhjxaQfJHeWx5Z8Ev4bSPByBeQBFl2~4vqy0S5RypINsRSa3MZdbiAAyn5tr5slWR6QdoqY3qBQgBJFZppy-3iWkFqqKgSxCPundF8gdDLC5ddizl~KYcYKl42y9SGFHIukH-TZs8~em0~iahzsqWVRks3zRG~tlBcX2U3M2~OJs~C33-NKhyfZT7-XFBREvb8Szmd~p66jDxrwOnKaku-G6DyoQipJqIz4VHmY9-y5T8RrUcJcM-5lVoMpAAAA.i2p/announce.php=http://tracker.mastertracker.i2p/"
// , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
"Postman", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
// ,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
,"Diftracker", "http://diftracker.i2p/announce.php=http://diftracker.i2p/"
// , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
// ,"Exotrack", "http://blbgywsjubw3d2zih2giokakhe3o2cko7jtte4risb3hohbcoyva.b32.i2p/announce.php=http://exotrack.i2p/"
,"DgTrack", "http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a=http://opentracker.dg2.i2p/"
// The following is ECDSA_SHA256_P256
,"TheBland", "http://s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p/a=http://tracker.thebland.i2p/stats?mode=peer"
};
/** URL. This is our equivalent to router.utorrent.com for bootstrap */
public static final String DEFAULT_BACKUP_TRACKER = "http://opentracker.dg2.i2p/a";
/** URLs, comma-separated. Used for "announce to open trackers also" */
private static final String DEFAULT_OPENTRACKERS = DEFAULT_BACKUP_TRACKER +
(SigType.ECDSA_SHA256_P256.isAvailable() ? ",http://tracker.thebland.i2p/a" : "");
public static final Set<String> DEFAULT_TRACKER_ANNOUNCES;
/** host names for config form */
public static final Set<String> KNOWN_OPENTRACKERS = new HashSet(Arrays.asList(new String[] {
"tracker.welterde.i2p", "cfmqlafjfmgkzbt4r3jsfyhgsr5abgxryl6fnz3d3y5a365di5aa.b32.i2p",
"opentracker.dg2.i2p", "w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p",
"tracker.thebland.i2p", "s5ikrdyjwbcgxmqetxb3nyheizftms7euacuub2hic7defkh3xhq.b32.i2p",
"psi.i2p", "avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p",
"opentracker.psi.i2p", "vmow3h54yljn7zvzbqepdddt5fmygijujycod2q6yznpy2rrzuwa.b32.i2p",
"tracker.killyourtv.i2p", "5mpvzxfbd4rtped3c7ln4ddw52e7i7t56s36ztky4ustxtxrjdpa.b32.i2p",
"opendiftracker.i2p", "bikpeyxci4zuyy36eau5ycw665dplun4yxamn7vmsastejdqtfoq.b32.i2p"
}));
static {
Set<String> ann = new HashSet();
for (int i = 1; i < DEFAULT_TRACKERS.length; i += 2) {
if (DEFAULT_TRACKERS[i-1].equals("TheBland") && !SigType.ECDSA_SHA256_P256.isAvailable())
continue;
String urls[] = DEFAULT_TRACKERS[i].split("=", 2);
ann.add(urls[0]);
}
@ -167,9 +212,11 @@ public class SnarkManager implements CompleteListener {
_messages = new LinkedBlockingQueue<String>();
_util = new I2PSnarkUtil(_context, ctxName);
String cfile = ctxName + CONFIG_FILE_SUFFIX;
_configFile = new File(cfile);
if (!_configFile.isAbsolute())
_configFile = new File(_context.getConfigDir(), cfile);
File configFile = new File(cfile);
if (!configFile.isAbsolute())
configFile = new File(_context.getConfigDir(), cfile);
_configDir = migrateConfig(configFile);
_configFile = new File(_configDir, CONFIG_FILE);
_trackerMap = new ConcurrentHashMap<String, Tracker>(4);
loadConfig(null);
}
@ -198,7 +245,9 @@ public class SnarkManager implements CompleteListener {
public void timeReached() {
if (!_running)
return;
_umgr = _context.updateManager();
ClientAppManager cmgr = _context.clientAppManager();
if (cmgr != null)
_umgr = (UpdateManager) cmgr.getRegisteredApp(UpdateManager.APP_NAME);
if (_umgr != null) {
_uhandler = new UpdateHandler(_context, _umgr, SnarkManager.this);
_umgr.register(_uhandler, UpdateType.ROUTER_SIGNED, UpdateMethod.TORRENT, 10);
@ -237,7 +286,20 @@ public class SnarkManager implements CompleteListener {
private static final int MAX_MESSAGES = 100;
/**
* Use if it does not include a link.
* Escapes '<' and '>' before queueing
*/
public void addMessage(String message) {
addMessageNoEscape(message.replace("<", "&lt;").replace(">", "&gt;"));
}
/**
* Use if it includes a link.
* Does not escape '<' and '>' before queueing
* @since 0.9.14.1
*/
public void addMessageNoEscape(String message) {
_messages.offer(message);
while (_messages.size() > MAX_MESSAGES) {
_messages.poll();
@ -324,20 +386,179 @@ public class SnarkManager implements CompleteListener {
return f;
}
/**
* Migrate the old flat config file to the new config dir
* containing the config file minus the per-torrent entries,
* the dht file, and 64 subdirs for per-torrent config files
* Caller must synch.
*
* @return the new config directory, non-null
* @throws RuntimeException on creation fail
* @since 0.9.15
*/
private File migrateConfig(File oldFile) {
File dir = new SecureDirectory(oldFile + CONFIG_DIR_SUFFIX);
if ((!dir.exists()) && (!dir.mkdirs())) {
_log.error("Error creating I2PSnark config dir " + dir);
throw new RuntimeException("Error creating I2PSnark config dir " + dir);
}
// move the DHT file as-is
String oldName = oldFile.toString();
if (oldName.endsWith(CONFIG_FILE_SUFFIX)) {
String oldDHT = oldName.replace(CONFIG_FILE_SUFFIX, KRPC.DHT_FILE_SUFFIX);
File oldDHTFile = new File(oldDHT);
if (oldDHTFile.exists()) {
File newDHTFile = new File(dir, "i2psnark" + KRPC.DHT_FILE_SUFFIX);
FileUtil.rename(oldDHTFile, newDHTFile);
}
}
if (!oldFile.exists())
return dir;
Properties oldProps = new Properties();
try {
DataHelper.loadProps(oldProps, oldFile);
// a good time to fix this ancient typo
String auto = (String) oldProps.remove(PROP_OLD_AUTO_START);
if (auto != null)
oldProps.setProperty(PROP_AUTO_START, auto);
} catch (IOException ioe) {
_log.error("Error loading I2PSnark config " + oldFile, ioe);
return dir;
}
// Gather the props for each torrent, removing them from config
// old b64 of hash as key
Map<String, Properties> configs = new HashMap<String, Properties>(16);
for (Iterator<Map.Entry<Object, Object>> iter = oldProps.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry<Object, Object> e = iter.next();
String k = (String) e.getKey();
if (k.startsWith(PROP_META_PREFIX)) {
iter.remove();
String v = (String) e.getValue();
try {
k = k.substring(PROP_META_PREFIX.length());
String h = k.substring(0, 28); // length of b64 of 160 bit infohash
k = k.substring(29); // skip '.'
Properties tprops = configs.get(h);
if (tprops == null) {
tprops = new OrderedProperties();
configs.put(h, tprops);
}
if (k.equals(PROP_META_BITFIELD)) {
// old config was timestamp,bitfield; split them
int comma = v.indexOf(',');
if (comma > 0 && v.length() > comma + 1) {
tprops.put(PROP_META_STAMP, v.substring(0, comma));
tprops.put(PROP_META_BITFIELD, v.substring(comma + 1));
} else {
// timestamp only??
tprops.put(PROP_META_STAMP, v);
}
} else {
tprops.put(k, v);
}
} catch (IndexOutOfBoundsException ioobe) {
continue;
}
}
}
// Now make a config file for each torrent
for (Map.Entry<String, Properties> e : configs.entrySet()) {
String b64 = e.getKey();
Properties props = e.getValue();
if (props.isEmpty())
continue;
b64 = b64.replace('$', '=');
byte[] ih = Base64.decode(b64);
if (ih == null || ih.length != 20)
continue;
File cfg = configFile(dir, ih);
if (!cfg.exists()) {
File subdir = cfg.getParentFile();
if (!subdir.exists())
subdir.mkdirs();
try {
DataHelper.storeProps(props, cfg);
} catch (IOException ioe) {
_log.error("Error storing I2PSnark config " + cfg, ioe);
}
}
}
// now store in new location, minus the zmeta entries
File newFile = new File(dir, CONFIG_FILE);
Properties newProps = new OrderedProperties();
newProps.putAll(oldProps);
try {
DataHelper.storeProps(newProps, newFile);
} catch (IOException ioe) {
_log.error("Error storing I2PSnark config " + newFile, ioe);
return dir;
}
oldFile.delete();
if (_log.shouldLog(Log.WARN))
_log.warn("Config migrated from " + oldFile + " to " + dir);
return dir;
}
/**
* The config for a torrent
* @return non-null, possibly empty
* @since 0.9.15
*/
private Properties getConfig(Snark snark) {
return getConfig(snark.getInfoHash());
}
/**
* The config for a torrent
* @param ih 20-byte infohash
* @return non-null, possibly empty
* @since 0.9.15
*/
private Properties getConfig(byte[] ih) {
Properties rv = new OrderedProperties();
File conf = configFile(_configDir, ih);
synchronized(_configLock) { // one lock for all
try {
DataHelper.loadProps(rv, conf);
} catch (IOException ioe) {}
}
return rv;
}
/**
* The config file for a torrent
* @param confDir the config directory
* @param ih 20-byte infohash
* @since 0.9.15
*/
private static File configFile(File confDir, byte[] ih) {
String hex = I2PSnarkUtil.toHex(ih);
File subdir = new SecureDirectory(confDir, SUBDIR_PREFIX + B64.charAt((ih[0] >> 2) & 0x3f));
return new File(subdir, hex + CONFIG_FILE_SUFFIX);
}
/** null to set initial defaults */
public void loadConfig(String filename) {
synchronized(_configLock) {
locked_loadConfig(filename);
}
}
/** null to set initial defaults */
private void locked_loadConfig(String filename) {
if (_config == null)
_config = new OrderedProperties();
if (filename != null) {
File cfg = new File(filename);
if (!cfg.isAbsolute())
cfg = new File(_context.getConfigDir(), filename);
_configFile = cfg;
if (cfg.exists()) {
_configDir = migrateConfig(cfg);
_configFile = new File(_configDir, CONFIG_FILE);
if (_configFile.exists()) {
try {
DataHelper.loadProps(_config, cfg);
DataHelper.loadProps(_config, _configFile);
} catch (IOException ioe) {
_log.error("Error loading I2PSnark config '" + filename + "'", ioe);
_log.error("Error loading I2PSnark config " + _configFile, ioe);
}
}
}
@ -347,7 +568,7 @@ public class SnarkManager implements CompleteListener {
if (!_config.containsKey(PROP_I2CP_PORT))
_config.setProperty(PROP_I2CP_PORT, "7654");
if (!_config.containsKey(PROP_I2CP_OPTS))
_config.setProperty(PROP_I2CP_OPTS, "inbound.length=2 inbound.lengthVariance=0 outbound.length=2 outbound.lengthVariance=0 inbound.quantity=3 outbound.quantity=3");
_config.setProperty(PROP_I2CP_OPTS, "inbound.length=3 outbound.length=3 inbound.quantity=3 outbound.quantity=3");
//if (!_config.containsKey(PROP_EEP_HOST))
// _config.setProperty(PROP_EEP_HOST, "127.0.0.1");
//if (!_config.containsKey(PROP_EEP_PORT))
@ -371,6 +592,7 @@ public class SnarkManager implements CompleteListener {
// _config.setProperty(PROP_USE_DHT, Boolean.toString(I2PSnarkUtil.DEFAULT_USE_DHT));
updateConfig();
}
/**
* Get current theme.
* @return String -- the current theme
@ -402,10 +624,10 @@ public class SnarkManager implements CompleteListener {
/**
* Get all themes
* @return String[] -- Array of all the themes found.
* @return String[] -- Array of all the themes found, non-null, unsorted
*/
public String[] getThemes() {
String[] themes = null;
String[] themes;
// "docs/themes/snark/"
File dir = new File(_context.getBaseDir(), "docs/themes/snark");
FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } };
@ -416,6 +638,8 @@ public class SnarkManager implements CompleteListener {
for(int i = 0; i < dirnames.length; i++) {
themes[i] = dirnames[i].getName();
}
} else {
themes = new String[0];
}
// return the map.
return themes;
@ -457,9 +681,7 @@ public class SnarkManager implements CompleteListener {
_util.setMaxUpBW(getInt(PROP_UPBW_MAX, DEFAULT_MAX_UP_BW));
_util.setStartupDelay(getInt(PROP_STARTUP_DELAY, DEFAULT_STARTUP_DELAY));
_util.setFilesPublic(areFilesPublic());
String ot = _config.getProperty(PROP_OPENTRACKERS);
if (ot != null)
_util.setOpenTrackers(getOpenTrackers());
_util.setOpenTrackers(getListConfig(PROP_OPENTRACKERS, DEFAULT_OPENTRACKERS));
String useOT = _config.getProperty(PROP_USE_OPENTRACKERS);
boolean bOT = useOT == null || Boolean.parseBoolean(useOT);
_util.setUseOpenTrackers(bOT);
@ -488,6 +710,18 @@ public class SnarkManager implements CompleteListener {
String startDelay, String pageSize, String seedPct, String eepHost,
String eepPort, String i2cpHost, String i2cpPort, String i2cpOpts,
String upLimit, String upBW, boolean useOpenTrackers, boolean useDHT, String theme) {
synchronized(_configLock) {
locked_updateConfig(dataDir, filesPublic, autoStart, refreshDelay,
startDelay, pageSize, seedPct, eepHost,
eepPort, i2cpHost, i2cpPort, i2cpOpts,
upLimit, upBW, useOpenTrackers, useDHT, theme);
}
}
private void locked_updateConfig(String dataDir, boolean filesPublic, boolean autoStart, String refreshDelay,
String startDelay, String pageSize, String seedPct, String eepHost,
String eepPort, String i2cpHost, String i2cpPort, String i2cpOpts,
String upLimit, String upBW, boolean useOpenTrackers, boolean useDHT, String theme) {
boolean changed = false;
boolean interruptMonitor = false;
//if (eepHost != null) {
@ -575,7 +809,7 @@ public class SnarkManager implements CompleteListener {
}
if (dataDir != null && !dataDir.equals(getDataDir().getAbsolutePath())) {
dataDir = dataDir.trim();
dataDir = DataHelper.stripHTML(dataDir.trim());
File dd = new File(dataDir);
if (!dd.isAbsolute()) {
addMessage(_("Data directory must be an absolute path") + ": " + dataDir);
@ -605,7 +839,7 @@ public class SnarkManager implements CompleteListener {
}
Map<String, String> opts = new HashMap<String, String>();
if (i2cpOpts == null) i2cpOpts = "";
i2cpOpts = DataHelper.stripHTML(i2cpOpts);
StringTokenizer tok = new StringTokenizer(i2cpOpts, " \t\n");
while (tok.hasMoreTokens()) {
String pair = tok.nextToken();
@ -747,7 +981,7 @@ public class SnarkManager implements CompleteListener {
private List<String> getOpenTrackers() {
if (!_util.shouldUseOpenTrackers())
return Collections.emptyList();
return getListConfig(PROP_OPENTRACKERS, I2PSnarkUtil.DEFAULT_OPENTRACKERS);
return getListConfig(PROP_OPENTRACKERS, DEFAULT_OPENTRACKERS);
}
/**
@ -765,7 +999,7 @@ public class SnarkManager implements CompleteListener {
public void saveOpenTrackers(List<String> ot) {
setListConfig(PROP_OPENTRACKERS, ot);
if (ot == null)
ot = Collections.singletonList(I2PSnarkUtil.DEFAULT_OPENTRACKERS);
ot = getListConfig(PROP_OPENTRACKERS, DEFAULT_OPENTRACKERS);
_util.setOpenTrackers(ot);
addMessage(_("Open Tracker list changed - torrent restart required to take effect."));
saveConfig();
@ -819,7 +1053,7 @@ public class SnarkManager implements CompleteListener {
public void saveConfig() {
try {
synchronized (_configFile) {
synchronized (_configLock) {
DataHelper.storeProps(_config, _configFile);
}
} catch (IOException ioe) {
@ -827,13 +1061,6 @@ public class SnarkManager implements CompleteListener {
}
}
public Properties getConfig() { return _config; }
/** @since Jetty 7 */
public String getConfigFilename() {
return _configFile.getAbsolutePath();
}
/** hardcoded for sanity. perhaps this should be customizable, for people who increase their ulimit, etc. */
public static final int MAX_FILES_PER_TORRENT = 512;
@ -891,15 +1118,25 @@ public class SnarkManager implements CompleteListener {
/**
* Caller must verify this torrent is not already added.
*
* @param filename the absolute path to save the metainfo to, generally ending in ".torrent"
* @param baseFile may be null, if so look in dataDir
* @throws RuntimeException via Snark.fatal()
*/
private void addTorrent(String filename) { addTorrent(filename, false); }
private void addTorrent(String filename, File baseFile, boolean dontAutoStart) {
addTorrent(filename, baseFile, dontAutoStart, null);
}
/**
* Caller must verify this torrent is not already added.
*
* @param filename the absolute path to save the metainfo to, generally ending in ".torrent"
* @param baseFile may be null, if so look in dataDir
* @param dataDir must exist, or null to default to snark data directory
* @throws RuntimeException via Snark.fatal()
* @since 0.9.17
*/
private void addTorrent(String filename, boolean dontAutoStart) {
private void addTorrent(String filename, File baseFile, boolean dontAutoStart, File dataDir) {
if ((!dontAutoStart) && !_util.connected()) {
addMessage(_("Connecting to I2P"));
boolean ok = _util.connect();
@ -916,7 +1153,8 @@ public class SnarkManager implements CompleteListener {
addMessage(_("Error: Could not add the torrent {0}", filename) + ": " + ioe);
return;
}
File dataDir = getDataDir();
if (dataDir == null)
dataDir = getDataDir();
Snark torrent = null;
synchronized (_snarks) {
torrent = _snarks.get(filename);
@ -980,9 +1218,13 @@ public class SnarkManager implements CompleteListener {
} else {
// TODO load saved closest DHT nodes and pass to the Snark ?
// This may take a LONG time
if (baseFile == null)
baseFile = getSavedBaseFile(info.getInfoHash());
if (_log.shouldLog(Log.INFO))
_log.info("New Snark, torrent: " + filename + " base: " + baseFile);
torrent = new Snark(_util, filename, null, -1, null, null, this,
_peerCoordinatorSet, _connectionAcceptor,
false, dataDir.getPath());
false, dataDir.getPath(), baseFile);
loadSavedFilePriorities(torrent);
synchronized (_snarks) {
_snarks.put(filename, torrent);
@ -1028,7 +1270,25 @@ public class SnarkManager implements CompleteListener {
*/
public void addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus) {
// updateStatus is true from UI, false from config file bulk add
addMagnet(name, ih, trackerURL, updateStatus, updateStatus, this);
addMagnet(name, ih, trackerURL, updateStatus, updateStatus, null, this);
}
/**
* Add a torrent with the info hash alone (magnet / maggot)
*
* @param name hex or b32 name from the magnet link
* @param ih 20 byte info hash
* @param trackerURL may be null
* @param updateStatus should we add this magnet to the config file,
* to save it across restarts, in case we don't get
* the metadata before shutdown?
* @param dataDir must exist, or null to default to snark data directory
* @throws RuntimeException via Snark.fatal()
* @since 0.9.17
*/
public void addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus, File dataDir) {
// updateStatus is true from UI, false from config file bulk add
addMagnet(name, ih, trackerURL, updateStatus, updateStatus, dataDir, this);
}
/**
@ -1041,16 +1301,18 @@ public class SnarkManager implements CompleteListener {
* @param updateStatus should we add this magnet to the config file,
* to save it across restarts, in case we don't get
* the metadata before shutdown?
* @param dataDir must exist, or null to default to snark data directory
* @param listener to intercept callbacks, should pass through to this
* @return the new Snark or null on failure
* @throws RuntimeException via Snark.fatal()
* @since 0.9.4
*/
public Snark addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus,
boolean autoStart, CompleteListener listener) {
boolean autoStart, File dataDir, CompleteListener listener) {
String dirPath = dataDir != null ? dataDir.getAbsolutePath() : getDataDir().getPath();
Snark torrent = new Snark(_util, name, ih, trackerURL, listener,
_peerCoordinatorSet, _connectionAcceptor,
false, getDataDir().getPath());
false, dirPath);
synchronized (_snarks) {
Snark snark = getTorrentByInfoHash(ih);
@ -1125,32 +1387,39 @@ public class SnarkManager implements CompleteListener {
* This verifies that a torrent with this infohash is not already added.
* This may take a LONG time to create or check the storage.
*
* Called from servlet. This is only for the 'create torrent' form.
*
* @param metainfo the metainfo for the torrent
* @param bitfield the current completion status of the torrent
* @param filename the absolute path to save the metainfo to, generally ending in ".torrent", which is also the name of the torrent
* Must be a filesystem-safe name.
* @param baseFile may be null, if so look in rootDataDir
* @throws RuntimeException via Snark.fatal()
* @return success
* @since 0.8.4
*/
public void addTorrent(MetaInfo metainfo, BitField bitfield, String filename, boolean dontAutoStart) throws IOException {
public boolean addTorrent(MetaInfo metainfo, BitField bitfield, String filename,
File baseFile, boolean dontAutoStart) throws IOException {
// prevent interference by DirMonitor
synchronized (_snarks) {
Snark snark = getTorrentByInfoHash(metainfo.getInfoHash());
if (snark != null) {
addMessage(_("Torrent with this info hash is already running: {0}", snark.getBaseName()));
return;
return false;
}
// so addTorrent won't recheck
saveTorrentStatus(metainfo, bitfield, null); // no file priorities
saveTorrentStatus(metainfo, bitfield, null, baseFile, true, 0); // no file priorities
try {
locked_writeMetaInfo(metainfo, filename, areFilesPublic());
// hold the lock for a long time
addTorrent(filename, dontAutoStart);
addTorrent(filename, baseFile, dontAutoStart);
} catch (IOException ioe) {
addMessage(_("Failed to copy torrent file to {0}", filename));
_log.error("Failed to write torrent file", ioe);
return false;
}
}
return true;
}
/**
@ -1162,10 +1431,11 @@ public class SnarkManager implements CompleteListener {
* @param fromfile where the file is now, presumably in a temp directory somewhere
* @param filename the absolute path to save the metainfo to, generally ending in ".torrent", which is also the name of the torrent
* Must be a filesystem-safe name.
* @param dataDir must exist, or null to default to snark data directory
* @throws RuntimeException via Snark.fatal()
* @since 0.8.4
*/
public void copyAndAddTorrent(File fromfile, String filename) throws IOException {
public void copyAndAddTorrent(File fromfile, String filename, File dataDir) throws IOException {
// prevent interference by DirMonitor
synchronized (_snarks) {
boolean success = FileUtil.copy(fromfile.getAbsolutePath(), filename, false);
@ -1177,7 +1447,7 @@ public class SnarkManager implements CompleteListener {
if (!areFilesPublic())
SecureFileOutputStream.setPerms(new File(filename));
// hold the lock for a long time
addTorrent(filename);
addTorrent(filename, null, false, dataDir);
}
}
@ -1218,16 +1488,10 @@ public class SnarkManager implements CompleteListener {
* A Snark.CompleteListener method.
*/
public long getSavedTorrentTime(Snark snark) {
byte[] ih = snark.getInfoHash();
String infohash = Base64.encode(ih);
infohash = infohash.replace('=', '$');
String time = _config.getProperty(PROP_META_PREFIX + infohash + PROP_META_BITFIELD_SUFFIX);
Properties config = getConfig(snark);
String time = config.getProperty(PROP_META_STAMP);
if (time == null)
return 0;
int comma = time.indexOf(',');
if (comma <= 0)
return 0;
time = time.substring(0, comma);
try { return Long.parseLong(time); } catch (NumberFormatException nfe) {}
return 0;
}
@ -1241,16 +1505,10 @@ public class SnarkManager implements CompleteListener {
MetaInfo metainfo = snark.getMetaInfo();
if (metainfo == null)
return null;
byte[] ih = snark.getInfoHash();
String infohash = Base64.encode(ih);
infohash = infohash.replace('=', '$');
String bf = _config.getProperty(PROP_META_PREFIX + infohash + PROP_META_BITFIELD_SUFFIX);
Properties config = getConfig(snark);
String bf = config.getProperty(PROP_META_BITFIELD);
if (bf == null)
return null;
int comma = bf.indexOf(',');
if (comma <= 0)
return null;
bf = bf.substring(comma + 1).trim();
int len = metainfo.getPieces();
if (bf.equals(".")) {
BitField bitfield = new BitField(len);
@ -1277,10 +1535,8 @@ public class SnarkManager implements CompleteListener {
return;
if (metainfo.getFiles() == null)
return;
byte[] ih = snark.getInfoHash();
String infohash = Base64.encode(ih);
infohash = infohash.replace('=', '$');
String pri = _config.getProperty(PROP_META_PREFIX + infohash + PROP_META_PRIORITY_SUFFIX);
Properties config = getConfig(snark);
String pri = config.getProperty(PROP_META_PRIORITY);
if (pri == null)
return;
int filecount = metainfo.getFiles().size();
@ -1295,24 +1551,82 @@ public class SnarkManager implements CompleteListener {
}
storage.setFilePriorities(rv);
}
/**
* Get the base location for a torrent from the config file.
* @return File or null, doesn't necessarily exist
* @since 0.9.15
*/
private File getSavedBaseFile(byte[] ih) {
Properties config = getConfig(ih);
String base = config.getProperty(PROP_META_BASE);
if (base == null)
return null;
return new File(base);
}
/**
* Get setting for a torrent from the config file.
* @return setting, false if not found
* @since 0.9.15
*/
public boolean getSavedPreserveNamesSetting(Snark snark) {
Properties config = getConfig(snark);
return Boolean.parseBoolean(config.getProperty(PROP_META_PRESERVE_NAMES));
}
/**
* Get setting for a torrent from the config file.
* @return setting, 0 if not found
* @since 0.9.15
*/
public long getSavedUploaded(Snark snark) {
Properties config = getConfig(snark);
if (config != null) {
try {
return Long.parseLong(config.getProperty(PROP_META_UPLOADED));
} catch (NumberFormatException nfe) {}
}
return 0;
}
/**
* Save the completion status of a torrent and other data in the config file
* for that torrent. Does nothing for magnets.
*
* @since 0.9.15
*/
public void saveTorrentStatus(Snark snark) {
MetaInfo meta = snark.getMetaInfo();
Storage storage = snark.getStorage();
if (meta == null || storage == null)
return;
saveTorrentStatus(meta, storage.getBitField(), storage.getFilePriorities(),
storage.getBase(), storage.getPreserveFileNames(),
snark.getUploaded());
}
/**
* Save the completion status of a torrent and the current time in the config file
* in the form "i2psnark.zmeta.$base64infohash=$time,$base64bitfield".
* The config file property key is appended with the Base64 of the infohash,
* with the '=' changed to '$' since a key can't contain '='.
* for that torrent.
* The time is a standard long converted to string.
* The status is either a bitfield converted to Base64 or "." for a completed
* torrent to save space in the config file and in memory.
*
* @param bitfield non-null
* @param priorities may be null
* @param base may be null
*/
public void saveTorrentStatus(MetaInfo metainfo, BitField bitfield, int[] priorities) {
private void saveTorrentStatus(MetaInfo metainfo, BitField bitfield, int[] priorities,
File base, boolean preserveNames, long uploaded) {
synchronized (_configLock) {
locked_saveTorrentStatus(metainfo, bitfield, priorities, base, preserveNames, uploaded);
}
}
private void locked_saveTorrentStatus(MetaInfo metainfo, BitField bitfield, int[] priorities,
File base, boolean preserveNames, long uploaded) {
byte[] ih = metainfo.getInfoHash();
String infohash = Base64.encode(ih);
infohash = infohash.replace('=', '$');
String now = "" + System.currentTimeMillis();
String bfs;
if (bitfield.complete()) {
bfs = ".";
@ -1320,10 +1634,15 @@ public class SnarkManager implements CompleteListener {
byte[] bf = bitfield.getFieldBytes();
bfs = Base64.encode(bf);
}
_config.setProperty(PROP_META_PREFIX + infohash + PROP_META_BITFIELD_SUFFIX, now + "," + bfs);
Properties config = getConfig(ih);
config.setProperty(PROP_META_STAMP, Long.toString(System.currentTimeMillis()));
config.setProperty(PROP_META_BITFIELD, bfs);
config.setProperty(PROP_META_PRESERVE_NAMES, Boolean.toString(preserveNames));
config.setProperty(PROP_META_UPLOADED, Long.toString(uploaded));
if (base != null)
config.setProperty(PROP_META_BASE, base.getAbsolutePath());
// now the file priorities
String prop = PROP_META_PREFIX + infohash + PROP_META_PRIORITY_SUFFIX;
if (priorities != null) {
boolean nonzero = false;
for (int i = 0; i < priorities.length; i++) {
@ -1341,30 +1660,40 @@ public class SnarkManager implements CompleteListener {
if (i != priorities.length - 1)
buf.append(',');
}
_config.setProperty(prop, buf.toString());
config.setProperty(PROP_META_PRIORITY, buf.toString());
} else {
_config.remove(prop);
config.remove(PROP_META_PRIORITY);
}
} else {
_config.remove(prop);
config.remove(PROP_META_PRIORITY);
}
// TODO save closest DHT nodes too
saveConfig();
File conf = configFile(_configDir, ih);
File subdir = conf.getParentFile();
if (!subdir.exists())
subdir.mkdirs();
try {
DataHelper.storeProps(config, conf);
} catch (IOException ioe) {
_log.error("Unable to save the config to " + conf);
}
}
/**
* Remove the status of a torrent from the config file.
* This may help the config file from growing too big.
* Remove the status of a torrent by removing the config file.
*/
public void removeTorrentStatus(MetaInfo metainfo) {
byte[] ih = metainfo.getInfoHash();
String infohash = Base64.encode(ih);
infohash = infohash.replace('=', '$');
_config.remove(PROP_META_PREFIX + infohash + PROP_META_BITFIELD_SUFFIX);
_config.remove(PROP_META_PREFIX + infohash + PROP_META_PRIORITY_SUFFIX);
saveConfig();
File conf = configFile(_configDir, ih);
synchronized (_configLock) {
conf.delete();
File subdir = conf.getParentFile();
String[] files = subdir.list();
if (files != null && files.length == 0)
subdir.delete();
}
}
/**
@ -1549,11 +1878,12 @@ public class SnarkManager implements CompleteListener {
if (meta == null || storage == null)
return;
StringBuilder buf = new StringBuilder(256);
buf.append("<a href=\"").append(_contextPath).append('/').append(storage.getBaseName());
String base = DataHelper.escapeHTML(storage.getBaseName());
buf.append("<a href=\"").append(_contextPath).append('/').append(base);
if (meta.getFiles() != null)
buf.append('/');
buf.append("\">").append(storage.getBaseName()).append("</a>");
addMessage(_("Download finished: {0}", buf.toString())); // + " (" + _("size: {0}B", DataHelper.formatSize2(len)) + ')');
buf.append("\">").append(base).append("</a>");
addMessageNoEscape(_("Download finished: {0}", buf.toString())); // + " (" + _("size: {0}B", DataHelper.formatSize2(len)) + ')');
updateStatus(snark);
}
@ -1564,7 +1894,8 @@ public class SnarkManager implements CompleteListener {
MetaInfo meta = snark.getMetaInfo();
Storage storage = snark.getStorage();
if (meta != null && storage != null)
saveTorrentStatus(meta, storage.getBitField(), storage.getFilePriorities());
saveTorrentStatus(meta, storage.getBitField(), storage.getFilePriorities(),
storage.getBase(), storage.getPreserveFileNames(), snark.getUploaded());
}
/**
@ -1586,7 +1917,8 @@ public class SnarkManager implements CompleteListener {
snark.stopTorrent();
return null;
}
saveTorrentStatus(meta, storage.getBitField(), null); // no file priorities
saveTorrentStatus(meta, storage.getBitField(), null,
storage.getBase(), storage.getPreserveFileNames(), 0);
// temp for addMessage() in case canonical throws
String name = storage.getBaseName();
try {
@ -1687,7 +2019,7 @@ public class SnarkManager implements CompleteListener {
try {
// Snark.fatal() throws a RuntimeException
// don't let one bad torrent kill the whole loop
addTorrent(name, !shouldAutoStart());
addTorrent(name, null, !shouldAutoStart());
} catch (Exception e) {
addMessage(_("Error: Could not add the torrent {0}", name) + ": " + e);
_log.error("Unable to add the torrent " + name, e);
@ -1785,6 +2117,8 @@ public class SnarkManager implements CompleteListener {
_trackerMap.clear();
for (int i = 0; i < DEFAULT_TRACKERS.length; i += 2) {
String name = DEFAULT_TRACKERS[i];
if (name.equals("TheBland") && !SigType.ECDSA_SHA256_P256.isAvailable())
continue;
String urls[] = DEFAULT_TRACKERS[i+1].split("=", 2);
String url2 = urls.length > 1 ? urls[1] : null;
_trackerMap.put(name, new Tracker(name, urls[0], url2));
@ -1966,7 +2300,7 @@ public class SnarkManager implements CompleteListener {
* ignore case, current locale
* @since 0.9
*/
private static class IgnoreCaseComparator implements Comparator<Tracker> {
private static class IgnoreCaseComparator implements Comparator<Tracker>, Serializable {
public int compare(Tracker l, Tracker r) {
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
}

View File

@ -32,7 +32,9 @@ 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;
@ -52,6 +54,7 @@ public class Storage
{
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,6 +66,7 @@ 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();
@ -70,7 +74,7 @@ public class Storage
/** 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 = 8*1024*1024;
/** The maximum number of pieces in a torrent. */
public static final int MAX_PIECES = 10*1024;
public static final long MAX_TOTAL_SIZE = MAX_PIECE_SIZE * (long) MAX_PIECES;
@ -83,15 +87,19 @@ public class Storage
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 +110,7 @@ public class Storage
List<List<String>> files = metainfo.getFiles();
int sz = files != null ? files.size() : 1;
_torrentFiles = new ArrayList<TorrentFile>(sz);
_preserveFileNames = preserveFileNames;
}
/**
@ -121,8 +130,10 @@ public class Storage
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);
@ -305,24 +316,34 @@ 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;
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)) {
for (int i = 0; i < _torrentFiles.size(); i++) {
TorrentFile tf = _torrentFiles.get(i);
if (i == fileIndex) {
File f = tf.RAFfile;
if (complete())
return 0;
int psz = piece_size;
@ -348,49 +369,30 @@ public class Storage
}
/**
* @param file canonical path (non-directory)
* @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;
}
/**
@ -483,16 +485,21 @@ 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.
*/
public void check(String rootDir) throws IOException
public void check() throws IOException
{
check(rootDir, 0, null);
check(0, null);
}
/**
@ -500,14 +507,9 @@ public class Storage
* Use a saved bitfield and timestamp from a config file.
* Only call this once, and only after the constructor with the metainfo.
*/
public void check(String rootDir, long savedTime, BitField savedBitField) throws IOException
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,16 +519,18 @@ public class Storage
{
// Create base as file.
if (_log.shouldLog(Log.INFO))
_log.info("Creating/Checking file: " + base);
if (!base.createNewFile() && !base.exists())
throw new IOException("Could not create 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);
_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;
}
}
@ -534,9 +538,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();
@ -544,7 +548,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)) {
@ -560,12 +564,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();
@ -609,10 +613,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");
@ -635,6 +638,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
@ -688,14 +704,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.
@ -714,22 +732,56 @@ public class Storage
f = new File(base, name);
else
f = new SecureFile(base, name);
if (!f.createNewFile() && !f.exists())
// createNewFile() can throw a "Permission denied" IOE even if the file exists???
// so do it second
if (!f.exists() && !f.createNewFile())
throw new IOException("Could not create file " + f);
}
}
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;
}
/**
* 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;
}
/**

View File

@ -71,8 +71,9 @@ public class TrackerClient implements Runnable {
private static final String COMPLETED_EVENT = "completed";
private static final String STOPPED_EVENT = "stopped";
private static final String NOT_REGISTERED = "torrent not registered"; //bytemonsoon
/** 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_2 = "torrent not found"; // diftracker
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.
@ -82,8 +83,11 @@ public class TrackerClient implements Runnable {
private final static int MAX_CONSEC_FAILS = 5; // slow down after this
private final static int LONG_SLEEP = 30*60*1000; // sleep a while after lots of fails
private final static long MIN_TRACKER_ANNOUNCE_INTERVAL = 15*60*1000;
private final static long MIN_DHT_ANNOUNCE_INTERVAL = 10*60*1000;
private final static long MIN_DHT_ANNOUNCE_INTERVAL = 39*60*1000;
/** No guidance in BEP 5; standard practice is K (=8) */
private static final int DHT_ANNOUNCE_PEERS = 4;
public static final int PORT = 6881;
private static final int MAX_TRACKERS = 12;
private final I2PSnarkUtil _util;
private final MetaInfo meta;
@ -106,6 +110,8 @@ public class TrackerClient implements Runnable {
// these 2 used in loop()
private volatile boolean runStarted;
private volatile int consecutiveFails;
// if we don't want anything else.
// Not necessarily seeding, as we may have skipped some files.
private boolean completed;
private volatile boolean _fastUnannounce;
private long lastDHTAnnounce;
@ -288,6 +294,7 @@ public class TrackerClient implements Runnable {
}
// announce list
// We completely ignore the BEP 12 processing rules
if (meta != null && !meta.isPrivate()) {
List<List<String>> list = meta.getAnnounceList();
if (list != null) {
@ -300,6 +307,12 @@ public class TrackerClient implements Runnable {
_log.debug("Additional announce (list): [" + url + "] for infoHash: " + infoHash);
}
}
if (trackers.size() > 2) {
// shuffle everything but the primary
TCTracker pri = trackers.remove(0);
Collections.shuffle(trackers, _util.getContext().random());
trackers.add(0, pri);
}
}
}
@ -329,7 +342,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;
@ -345,7 +360,13 @@ public class TrackerClient implements Runnable {
private boolean isNewValidTracker(Set<Hash> existing, String ann) {
Hash h = getHostHash(ann);
if (h == null) {
_log.error("Bad announce URL: [" + ann + ']');
if (_log.shouldLog(Log.WARN))
_log.warn("Bad announce URL: [" + 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;
}
boolean rv = existing.add(h);
@ -375,7 +396,7 @@ public class TrackerClient implements Runnable {
// Local DHT tracker announce
DHT dht = _util.getDHT();
if (dht != null && (meta == null || !meta.isPrivate()))
dht.announce(snark.getInfoHash());
dht.announce(snark.getInfoHash(), coordinator.completed());
int oldSeenPeers = snark.getTrackerSeenPeers();
int maxSeenPeers = 0;
@ -509,7 +530,7 @@ public class TrackerClient implements Runnable {
coordinator.getPeerCount() <= 0 &&
_util.getContext().clock().now() > _startedOn + 2*60*60*1000 &&
snark.getTotalLength() > 0 &&
uploaded >= 2 * snark.getTotalLength()) {
uploaded >= snark.getTotalLength() * 5 / 4) {
if (_log.shouldLog(Log.WARN))
_log.warn("Auto stopping " + snark.getBaseName());
snark.setAutoStoppable(false);
@ -523,7 +544,8 @@ public class TrackerClient implements Runnable {
DHT dht = _util.getDHT();
if (dht != null) {
for (Peer peer : peers) {
dht.announce(snark.getInfoHash(), peer.getPeerID().getDestHash());
dht.announce(snark.getInfoHash(), peer.getPeerID().getDestHash(),
false); // TODO actual seed/leech status
}
}
@ -556,13 +578,21 @@ public class TrackerClient implements Runnable {
// don't show secondary tracker problems to the user
if (tr.isPrimary)
snark.setTrackerProblems(tr.trackerProblems);
if (tr.trackerProblems.toLowerCase(Locale.US).startsWith(NOT_REGISTERED)) {
String tplc = tr.trackerProblems.toLowerCase(Locale.US);
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)
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;
//
}
@ -636,7 +666,9 @@ public class TrackerClient implements Runnable {
numwant = 1;
else
numwant = _util.getMaxConnections();
Collection<Hash> hashes = dht.getPeersAndAnnounce(snark.getInfoHash(), numwant, 5*60*1000, 1, 3*60*1000);
Collection<Hash> hashes = dht.getPeersAndAnnounce(snark.getInfoHash(), numwant,
5*60*1000, DHT_ANNOUNCE_PEERS, 3*60*1000,
coordinator.completed(), numwant <= 1);
if (!hashes.isEmpty()) {
runStarted = true;
lastDHTAnnounce = _util.getContext().clock().now();
@ -773,10 +805,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);
@ -836,8 +873,7 @@ public class TrackerClient implements Runnable {
return false;
}
return url.getProtocol().equals("http") &&
(url.getHost().endsWith(".i2p") || url.getHost().equals("i2p")) &&
url.getPort() < 0;
(url.getHost().endsWith(".i2p") || url.getHost().equals("i2p"));
}
/**
@ -852,7 +888,7 @@ public class TrackerClient implements Runnable {
} catch (MalformedURLException mue) {
return null;
}
if (url.getPort() >= 0 || !url.getProtocol().equals("http"))
if (!url.getProtocol().equals("http"))
return null;
String host = url.getHost();
if (host.endsWith(".i2p"))

View File

@ -62,7 +62,7 @@ class TrackerInfo
private TrackerInfo(Map<String, BEValue> m, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util)
throws IOException
{
BEValue reason = (BEValue)m.get("failure reason");
BEValue reason = m.get("failure reason");
if (reason != null)
{
failure_reason = reason.getString();
@ -72,13 +72,13 @@ class TrackerInfo
else
{
failure_reason = null;
BEValue beInterval = (BEValue)m.get("interval");
BEValue beInterval = m.get("interval");
if (beInterval == null)
throw new InvalidBEncodingException("No interval given");
else
interval = beInterval.getInt();
BEValue bePeers = (BEValue)m.get("peers");
BEValue bePeers = m.get("peers");
if (bePeers == null) {
peers = Collections.emptySet();
} else {
@ -93,14 +93,14 @@ class TrackerInfo
peers = p;
}
BEValue bev = (BEValue)m.get("complete");
BEValue bev = m.get("complete");
if (bev != null) try {
complete = bev.getInt();
if (complete < 0)
complete = 0;
} catch (InvalidBEncodingException ibe) {}
bev = (BEValue)m.get("incomplete");
bev = m.get("incomplete");
if (bev != null) try {
incomplete = bev.getInt();
if (incomplete < 0)
@ -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

@ -21,6 +21,7 @@
package org.klomp.snark.bencode;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
@ -232,10 +233,8 @@ public class BDecoder
if (c == '-')
{
c = read();
if (c == '0')
throw new InvalidBEncodingException("Negative zero not allowed");
chars.append((char)c);
c = read();
}
if (c < '1' || c > '9')
@ -376,4 +375,21 @@ public class BDecoder
return result;
}
/**
* prints out the decoded data
* @since 0.9.14
*/
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Usage: BDecoder file.torrent");
System.exit(1);
}
try {
BEValue bev = bdecode(new FileInputStream(args[0]));
System.out.println(bev.toString());
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(1);
}
}
}

View File

@ -36,7 +36,7 @@ public interface DHT {
public void ping(Destination dest, int port);
/**
* Get peers for a torrent, and announce to the closest node we find.
* Get peers for a torrent, and announce to the closest annMax nodes we find.
* Blocking!
* Caller should run in a thread.
*
@ -45,9 +45,13 @@ public interface DHT {
* @param maxWait the maximum time to wait (ms) must be > 0
* @param annMax the number of peers to announce to
* @param annMaxWait the maximum total time to wait for announces, may be 0 to return immediately without waiting for acks
* @param isSeed true if seed, false if leech
* @param noSeeds true if we do not want seeds in the result
* @return possibly empty (never null)
*/
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait, int annMax, long annMaxWait);
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait,
int annMax, long annMaxWait,
boolean isSeed, boolean noSeeds);
/**
* Announce to ourselves.
@ -55,16 +59,16 @@ public interface DHT {
*
* @param ih the Info Hash (torrent)
*/
public void announce(byte[] ih);
public void announce(byte[] ih, boolean isSeed);
/**
* Announce somebody else we know about.
* Announce somebody else we know about to ourselves.
* Non-blocking.
*
* @param ih the Info Hash (torrent)
* @param peerHash the peer's Hash
*/
public void announce(byte[] ih, byte[] peerHash);
public void announce(byte[] ih, byte[] peerHash, boolean isSeed);
/**
* Remove reference to ourselves in the local tracker.
@ -84,9 +88,10 @@ public interface DHT {
*
* @param ih the Info Hash (torrent)
* @param maxWait the maximum total time to wait (ms) or 0 to do all in parallel and return immediately.
* @param isSeed true if seed, false if leech
* @return the number of successful announces, not counting ourselves.
*/
public int announce(byte[] ih, int max, long maxWait);
public int announce(byte[] ih, int max, long maxWait, boolean isSeed);
/**
* Stop everything.

View File

@ -34,7 +34,8 @@ class DHTTracker {
/** stagger with other cleaners */
private static final long CLEAN_TIME = 199*1000;
private static final long MAX_EXPIRE_TIME = 45*60*1000;
/** no guidance in BEP 5; Vuze is 8h */
private static final long MAX_EXPIRE_TIME = 3*60*60*1000L;
private static final long MIN_EXPIRE_TIME = 15*60*1000;
private static final long DELTA_EXPIRE_TIME = 3*60*1000;
private static final int MAX_PEERS = 2000;
@ -59,7 +60,7 @@ class DHTTracker {
_isRunning = false;
}
void announce(InfoHash ih, Hash hash) {
void announce(InfoHash ih, Hash hash, boolean isSeed) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Announce " + hash + " for " + ih);
Peers peers = _torrents.get(ih);
@ -78,6 +79,9 @@ class DHTTracker {
if (peer2 != null)
peer = peer2;
peer.setLastSeen(_context.clock().now());
// don't let false trump true, as not all sources know the seed status
if (isSeed)
peer.setSeed(true);
} else {
// We could update setLastSeen if he is already
// in there, but that would tend to keep
@ -93,26 +97,42 @@ class DHTTracker {
Peers peers = _torrents.get(ih);
if (peers == null)
return;
Peer peer = new Peer(hash.getData());
peers.remove(peer);
peers.remove(hash);
}
/**
* Caller's responsibility to remove himself from the list
*
* @param noSeeds true if we do not want seeds in the result
* @return list or empty list (never null)
*/
List<Hash> getPeers(InfoHash ih, int max) {
List<Hash> getPeers(InfoHash ih, int max, boolean noSeeds) {
Peers peers = _torrents.get(ih);
if (peers == null)
if (peers == null || max <= 0)
return Collections.emptyList();
int size = peers.size();
List<Hash> rv = new ArrayList<Hash>(peers.values());
if (max < size) {
Collections.shuffle(rv, _context.random());
List<Peer> rv = new ArrayList<Peer>(peers.values());
int size = rv.size();
if (max < size)
Collections.shuffle(rv, _context.random());
if (noSeeds) {
int i = 0;
for (Iterator<Peer> iter = rv.iterator(); iter.hasNext(); ) {
if (iter.next().isSeed())
iter.remove();
else if (++i >= max)
break;
}
if (max < rv.size())
rv = rv.subList(0, max);
} else {
if (max < size)
rv = rv.subList(0, max);
}
return rv;
// a Peer is a Hash
List rv1 = rv;
List<Hash> rv2 = rv1;
return rv2;
}
/**

View File

@ -10,6 +10,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -39,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;
@ -151,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;
@ -184,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();
@ -305,7 +313,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
/**
* Get peers for a torrent, and announce to the closest node we find.
* Get peers for a torrent, and announce to the closest annMax nodes we find.
* This is an iterative lookup in the DHT.
* Blocking!
* Caller should run in a thread.
@ -315,12 +323,16 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param maxWait the maximum time to wait (ms) must be > 0
* @param annMax the number of peers to announce to
* @param annMaxWait the maximum total time to wait for announces, may be 0 to return immediately without waiting for acks
* @param isSeed true if seed, false if leech
* @param noSeeds true if we do not want seeds in the result
* @return possibly empty (never null)
*/
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait, int annMax, long annMaxWait) {
public Collection<Hash> getPeersAndAnnounce(byte[] ih, int max, long maxWait,
int annMax, long annMaxWait,
boolean isSeed, boolean noSeeds) {
// check local tracker first
InfoHash iHash = new InfoHash(ih);
Collection<Hash> rv = _tracker.getPeers(iHash, max);
Collection<Hash> rv = _tracker.getPeers(iHash, max, noSeeds);
rv.remove(_myNodeInfo.getHash());
if (rv.size() >= max)
return rv;
@ -356,7 +368,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Try " + i + ": " + nInfo);
ReplyWaiter waiter = sendGetPeers(nInfo, iHash);
ReplyWaiter waiter = sendGetPeers(nInfo, iHash, noSeeds);
if (waiter == null)
continue;
synchronized(waiter) {
@ -415,7 +427,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
// now announce
if (!heardFrom.isEmpty()) {
announce(ih);
announce(ih, isSeed);
// announce to the closest we've heard from
int annCnt = 0;
long start = _context.clock().now();
@ -424,7 +436,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
if (_log.shouldLog(Log.INFO))
_log.info("Announcing to closest from get peers: " + annTo);
long toWait = annMaxWait > 0 ? Math.min(annMaxWait, 60*1000) : 0;
if (announce(ih, annTo, toWait))
if (announce(ih, annTo, toWait, isSeed))
annCnt++;
if (annMaxWait > 0) {
annMaxWait -= _context.clock().now() - start;
@ -437,7 +449,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// so this is essentially just a retry
if (_log.shouldLog(Log.INFO))
_log.info("Announcing to closest in kbuckets after get peers failed");
announce(ih, annMax, annMaxWait);
announce(ih, annMax, annMaxWait, isSeed);
}
if (_log.shouldLog(Log.INFO)) {
_log.info("Finished get Peers, returning " + rv.size());
@ -454,21 +466,21 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
*
* @param ih the Info Hash (torrent)
*/
public void announce(byte[] ih) {
public void announce(byte[] ih, boolean isSeed) {
InfoHash iHash = new InfoHash(ih);
_tracker.announce(iHash, _myNodeInfo.getHash());
_tracker.announce(iHash, _myNodeInfo.getHash(), isSeed);
}
/**
* Announce somebody else we know about.
* Announce somebody else we know about to ourselves.
* Non-blocking.
*
* @param ih the Info Hash (torrent)
* @param peerHash the peer's Hash
*/
public void announce(byte[] ih, byte[] peerHash) {
public void announce(byte[] ih, byte[] peerHash, boolean isSeed) {
InfoHash iHash = new InfoHash(ih);
_tracker.announce(iHash, new Hash(peerHash));
_tracker.announce(iHash, new Hash(peerHash), isSeed);
// Do NOT do this, corrupts the Hash cache and the Peer ID
//_tracker.announce(iHash, Hash.create(peerHash));
}
@ -500,10 +512,11 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param ih the Info Hash (torrent)
* @param max maximum number of peers to announce to
* @param maxWait the maximum total time to wait (ms) or 0 to do all in parallel and return immediately.
* @param isSeed true if seed, false if leech
* @return the number of successful announces, not counting ourselves.
*/
public int announce(byte[] ih, int max, long maxWait) {
announce(ih);
public int announce(byte[] ih, int max, long maxWait, boolean isSeed) {
announce(ih, isSeed);
int rv = 0;
long start = _context.clock().now();
InfoHash iHash = new InfoHash(ih);
@ -513,7 +526,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
for (NodeInfo nInfo : nodes) {
if (!_isRunning)
break;
if (announce(ih, nInfo, Math.min(maxWait, 60*1000)))
if (announce(ih, nInfo, Math.min(maxWait, 60*1000), isSeed))
rv++;
maxWait -= _context.clock().now() - start;
if (maxWait < 1000)
@ -531,9 +544,10 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param ih the Info Hash (torrent)
* @param nInfo the peer to announce to
* @param maxWait the maximum time to wait (ms) or 0 to return immediately.
* @param isSeed true if seed, false if leech
* @return success
*/
private boolean announce(byte[] ih, NodeInfo nInfo, long maxWait) {
private boolean announce(byte[] ih, NodeInfo nInfo, long maxWait, boolean isSeed) {
InfoHash iHash = new InfoHash(ih);
// it isn't clear from BEP 5 if a token is bound to a single infohash?
// for now, just bind to the NID
@ -549,7 +563,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
return false;
if (_log.shouldLog(Log.INFO))
_log.info("No token for announce to " + nInfo + ", sending get_peers first");
ReplyWaiter waiter = sendGetPeers(nInfo, iHash);
ReplyWaiter waiter = sendGetPeers(nInfo, iHash, false);
if (waiter == null)
return false;
long start = _context.clock().now();
@ -580,7 +594,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
// send and wait on rcv msg lock unless maxWait <= 0
ReplyWaiter waiter = sendAnnouncePeer(nInfo, iHash, token);
ReplyWaiter waiter = sendAnnouncePeer(nInfo, iHash, token, isSeed);
if (waiter == null)
return false;
if (maxWait <= 0)
@ -722,15 +736,18 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* Blocking if we have to look up the dest for the nodeinfo
*
* @param nInfo who to send it to
* @param noSeeds true if we do not want seeds in the result
* @return null on error
*/
private ReplyWaiter sendGetPeers(NodeInfo nInfo, InfoHash ih) {
private ReplyWaiter sendGetPeers(NodeInfo nInfo, InfoHash ih, boolean noSeeds) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending get peers of " + ih + " to: " + nInfo);
_log.info("Sending get peers of " + ih + " to: " + nInfo + " noseeds? " + noSeeds);
Map<String, Object> map = new HashMap<String, Object>();
map.put("q", "get_peers");
Map<String, Object> args = new HashMap<String, Object>();
args.put("info_hash", ih.getData());
if (noSeeds)
args.put("noseed", Integer.valueOf(1));
map.put("a", args);
ReplyWaiter rv = sendQuery(nInfo, map, true);
// save the InfoHash so we can get it later
@ -743,11 +760,12 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* Non-blocking, will fail if we don't have the dest for the nodeinfo
*
* @param nInfo who to send it to
* @param isSeed true if seed, false if leech
* @return null on error
*/
private ReplyWaiter sendAnnouncePeer(NodeInfo nInfo, InfoHash ih, Token token) {
private ReplyWaiter sendAnnouncePeer(NodeInfo nInfo, InfoHash ih, Token token, boolean isSeed) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending announce of " + ih + " to: " + nInfo);
_log.info("Sending announce of " + ih + " to: " + nInfo + " seed? " + isSeed);
Map<String, Object> map = new HashMap<String, Object>();
map.put("q", "announce_peer");
Map<String, Object> args = new HashMap<String, Object>();
@ -755,6 +773,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// port ignored
args.put("port", Integer.valueOf(TrackerClient.PORT));
args.put("token", token.getData());
args.put("seed", Integer.valueOf(isSeed ? 1 : 0));
map.put("a", args);
// an announce need not be signed, we have a token
ReplyWaiter rv = sendQuery(nInfo, map, false);
@ -814,16 +833,20 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// All errors use the response port.
/**
* Unused
*
* @param nInfo who to send it to
* @return success
*/
private boolean sendError(NodeInfo nInfo, MsgID msgID, int err, String msg) {
if (_log.shouldLog(Log.INFO))
_log.info("Sending error " + msg + " to: " + nInfo);
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> resps = new HashMap<String, Object>();
map.put("r", resps);
return sendResponse(nInfo, msgID, map);
Map<String, Object> map = new HashMap<String, Object>(4);
List<Object> error = new ArrayList(2);
error.add(Integer.valueOf(err));
error.add(msg);
map.put("e", error);
return sendError(nInfo, msgID, map);
}
// Low-level send methods
@ -910,7 +933,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
/**
* @param toPort the query port, we will increment here
* Unused
*
* @return success
*/
private boolean sendError(NodeInfo nInfo, MsgID msgID, Map<String, Object> map) {
@ -1113,14 +1137,22 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
} else if (method.equals("get_peers")) {
byte[] hash = args.get("info_hash").getBytes();
InfoHash ih = new InfoHash(hash);
receiveGetPeers(msgID, nInfo, ih);
boolean noSeeds = false;
BEValue nos = args.get("noseed");
if (nos != null)
noSeeds = nos.getInt() == 1;
receiveGetPeers(msgID, nInfo, ih, noSeeds);
} else if (method.equals("announce_peer")) {
byte[] hash = args.get("info_hash").getBytes();
InfoHash ih = new InfoHash(hash);
// this is the "TCP" port, we don't care
//int port = args.get("port").getInt();
byte[] token = args.get("token").getBytes();
receiveAnnouncePeer(msgID, ih, token);
boolean isSeed = false;
BEValue iss = args.get("seed");
if (iss != null)
isSeed = iss.getInt() == 1;
receiveAnnouncePeer(msgID, ih, token, isSeed);
} else {
if (_log.shouldLog(Log.WARN))
_log.warn("Unknown query method rcvd: " + method);
@ -1233,18 +1265,22 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
/**
* Handle and respond to the query
*/
private void receiveGetPeers(MsgID msgID, NodeInfo nInfo, InfoHash ih) throws InvalidBEncodingException {
private void receiveGetPeers(MsgID msgID, NodeInfo nInfo,
InfoHash ih, boolean noSeeds) throws InvalidBEncodingException {
if (_log.shouldLog(Log.INFO))
_log.info("Rcvd get_peers from: " + nInfo + " for: " + ih);
_log.info("Rcvd get_peers from: " + nInfo + " for: " + ih + " noseeds? " + noSeeds);
// generate and save random token
Token token = new Token(_context);
_outgoingTokens.put(token, nInfo);
if (_log.shouldLog(Log.INFO))
_log.info("Stored new OB token: " + token + " for: " + nInfo);
List<Hash> peers = _tracker.getPeers(ih, MAX_WANT);
List<Hash> peers = _tracker.getPeers(ih, MAX_WANT, noSeeds);
// Check this before removing him, so we don't needlessly send nodes
// if he's the only one on the torrent.
boolean noPeers = peers.isEmpty();
peers.remove(nInfo.getHash()); // him
if (peers.isEmpty()) {
if (noPeers) {
// similar to find node, but with token
// get closest from DHT
List<NodeInfo> nodes = _knownNodes.findClosest(ih, K);
@ -1256,9 +1292,14 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
}
sendNodes(nInfo, msgID, token, nodeArray);
} else {
List<byte[]> hashes = new ArrayList<byte[]>(peers.size());
for (Hash peer : peers) {
hashes.add(peer.getData());
List<byte[]> hashes;
if (peers.isEmpty()) {
hashes = Collections.EMPTY_LIST;
} else {
hashes = new ArrayList<byte[]>(peers.size());
for (Hash peer : peers) {
hashes.add(peer.getData());
}
}
sendPeers(nInfo, msgID, token, hashes);
}
@ -1269,7 +1310,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* We have no node info here, it came on response port, we have to get it from the token.
* So we can't verify that it came from the same peer, as BEP 5 specifies.
*/
private void receiveAnnouncePeer(MsgID msgID, InfoHash ih, byte[] tok) throws InvalidBEncodingException {
private void receiveAnnouncePeer(MsgID msgID, InfoHash ih,
byte[] tok, boolean isSeed) throws InvalidBEncodingException {
Token token = new Token(tok);
NodeInfo nInfo = _outgoingTokens.get(token);
if (nInfo == null) {
@ -1280,9 +1322,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
return;
}
if (_log.shouldLog(Log.INFO))
_log.info("Rcvd announce from: " + nInfo + " for: " + ih);
_log.info("Rcvd announce from: " + nInfo + " for: " + ih + " seed? " + isSeed);
_tracker.announce(ih, nInfo.getHash());
_tracker.announce(ih, nInfo.getHash(), isSeed);
// the reply for an announce is the same as the reply for a ping
sendPong(nInfo, msgID);
}
@ -1341,7 +1383,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @throws NPE, IllegalArgumentException, and others too
*/
private List<NodeInfo> receiveNodes(NodeInfo nInfo, byte[] ids) throws InvalidBEncodingException {
int max = Math.min(K, ids.length / NodeInfo.LENGTH);
// Azureus sends 20
int max = Math.min(3 * K, ids.length / NodeInfo.LENGTH);
List<NodeInfo> rv = new ArrayList<NodeInfo>(max);
for (int off = 0; off < ids.length && rv.size() < max; off += NodeInfo.LENGTH) {
NodeInfo nInf = new NodeInfo(ids, off);
@ -1399,6 +1442,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// Errors.....
/**
* @param error 1st item is error code, 2nd is message string
* @throws NPE, and others too
*/
private void receiveError(ReplyWaiter waiter, List<BEValue> error) throws InvalidBEncodingException {
@ -1536,6 +1580,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// TODO throttle
try {
byte[] payload = session.receiveMessage(msgId);
if (payload == null)
return;
_rxPkts.incrementAndGet();
_rxBytes.addAndGet(payload.length);
if (toPort == _qPort) {

View File

@ -3,6 +3,7 @@ package org.klomp.snark.dht;
* From zzzot, modded and relicensed to GPLv2
*/
import java.io.Serializable;
import java.util.Comparator;
import net.i2p.crypto.SHA1Hash;
@ -15,7 +16,7 @@ import net.i2p.data.DataHelper;
* @since 0.9.2
* @author zzz
*/
class NodeInfoComparator implements Comparator<NodeInfo> {
class NodeInfoComparator implements Comparator<NodeInfo>, Serializable {
private final byte[] _base;
public NodeInfoComparator(SHA1Hash h) {

View File

@ -14,7 +14,9 @@ import net.i2p.data.Hash;
*/
class Peer extends Hash {
private long lastSeen;
private volatile long lastSeen;
// todo we could pack this into the upper bit of lastSeen
private volatile boolean isSeed;
public Peer(byte[] data) {
super(data);
@ -27,4 +29,14 @@ class Peer extends Hash {
public void setLastSeen(long now) {
lastSeen = now;
}
/** @since 0.9.14 */
public boolean isSeed() {
return isSeed;
}
/** @since 0.9.14 */
public void setSeed(boolean isSeed) {
this.isSeed = isSeed;
}
}

View File

@ -84,16 +84,17 @@ import net.i2p.util.SystemVersion;
*/
class BasicServlet extends HttpServlet
{
protected final I2PAppContext _context;
protected final Log _log;
private static final long serialVersionUID = 1L;
protected transient final I2PAppContext _context;
protected transient final Log _log;
protected File _resourceBase;
private String _warBase;
private final MimeTypes _mimeTypes;
private transient final MimeTypes _mimeTypes;
/** same as PeerState.PARTSIZE */
private static final int BUFSIZE = 16*1024;
private ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
private transient ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
private static final int WAR_CACHE_CONTROL_SECS = 24*60*60;
private static final int FILE_CACHE_CONTROL_SECS = 24*60*60;
@ -123,8 +124,10 @@ class BasicServlet extends HttpServlet
* Files are served from here
*/
protected void setResourceBase(File base) throws UnavailableException {
if (!base.isDirectory())
if (!base.isDirectory()) {
_log.log(Log.CRIT, "Configured i2psnark directory " + base + " does not exist");
throw new UnavailableException("Resource base does not exist: " + base);
}
_resourceBase = base;
if (_log.shouldLog(Log.INFO))
_log.info("Resource base is " + _resourceBase);
@ -178,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;
@ -280,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;
@ -552,14 +559,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);
@ -75,6 +78,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
_mgr = mgr;
_url = url;
_name = _("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.addMessage(_("Fetching {0}", urlify(_url)));
_mgr.addMessageNoEscape(_("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.addMessage(_("Torrent was not retrieved from {0}", urlify(_url)) +
_mgr.addMessageNoEscape(_("Torrent was not retrieved from {0}", urlify(_url)) +
((_failCause != null) ? (": " + DataHelper.stripHTML(_failCause)) : ""));
}
if (file != 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.addMessage(_("Torrent fetched from {0}", urlify(_url)));
_mgr.addMessageNoEscape(_("Torrent fetched from {0}", urlify(_url)));
FileInputStream in = null;
try {
in = new FileInputStream(file);
@ -176,14 +180,17 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
_mgr.addMessage(_("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);
snark.startTorrent();
if (snark != null)
snark.startTorrent();
else
throw new IOException("Unknown error - check logs");
}
} catch (IOException ioe) {
_mgr.addMessage(_("Torrent at {0} was not valid", urlify(_url)) + ": " + ioe.getMessage());
_mgr.addMessageNoEscape(_("Torrent at {0} was not valid", urlify(_url)) + ": " + DataHelper.stripHTML(ioe.getMessage()));
} catch (OutOfMemoryError oom) {
_mgr.addMessage(_("ERROR - Out of memory, cannot create torrent from {0}", urlify(_url)) + ": " + oom.getMessage());
_mgr.addMessageNoEscape(_("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) {}
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,530 @@
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 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 {
/**
* 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 "the "
* (I guess this is worth it, a lot of torrents start with "The "
* @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 llc = ls.toLowerCase(Locale.US);
if (llc.startsWith("the ") || llc.startsWith("the.") || llc.startsWith("the_"))
ls = ls.substring(4);
String rs = r.getBaseName();
String rlc = rs.toLowerCase(Locale.US);
if (rlc.startsWith("the ") || rlc.startsWith("the.") || rlc.startsWith("the_"))
rs = rs.substring(4);
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
*/
public FileAndIndex(File file, Storage storage) {
this.file = file;
index = storage != null ? storage.indexOf(file) : -1;
if (index >= 0) {
isDirectory = false;
remaining = storage.remaining(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;
}
}
}

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);
}
}
}

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

@ -24,6 +24,7 @@ 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

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

View File

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

View File

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

View File

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

View File

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 591 B

View File

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

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