Compare commits

...

235 Commits

Author SHA1 Message Date
zzz
960cd18d0a 0.7.7 2009-10-12 01:27:29 +00:00
zzz
405b85c4b4 Cleanups after review and prep for release 2009-10-11 22:51:43 +00:00
z3d
92e323df51 merge of 'd203ac237f3507d4d4e4ac35692ac8e1c7afbd2c'
and 'f9fb6fe4c42fe93b267d23014e9277aec85820be'
2009-10-10 15:16:45 +00:00
z3d
3f2c34903d Updated readme_zh.html, thanks to "walking". 2009-10-10 15:13:39 +00:00
zzz
3c260aa333 fix rare ElGamal AIOOBE 2009-10-09 16:00:38 +00:00
zzz
da41f3a93b fix NTCP rate formatting 2009-10-09 15:59:51 +00:00
zzz
aeb711acde merge of 'd14138bee147039ed42a30254eb29e75c42c1ae2'
and 'f513d5843ba7ec1c5fb1de267d196ed59df37018'
2009-10-09 14:12:25 +00:00
z3d
a46ee9a5b2 Increment version to 0.7.6-25. 2009-10-09 14:01:18 +00:00
zzz
088f9558ec fix persistent client key on split directories - thanks user! 2009-10-09 13:56:34 +00:00
zzz
376d61c155 docs 2009-10-09 13:55:15 +00:00
zzz
285a2b92e5 Drop unused ConfigConsole*. Password implementation should merge code into ConfigUI*. 2009-10-09 13:54:51 +00:00
z3d
8939c573ea Update readmes to include pastebin and echelon's software archive; minor
layout tweak for English readme.
2009-10-09 13:52:36 +00:00
z3d
3839d9873a Minor theme updates; lose whitespace in config.jsp; add license for SilkIcons. 2009-10-09 00:45:33 +00:00
zzz
116762ebce doc and eepsite index updates 2009-10-07 17:12:00 +00:00
zzz
7dd8f00e95 remove UDP port number from thread names for better thread dump anonymity 2009-10-07 17:09:53 +00:00
dev
29a3db4b5c merge of '10cb3e6e3bbb0dac3121e53e10232efe27200229'
and 'd5b1ef74ebfbd8e8c1cd1d51c74e6ec542940ca3'
2009-10-07 15:00:17 +00:00
z3d
5d95907996 Near invisible to the naked eye tweak to dark theme; modest aesthetic tweak to debug.jsp, with apologies to zzz. :) 2009-10-05 19:42:36 +00:00
z3d
2f940d01b6 Modify build.xml to remove reference to defCon1. 2009-10-05 11:45:21 +00:00
z3d
517e170b88 Lose the defunct defCon1 theme, remove the rogue i2plogo.png. 2009-10-05 05:03:32 +00:00
z3d
b27fbb9b8e More minor theme embellishments. 2009-10-04 18:02:28 +00:00
zzz
9b97d32ea8 fix snark npe caused by last checkin 2009-10-04 14:06:14 +00:00
zzz
d4f3952a90 merge of 'de249007f709f415ccb2f090ef084b27be21cbec'
and 'e922f8bd0916c3caf7c241cc5950083486a1ef97'
2009-10-04 13:34:13 +00:00
z3d
f7840652ed Flag adjustment for homepage in classic theme. 2009-10-03 18:43:56 +00:00
dev
08634c1ff6 merge of '054daeda4eca6a485cd4de94e3ab4b59c93e3a08'
and 'b0854af170b1973f5dd1fb73c7266f35942cfc41'
2009-10-03 18:12:05 +00:00
dev
dec4205890 * added paste.i2p2.i2p to readme[LANG=EN]
* added paste.i2p2.i2p to readme[LANG=DE]
2009-10-03 18:11:58 +00:00
dev
b49ab59e3b merge of '1e5ca44c3d69e2a7712396e0ea4f43f05a201f14'
and 'afad15f1e34ff7456efc1b53fb8d8b11df49e57e'
2009-10-03 18:07:38 +00:00
dev
7e1171ec9f merge of '6199603651b9fab5b9659f927bce9edfff2221d8'
and 'aff8790819defcbd74113acc5dc7e024daad5462'
2009-10-03 18:07:02 +00:00
dev
3eae787957 merge hosts.txt with i2p.www 2009-10-03 18:06:50 +00:00
z3d
9ecba4fc5e Drop i2psnark.png 2009-10-03 17:48:01 +00:00
z3d
4fb9eef198 Light theme tweaks. 2009-10-03 17:45:01 +00:00
z3d
49ecfd8224 Theme tweaks. 2009-10-03 14:24:28 +00:00
z3d
09a2854b8b Theme stuff and lose excess. 2009-10-03 07:41:57 +00:00
z3d
82976e609f merge of '41b07fbbaf6d101843800351ffbd1ec5628d4667'
and 'd4ad945d65ad61b0d56ec3cfd1d5f03c6d023002'
2009-10-02 16:28:50 +00:00
z3d
b2d6b60300 Make spaces between divs in dark theme more consistent. 2009-10-02 15:41:38 +00:00
zzz
90737493e6 -21-rc 2009-10-02 15:20:50 +00:00
zzz
fe3abc79d6 fix changing opentracker list 2009-10-02 15:12:24 +00:00
zzz
9931112387 * Tunnel IVValidator: Increase size of bloom filter
for high-bw routers (>= 512KBps share bw) to reduce
      false positive rate. Adds 2MB heap for >= 512KBps routers
      and 6MB for >= 1536KBps.
2009-10-02 03:14:16 +00:00
zzz
1cd646afe2 SusiDNS: HTML transitional fixes, might help opera 2009-10-02 03:12:09 +00:00
zzz
0d262d28b7 propagate from branch 'i2p.i2p.zzz.test' (head a6c2e5692419553edb1079eb25feee51bdd0e3fa)
to branch 'i2p.i2p' (head 70c7015adc1e76f29e33788e2e262f0db5fd91a0)
2009-10-01 18:31:44 +00:00
zzz
f33e950780 comment cleanup 2009-10-01 18:22:54 +00:00
zzz
7094489536 fix OCMOSJ SKM NPE 2009-10-01 18:19:02 +00:00
zzz
2dd650df01 propagate from branch 'i2p.i2p.zzz.test3' (head 459a56e53d8d694591071574e87474b5e95d6494)
to branch 'i2p.i2p' (head ffa1aab7aa8e75d75c183fd6f76140f7d840a6ae)
2009-10-01 18:18:23 +00:00
sponge
7e8037979f * fixups to SlackBuilds. requiredbuilder does the wrong thing, and
thinks that java is perl! This isn't really a big deal,
      the file format is simple enough and the requirements are known.
2009-09-21 08:54:41 +00:00
zzz
3a1c042cd2 gcj makefile fixups 2009-09-16 14:51:39 +00:00
zzz
ca81c35b3d static tweaks 2009-09-16 14:50:52 +00:00
zzz
6a2dfff34d one more test class out of the lib 2009-09-16 14:49:12 +00:00
BlubMail
5eccc01de6 merge of '1d77e0a89198e422acfb66d9310fad7b0b290e38'
and '5271eb82ac21ebc1a96dd31c462a14e2aaa0c89e'
2009-09-13 16:33:32 +00:00
mkvore-commit
1850e893e9 removes a bug in SAM v1 and v2 (introduced when merging with v3) 2009-09-07 17:33:29 +00:00
BlubMail
2341793546 writeString(String str): synchronize using socket write lock to prevent split SAM messages 2009-09-06 00:43:45 +00:00
zzz
1f1d089fda Move FloodSearchJob to its own file, history for two props, -19 2009-09-04 19:58:15 +00:00
zzz
5372a50bcc propagate from branch 'i2p.i2p.zzz.test3' (head f18425568ef4ef20f5054f6fb133cf217bfab485)
to branch 'i2p.i2p' (head 36f4774eb9dd538b3a7c314de79a6fb3bc4df813)
2009-09-04 15:14:36 +00:00
zzz
83588d9b98 propagate from branch 'i2p.i2p.zzz.test' (head 350d5a26c305a3178c851c60451ad9e72d7d82a7)
to branch 'i2p.i2p' (head 869d178de23c9945a98da66013e642b9aa435e28)
2009-09-04 15:14:22 +00:00
zzz
58e960ceb5 Fix inbound tunnel tests by using the correct SKM 2009-09-04 14:20:20 +00:00
zzz
de07705671 deliver more tags as the available number gets low 2009-09-02 15:02:19 +00:00
sponge
49ff3cfbf3 * Small logic fix for dr|z3d 2009-09-02 00:08:03 +00:00
zzz
e392469835 TunnelDispatcher cleanup 2009-09-01 14:51:11 +00:00
zzz
7745bd89a9 * configkeyring.jsp: Add delete and cancel buttons 2009-09-01 14:50:22 +00:00
zzz
01bed932c7 * Logging: Fix directory for rotated log 2009-09-01 14:47:16 +00:00
zzz
157190757b * SessionKeyManager:
- Fix TagSet hashCode
      - More synchronization
2009-09-01 13:47:27 +00:00
zzz
e0f1047d72 * SessionKeyManager, OCMOSJ, Garlic:
- Enable per-client SessionKeyManagers for better anonymity
      - tagsDelivered() now means tags are sent, not acked.
      - OCMOSJ uses the new TagSetHandle object returned from tagsDelivered()
        to call tagsAcked() or failTags() as appropriate.
      - Assume tags delivered on an established session to
        reduce streaming lib stalls caused by massive tag deliveries;
        should increase throughput and window sizes on long-lived streams
      - Unacked tagsets on a new session are stored on a separate list
      - Don't kill an OB Session just because it's temporarily out of tags
      - Increase min tag threshold to 30 (was 20) due to new speculative
        tags delivered scheme, and to increase effective max window
      - More Java 5 and dead code cleanups, and more comments and javadoc,
        debug logging cleanups
2009-08-30 16:27:03 +00:00
zzz
15f0cda41f cleanup of things moved to GarlicMessageReceiver long ago 2009-08-30 16:21:38 +00:00
zzz
9a95122c7c new disable tunnel tests option 2009-08-30 16:13:46 +00:00
zzz
d868f7c02a propagate from branch 'i2p.i2p' (head 5b1c8cca17ce959d164a3d3d95453124211fb41d)
to branch 'i2p.i2p.zzz.test' (head e118104e3601f3c56d3a84594fb35de6d902da8f)
2009-08-30 16:06:46 +00:00
zzz
5ca2f306b8 consume sessiontag after failed tunnel test 2009-08-30 16:05:33 +00:00
zzz
c714c1a0c9 instantiate per-client SKM 2009-08-30 16:05:12 +00:00
zzz
e6e6c00497 tostring updates for debugging 2009-08-30 16:04:50 +00:00
zzz
62a3da2fa6 javadoc updates for SKM changes 2009-08-30 16:04:28 +00:00
z3d
f1f97e8ec5 New default light header logo until we rig them by theme. 2009-08-28 03:44:56 +00:00
z3d
6c361679c6 merge of '1b1c377c45e8746e4e04afc47cde55a03b859f32'
and '6869519b0cd38f4bc366d0277c5dc4e924348e66'
2009-08-28 03:16:12 +00:00
z3d
ae89d2f2ab Rejig netdb.jsp into tables; sidepanel logo refresh. 2009-08-28 03:12:23 +00:00
zzz
8053fb5eae prop history, -18 2009-08-27 19:59:11 +00:00
zzz
ebf5eb6e20 propagate from branch 'i2p.i2p.zzz.test3' (head 75804c9355329ab942a5e2e8ecc91e2ec1eb9d33)
to branch 'i2p.i2p' (head 33e55422045b9b3c8ae410162f5cca3eb9baae49)
2009-08-27 19:55:56 +00:00
zzz
2e2bff3f0a fix the favicon again 2009-08-27 19:43:57 +00:00
zzz
a3f290e4d8 * Tunnel:
- Adjust the random drop probability for the message size
2009-08-27 19:31:24 +00:00
zzz
e0dd1f13e3 keep publishing leaseset if we are restarting, to minimize downtime 2009-08-27 15:29:23 +00:00
zzz
787def6a1c * Tunnel:
- Adjust the random drop probability for the message size
2009-08-27 15:27:46 +00:00
zzz
1f5d7d7b5b dont reopen tunnel to say goodbye to tracker 2009-08-27 15:08:21 +00:00
zzz
4bc5215833 fix /i2p/B64 handling 2009-08-27 15:07:48 +00:00
zzz
7736545f5b speed up data hashcodes 2009-08-27 03:53:41 +00:00
zzz
1ecf4377c6 * Client:
- Fail if no date handshake after 30s or no leaseset
        after 5m, rather than hanging forever.
2009-08-27 03:52:14 +00:00
zzz
593d4dc508 * DecayingBloomFilter:
- Replace with new DecayingHashSet for 3 of 4 uses,
        and also in the 4th if the router is low-bandwidth.
        Saves 8 MB heap.
2009-08-26 22:22:47 +00:00
zzz
93d366fea1 * Tunnel: Concurrentify HashSetIVValidator 2009-08-26 22:18:15 +00:00
zzz
7973f2e8b9 * DataHelper: Fix byte array hashcode for small arrays 2009-08-26 22:17:29 +00:00
zzz
bb14fa0b4e * Console: Prevent OOMs in NewsFetcher or StatsSummarizer from
killing the router
2009-08-26 22:16:29 +00:00
zzz
95aba0c537 * EepGet, I2PSnark:
- New I2PSocketEepGet fetches through existing tunnels
        rather than through the proxy
      - Use new eepget for i2psnark
      - Add a fake user agent for non-proxied fetches
      - Cleanups
2009-08-26 22:15:32 +00:00
zzz
df4143f036 * NetDb:
- oops, store leaseset locally even when shutting down
        (fix -16)
      - Java 5 cleanups
    * PRNG:
      - Rename config option to prng.buffers (was router.prng.buffers)
      - Change the default from 16 to 2 for I2PAppContext (saves 3.5MB)
    * TunnelPool:
      - Don't test tunnels when shutting down
      - Less rates
      - Java 5 cleanups
2009-08-25 13:12:24 +00:00
dev
ed0575e937 update launchpad and freshmeat too 2009-08-24 20:51:09 +00:00
zzz
456ed0aab4 history for 2 props, -17 2009-08-24 00:28:49 +00:00
zzz
47c8389419 propagate from branch 'i2p.i2p.zzz.test3' (head e19da9b978ed2ec03adb0e326fff6870746cc4fc)
to branch 'i2p.i2p' (head 179b9a7974d64853c0c91924a5ad86e8b04ee7ba)
2009-08-24 00:08:30 +00:00
zzz
51fd4d70da cleanup 2009-08-24 00:08:19 +00:00
zzz
79e32231fb propagate from branch 'i2p.i2p.zzz.test' (head b1e81b14fbaafdc188ae4d312f843c38b65cc310)
to branch 'i2p.i2p' (head 010351f9470b0e699e17447c87daf6c67e5e5dcc)
2009-08-24 00:06:48 +00:00
zzz
80f9f857e5 more HTML fixup 2009-08-23 17:42:04 +00:00
zzz
5a4c2de425 * Message, I2PSession, SessionKeyManager, Console:
Prep for SessionKeyManager work in the router -
      Fix up SKM renderStatusHTML(); add debug.jsp to see it;
      Redefine getClientSessionKeyManager();
      More cleanups
2009-08-23 16:12:09 +00:00
zzz
7e547743c7 * Message: Move 2 unused classes out of the router lib (~15KB)
(more SKM prep)
2009-08-23 12:29:34 +00:00
zzz
3f3d43df41 * Streaming, I2PSession:
Prep for SessionKeyManager work in the router -
      Comment out, deprecate, and javadoc for unused keys and tags,
      they are vestiges of end-to-end crypto
2009-08-22 22:55:37 +00:00
z3d
0cc72a49c8 "page or resource" indication on 404 console error page. 2009-08-22 17:42:15 +00:00
zzz
35c9e99914 - Throw 403 instead of 404 from flags.jsp and viewstat.jsp
so we don't render error.jsp
2009-08-22 16:23:15 +00:00
z3d
2e4bd1e440 Polish the console 404 error messages. 2009-08-22 12:15:19 +00:00
zzz
22c0b8e524 * profiles.jsp: Bulletproofing, less memory usage
* Updates: Verify zip at startup before extracting
    * Wrapper: Take a couple fields out of the log so it's narrower
2009-08-21 23:36:21 +00:00
zzz
faeb58f7e2 * ClientManager:
- Prevent client destination theft by rejecting duplicates
      - Java 5 cleanups
2009-08-21 15:40:26 +00:00
zzz
cdc184c5e5 * HTTP Proxy: Get mime type right for .ico
* DataHelper: Cleanup
2009-08-21 15:37:13 +00:00
z3d
2f9a4f0fa5 Slight margin adjustments for the light theme. 2009-08-21 00:27:32 +00:00
zzz
37437da34d * I2CP: Fix the SessionConfig serializer in DataHelper,
so that UTF-8 tunnel names are not corrupted by
      I2CP and can be displayed on the console
    * Fix UTF-8 form submission on console and i2ptunnel
2009-08-20 22:22:07 +00:00
zzz
6d3a5856b4 options cleanup on configtunnels.jsp 2009-08-20 15:43:27 +00:00
z3d
4d4538a346 Space efficiency drive for light console theme. 2009-08-20 15:24:14 +00:00
zzz
327102a254 * Console:
- Put favicon on every page
      - Make every page UTF-8
2009-08-20 14:35:32 +00:00
zzz
3602eb14f5 kill deprecation warnings 2009-08-20 14:35:07 +00:00
z3d
cf82b51a1f Rename I2PTunnel Webmanager to I2P Tunnels Manager on edit client/server tunnels pages. 2009-08-20 12:10:18 +00:00
z3d
412d3bc2f8 merge of '1a3fcced1ae28b24a35236271c526379db98613f'
and 'a95bd8209bbd14b8c0a590ba071ecf5a0191644d'
2009-08-20 10:25:42 +00:00
z3d
4735508a0a I2PSnark. 2009-08-20 10:21:25 +00:00
zzz
9225d01b29 * Fix broken 'check for update' button on configupdate.jsp
* history for prop from test3, -16
2009-08-20 04:13:39 +00:00
zzz
7782970d51 propagate from branch 'i2p.i2p.zzz.test3' (head d65e8465671ba0b8f6f013b56045bf867e10a78e)
to branch 'i2p.i2p' (head e2ee75916f2ff6bd698585808a81071b44c978b1)
2009-08-19 23:44:19 +00:00
zzz
6f053287d5 * Update:
- Fix problems where a requested unsigned update would actually
        kick off a signed update
      - Fix problem when policy set to notify, and clicking
        check for update, incorrectly causing unsigned update download
        and bad messages
      - Verify zip integrity of unsigned updates
      - Move zip files to router dir, not base dir
      - More tweaks and cleanup
2009-08-19 20:20:25 +00:00
z3d
7a88f59f08 Optimize space layout on i2psnark ui. 2009-08-19 18:39:30 +00:00
z3d
d56aae8913 Minor changes to the I2PSnark UI. 2009-08-19 18:28:44 +00:00
z3d
a309a14396 Fixes for config page ui issues. 2009-08-19 17:05:59 +00:00
z3d
b80cbbdd4a Return of the mia <hr>'s. 2009-08-19 16:57:47 +00:00
zzz
5bc2dab1d2 * profiles.jsp:
- Rename the Failing column
      - Reduce the time cutoff again to 90m (was 2h)
2009-08-19 15:26:35 +00:00
sponge
8bbe7fabb3 Java code to set Router Console password for dr|z3d 2009-08-19 10:31:51 +00:00
zzz
c537d160a6 * XmlPull: Remove, unused.
Somehow, when I implemented UPnP, I thought it was required,
      but it isn't. ~50KB
2009-08-18 21:54:14 +00:00
zzz
475187fcbc * Stats:
- Fix BufferedStatsLog so it works at all
      - Don't instantiate BufferedStatsLog unless stats.logFilters
        property is defined (restart now required to enable logging)
        This eliminates the StatLogWriter thread and a decent
        amount of memory.
      - Move two CLI classes out of the lib
      - Commment out places where getStatLog() isn't checked for null
      - Cleanups
2009-08-18 20:33:15 +00:00
zzz
a379e36e24 more UTF-8 configs 2009-08-18 14:46:29 +00:00
zzz
a9054a3cab * Transports: Lower conn limit factor to 50 (was 60) 2009-08-18 14:44:57 +00:00
z3d
ea7a9c259f Remove extra whitespace in English readme; fix a couple of validation errors. 2009-08-18 12:45:33 +00:00
z3d
2cba48d4d7 Update history.txt to reflect latest changes. 2009-08-18 02:46:08 +00:00
z3d
42b79c5a20 Work on the classic theme i2ptunnels look and feel, mostly. 2009-08-18 02:38:00 +00:00
zzz
be9523f1e4 * Config files: Add some encoding help
* DataHelper, Router:
      - Save config files in UTF-8 rather than the default encoding,
        since we read them in UTF-8
    * jetty.xml: Change encoding to UTF-8
    * logs.jsp: Add system encoding
    * NTCP: Clean up clock skew shitlist message
    * Shitlist: Clean up expire message
    * WorkingDir: Ensure modified files are processed with UTF-8 encoding
2009-08-17 22:14:39 +00:00
z3d
6a8dd0f053 Revert xhtml regressions in i2ptunnel code; fixes for various validation issues. 2009-08-17 20:17:30 +00:00
z3d
1b63aa411b Replace all <hr /> and <br /> with <hr> and <br> whilst we're in html4 transitional. 2009-08-17 14:35:18 +00:00
z3d
33a7f3351b Start of validation cleanup. 2009-08-17 13:24:08 +00:00
z3d
f7af5e1329 Remove right justification on status stars. 2009-08-17 02:19:04 +00:00
z3d
3a9a029d70 Sidepanel fixes. Bumped to -14. 2009-08-17 02:13:10 +00:00
z3d
0aaacc86e2 Dark theme and ieshim.css tweaks; minor sidepanel mods. 2009-08-16 15:45:07 +00:00
z3d
1b8b7b741c Revert <br>'s to <hr>'s in sidepanel, remove tunnel status from table; fixes Opera display issue. Reported and partially fixed by sponge. 2009-08-15 20:19:39 +00:00
zzz
66831c619b cleanups 2009-08-15 19:51:55 +00:00
zzz
30628fb5f9 more clean targets 2009-08-15 19:51:13 +00:00
sponge
064ff8a7d2 2009-08-15 sponge
* Merge in dr|z3d and my own html fixes for router console java and jsp
      files so that Opera (and now IE?) doesn't puke anymore on the missing
      and misplaced HTML tags.
    * Optimized all jsp files so that they are shorter to save space, which
      is then used to fix the broken HTML. We should break even space-wise.
    * Bump to -13.
2009-08-15 16:28:24 +00:00
sponge
9a18955de3 merge of '522de7791fdad000d42bb5a01f139d913e74d7ef'
and 'ef33b50138594ef55a1dbcd6c77a3d3afeb22ff6'
2009-08-15 16:22:38 +00:00
sponge
35da3f3334 HTML bugfixes in routerconsole pages. 2009-08-15 16:08:33 +00:00
z3d
335d45f03e Fix borked snarkmanager.java before anyone notices. 2009-08-15 01:12:26 +00:00
z3d
c466cd77ad Add some <centre> tags to our router restart/shutdown event notices. 2009-08-14 21:40:45 +00:00
z3d
d998e2e9bb Theme tweaks, minor textual edits and a whole lot less. 2009-08-14 21:00:22 +00:00
zzz
0a20315280 * configpeer.jsp: Limit max displayed banned IPs
* jobs.jsp: Cleanup
    * eepsite_index_de.html: localhost -> 127.0.0.1
    * readme*html: localhost -> 127.0.0.1
2009-08-14 17:39:05 +00:00
zzz
01753f5aea * Ministreaming: Cleanups, deprecation, move demos out of the lib 2009-08-14 04:36:06 +00:00
zzz
bcd22cfbf3 * Console cleanups
* Router: Don't do some things when we are shutting down
    * VMCommSystem fixups
2009-08-14 01:52:47 +00:00
zzz
7e039d0339 tweak 2009-08-13 22:21:49 +00:00
zzz
ab08ac70aa * I2PTunnel:
- Make IRC Proxy non-shared, delayed-start, close-on-idle
        for new users, for the anonymity benefits (see "Shared Clients,
        Correlation and Collusion" http://zzz.i2p/topics/217 )
      - Remove "experimental" flag on new client options
    * configclients.jsp: Add full path to config file
    * Add some path help in some config files
2009-08-13 22:14:07 +00:00
zzz
5decf3cd7a Dont show firewall warning unless its for real 2009-08-13 18:46:14 +00:00
zzz
5c6d757e35 add size total 2009-08-13 18:25:45 +00:00
zzz
4b75be804f flags for leases 2009-08-13 15:35:37 +00:00
zzz
6515e6ee17 merge strings for efficiency 2009-08-13 15:21:22 +00:00
zzz
55e8583663 unused code out 2009-08-13 15:15:41 +00:00
sponge
3fbff71861 2009-08-11 sponge
* Code Janitor time! Many fixes and documenting fixes that should be
      done in the future. for the most part, this is a general code cleanup.
    * On smaller/embedded systems, the "final" keyword cleanups will have
      more of an impact than on larger systems.
    * Document missing hashCode() methods.
    * Unhide more variables to make code easier to read.
2009-08-11 21:58:56 +00:00
z3d
e5eea47b66 Lose the _blank targets on integrated console pages; yellow/green indicators in sidepanel. 2009-08-11 21:29:43 +00:00
zzz
b10b0e8f57 client/server icon selection, history for triple prop, -11 2009-08-11 16:22:43 +00:00
zzz
631a367b1c propagate from branch 'i2p.i2p.zzz.test3' (head d847100f901613ad765312ac9fed6d578d08d907)
to branch 'i2p.i2p' (head 63ce4ace08b7b7ba01531f0951ffc47ed57411a6)
2009-08-11 16:11:45 +00:00
zzz
8ea279fbe2 post-prop fixup 2009-08-11 16:09:44 +00:00
zzz
089572befd propagate from branch 'i2p.i2p.zzz.test2' (head 63cdcb547c0d33cd3c3c899b168ffab9f7ed2ebe)
to branch 'i2p.i2p' (head 52964ce47701fd8838e3f9c84af29d2463c83bc7)
2009-08-11 16:04:36 +00:00
zzz
0f96b9569a propagate from branch 'i2p.i2p.zzz.android' (head ad3a2f8952b533fbbae2868097f6a20d525e07bf)
to branch 'i2p.i2p' (head 2c89302763aa8dcb1a59e3e1f83fd653e01c15a5)
2009-08-11 15:57:38 +00:00
zzz
d1114666de fix comment 2009-08-11 15:37:12 +00:00
z3d
f676abc0d4 Fix regression in classic theme that broke the proxy error pages. 2009-08-11 14:50:12 +00:00
z3d
3492b7219b .10 2009-08-11 10:50:29 +00:00
z3d
a12ae6e399 Ongoing overhaul of the sidepanel. 2009-08-11 10:45:20 +00:00
zzz
9b2e18a65b * NetDb stats: Hide part. tunnel total events, effective next release 2009-08-10 19:11:21 +00:00
zzz
c52ccf7eef comment out dead oldconsole code 2009-08-10 17:48:16 +00:00
zzz
1282434684 * Move StatsGenerator from router to routerconsole
* Move the unused AdminManager from router to the apps directory
2009-08-09 19:33:15 +00:00
zzz
4e844187f7 revert another change from when this branch had reseed changes 2009-08-09 15:34:26 +00:00
zzz
ccd67d658d propagate from branch 'i2p.i2p' (head 12e0efc6ee1b41bd216403b5ac11facb9c70b1fb)
to branch 'i2p.i2p.zzz.android' (head a519611a2637a052eff6b9b8d9363b3fe0550840)
2009-08-09 14:35:41 +00:00
zzz
62383819cb propagate from branch 'i2p.i2p' (head 6ab0f64b9f4992591ed989f8d89a859fc3ceaeaf)
to branch 'i2p.i2p.zzz.android' (head e02886e19d254dac40a7f775e102e60560efe5e5)
2009-08-09 14:34:21 +00:00
zzz
3febcf6043 * Updater:
- Add new unsigned update option, triggered by
        last-modified date, using the new EepHead.
        Buttons still are not hidden after download complete.
      - Make the .sud updater use the temp dir when proxied
      - Several cleanups
2009-08-09 14:28:20 +00:00
zzz
a431137f45 comments 2009-08-09 14:21:47 +00:00
z3d
5a6e14b9df Add a static image to the local destinations list to indicate server/client
status of local destinations; zzz to add server/client logic.
;
2009-08-09 10:50:54 +00:00
zzz
536bc3112f add comment 2009-08-08 18:53:26 +00:00
z3d
81b2e6b789 Fix a sidebar regression. 2009-08-08 18:03:05 +00:00
zzz
4cf376ec1d Rename the shitlist and blocklist 2009-08-08 17:14:30 +00:00
zzz
d3a0c91398 more possible bork prevention 2009-08-08 17:11:05 +00:00
z3d
43140d3efd Overhaul of sidepanel layout, with concommitant tweaks and fudges to the css. 2009-08-08 15:34:58 +00:00
zzz
3dd3bf829d propagate from branch 'i2p.i2p' (head 6ab0f64b9f4992591ed989f8d89a859fc3ceaeaf)
to branch 'i2p.i2p.zzz.test2' (head 3e85c6cfff244d09df42d967d3a3cdf77053890d)
2009-08-08 14:30:07 +00:00
zzz
bdcad06ece EepHead 2009-08-08 14:29:18 +00:00
zzz
69fdfb0635 -8 2009-08-07 18:36:09 +00:00
zzz
55a8002b9c propagate from branch 'i2p.i2p.zzz.test3' (head 1f086d33dd3479afceb025d2da7956d7470fb3e5)
to branch 'i2p.i2p' (head 6959293ce260b9da4d61776717c02e20a0c7b2dd)
2009-08-07 18:30:04 +00:00
z3d
e36f9b2273 UI enhancements. 2009-08-07 18:19:42 +00:00
zzz
70ae99f31a fix broken persistent key storage 2009-08-07 17:03:26 +00:00
zzz
15565ca09c more hellips 2009-08-07 16:17:52 +00:00
zzz
f188e02a5d move css include up to possibly reduce servlet borkage 2009-08-07 15:49:36 +00:00
zzz
4d005349a7 * I2PTunnel:
- Move the privkey files from the app dir to the
        config dir, in preparation for splitting the two
        dirs by default
2009-08-06 18:59:06 +00:00
zzz
c65a97882e * Eepsite:
- Quote the jetty.xml path in clients.config,
        and adjust the migration function, to fix the
        eepsite-won't-start bug on windows
2009-08-05 19:18:17 +00:00
zzz
cf880548d9 * HTTP Proxy:
- Restore the localhost error message
      - Catch 127.0.0.1:xxxx addresses too
2009-08-05 19:15:03 +00:00
zzz
b5876e7f04 * Router: Move the WorkingDir class from i2p.jar to router.jar 2009-08-05 17:08:04 +00:00
z3d
2436ea1131 More classic/ieshim futzing. 2009-08-03 23:10:53 +00:00
z3d
5395b6829a Ongoing betterment of the classic theme. 2009-08-03 22:07:34 +00:00
zzz
c3af134a5b - Remove UTC time from summary bar
- Increase skew warning threshold to 3s (was 100ms)
2009-08-03 20:02:28 +00:00
z3d
cce72a5f1b More classic manoeuvres 2009-08-03 19:09:21 +00:00
z3d
32c143f8d7 More classic tweaks. 2009-08-03 18:17:11 +00:00
z3d
895cb1f2e5 More ieshim.css goodness. 2009-08-03 15:48:17 +00:00
zzz
7986f5646e truncate long dest names 2009-08-03 15:29:35 +00:00
z3d
59a5776f9d More Classic theme tweaks. 2009-08-03 15:28:49 +00:00
z3d
fc8c0ccfe1 Minor classic theme tweakage. 2009-08-03 15:00:15 +00:00
z3d
0930ead814 Ongoing Classic theme renovations. 2009-08-03 14:45:44 +00:00
zzz
b5a17637cb * Wrapper:
- Extend timeout to 20s (was 5s)
      - Shorten ping interval to 5m (was 10m)
2009-08-03 14:18:55 +00:00
z3d
460c8a319f Extensive overhaul of the classic theme; css hacks for IE! 2009-08-03 13:24:55 +00:00
zzz
7aa051ef4f add custom error page 2009-08-02 20:12:16 +00:00
z3d
c7c132c0ac More classic theme tweaks, I2PSnark UI fixes, and enhanced proxy error messages for classic. 2009-08-02 19:05:40 +00:00
zzz
d84b1125eb * Timestamper: Don't start thread if not enabled 2009-08-02 16:16:57 +00:00
zzz
8d4a1899f2 * Streaming: New option i2p.streaming.answerPings (default true) 2009-08-02 14:51:06 +00:00
z3d
3a0cdf1388 More IE overflow fixes; remove max-width from i2psnark css. 2009-08-02 13:57:29 +00:00
zzz
d8d76fd327 * Ministreaming:
- Make getInt() static
      - Move the big TestSwarm class out of the lib
2009-08-02 13:37:23 +00:00
z3d
abf7296de1 Fix for IE overflow issue; classic theme enhanced; more UI enhancements. 2009-08-02 12:57:50 +00:00
zzz
316c20ee44 Dont count yourself as a known peer 2009-08-02 11:54:14 +00:00
zzz
13e8c95667 Hide update button when shutting down 2009-08-01 17:42:27 +00:00
zzz
a14ad423a6 formatDuration tweak 2009-08-01 17:22:57 +00:00
zzz
e1a5d5e19a post-release cleanup 2009-08-01 14:43:04 +00:00
z3d
6e29eddaa7 More UI layout tweak & fixes to config page(s). 2009-08-01 04:14:05 +00:00
z3d
65ae26a961 More UI layout enhancements to the config pages. 2009-08-01 03:28:42 +00:00
z3d
1afd946a94 Close quotes on div to ensure buttons align to the right in configui.jsp. 2009-08-01 01:36:59 +00:00
z3d
d6820634ac Further enhancements to the configuration pages. 2009-08-01 01:15:12 +00:00
z3d
95dd744633 Give the radio and checkbox icons some breathing space. 2009-07-31 19:40:05 +00:00
z3d
219af36090 Ensure all buttons in dark theme have consistent font size. 2009-07-31 19:20:07 +00:00
z3d
24e83398ba UI fixes: text boxes, buttons, radio/checkbox width. Enhanced /peers.jsp. 2009-07-31 19:15:35 +00:00
zzz
4172ed21a9 take jetty back out of the updater 2009-07-31 17:56:02 +00:00
zzz
1cba7b8ec1 * Core:
- Catch unzip fd leaks on error
      - Move 2 test classes out of the lib
2009-07-31 17:55:38 +00:00
zzz
0bef85277e try to automate the release process 2009-07-31 02:36:15 +00:00
z3d
2f4c428316 merge of '2cffbafe300f5dce55a82db20e2bf8f61ae8717f'
and 'b4f1b960a7d1bf1a3d5baaf9ddea72625177726a'
2009-07-30 23:13:10 +00:00
z3d
4de0b73cd8 Ongoing UI enhancements; peers.jsp gets some love. 2009-07-30 23:10:48 +00:00
zzz
2e5caac8bf - Update to Android 1.5 SDK
- Fix RouterContext problem
2009-07-03 22:13:18 +00:00
zzz
7972c0c862 - Fix another Mac class problem
- Change to RouterLaunch main so we get a wrapper.log
2009-06-29 17:42:13 +00:00
zzz
3fee5a3781 more cleanup, set dirs 2009-06-29 16:51:19 +00:00
zzz
db45e74fcc Cleanup after prop from i2p.i2p:
- Remove I2PFile, FileStreamFactory hacks
- Remove custom reseed stuff
2009-06-29 14:51:02 +00:00
zzz
206e45b9e8 propagate from branch 'i2p.i2p' (head 44eff3cb8553cf29a7e4eb6c02f624648f91b124)
to branch 'i2p.i2p.zzz.android' (head 66bd014debdd51906e18555d12906ee20c016ef6)
2009-06-29 14:04:49 +00:00
zzz
5022575429 - Deal with conflicting bouncycastle libs take #2
- Disable NTCP
- Shuffle the startup/shutdown tasks some
2009-03-13 21:49:27 +00:00
zzz
b8f22bf3bf - Add FileStreamFactory and I2PFile to deal with the problems from
the code CWD is / but the only writable directory is
  /data/data/net.i2p.router/files/ - still a ton of places to be
  fixed, will be fixed up as things get working
- Load some config files from resources at startup
- Fix up logging
- Add reseed capability, by copying some code over from routerconsole
- Deal with conflicting bouncycastle libs
2009-03-13 18:56:16 +00:00
zzz
5a8b3eb8f3 Move HMac to I2PHMac, as jrandom implemented changes that make it
incompatible with the HMac in the android libraries.
2009-03-13 18:27:29 +00:00
zzz
d26ac84126 two memory savers 2009-03-12 18:22:49 +00:00
zzz
82045b3fde android logging 2009-03-10 22:30:33 +00:00
zzz
14ce5a2432 hello world 2009-03-10 05:20:48 +00:00
431 changed files with 10841 additions and 8546 deletions

View File

@@ -3,9 +3,10 @@ Headless I2P installation instructions
1) java -jar i2pinstall.exe -console (you've already done this)
This will run the installer in text mode, including running the postinstall.sh
script, which will start the router and launch a browser.
script. After that, you may run 'sh i2prouter start'
which will start the router and attempt to launch a browser.
If you do not have an X server running, the browser launch will fail, and
If you do not have an X server running, the browser launch will probably fail, and
you may use:
lynx http://localhost:7657/index.jsp
to configure the router.
@@ -13,6 +14,16 @@ to configure the router.
If you're having trouble, swing by http://forum.i2p2.de/, check the
website at http://www.i2p2.de/, or get on irc://irc.freenode.net/#i2p
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
when I2P is run for the first time. It also creates files in the system
temporary directory specified by the Java Virtual Machine.
To change the location of these directories, or to configure I2P to
put all files in this directory (the so-called "portable" configuration),
edit the files i2prouter (Linux) and wrapper.config (Linux and Windows)
where there are comments labeled "PORTABLE". Do this before you
run I2P for the first time.
To run I2P explicitly:
(*nix): sh i2prouter start
(win*): I2P.exe

View File

@@ -76,9 +76,6 @@ Public domain except as listed below:
Copyright (C) 2003-2006 Satoshi Konno
See licenses/LICENSE-UPnP.txt
XMLPull library used by UPnP:
See licenses/LICENSE-Apache2.0.txt
GeoIP data free to use, courtesy http://ip-to-country.webhosting.info/

View File

@@ -5,7 +5,7 @@
GCJ=gcj #/usr/local/gcc-4.0.2/bin/gcj
EXTRA_LD_PATH= #/usr/local/gcc-4.0.2/lib
ANT=ant #/opt/apache-ant-1.6.5/bin/ant
ANT_TARGET=buildclean
ANT_TARGET=build2
NATIVE_DIR=native
##
@@ -24,20 +24,22 @@ JAR_BASE=i2p.jar mstreaming.jar streaming.jar
JAR_CLIENTS=i2ptunnel.jar sam.jar
JAR_ROUTER=router.jar
JAR_JBIGI=jbigi.jar
JAR_XML=xml-apis.jar resolver.jar xercesImpl.jar
JAR_CONSOLE=\
i2psnark.jar \
javax.servlet.jar \
commons-el.jar \
commons-logging.jar \
jasper-runtime.jar \
ant-apache-bcel.jar \
ant.jar \
jasper-compiler.jar \
org.mortbay.jetty.jar \
routerconsole.jar
JAR_SUCKER=jdom.jar rome-0.7.jar sucker.jar
LIBI2P_JARS=${JAR_BASE} ${JAR_CLIENTS} ${JAR_ROUTER} ${JAR_JBIGI}
LIBSAM_JARS=${JAR_BASE} sam.jar
LIBROUTER_JARS=i2p.jar ${JAR_ROUTER} ${JAR_JBIGI}
LIBCONSOLE_JARS=${LIBROUTER_JARS} ${JAR_CONSOLE}
LIBSNARK_JARS=${LIBROUTER_JARS} i2psnark.jar
# update:
# similar error with gcj 4.3.3.
#
# unfortunately, its not quite ready for most end users, as the
# ${JAR_CONSOLE} fails to compile with:
# org/apache/commons/logging/impl/LogKitLogger.java: In class 'org.apache.commons.logging.impl.LogKitLogger':
@@ -95,7 +97,36 @@ native_shared: libi2p.so
@echo " i2ptunnel will, so it will start all the proxies defined in i2ptunnel.config"
libi2p.so:
@echo "* Building libi2p.so"
@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/libi2p.so ${LIBI2P_JARS} ; cd .. )
@ls -l ${NATIVE_DIR}/libi2p.so
@echo "* libi2p.so built"
@echo "* Building $@"
@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBI2P_JARS} ; cd .. )
@ls -l ${NATIVE_DIR}/$@
@echo "* $@ built"
sam: jars libi2psam.so
libi2psam.so:
@echo "* Building $@"
@rm -f ${NATIVE_DIR}/$@
@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBSAM_JARS} ; cd .. )
@ls -l ${NATIVE_DIR}/$@
@echo "* $@ built"
router: jars libi2prouter.so
libi2prouter.so:
@echo "* Building $@"
@rm -f ${NATIVE_DIR}/$@
@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBROUTER_JARS} ; cd .. )
@ls -l ${NATIVE_DIR}/$@
@echo "* $@ built"
console: jars libi2pconsole.so
# doesn't work, see above
libi2pconsole.so:
@echo "* Building $@"
@rm -f ${NATIVE_DIR}/$@
@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBCONSOLE_JARS} ; cd .. )
@ls -l ${NATIVE_DIR}/$@
@echo "* $@ built"

View File

@@ -24,7 +24,7 @@ mkdir -p $PKG
# es: usr/local
NAME=i2p-base
VERSION=0.0.1
BUILD=1sim
BUILD=1sponge
ARCH=noarch
INSTALL_DIR=opt
cd $PKG
@@ -38,5 +38,9 @@ sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
#
# Not really that important to exec this.
#requiredbuilder -v -y -s $CWD $PKG
#
cat $CWD/slack-required > $PKG/install/slack-required
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.tgz

View File

@@ -15,7 +15,7 @@
# It's suggested to subscribe to various dns host, like i2host.i2p
# For any additional information, visit i2host.i2p and forum.i2p
BUILD=1sim
BUILD=1sponge
# put here installation dir, without first and last /
# eg: usr/local
@@ -113,5 +113,11 @@ sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
#
# requiredbuilder fucks 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
makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.tgz

View File

@@ -1,2 +1,4 @@
glibc >= 2.7-i486-17 | glibc-solibs >= 2.7-i486-17
perl >= 5.10.0-i486-1
jre >= 5
i2p-base >= 0.0.1
bash >= 3.1.017

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.i2p.router"
android:versionCode="1"
android:versionName="1.0.0">
<uses-permission android:name="android.permission.INTERNET" />
<!-- 3 = 1.5, 2 = 1.1, 1 = 1.0; would probably work with 1 but don't have a 1.0 SDK to test against -->
<uses-sdk android:minSdkVersion="2" />
<application android:label="@string/app_name">
<activity android:name=".I2PAndroid"
android:label="@string/app_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

25
android/README.txt Normal file
View File

@@ -0,0 +1,25 @@
These instructions are for the 1.5 SDK.
The build file is not compatible with the 1.1 SDK any more.
#Unzip the android SDK in ../../
#So then the android tools will be in ../../android-sdk-linux_x86-1.5_r2/tools/
#then build the android apk file:
ant debug
# Create the android 1.5 virtual device
# (don't make a custom hardware profile)
../../android-sdk-linux_x86-1.5_r2/tools/android create avd --name i2p --target 2
#then run the emulator:
../../android-sdk-linux_x86-1.5_r2/tools/emulator -avd i2p &
#then wait a couple minutes until the emulator is up
#then install the I2P app
ant install
#then run the debugger
../../android-sdk-linux_x86-1.5_r2/tools/ddms &
#to rebuild and reinstall to emulator:
ant reinstall

352
android/build.xml Normal file
View File

@@ -0,0 +1,352 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name=".I2PAndroid" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contain the path to the SDK. It should *NOT* be checked in in Version
Control Systems. -->
<property file="local.properties"/>
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the default property values
used by the Ant rules.
Here are some properties you may want to change/update:
application-package
the name of your application package as defined in the manifest. Used by the
'uninstall' rule.
source-folder
the name of the source folder. Default is 'src'.
out-folder
the name of the output folder. Default is 'bin'.
Properties related to the SDK location or the project target should be updated
using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems.
-->
<property file="build.properties"/>
<!-- The default.properties file is created and updated by the 'android' tool, as well
as ADT.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems. -->
<property file="default.properties"/>
<!-- Custom Android task to deal with the project target, and import the proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk-location}/tools/lib/anttasks.jar" />
<pathelement path="${sdk-location}/tools/lib/sdklib.jar" />
<pathelement path="${sdk-location}/tools/lib/androidprefs.jar" />
<pathelement path="${sdk-location}/tools/lib/apkbuilder.jar" />
<pathelement path="${sdk-location}/tools/lib/jarutils.jar" />
</path>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>
<!-- Execute the Android Setup task that will setup some properties specific to the target,
and import the rules files.
To customize the rules, copy/paste them below the task, and disable import by setting
the import attribute to false:
<setup import="false" />
This will ensure that the properties are setup correctly but that your customized
targets are used.
-->
<setup import="false" />
<!--
================================================================================
New I2P rules
================================================================================
-->
<target name="buildrouter" depends="dirs" >
<!-- build router and core -->
<ant dir=".." target="buildrouter" />
<!-- router -->
<copy file="../build/router.jar" todir="${external-libs-folder}" />
<!-- core -->
<mkdir dir="tmp" />
<unjar src="../build/i2p.jar" dest="tmp/" />
<delete file="tmp/net/i2p/util/LogWriter.class" />
<!-- org.bouncycastle.crypto already in android
but we need a little trickery because our HMac is incompatible...
and the libs aren't in the SDK to compile against??? -->
<jar destfile="${external-libs-folder}/crypto.jar" >
<fileset dir="tmp/" >
<include name="org/bouncycastle/crypto/Digest.class" />
<include name="org/bouncycastle/crypto/Mac.class" />
<include name="org/bouncycastle/crypto/digests/GeneralDigest.class" />
<include name="org/bouncycastle/crypto/digests/MD5Digest.class" />
</fileset>
</jar>
<delete>
<fileset dir="tmp/" >
<include name="org/bouncycastle/crypto/Digest.class" />
<include name="org/bouncycastle/crypto/Mac.class" />
<include name="org/bouncycastle/crypto/digests/GeneralDigest.class" />
<include name="org/bouncycastle/crypto/digests/MD5Digest.class" />
</fileset>
</delete>
<!--
<delete dir="tmp/org/bouncycastle/" />
<delete file="tmp/net/i2p/crypto/HMACGenerator.class" />
-->
<delete file="tmp/org/bouncycastle/" />
<!-- lots of unneeded stuff could be deleted here -->
<jar destfile="${external-libs-folder}/i2p.jar" basedir="tmp/" />
<!-- some resources -->
<mkdir dir="res/drawable/" />
<copy file="../installer/resources/themes/console/images/i2plogo.png" todir="res/drawable/" />
<copy file="../installer/resources/blocklist.txt" tofile="res/raw/blocklist_txt" />
</target>
<target name="hackcleanup">
<delete file="${external-libs-folder}/crypto.jar" />
</target>
<!--
================================================================================
From here down copied from SDK platforms/android-1.1/templates/android_rules.xml
and then modified
================================================================================
-->
<!--
This rules file is meant to be imported by the custom Ant task:
com.android.ant.AndroidInitTask
The following properties are put in place by the importing task:
android-jar, android-aidl, aapt, aidl, and dx
Additionnaly, the task sets up the following classpath reference:
android.target.classpath
This is used by the compiler task as the boot classpath.
-->
<!-- Custom tasks -->
<taskdef name="aaptexec"
classname="com.android.ant.AaptExecLoopTask"
classpathref="android.antlibs"/>
<taskdef name="apkbuilder"
classname="com.android.ant.ApkBuilderTask"
classpathref="android.antlibs"/>
<!-- Properties -->
<property name="android-tools" value="${sdk-location}/tools" />
<!-- Input directories -->
<property name="source-folder" value="src" />
<property name="gen-folder" value="gen" />
<property name="resource-folder" value="res" />
<property name="asset-folder" value="assets" />
<property name="source-location" value="${basedir}/${source-folder}" />
<!-- folder for the 3rd party java libraries -->
<property name="external-libs-folder" value="libs" />
<!-- folder for the native libraries -->
<property name="native-libs-folder" value="libs" />
<!-- Output directories -->
<property name="gen-folder" value="gen" />
<property name="out-folder" value="bin" />
<property name="out-classes" value="${out-folder}/classes" />
<property name="out-classes-location" value="${basedir}/${out-classes}"/>
<!-- out folders for a parent project if this project is an instrumentation project -->
<property name="main-out-folder" value="../${out-folder}" />
<property name="main-out-classes" value="${main-out-folder}/classes"/>
<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${out-folder}/${dex-file}" />
<!-- dx does not properly support incorrect / or \ based on the platform
and Ant cannot convert them because the parameter is not a valid path.
Because of this we have to compute different paths depending on the platform. -->
<condition property="intermediate-dex-location"
value="${basedir}\${intermediate-dex}"
else="${basedir}/${intermediate-dex}" >
<os family="windows"/>
</condition>
<!-- The final package file to generate -->
<property name="out-debug-package" value="${out-folder}/${ant.project.name}-debug.apk"/>
<!-- Tools -->
<condition property="exe" value=".exe" else=""><os family="windows"/></condition>
<property name="adb" value="${android-tools}/adb${exe}"/>
<!-- rules -->
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${resource-folder}" />
<mkdir dir="${external-libs-folder}" />
<mkdir dir="${gen-folder}" />
<mkdir dir="${out-folder}" />
<mkdir dir="${out-classes}" />
</target>
<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<echo>Generating R.java / Manifest.java from the resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-m" />
<arg value="-J" />
<arg path="${gen-folder}" />
<arg value="-M" />
<arg path="AndroidManifest.xml" />
<arg value="-S" />
<arg path="${resource-folder}" />
<arg value="-I" />
<arg path="${android-jar}" />
</exec>
</target>
<!-- Generate java classes from .aidl files. -->
<target name="aidl" depends="dirs">
<echo>Compiling aidl files into Java classes...</echo>
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-aidl}" />
<arg value="-I${source-folder}" />
<arg value="-o${gen-folder}" />
<fileset dir="${source-folder}">
<include name="**/*.aidl"/>
</fileset>
</apply>
</target>
<!-- Compile this project's .java files into .class files. -->
<!-- I2P add buildrouter -->
<target name="compile" depends="buildrouter, resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
destdir="${out-classes}"
bootclasspathref="android.target.classpath">
<src path="${source-folder}" />
<src path="${gen-folder}" />
<classpath>
<fileset dir="${external-libs-folder}" includes="*.jar"/>
<pathelement path="${main-out-classes}"/>
</classpath>
</javac>
</target>
<!-- Convert this project's .class files into .dex files. -->
<!-- I2P add hackcleanup -->
<target name="dex" depends="compile, hackcleanup">
<echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<!-- I2P this is a bad sign that we need this -->
<arg value="-JXmx256m" />
<arg value="--dex" />
<arg value="--output=${intermediate-dex-location}" />
<arg path="${out-classes-location}" />
<fileset dir="${external-libs-folder}" includes="*.jar"/>
</apply>
</target>
<!-- Put the project's resources into the output package file
This actually can create multiple resource package in case
Some custom apk with specific configuration have been
declared in default.properties.
-->
<target name="package-resources">
<echo>Packaging resources</echo>
<aaptexec executable="${aapt}"
command="package"
manifest="AndroidManifest.xml"
resources="${resource-folder}"
assets="${asset-folder}"
androidjar="${android-jar}"
outfolder="${out-folder}"
basename="${ant.project.name}" />
</target>
<!-- Package the application and sign it with a debug key.
This is the default target when building. It is used for debug. -->
<target name="debug" depends="dex, package-resources">
<apkbuilder
outfolder="${out-folder}"
basename="${ant.project.name}"
signed="true"
verbose="false">
<file path="${intermediate-dex}" />
<sourcefolder path="${source-folder}" />
<jarfolder path="${external-libs-folder}" />
<nativefolder path="${native-libs-folder}" />
</apkbuilder>
</target>
<!-- Package the application without signing it.
This allows for the application to be signed later with an official publishing key. -->
<target name="release" depends="dex, package-resources">
<apkbuilder
outfolder="${out-folder}"
basename="${ant.project.name}"
signed="false"
verbose="false">
<file path="${intermediate-dex}" />
<sourcefolder path="${source-folder}" />
<jarfolder path="${external-libs-folder}" />
<nativefolder path="${native-libs-folder}" />
</apkbuilder>
<echo>All generated packages need to be signed with jarsigner before they are published.</echo>
</target>
<!-- Install the package on the default emulator -->
<target name="install" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg path="${out-debug-package}" />
</exec>
</target>
<target name="reinstall" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg path="${out-debug-package}" />
</exec>
</target>
<!-- Uinstall the package from the default emulator -->
<target name="uninstall">
<echo>Uninstalling ${application-package} from the default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="uninstall" />
<arg path="${application-package}" />
</exec>
</target>
<target name="help">
<!-- displays starts at col 13
|13 80| -->
<echo>Android Ant Build. Available targets:</echo>
<echo> help: Displays this help.</echo>
<echo> debug: Builds the application and sign it with a debug key.</echo>
<echo> release: Builds the application. The generated apk file must be</echo>
<echo> signed before it is published.</echo>
<echo> install: Installs the debug package onto a running emulator or</echo>
<echo> device. This can only be used if the application has </echo>
<echo> not yet been installed.</echo>
<echo> reinstall: Installs the debug package on a running emulator or</echo>
<echo> device that already has the application.</echo>
<echo> The signatures must match.</echo>
<echo> uninstall: uninstall the application from a running emulator or</echo>
<echo> device.</echo>
</target>
</project>

View File

@@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-2

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, I2PAndroid"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/i2plogo"
/>
</LinearLayout>

View File

@@ -0,0 +1,3 @@
logger.defaultLevel=INFO
logger.record.net.i2p.router.transport.FIFOBandwidthRefiller=ERROR
logger.record.net.i2p.stat.Rate=ERROR

View File

@@ -0,0 +1,16 @@
# initial router.config
# temp directory
i2p.dir.temp=/data/data/net.i2p.router/files/tmp
i2p.dir.pid=/data/data/net.i2p.router/files/tmp
# save memory
prng.buffers=2
router.decayingBloomFilterM=20
stat.full=false
i2np.udp.maxConnections=30
# no I2CP
i2p.dummyClientFacade=true
# for now
i2np.ntcp.enable=false
# not on android
i2np.upnp.enable=false
routerconsole.geoip.enable=false

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">I2PAndroid</string>
</resources>

View File

@@ -0,0 +1,142 @@
package net.i2p.router;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.os.Bundle;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.List;
import net.i2p.router.Router;
import net.i2p.router.RouterLaunch;
// import net.i2p.util.NativeBigInteger;
public class I2PAndroid extends Activity
{
static Context _context;
private static final String DIR = "/data/data/net.i2p.router/files";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_context = this; // Activity extends Context
debugStuff();
initialize();
// 300ms per run
// 5x slower than java on my server and 50x slower than native on my server
// NativeBigInteger.main(null);
}
public void onRestart()
{
System.err.println("onRestart called");
super.onRestart();
}
public void onStart()
{
System.err.println("onStart called");
super.onStart();
RouterLaunch.main(null);
System.err.println("Router.main finished");
}
public void onResume()
{
System.err.println("onResume called");
super.onResume();
}
public void onPause()
{
System.err.println("onPause called");
super.onPause();
}
public void onStop()
{
System.err.println("onStop called");
super.onStop();
// from routerconsole ContextHelper
List contexts = RouterContext.listContexts();
if ( (contexts == null) || (contexts.size() <= 0) )
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
RouterContext ctx = (RouterContext)contexts.get(0);
// shutdown() doesn't return so use shutdownGracefully()
ctx.router().shutdownGracefully(Router.EXIT_HARD);
System.err.println("shutdown complete");
}
public void onDestroy()
{
System.err.println("onDestroy called");
super.onDestroy();
}
public static Context getContext() {
return _context;
}
private void debugStuff() {
System.err.println("java.io.tmpdir" + ": " + System.getProperty("java.io.tmpdir"));
System.err.println("java.vendor" + ": " + System.getProperty("java.vendor"));
System.err.println("java.version" + ": " + System.getProperty("java.version"));
System.err.println("os.arch" + ": " + System.getProperty("os.arch"));
System.err.println("os.name" + ": " + System.getProperty("os.name"));
System.err.println("os.version" + ": " + System.getProperty("os.version"));
System.err.println("user.dir" + ": " + System.getProperty("user.dir"));
System.err.println("user.home" + ": " + System.getProperty("user.home"));
System.err.println("user.name" + ": " + System.getProperty("user.name"));
}
private void initialize() {
// Until we can edit the router.config on the device,
// copy it from the resource every time.
// File f = new I2PFile("router.config");
// if (!f.exists()) {
copyResourceToFile(R.raw.router_config, "router.config");
copyResourceToFile(R.raw.logger_config, "logger.config");
copyResourceToFile(R.raw.blocklist_txt, "blocklist.txt");
// }
// Set up the locations so Router and WorkingDir can find them
System.setProperty("i2p.dir.base", DIR);
System.setProperty("i2p.dir.config", DIR);
System.setProperty("wrapper.logfile", DIR + "/wrapper.log");
}
private void copyResourceToFile(int resID, String f) {
InputStream in = null;
FileOutputStream out = null;
System.err.println("Creating file " + f + " from resource");
byte buf[] = new byte[4096];
try {
// Context methods
in = getResources().openRawResource(resID);
out = openFileOutput(f, 0);
int read = 0;
while ( (read = in.read(buf)) != -1)
out.write(buf, 0, read);
} catch (IOException ioe) {
} catch (Resources.NotFoundException nfe) {
} finally {
if (in != null) try { in.close(); } catch (IOException ioe) {}
if (out != null) try { out.close(); } catch (IOException ioe) {}
}
}
}

View File

@@ -0,0 +1,163 @@
package net.i2p.util;
/*
* public domain
*
*/
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
* bridge to android logging
*
* @author zzz
*/
class LogWriter implements Runnable {
private final static long CONFIG_READ_ITERVAL = 10 * 1000;
private long _lastReadConfig = 0;
private long _numBytesInCurrentFile = 0;
private OutputStream _currentOut; // = System.out
private int _rotationNum = -1;
private String _logFilenamePattern;
private File _currentFile;
private LogManager _manager;
private boolean _write;
private LogWriter() { // nop
}
public LogWriter(LogManager manager) {
_manager = manager;
}
public void stopWriting() {
_write = false;
}
public void run() {
_write = true;
try {
while (_write) {
flushRecords();
rereadConfig();
}
System.err.println("Done writing");
} catch (Exception e) {
System.err.println("Error writing the logs: " + e.getMessage());
e.printStackTrace();
}
}
public void flushRecords() { flushRecords(true); }
public void flushRecords(boolean shouldWait) {
try {
List records = _manager._removeAll();
if (records == null) return;
for (int i = 0; i < records.size(); i++) {
LogRecord rec = (LogRecord) records.get(i);
writeRecord(rec);
}
} catch (Throwable t) {
t.printStackTrace();
} finally {
if (shouldWait) {
try {
synchronized (this) {
this.wait(10*1000);
}
} catch (InterruptedException ie) { // nop
}
}
}
}
public String currentFile() {
return _currentFile != null ? _currentFile.getAbsolutePath() : "uninitialized";
}
private void rereadConfig() {
long now = Clock.getInstance().now();
if (now - _lastReadConfig > CONFIG_READ_ITERVAL) {
_manager.rereadConfig();
_lastReadConfig = now;
}
}
private void writeRecord(LogRecord rec) {
if (rec.getThrowable() == null)
log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage());
else
log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage(), rec.getThrowable());
}
public void log(int priority, Class src, String name, String threadName, String msg) {
if (src != null) {
String tag = src.getName();
int dot = tag.lastIndexOf(".");
if (dot >= 0)
tag = tag.substring(dot + 1);
android.util.Log.println(toAndroidLevel(priority),
tag,
'[' + threadName + "] " + msg);
} else if (name != null)
android.util.Log.println(toAndroidLevel(priority),
name,
'[' + threadName + "] " + msg);
else
android.util.Log.println(toAndroidLevel(priority),
threadName, msg);
}
public void log(int priority, Class src, String name, String threadName, String msg, Throwable t) {
if (src != null) {
String tag = src.getName();
int dot = tag.lastIndexOf(".");
if (dot >= 0)
tag = tag.substring(dot + 1);
android.util.Log.println(toAndroidLevel(priority),
tag,
'[' + threadName + "] " + msg +
' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
} else if (name != null)
android.util.Log.println(toAndroidLevel(priority),
name,
'[' + threadName + "] " + msg +
' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
else
android.util.Log.println(toAndroidLevel(priority),
threadName,
msg + ' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
}
private static int toAndroidLevel(int level) {
switch (level) {
case Log.DEBUG:
return android.util.Log.DEBUG;
case Log.INFO:
return android.util.Log.INFO;
case Log.WARN:
return android.util.Log.WARN;
case Log.ERROR:
case Log.CRIT:
default:
return android.util.Log.ERROR;
}
}
private static final String replace(String pattern, int num) {
char c[] = pattern.toCharArray();
StringBuffer buf = new StringBuffer();
for (int i = 0; i < c.length; i++) {
if ( (c[i] != '#') && (c[i] != '@') )
buf.append(c[i]);
else
buf.append(num);
}
return buf.toString();
}
}

View File

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

View File

@@ -39,6 +39,9 @@ import java.util.Map;
* Utility class providing methods to parse and write files in config file
* format, and subscription file format.
*
* TODO: Change file encoding from default to UTF-8?
* Or switch to the DataHelper loadProps/storeProps methods?
*
* @author Ragnarok
*/
public class ConfigParser {

View File

@@ -1 +1,7 @@
# NOTE: This I2P config file must use UTF-8 encoding
#
# If you have a 'split' directory installation, with configuration
# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
# edit the file in the configuration directory, NOT the install directory.
#
i2psnark.dir=i2psnark

View File

@@ -7,7 +7,6 @@ package org.klomp.snark;
import java.util.Arrays;
import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.client.I2PSessionException;
import net.i2p.client.I2PClient;
import net.i2p.client.I2PSession;

View File

@@ -137,6 +137,7 @@ public class BitField
return count >= size;
}
@Override
public String toString()
{
// Not very efficient

View File

@@ -17,6 +17,7 @@ import net.i2p.I2PException;
import net.i2p.client.I2PSession;
import net.i2p.client.streaming.I2PServerSocket;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketEepGet;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.data.DataFormatException;
@@ -46,7 +47,7 @@ public class I2PSnarkUtil {
private Map _opts;
private I2PSocketManager _manager;
private boolean _configured;
private Set _shitlist;
private final Set _shitlist;
private int _maxUploaders;
private int _maxUpBW;
private int _maxConnections;
@@ -231,7 +232,13 @@ public class I2PSnarkUtil {
if (rewrite)
fetchURL = rewriteAnnounce(url);
//_log.debug("Rewritten url [" + fetchURL + "]");
EepGet get = new EepGet(_context, _shouldProxy, _proxyHost, _proxyPort, retries, out.getAbsolutePath(), fetchURL);
//EepGet get = new EepGet(_context, _shouldProxy, _proxyHost, _proxyPort, retries, out.getAbsolutePath(), fetchURL);
// Use our tunnel for announces and .torrent fetches too! Make sure we're connected first...
if (!connected()) {
if (!connect())
return null;
}
EepGet get = new I2PSocketEepGet(_context, _manager, retries, out.getAbsolutePath(), fetchURL);
if (get.fetch()) {
_log.debug("Fetch successful [" + url + "]: size=" + out.length());
return out;
@@ -327,6 +334,11 @@ public class I2PSnarkUtil {
return rv;
}
/** @param ot non-null */
public void setOpenTrackerString(String ot) {
_opts.put(PROP_OPENTRACKERS, ot);
}
public String getOpenTrackerString() {
String rv = (String) _opts.get(PROP_OPENTRACKERS);
if (rv == null)

View File

@@ -110,6 +110,7 @@ class Message
dos.write(data, off, len);
}
@Override
public String toString()
{
switch (type)

View File

@@ -345,6 +345,7 @@ public class MetaInfo
return length;
}
@Override
public String toString()
{
return "MetaInfo[info_hash='" + hexencode(info_hash)

View File

@@ -106,6 +106,7 @@ public class Peer implements Comparable
/**
* Returns the String representation of the peerID.
*/
@Override
public String toString()
{
if (peerID != null)
@@ -125,6 +126,7 @@ public class Peer implements Comparable
/**
* The hash code of a Peer is the hash code of the peerID.
*/
@Override
public int hashCode()
{
return peerID.hashCode() ^ (2 << _id);
@@ -134,6 +136,7 @@ public class Peer implements Comparable
* Two Peers are equal when they have the same PeerID.
* All other properties are ignored.
*/
@Override
public boolean equals(Object o)
{
if (o instanceof Peer)

View File

@@ -41,7 +41,7 @@ class PeerConnectionOut implements Runnable
private boolean quit;
// Contains Messages.
private List sendQueue = new ArrayList();
private final List sendQueue = new ArrayList();
private static long __id = 0;
private long _id;

View File

@@ -12,7 +12,7 @@ import java.util.Set;
* from it there too)
*/
public class PeerCoordinatorSet {
private Set _coordinators;
private final Set _coordinators;
public PeerCoordinatorSet() {
_coordinators = new HashSet();

View File

@@ -107,6 +107,7 @@ public class PeerID implements Comparable
/**
* The hash code of a PeerID is the exclusive or of all id bytes.
*/
@Override
public int hashCode()
{
return hash;
@@ -127,6 +128,7 @@ public class PeerID implements Comparable
/**
* Two PeerIDs are equal when they have the same id, address and port.
*/
@Override
public boolean equals(Object o)
{
if (o instanceof PeerID)
@@ -171,6 +173,7 @@ public class PeerID implements Comparable
* and address is the base64 dest (was the base64 hash of the dest) which
* should match what the bytemonsoon tracker reports on its web pages.
*/
@Override
public String toString()
{
int nonZero = 0;

View File

@@ -151,7 +151,7 @@ public interface PeerListener
*
* @param state the PeerState for the peer
*/
void savePeerPartial(PeerState state);
void savePeerPartial(PeerState state); /* FIXME Exporting non-public type through public API FIXME */
/**
* Called when a peer has connected and there may be a partially
@@ -161,7 +161,7 @@ public interface PeerListener
*
* @return request (contains the partial data and valid length)
*/
Request getPeerPartial(BitField havePieces);
Request getPeerPartial(BitField havePieces); /* FIXME Exporting non-public type through public API FIXME */
/** Mark a peer's requested pieces unrequested when it is disconnected
* This prevents premature end game

View File

@@ -20,13 +20,20 @@ public class Piece implements Comparable {
return this.peers.size() - ((Piece)o).peers.size();
}
@Override
public boolean equals(Object o) {
if (o == null) return false;
try {
if (o instanceof Piece) {
if (o == null) return false;
return this.id == ((Piece)o).id;
} catch (ClassCastException cce) {
return false;
}
return false;
}
@Override
public int hashCode() {
int hash = 5;
hash = 31 * hash + this.id;
return hash;
}
public int getId() { return this.id; }
@@ -36,6 +43,7 @@ public class Piece implements Comparable {
public boolean isRequested() { return this.requested; }
public void setRequested(boolean requested) { this.requested = requested; }
@Override
public String toString() {
return String.valueOf(id);
}

View File

@@ -51,11 +51,13 @@ class Request
throw new IndexOutOfBoundsException("Illegal Request " + toString());
}
@Override
public int hashCode()
{
return piece ^ off ^ len;
}
@Override
public boolean equals(Object o)
{
if (o instanceof Request)
@@ -67,6 +69,7 @@ class Request
return false;
}
@Override
public String toString()
{
return "(" + piece + "," + off + "," + len + ")";

View File

@@ -28,7 +28,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.StringTokenizer;

File diff suppressed because it is too large Load Diff

View File

@@ -36,6 +36,7 @@ public class SnarkShutdown extends I2PAppThread
private final ShutdownListener listener;
/* FIXME Exporting non-public type through public API FIXME */
public SnarkShutdown(Storage storage,
PeerCoordinator coordinator,
ConnectionAcceptor acceptor,
@@ -49,6 +50,7 @@ public class SnarkShutdown extends I2PAppThread
this.listener = listener;
}
@Override
public void run()
{
//Snark.debug("Shutting down...", Snark.NOTICE);

View File

@@ -46,7 +46,7 @@ public class Storage
private final StorageListener listener;
private I2PSnarkUtil _util;
private BitField bitfield; // BitField to represent the pieces
private /* FIXME final FIXME */ BitField bitfield; // BitField to represent the pieces
private int needed; // Number of pieces needed
private boolean _probablyComplete; // use this to decide whether to open files RO

View File

@@ -81,6 +81,7 @@ public class TrackerClient extends I2PAppThread
started = false;
}
@Override
public void start() {
if (stop) throw new RuntimeException("Dont rerun me, create a copy");
super.start();
@@ -109,6 +110,7 @@ public class TrackerClient extends I2PAppThread
return !stop && _util.connected();
}
@Override
public void run()
{
String infoHash = urlencode(meta.getInfoHash());
@@ -162,7 +164,7 @@ public class TrackerClient extends I2PAppThread
try
{
if (!verifyConnected()) return;
boolean started = false;
boolean runStarted = false;
boolean firstTime = true;
int consecutiveFails = 0;
Random r = new Random();
@@ -178,7 +180,7 @@ public class TrackerClient extends I2PAppThread
if (firstTime) {
delay = r.nextInt(30*1000);
firstTime = false;
} else if (completed && started)
} else if (completed && runStarted)
delay = 3*SLEEP*60*1000 + random;
else if (coordinator.trackerProblems != null && ++consecutiveFails < MAX_CONSEC_FAILS)
delay = INITIAL_SLEEP;
@@ -221,7 +223,7 @@ public class TrackerClient extends I2PAppThread
Tracker tr = (Tracker)iter.next();
if ((!stop) && (!tr.stop) &&
(completed || coordinator.needPeers()) &&
(event == COMPLETED_EVENT || System.currentTimeMillis() > tr.lastRequestTime + tr.interval))
(event.equals(COMPLETED_EVENT) || System.currentTimeMillis() > tr.lastRequestTime + tr.interval))
{
try
{
@@ -237,7 +239,7 @@ public class TrackerClient extends I2PAppThread
tr.consecutiveFails = 0;
if (tr.isPrimary)
consecutiveFails = 0;
started = true;
runStarted = true;
tr.started = true;
Set peers = info.getPeers();
@@ -296,7 +298,7 @@ public class TrackerClient extends I2PAppThread
// we could try and total the unique peers but that's too hard for now
coordinator.trackerSeenPeers = maxSeenPeers;
if (!started)
if (!runStarted)
_util.debug(" Retrying in one minute...", Snark.DEBUG);
} // *** end of while loop
} // try
@@ -311,9 +313,9 @@ public class TrackerClient extends I2PAppThread
try
{
// try to contact everybody we can
// We don't need I2CP connection for eepget
// if (!verifyConnected()) return;
// Don't try to restart I2CP connection just to say goodbye
for (Iterator iter = trackers.iterator(); iter.hasNext(); ) {
if (!verifyConnected()) return;
Tracker tr = (Tracker)iter.next();
if (tr.started && (!tr.stop) && tr.trackerProblems == null)
doRequest(tr, infoHash, peerID, uploaded,
@@ -338,7 +340,7 @@ public class TrackerClient extends I2PAppThread
+ "&uploaded=" + uploaded
+ "&downloaded=" + downloaded
+ "&left=" + left
+ ((event != NO_EVENT) ? ("&event=" + event) : "");
+ ((! event.equals(NO_EVENT)) ? ("&event=" + event) : "");
_util.debug("Sending TrackerClient request: " + s, Snark.INFO);
tr.lastRequestTime = System.currentTimeMillis();

View File

@@ -125,6 +125,7 @@ public class TrackerInfo
return interval;
}
@Override
public String toString()
{
if (failure_reason != null)

View File

@@ -172,6 +172,7 @@ public class BEValue
/** return the untyped value */
public Object getValue() { return value; }
@Override
public String toString()
{
String valueString;

View File

@@ -27,7 +27,6 @@ import net.i2p.util.FileUtil;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
import org.klomp.snark.I2PSnarkUtil;
import org.klomp.snark.MetaInfo;
import org.klomp.snark.Peer;
import org.klomp.snark.Snark;
@@ -46,6 +45,7 @@ public class I2PSnarkServlet extends HttpServlet {
public static final String PROP_CONFIG_FILE = "i2psnark.configFile";
@Override
public void init(ServletConfig cfg) throws ServletException {
super.init(cfg);
_context = I2PAppContext.getGlobalContext();
@@ -59,11 +59,13 @@ public class I2PSnarkServlet extends HttpServlet {
_manager.start();
}
@Override
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
resp.setContentType("text/html; charset=UTF-8");
long stats[] = {0,0,0,0,0};
/** dl, ul, down rate, up rate, peers, size */
final long stats[] = {0,0,0,0,0,0};
String nonce = req.getParameter("nonce");
if ( (nonce != null) && (nonce.equals(String.valueOf(_nonce))) )
@@ -83,8 +85,8 @@ public class I2PSnarkServlet extends HttpServlet {
out.write("<meta http-equiv=\"refresh\" content=\"60;" + req.getRequestURI() + peerString + "\">\n");
out.write(HEADER);
out.write("</head><body>");
out.write("<center><div class=\"page\"><table border=\"0\" width=\"100%\"><tr><td align=\"center\" class=\"snarkTitle\"><a href=\"" + req.getRequestURI() + peerString + "\" title=\"I2PSnark (Manual Page Refresh)\"><img src=\"/themes/console/images/i2psnark.png\" alt=\"I2PSnark Anonymous BitTorrent Client\" border=\"0\" class=\"snarklogo\"></a></table>");
out.write("<div class=\"snarknavbar\"><a href=\"http://forum.i2p/viewforum.php?f=21\" class=\"snarkRefresh\" target=\"_blank\">Forum</a>\n");
out.write("<center>");
out.write("<div class=\"snarknavbar\"><a href=\"" + req.getRequestURI() + peerString + "\" title=\"Refresh page\" class=\"snarkRefresh\">I2PSnark</a> <a href=\"http://forum.i2p/viewforum.php?f=21\" class=\"snarkRefresh\" target=\"_blank\">Forum</a>\n");
Map trackers = _manager.getTrackers();
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();
@@ -94,10 +96,10 @@ public class I2PSnarkServlet extends HttpServlet {
if (e < 0)
continue;
baseURL = baseURL.substring(e + 1);
out.write("<a href=\"" + baseURL + "\" class=\"snarkRefresh\" target=\"_blank\">" + name + "</a>");
out.write(" <a href=\"" + baseURL + "\" class=\"snarkRefresh\" target=\"_blank\">" + name + "</a>");
}
out.write("</div>\n");
out.write("<div class=\"mainsection\"><div class=\"snarkMessages\"><table><tr><td align=\"left\"><pre>");
out.write("<div class=\"page\"><div class=\"mainsection\"><div class=\"snarkMessages\"><table><tr><td align=\"left\"><pre>");
List msgs = _manager.getMessages();
for (int i = msgs.size()-1; i >= 0; i--) {
String msg = (String)msgs.get(i);
@@ -110,18 +112,18 @@ public class I2PSnarkServlet extends HttpServlet {
out.write(TABLE_HEADER);
if (_manager.util().connected() && snarks.size() > 0) {
if (peerParam != null)
out.write("(<a href=\"" + req.getRequestURI() + "\">Hide Peers</a>)<br />\n");
out.write("(<a href=\"" + req.getRequestURI() + "\">Hide Peers</a>)<br>\n");
else
out.write("(<a href=\"" + req.getRequestURI() + "?p=1" + "\">Show Peers</a>)<br />\n");
out.write("(<a href=\"" + req.getRequestURI() + "?p=1" + "\">Show Peers</a>)<br>\n");
}
out.write(TABLE_HEADER2);
out.write("<th align=\"left\">");
out.write("<th align=\"center\">");
if (_manager.util().connected())
out.write("<a href=\"" + uri + "?action=StopAll&nonce=" + _nonce +
"\" title=\"Stop all torrents and the i2p tunnel\">Stop All</a>");
"\" title=\"Stop all torrents and the I2P tunnel\">Stop All</a>");
else if (snarks.size() > 0)
out.write("<a href=\"" + uri + "?action=StartAll&nonce=" + _nonce +
"\" title=\"Start all torrents and the i2p tunnel\">Start All</a>");
"\" title=\"Start all torrents and the I2P tunnel\">Start All</a>");
else
out.write("&nbsp;");
out.write("</th></tr></thead>\n");
@@ -135,7 +137,10 @@ public class I2PSnarkServlet extends HttpServlet {
out.write(TABLE_EMPTY);
} else if (snarks.size() > 1) {
out.write("<tfoot><tr>\n" +
" <th align=\"left\" colspan=\"2\">Totals (" + snarks.size() + " torrents, " + stats[4] + " connected peers)</th>\n" +
" <th align=\"left\" colspan=\"2\">Totals (" +
snarks.size() + " torrents, " +
DataHelper.formatSize(stats[5]) + "B, " +
stats[4] + " connected peers)</th>\n" +
" <th>&nbsp;</th>\n" +
" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" +
" <th align=\"right\">" + formatSize(stats[1]) + "</th>\n" +
@@ -401,7 +406,7 @@ public class I2PSnarkServlet extends HttpServlet {
if (i > 0)
filename = filename.substring(0, i);
if (filename.length() > MAX_DISPLAYED_FILENAME_LENGTH)
filename = filename.substring(0, MAX_DISPLAYED_FILENAME_LENGTH) + "...";
filename = filename.substring(0, MAX_DISPLAYED_FILENAME_LENGTH) + "&hellip;";
long total = snark.meta.getTotalLength();
// Early typecast, avoid possibly overflowing a temp integer
long remaining = (long) snark.storage.needed() * (long) snark.meta.getPieceLength(0);
@@ -429,6 +434,7 @@ public class I2PSnarkServlet extends HttpServlet {
stats[2] += downBps;
stats[3] += upBps;
}
stats[5] += total;
boolean isValid = snark.meta != null;
boolean singleFile = snark.meta.getFiles() == null;
@@ -453,8 +459,8 @@ public class I2PSnarkServlet extends HttpServlet {
statusString = "<a title=\"" + err + "\">TrackerErr (" + curPeers + "/" + knownPeers + " peers)";
else {
if (err.length() > MAX_DISPLAYED_ERROR_LENGTH)
err = err.substring(0, MAX_DISPLAYED_ERROR_LENGTH) + "...";
statusString = "TrackerErr<br />(" + err + ")";
err = err.substring(0, MAX_DISPLAYED_ERROR_LENGTH) + "&hellip;";
statusString = "TrackerErr<br>(" + err + ")";
}
} else if (remaining <= 0) {
if (isRunning && curPeers > 0 && !showPeers)
@@ -486,13 +492,13 @@ public class I2PSnarkServlet extends HttpServlet {
String rowClass = (row % 2 == 0 ? "snarkTorrentEven" : "snarkTorrentOdd");
out.write("<tr class=\"" + rowClass + "\">");
out.write("<td align=\"left\" class=\"snarkTorrentStatus " + rowClass + "\">");
out.write("<td align=\"center\" class=\"snarkTorrentStatus " + rowClass + "\">");
out.write(statusString + "</td>\n\t");
out.write("<td align=\"left\" class=\"snarkTorrentName " + rowClass + "\">");
if (remaining == 0)
out.write("<a href=\"" + _manager.linkPrefix() + snark.meta.getName()
+ "\" title=\"Click to access completed downloaded..\">");
+ "\" title=\"View file\">");
out.write(filename);
if (remaining == 0)
out.write("</a>");
@@ -520,7 +526,7 @@ public class I2PSnarkServlet extends HttpServlet {
}
out.write("</td>\n\t");
out.write("<td align=\"right\" class=\"snarkTorrentETA " + rowClass + "\">");
out.write("<td align=\"center\" class=\"snarkTorrentETA " + rowClass + "\">");
if(isRunning && remainingSeconds > 0)
out.write(DataHelper.formatDuration(remainingSeconds*1000)); // (eta 6h)
out.write("</td>\n\t");
@@ -540,7 +546,7 @@ public class I2PSnarkServlet extends HttpServlet {
if(isRunning)
out.write(formatSize(upBps) + "ps");
out.write("</td>\n\t");
out.write("<td align=\"left\" class=\"snarkTorrentAction " + rowClass + "\">");
out.write("<td align=\"center\" class=\"snarkTorrentAction " + rowClass + "\">");
String parameters = "&nonce=" + _nonce + "&torrent=" + Base64.encode(snark.meta.getInfoHash());
if (showPeers)
parameters = parameters + "&p=1";
@@ -552,7 +558,7 @@ public class I2PSnarkServlet extends HttpServlet {
out.write("<a href=\"" + uri + "?action=Start" + parameters
+ "\" title=\"Start the torrent\">Start</a> ");
out.write("<a href=\"" + uri + "?action=Remove" + parameters
+ "\" title=\"Remove the torrent from the active list, deleting the .torrent file\">Remove</a><br />");
+ "\" title=\"Remove the torrent from the active list, deleting the .torrent file\">Remove</a><br>");
out.write("<a href=\"" + uri + "?action=Delete" + parameters
+ "\" title=\"Delete the .torrent file and the associated data file(s)\">Delete</a> ");
}
@@ -565,9 +571,9 @@ public class I2PSnarkServlet extends HttpServlet {
if (!peer.isConnected())
continue;
out.write("<tr class=\"" + rowClass + "\">");
out.write("<td class=\"snarkTorrentStatus " + rowClass + "\">");
out.write("<td align=\"center\" class=\"snarkTorrentStatus " + rowClass + "\">");
out.write("</td>\n\t");
out.write("<td align=\"right\" class=\"snarkTorrentStatus " + rowClass + "\">");
out.write("<td align=\"left\" class=\"snarkTorrentStatus " + rowClass + "\">");
String ch = peer.toString().substring(0, 4);
String client;
if ("AwMD".equals(ch))
@@ -586,7 +592,7 @@ public class I2PSnarkServlet extends HttpServlet {
client = "Robert";
else
client = "Unknown (" + ch + ')';
out.write("<font size=-1>" + client + "</font>&nbsp;&nbsp;<tt>" + peer.toString().substring(5, 9) + "</tt>");
out.write(client + "&nbsp;&nbsp;" + peer.toString().substring(5, 9));
if (showDebug)
out.write(" inactive " + (peer.getInactiveTime() / 1000) + "s");
out.write("</td>\n\t");
@@ -595,12 +601,12 @@ public class I2PSnarkServlet extends HttpServlet {
out.write("<td align=\"right\" class=\"snarkTorrentStatus " + rowClass + "\">");
float pct = (float) (100.0 * (float) peer.completed() / snark.meta.getPieces());
if (pct == 100.0)
out.write("<font size=-1>Seed</font>");
out.write("Seed");
else {
String ps = String.valueOf(pct);
if (ps.length() > 5)
ps = ps.substring(0, 5);
out.write("<font size=-1>" + ps + "%</font>");
out.write(ps + "%");
}
out.write("</td>\n\t");
out.write("<td class=\"snarkTorrentStatus " + rowClass + "\">");
@@ -609,14 +615,14 @@ public class I2PSnarkServlet extends HttpServlet {
if (remaining > 0) {
if (peer.isInteresting() && !peer.isChoked()) {
out.write("<font color=#008000>");
out.write("<font size=-1>" + formatSize(peer.getDownloadRate()) + "ps</font></font>");
out.write(formatSize(peer.getDownloadRate()) + "ps</font>");
} else {
out.write("<font color=#a00000><font size=-1><a title=\"");
out.write("<font color=#a00000><a title=\"");
if (!peer.isInteresting())
out.write("Uninteresting\">");
else
out.write("Choked\">");
out.write(formatSize(peer.getDownloadRate()) + "ps</a></font></font>");
out.write(formatSize(peer.getDownloadRate()) + "ps</a></font>");
}
}
out.write("</td>\n\t");
@@ -624,14 +630,14 @@ public class I2PSnarkServlet extends HttpServlet {
if (pct != 100.0) {
if (peer.isInterested() && !peer.isChoking()) {
out.write("<font color=#008000>");
out.write("<font size=-1>" + formatSize(peer.getUploadRate()) + "ps</font></font>");
out.write(formatSize(peer.getUploadRate()) + "ps</font>");
} else {
out.write("<font color=#a00000><font size=-1><a title=\"");
out.write("<font color=#a00000><a title=\"");
if (!peer.isInterested())
out.write("Uninterested\">");
else
out.write("Choking\">");
out.write(formatSize(peer.getUploadRate()) + "ps</a></font></font>");
out.write(formatSize(peer.getUploadRate()) + "ps</a></font>");
}
}
out.write("</td>\n\t");
@@ -654,13 +660,13 @@ public class I2PSnarkServlet extends HttpServlet {
// *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
out.write("<form action=\"" + uri + "\" method=\"POST\">\n");
out.write("<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" />\n");
out.write("<div class=\"addtorrentsection\"><span class=\"snarkConfigTitle\">Add Torrent:</span><br />\n");
out.write("<div class=\"addtorrentsection\"><span class=\"snarkConfigTitle\">Add Torrent:</span><br>\n");
out.write("From URL&nbsp;: <input type=\"text\" name=\"newURL\" size=\"80\" value=\"" + newURL + "\" /> \n");
// not supporting from file at the moment, since the file name passed isn't always absolute (so it may not resolve)
//out.write("From file: <input type=\"file\" name=\"newFile\" size=\"50\" value=\"" + newFile + "\" /><br />\n");
out.write("<input type=\"submit\" value=\"Add torrent\" name=\"action\" /><br />\n");
out.write("<span class=\"snarkAddInfo\">Alternately, you can copy .torrent files to " + _manager.getDataDir().getAbsolutePath() + "<br />\n");
out.write("Removing that .torrent file will cause the torrent to stop.<br /></span>\n");
//out.write("From file: <input type=\"file\" name=\"newFile\" size=\"50\" value=\"" + newFile + "\" /><br>\n");
out.write("<input type=\"submit\" value=\"Add torrent\" name=\"action\" /><br>\n");
out.write("<span class=\"snarkAddInfo\">Alternately, you can copy .torrent files to " + _manager.getDataDir().getAbsolutePath() + "<br>\n");
out.write("Removing that .torrent file will cause the torrent to stop.<br></span>\n");
out.write("</form>\n</span></div>");
}
@@ -674,11 +680,11 @@ public class I2PSnarkServlet extends HttpServlet {
// *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
out.write("<form action=\"" + uri + "\" method=\"POST\">\n");
out.write("<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" />\n");
out.write("<span class=\"snarkConfigTitle\">Create Torrent:</span><br />\n");
//out.write("From file: <input type=\"file\" name=\"newFile\" size=\"50\" value=\"" + newFile + "\" /><br />\n");
out.write("<span class=\"snarkConfigTitle\">Create Torrent:</span><br>\n");
//out.write("From file: <input type=\"file\" name=\"newFile\" size=\"50\" value=\"" + newFile + "\" /><br>\n");
out.write("Data to seed: " + _manager.getDataDir().getAbsolutePath() + File.separatorChar
+ "<input type=\"text\" name=\"baseFile\" size=\"20\" value=\"" + baseFile
+ "\" title=\"File to seed (must be within the specified path)\" /><br />\n");
+ "\" title=\"File to seed (must be within the specified path)\" /><br>\n");
out.write("Tracker: <select name=\"announceURL\"><option value=\"\">Select a tracker</option>\n");
Map trackers = _manager.getTrackers();
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
@@ -708,15 +714,15 @@ public class I2PSnarkServlet extends HttpServlet {
out.write("<form action=\"" + uri + "\" method=\"POST\">\n");
out.write("<div class=\"configsection\"><span class=\"snarkConfig\">\n");
out.write("<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" />\n");
out.write("<span class=\"snarkConfigTitle\">Configuration:</span><br />\n");
out.write("<span class=\"snarkConfigTitle\">Configuration:</span><br>\n");
out.write("Data directory: <input type=\"text\" size=\"40\" name=\"dataDir\" value=\"" + dataDir + "\" ");
out.write("title=\"Directory to store torrents and data\" disabled=\"true\" /> <i>(Edit i2psnark.config and restart to change)</i><br />\n");
out.write("Auto start: <input type=\"checkbox\" name=\"autoStart\" value=\"true\" "
out.write("title=\"Directory to store torrents and data\" disabled=\"true\" /> <i>(Edit i2psnark.config and restart to change)</i><br>\n");
out.write("Auto start: <input type=\"checkbox\" class=\"optbox\" name=\"autoStart\" value=\"true\" "
+ (autoStart ? "checked " : "")
+ "title=\"If true, automatically start torrents that are added\" />");
//Auto add: <input type="checkbox" name="autoAdd" value="true" title="If true, automatically add torrents that are found in the data directory" />
//Auto stop: <input type="checkbox" name="autoStop" value="true" title="If true, automatically stop torrents that are removed from the data directory" />
//out.write("<br />\n");
//out.write("<br>\n");
/*
out.write("Seed percentage: <select name=\"seedPct\" disabled=\"true\" >\n\t");
if (seedPct <= 0)
@@ -731,28 +737,28 @@ public class I2PSnarkServlet extends HttpServlet {
out.write("<option value=\"150\" selected=\"true\">150%</option>\n\t");
else
out.write("<option value=\"150\">150%</option>\n\t");
out.write("</select><br />\n");
out.write("</select><br>\n");
*/
out.write("Total uploader limit: <input type=\"text\" name=\"upLimit\" value=\""
+ _manager.util().getMaxUploaders() + "\" size=\"3\" maxlength=\"3\" /> peers<br />\n");
+ _manager.util().getMaxUploaders() + "\" size=\"3\" maxlength=\"3\" /> peers<br>\n");
out.write("Up bandwidth limit: <input type=\"text\" name=\"upBW\" value=\""
+ _manager.util().getMaxUpBW() + "\" size=\"3\" maxlength=\"3\" /> KBps <i>(Half <a href=\"/config.jsp\" target=\"blank\">available bandwidth</a> recommended.)</i><br />\n");
+ _manager.util().getMaxUpBW() + "\" size=\"3\" maxlength=\"3\" /> KBps <i>(Half <a href=\"/config.jsp\" target=\"blank\">available bandwidth</a> recommended.)</i><br>\n");
out.write("Use open trackers also: <input type=\"checkbox\" name=\"useOpenTrackers\" value=\"true\" "
out.write("Use open trackers also: <input type=\"checkbox\" class=\"optbox\" name=\"useOpenTrackers\" value=\"true\" "
+ (useOpenTrackers ? "checked " : "")
+ "title=\"If true, uses open trackers in addition\" /> ");
out.write("Announce URLs: <input type=\"text\" name=\"openTrackers\" value=\""
+ openTrackers + "\" size=\"50\" /><br />\n");
+ openTrackers + "\" size=\"50\" /><br>\n");
//out.write("\n");
out.write("EepProxy host: <input type=\"text\" name=\"eepHost\" value=\""
+ _manager.util().getEepProxyHost() + "\" size=\"15\" /> ");
out.write("port: <input type=\"text\" name=\"eepPort\" value=\""
+ _manager.util().getEepProxyPort() + "\" size=\"5\" maxlength=\"5\" /><br />\n");
//out.write("EepProxy host: <input type=\"text\" name=\"eepHost\" value=\""
// + _manager.util().getEepProxyHost() + "\" size=\"15\" /> ");
//out.write("port: <input type=\"text\" name=\"eepPort\" value=\""
// + _manager.util().getEepProxyPort() + "\" size=\"5\" maxlength=\"5\" /><br>\n");
out.write("I2CP host: <input type=\"text\" name=\"i2cpHost\" value=\""
+ _manager.util().getI2CPHost() + "\" size=\"15\" /> ");
out.write("port: <input type=\"text\" name=\"i2cpPort\" value=\"" +
+ _manager.util().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br />\n");
+ _manager.util().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br>\n");
StringBuilder opts = new StringBuilder(64);
Map options = new TreeMap(_manager.util().getI2CPOptions());
for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) {
@@ -762,7 +768,7 @@ public class I2PSnarkServlet extends HttpServlet {
opts.append(key).append('=').append(val).append(' ');
}
out.write("I2CP opts: <input type=\"text\" name=\"i2cpOpts\" size=\"80\" value=\""
+ opts.toString() + "\" /><br />\n");
+ opts.toString() + "\" /><br>\n");
out.write("<input type=\"submit\" value=\"Save configuration\" name=\"action\" />\n");
out.write("</span>\n");
out.write("</form></div>");
@@ -789,11 +795,11 @@ public class I2PSnarkServlet extends HttpServlet {
private static final String TABLE_HEADER = "<table border=\"0\" class=\"snarkTorrents\" width=\"100%\" cellpadding=\"0 10px\">\n" +
"<thead>\n" +
"<tr><th align=\"left\">Status \n";
"<tr><th align=\"center\">Status \n";
private static final String TABLE_HEADER2 = "</th>\n" +
" <th align=\"left\">Torrent</th>\n" +
" <th align=\"right\">ETA</th>\n" +
" <th align=\"center\">ETA</th>\n" +
" <th align=\"right\">Downloaded</th>\n" +
" <th align=\"right\">Uploaded</th>\n" +
" <th align=\"right\">Down Rate</th>\n" +

View File

@@ -14,7 +14,7 @@ import net.i2p.util.Log;
*/
class BufferLogger implements Logging {
private final static Log _log = new Log(BufferLogger.class);
private ByteArrayOutputStream _baos; // should be final and use a factory. LINT
private ByteArrayOutputStream _baos; // FIXME should be final and use a factory. FIXME
private boolean _ignore;
/**

View File

@@ -373,7 +373,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
privKeyFile = new File(args[2]);
if (!privKeyFile.isAbsolute())
privKeyFile = new File(_context.getAppDir(), args[2]);
privKeyFile = new File(_context.getConfigDir(), args[2]);
if (!privKeyFile.canRead()) {
l.log("private key file does not exist");
_log.error(getPrefix() + "Private key file does not exist or is not readable: " + args[2]);
@@ -422,7 +422,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
privKeyFile = new File(args[2]);
if (!privKeyFile.isAbsolute())
privKeyFile = new File(_context.getAppDir(), args[2]);
privKeyFile = new File(_context.getConfigDir(), args[2]);
if (!privKeyFile.canRead()) {
l.log("private key file does not exist");
_log.error(getPrefix() + "Private key file does not exist or is not readable: " + args[2]);
@@ -481,7 +481,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
privKeyFile = new File(args[3]);
if (!privKeyFile.isAbsolute())
privKeyFile = new File(_context.getAppDir(), args[3]);
privKeyFile = new File(_context.getConfigDir(), args[3]);
if (!privKeyFile.canRead()) {
l.log("private key file does not exist");
_log.error(getPrefix() + "Private key file does not exist or is not readable: " + args[3]);
@@ -877,7 +877,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
File privKeyFile = new File(args[1]);
if (!privKeyFile.isAbsolute())
privKeyFile = new File(_context.getAppDir(), args[1]);
privKeyFile = new File(_context.getConfigDir(), args[1]);
if (!privKeyFile.canRead()) {
l.log("private key file does not exist");
_log.error(getPrefix() + "Private key file does not exist or is not readable: " + args[3]);

View File

@@ -3,6 +3,7 @@
*/
package net.i2p.i2ptunnel;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
@@ -66,7 +67,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
// private Object conLock = new Object();
/** List of Socket for those accept()ed but not yet started up */
private List _waitingSockets = new ArrayList(); // should be final and use a factory. LINT
private List _waitingSockets = new ArrayList(); // FIXME should be final and use a factory. FIXME
/** How many connections will we allow to be in the process of being built at once? */
private int _numConnectionBuilders;
/** How long will we allow sockets to sit in the _waitingSockets map before killing them? */
@@ -114,7 +115,6 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
this.localPort = localPort;
this.l = l;
this.handlerName = handlerName + _clientId;
this.privKeyFile = pkf;
_ownDest = ownDest; // == ! shared client
@@ -124,6 +124,14 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
_context.statManager().createRateStat("i2ptunnel.client.manageTime", "How long it takes to accept a socket and fire it into an i2ptunnel runner (or queue it for the pool)?", "I2PTunnel", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
_context.statManager().createRateStat("i2ptunnel.client.buildRunTime", "How long it takes to run a queued socket into an i2ptunnel runner?", "I2PTunnel", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
// normalize path so we can find it
if (pkf != null) {
File keyFile = new File(pkf);
if (!keyFile.isAbsolute())
keyFile = new File(_context.getConfigDir(), pkf);
this.privKeyFile = keyFile.getAbsolutePath();
}
// no need to load the netDb with leaseSets for destinations that will never
// be looked up
tunnel.getClientOptions().setProperty("i2cp.dontPublishLeaseSet", "true");
@@ -277,6 +285,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
protected static I2PSocketManager buildSocketManager(I2PTunnel tunnel) {
return buildSocketManager(tunnel, null);
}
/** @param pkf absolute path or null */
protected static I2PSocketManager buildSocketManager(I2PTunnel tunnel, String pkf) {
Properties props = new Properties();
props.putAll(tunnel.getClientOptions());

View File

@@ -153,6 +153,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
* create the default options (using the default timeout, etc)
*
*/
@Override
protected I2PSocketOptions getDefaultOptions() {
Properties defaultOpts = getTunnel().getClientOptions();
if (!defaultOpts.contains(I2PSocketOptions.PROP_READ_TIMEOUT))
@@ -259,8 +260,8 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
return;
}
Destination dest = I2PTunnel.destFromName(destination);
if (dest == null) {
Destination clientDest = I2PTunnel.destFromName(destination);
if (clientDest == null) {
String str;
byte[] header;
if (usingWWWProxy)
@@ -276,7 +277,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
return;
}
I2PSocket i2ps = createI2PSocket(dest, getDefaultOptions());
I2PSocket i2ps = createI2PSocket(clientDest, getDefaultOptions());
byte[] data = null;
byte[] response = null;
if (usingWWWProxy)
@@ -344,7 +345,7 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
if (targetRequest != null) {
out.write(targetRequest.getBytes());
if (usingWWWProxy)
out.write(("<br>WWW proxy: " + wwwProxy).getBytes());
out.write(("<br />WWW proxy: " + wwwProxy).getBytes());
}
out.write("</div>".getBytes());
out.write("\n</body></html>\n".getBytes());

View File

@@ -37,7 +37,7 @@ import net.i2p.util.Log;
* or
* $method $path $protocolVersion\nHost: $site
* or
* $method http://i2p/$site/$path $protocolVersion
* $method http://i2p/$b64key/$path $protocolVersion
* or
* $method /$site/$path $protocolVersion
* </pre>
@@ -191,6 +191,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
* create the default options (using the default timeout, etc)
* unused?
*/
@Override
protected I2PSocketOptions getDefaultOptions() {
Properties defaultOpts = getTunnel().getClientOptions();
if (!defaultOpts.contains(I2PSocketOptions.PROP_READ_TIMEOUT))
@@ -207,6 +208,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
* create the default options (using the default timeout, etc)
*
*/
@Override
protected I2PSocketOptions getDefaultOptions(Properties overrides) {
Properties defaultOpts = getTunnel().getClientOptions();
defaultOpts.putAll(overrides);
@@ -386,7 +388,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
String conflictURL = protocol + alias + ".i2p/?" + initialFragments;
out.write(header);
out.write(("To visit the destination in your host database, click <a href=\"" + trustedURL + "\">here</a>. To visit the conflicting addresshelper link by temporarily giving it a random alias, click <a href=\"" + conflictURL + "\">here</a>.<P/>").getBytes());
out.write("</div><div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br>Generated on: ".getBytes());
out.write("</div><div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br />Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></div></body></html>\n".getBytes());
out.flush();
@@ -404,6 +406,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
}
line = method + " " + request.substring(pos);
} else if (host.toLowerCase().equals("localhost") || host.equals("127.0.0.1")) {
if (out != null) {
out.write(ERR_LOCALHOST);
out.write("<p /><i>Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
}
s.close();
return;
} else if (host.indexOf(".") != -1) {
// rebuild host
host = host + ":" + port;
@@ -431,16 +443,6 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
usingWWWProxy = true;
if (_log.shouldLog(Log.DEBUG))
_log.debug(getPrefix(requestId) + "Host doesnt end with .i2p and it contains a period [" + host + "]: wwwProxy!");
} else if (host.toLowerCase().startsWith("localhost:")) {
if (out != null) {
out.write(ERR_LOCALHOST);
out.write("<p /><i>Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
}
s.close();
return;
} else {
request = request.substring(pos + 1);
pos = request.indexOf("/");
@@ -561,8 +563,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
return;
}
Destination dest = I2PTunnel.destFromName(destination);
if (dest == null) {
Destination clientDest = I2PTunnel.destFromName(destination);
if (clientDest == null) {
//l.log("Could not resolve " + destination + ".");
if (_log.shouldLog(Log.WARN))
_log.warn("Unable to resolve " + destination + " (proxy? " + usingWWWProxy + ", request: " + targetRequest);
@@ -594,7 +596,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
// 1 == disconnect. see ConnectionOptions in the new streaming lib, which i
// dont want to hard link to here
//opts.setProperty("i2p.streaming.inactivityTimeoutAction", ""+1);
I2PSocket i2ps = createI2PSocket(dest, getDefaultOptions(opts));
I2PSocket i2ps = createI2PSocket(clientDest, getDefaultOptions(opts));
byte[] data = newRequest.toString().getBytes("ISO-8859-1");
Runnable onTimeout = new OnTimeout(s, s.getOutputStream(), targetRequest, usingWWWProxy, currentProxy, requestId);
I2PTunnelRunner runner = new I2PTunnelHTTPClientRunner(s, i2ps, sockLock, data, mySockets, onTimeout);
@@ -703,9 +705,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
out.write("\">http://".getBytes());
out.write(uri.getBytes());
out.write("</a>".getBytes());
if (usingWWWProxy) out.write(("<br>WWW proxy: " + wwwProxy).getBytes());
if (usingWWWProxy) out.write(("<br />WWW proxy: " + wwwProxy).getBytes());
if (showAddrHelper) {
out.write("<br><br>Click a link below to look for an address helper by using a \"jump\" service:<br>".getBytes());
out.write("<br /><br />Click a link below to look for an address helper by using a \"jump\" service:<br />".getBytes());
for (int i = 0; i < jumpServers.length; i++) {
// Skip jump servers we don't know
String jumphost = jumpServers[i].substring(7); // "http://"
@@ -717,7 +719,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
continue;
}
out.write("<br><a href=\"".getBytes());
out.write("<br /><a href=\"".getBytes());
out.write(jumpServers[i].getBytes());
out.write(uri.getBytes());
out.write("\">".getBytes());
@@ -727,7 +729,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
}
}
}
out.write("</div><div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br>Generated on: ".getBytes());
out.write("</div><div class=\"proxyfooter\"><p><i>I2P HTTP Proxy Server<br />Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></div></body></html>\n".getBytes());
out.flush();
@@ -841,6 +843,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
String type;
if (filename.endsWith(".css"))
type = "text/css";
else if (filename.endsWith(".ico"))
type = "image/x-icon";
else if (filename.endsWith(".png"))
type = "image/png";
else if (filename.endsWith(".jpg"))

View File

@@ -77,10 +77,10 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
protected void clientConnectionRun(Socket s) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("got a connection.");
Destination dest = pickDestination();
Destination clientDest = pickDestination();
I2PSocket i2ps = null;
try {
i2ps = createI2PSocket(dest);
i2ps = createI2PSocket(clientDest);
i2ps.setReadTimeout(readTimeout);
StringBuilder expectedPong = new StringBuilder();
Thread in = new I2PThread(new IrcInboundFilter(s,i2ps, expectedPong), "IRC Client " + __clientId + " in");

View File

@@ -73,7 +73,7 @@ public class TunnelController implements Logging {
File keyFile = new File(getPrivKeyFile());
if (!keyFile.isAbsolute())
keyFile = new File(I2PAppContext.getGlobalContext().getAppDir(), getPrivKeyFile());
keyFile = new File(I2PAppContext.getGlobalContext().getConfigDir(), getPrivKeyFile());
if (keyFile.exists()) {
//log("Not overwriting existing private keys in " + keyFile.getAbsolutePath());
return;

View File

@@ -255,7 +255,7 @@ public class TunnelControllerGroup {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(cfgFile);
fos.write(buf.toString().getBytes());
fos.write(buf.toString().getBytes("UTF-8"));
if (_log.shouldLog(Log.INFO))
_log.info("Config written to " + cfgFile.getPath());
} catch (IOException ioe) {

View File

@@ -54,6 +54,6 @@ public class Pinger implements Source, Runnable {
protected Sink sink;
protected Thread thread;
protected Object waitlock; // should be final and use a factory. LINT
protected Object waitlock; // FIXME should be final and use a factory. FIXME
protected boolean running;
}

View File

@@ -69,5 +69,5 @@ public class I2PSink implements Sink {
protected boolean raw;
protected I2PSession sess;
protected Destination dest;
protected I2PDatagramMaker maker; // should be final and use a factory. LINT
protected I2PDatagramMaker maker; // FIXME should be final and use a factory. FIXME
}

View File

@@ -67,5 +67,5 @@ public class I2PSinkAnywhere implements Sink {
protected boolean raw;
protected I2PSession sess;
protected Destination dest;
protected I2PDatagramMaker maker; // should be final and use a factory. LINT
protected I2PDatagramMaker maker; // FIXME should be final and use a factory. FIXME
}

View File

@@ -60,7 +60,7 @@ import net.i2p.util.Log;
private ServerSocket ss;
private Object startLock = new Object();
private final Object startLock = new Object();
private boolean startRunning = false;
private byte[] pubkey;

View File

@@ -1,3 +1,4 @@
<%@page pageEncoding="UTF-8"%>
<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.EditBean" %><%
String tun = request.getParameter("tunnel");
if (tun != null) {

View File

@@ -13,7 +13,7 @@
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>I2PTunnel Webmanager - Edit</title>
<title>I2P Tunnel Manager - Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
@@ -192,7 +192,7 @@
<div id="tunnelAdvancedNetworking" class="panel">
<div class="header">
<h4>Advanced networking options</h4>
<h4>Advanced networking options</h4><br />
<span class="comment">(NOTE: when this client proxy is configured to share tunnels, then these options are for all the shared proxy clients!)</span>
</div>
@@ -319,7 +319,7 @@
<div id="optionsField" class="rowItem">
<label for="reduce" accesskey="c">
<span class="accessKey">C</span>lose tunnels when idle: <i>Experimental</i>
<span class="accessKey">C</span>lose tunnels when idle:
</label>
</div>
<div id="portField" class="rowItem">
@@ -335,10 +335,10 @@
<table border="0"><tr><!-- I give up -->
<td><input value="1" type="radio" id="startOnLoad" name="newDest" title="New Destination"
<%=(editBean.getNewDest(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
<td valign="center">Enable
<td>Enable
<td><input value="0" type="radio" id="startOnLoad" name="newDest" title="New Destination"
<%=(editBean.getNewDest(curTunnel) || editBean.getPersistentClientKey(curTunnel) ? "" : " checked=\"checked\"")%> class="tickbox" />
<td valign="center">Disable
<td>Disable
</table>
</div>
<div id="portField" class="rowItem">
@@ -354,7 +354,7 @@
<div id="optionsField" class="rowItem">
<label for="reduce" accesskey="c">
<span class="accessKey">D</span>elay tunnel open until required: <i>Experimental</i>
<span class="accessKey">D</span>elay tunnel open until required:
</label>
</div>
<div id="portField" class="rowItem">
@@ -411,7 +411,8 @@
<div class="header"></div>
<div class="footer">
<div class="toolbox">
<span class="comment">NOTE: If tunnel is currently running, most changes will not take effect until tunnel is stopped and restarted</span>
<span class="comment">NOTE: If tunnel is currently running, most changes will not take effect until tunnel is stopped and restarted.</span>
<div class="separator"><hr /></div>
<input type="hidden" value="true" name="removeConfirm" />
<button id="controlSave" accesskey="S" class="control" type="submit" name="action" value="Save changes" title="Save Changes"><span class="accessKey">S</span>ave</button>
<button id="controlDelete" <%=(editBean.allowJS() ? "onclick=\"if (!confirm('Are you sure you want to delete?')) { return false; }\" " : "")%>accesskey="D" class="control" type="submit" name="action" value="Delete this proxy" title="Delete this Proxy"><span class="accessKey">D</span>elete</button>

View File

@@ -13,7 +13,7 @@
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>I2PTunnel Webmanager - Edit</title>
<title>I2P Tunnel Manager - Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
@@ -399,7 +399,8 @@
<div class="header"></div>
<div class="footer">
<div class="toolbox">
<span class="comment">NOTE: If tunnel is currently running, most changes will not take effect until tunnel is stopped and restarted</span>
<span class="comment">NOTE: If tunnel is currently running, most changes will not take effect until tunnel is stopped and restarted.</span>
<div class="separator"><hr /></div>
<input type="hidden" value="true" name="removeConfirm" />
<button id="controlSave" accesskey="S" class="control" type="submit" name="action" value="Save changes" title="Save Changes"><span class="accessKey">S</span>ave</button>
<button id="controlDelete" <%=(editBean.allowJS() ? "onclick=\"if (!confirm('Are you sure you want to delete?')) { return false; }\" " : "")%>accesskey="D" class="control" type="submit" name="action" value="Delete this proxy" title="Delete this Proxy"><span class="accessKey">D</span>elete</button>

View File

@@ -1,18 +1,23 @@
<%
// http://www.crazysquirrel.com/computing/general/form-encoding.jspx
if (request.getCharacterEncoding() == null)
request.setCharacterEncoding("UTF-8");
%>
<%@page pageEncoding="UTF-8"%>
<%@page contentType="text/html" import="net.i2p.i2ptunnel.web.IndexBean"%><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<jsp:useBean class="net.i2p.i2ptunnel.web.IndexBean" id="indexBean" scope="request" />
<jsp:setProperty name="indexBean" property="*" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>I2PTunnel Webmanager - List</title>
<title>I2P Tunnel Manager - List</title>
<meta htt
p-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<% if (indexBean.allowCSS()) {
%><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
%><link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
<link href="<%=indexBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
<% }
%>
@@ -106,7 +111,7 @@ p-equiv="Content-Type" content="text/html; charset=UTF-8" />
<a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>.b32.i2p">Preview</a>
<%
} else if (indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
%><span class="text">Base32 Address:<br><%=indexBean.getDestHashBase32(curServer)%>.b32.i2p</span>
%><span class="text">Base32 Address:<br /><%=indexBean.getDestHashBase32(curServer)%>.b32.i2p</span>
<%
} else {
%><span class="comment">No Preview</span>

View File

@@ -109,6 +109,13 @@
<target name="distclean" depends="clean">
<echo message="Not actually deleting the jetty libs (since they're so large)" />
</target>
<target name="reallyclean" depends="distclean">
<delete dir="./jettylib" />
</target>
<target name="totallyclean" depends="clean">
<delete dir="./jettylib" />
<delete file="${jetty.filename}" />
</target>
<target name="javadoc" >
<available property="jetty.zip.available" file="${jetty.filename}" type="file" />
<available property="jetty.zip.javadocExtracted" file="build/javadoc" type="dir" />

View File

@@ -23,7 +23,8 @@
<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" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
<!-- half of this is deprecated classes so turn deprecation off -->
<javac srcdir="./src" debug="true" deprecation="off" source="1.5" target="1.5" destdir="./build/obj" classpath="../../../core/java/build/i2p.jar" >
<compilerarg line="${javac.compilerargs}" />
</javac>
</target>

View File

@@ -15,6 +15,7 @@ import net.i2p.util.Log;
* and pull from a queue populated by various threads (each of whom have their own
* timeout)
*
* @deprecated use I2PServerSocketFull
*/
class I2PServerSocketImpl implements I2PServerSocket {
private final static Log _log = new Log(I2PServerSocketImpl.class);

View File

@@ -0,0 +1,242 @@
package net.i2p.client.streaming;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.net.URL;
import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.util.EepGet;
import net.i2p.util.SocketTimeout;
/**
* Fetch a URL using a socket from the supplied I2PSocketManager.
* Hostname must resolve to an i2p destination - no routing to an outproxy.
* Does not support response gzip decompression (unlike I2PTunnelHTTPProxy) (yet),
* but of course there is still gzip at the I2CP layer.
*
* This is designed for Java apps such as bittorrent clients that wish to
* do HTTP fetches and use other protocols on a single set of tunnels.
* This may provide anonymity benefits over using the shared clients HTTP proxy,
* preventing inadvertent outproxy usage, reduce resource usage by eliminating
* a second set of tunnels, and eliminate the requirement to
* to separately configure the proxy host and port.
*
* For additional documentation see the superclass.
*
* Supports http://example.i2p/blah
* Supports http://B32KEY.b32.i2p/blah
* Supports http://i2p/B64KEY/blah for compatibility with the eepproxy
* Supports http://B64KEY/blah for compatibility with the eepproxy
* Warning - does not support /eepproxy/blah, address helpers, http://B64KEY.i2p/blah,
* or other odd things that may be found in the HTTP proxy.
*
* @author zzz
*/
public class I2PSocketEepGet extends EepGet {
private I2PSocketManager _socketManager;
/** this replaces _proxy in the superclass. Sadly, I2PSocket does not extend Socket. */
private I2PSocket _socket;
public I2PSocketEepGet(I2PAppContext ctx, I2PSocketManager mgr, int numRetries, String outputFile, String url) {
this(ctx, mgr, numRetries, -1, -1, outputFile, null, url);
}
public I2PSocketEepGet(I2PAppContext ctx, I2PSocketManager mgr, int numRetries, long minSize, long maxSize,
String outputFile, OutputStream outputStream, String url) {
// we're using this constructor:
// public EepGet(I2PAppContext ctx, boolean shouldProxy, String proxyHost, int proxyPort, int numRetries, long minSize, long maxSize, String outputFile, OutputStream outputStream, String url, boolean allowCaching, String etag, String postData) {
super(ctx, false, null, -1, numRetries, minSize, maxSize, outputFile, outputStream, url, true, null, null);
_socketManager = mgr;
_log = ctx.logManager().getLog(I2PSocketEepGet.class);
}
/**
* We have to override this to close _socket, since we can't use _proxy in super as the I2PSocket.
*/
@Override
public boolean fetch(long fetchHeaderTimeout, long totalTimeout, long inactivityTimeout) {
boolean rv = super.fetch(fetchHeaderTimeout, totalTimeout, inactivityTimeout);
if (_socket != null) {
try {
_socket.close();
_socket = null;
} catch (IOException ioe) {}
}
return rv;
}
/**
* Look up the address, get a socket from the I2PSocketManager supplied in the constructor,
* and send the request.
*
* @param timeout ignored
*/
@Override
protected void sendRequest(SocketTimeout timeout) throws IOException {
if (_outputStream == null) {
File outFile = new File(_outputFile);
if (outFile.exists())
_alreadyTransferred = outFile.length();
}
if (_proxyIn != null) try { _proxyIn.close(); } catch (IOException ioe) {}
if (_proxyOut != null) try { _proxyOut.close(); } catch (IOException ioe) {}
if (_socket != null) try { _socket.close(); } catch (IOException ioe) {}
try {
URL url = new URL(_actualURL);
if ("http".equals(url.getProtocol())) {
String host = url.getHost();
int port = url.getPort();
if (port != -1)
throw new IOException("Ports not supported in i2p: " + _actualURL);
// HTTP Proxy compatibility http://i2p/B64KEY/blah
// Rewrite the url to strip out the /i2p/,
// as the naming service accepts B64KEY (but not B64KEY.i2p atm)
if ("i2p".equals(host)) {
String file = url.getFile();
try {
int slash = 1 + file.substring(1).indexOf("/");
host = file.substring(1, slash);
_actualURL = "http://" + host + file.substring(slash);
} catch (IndexOutOfBoundsException ioobe) {
throw new IOException("Bad /i2p/ format: " + _actualURL);
}
}
Destination dest = _context.namingService().lookup(host);
if (dest == null)
throw new UnknownHostException("Unknown or non-i2p host");
// Set the timeouts, using the other existing options in the socket manager
// This currently duplicates what SocketTimeout is doing in EepGet,
// but when that's ripped out of EepGet to use setsotimeout, we'll need this.
Properties props = new Properties();
props.setProperty(I2PSocketOptions.PROP_CONNECT_TIMEOUT, "" + CONNECT_TIMEOUT);
props.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, "" + INACTIVITY_TIMEOUT);
I2PSocketOptions opts = _socketManager.buildOptions(props);
_socket = _socketManager.connect(dest, opts);
} else {
throw new IOException("Unsupported protocol: " + _actualURL);
}
} catch (MalformedURLException mue) {
throw new IOException("Request URL is invalid: " + _actualURL);
} catch (I2PException ie) {
throw new IOException(ie.toString());
}
_proxyIn = _socket.getInputStream();
_proxyOut = _socket.getOutputStream();
// SocketTimeout doesn't take an I2PSocket, but no matter, because we
// always close our socket in fetch() above.
//timeout.setSocket(_socket);
String req = getRequest();
_proxyOut.write(DataHelper.getUTF8(req));
_proxyOut.flush();
}
/**
* Guess we have to override this since
* super doesn't strip the http://host from the GET line
* which hoses some servers (opentracker)
* HTTP proxy was kind enough to do this for us
*/
@Override
protected String getRequest() throws IOException {
StringBuilder buf = new StringBuilder(2048);
URL url = new URL(_actualURL);
String host = url.getHost();
String path = url.getPath();
String query = url.getQuery();
if (query != null)
path = path + '?' + query;
if (!path.startsWith("/"))
path = '/' + path;
buf.append("GET ").append(path).append(" HTTP/1.1\r\n" +
"Host: ").append(url.getHost()).append("\r\n");
if (_alreadyTransferred > 0) {
buf.append("Range: bytes=");
buf.append(_alreadyTransferred);
buf.append("-\r\n");
}
buf.append("Accept-Encoding: \r\n" +
"Cache-control: no-cache\r\n" +
"Pragma: no-cache\r\n" +
"User-Agent: " + USER_AGENT + "\r\n" +
"Connection: close\r\n\r\n");
return buf.toString();
}
/**
* I2PSocketEepGet [-n #retries] [-t timeout] url
* Uses I2CP at localhost:7654 with a single 1-hop tunnel each direction.
* Tunnel build time not included in the timeout.
*
* This is just for testing, it will be commented out someday.
* Real command line apps should use EepGet.main(),
* which has more options, and you don't have to wait for tunnels to be built.
*/
public static void main(String args[]) {
int numRetries = 0;
long inactivityTimeout = INACTIVITY_TIMEOUT;
String url = null;
try {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-n")) {
numRetries = Integer.parseInt(args[i+1]);
i++;
} else if (args[i].equals("-t")) {
inactivityTimeout = 1000 * Integer.parseInt(args[i+1]);
i++;
} else if (args[i].startsWith("-")) {
usage();
return;
} else {
url = args[i];
}
}
} catch (Exception e) {
e.printStackTrace();
usage();
return;
}
if (url == null) {
usage();
return;
}
Properties opts = new Properties();
opts.setProperty("i2cp.dontPublishLeaseSet", "true");
opts.setProperty("inbound.quantity", "1");
opts.setProperty("outbound.quantity", "1");
opts.setProperty("inbound.length", "1");
opts.setProperty("outbound.length", "1");
opts.setProperty("inbound.nickname", "I2PSocketEepGet");
I2PSocketManager mgr = I2PSocketManagerFactory.createManager(opts);
if (mgr == null) {
System.err.println("Error creating the socket manager");
return;
}
I2PSocketEepGet get = new I2PSocketEepGet(I2PAppContext.getGlobalContext(),
mgr, numRetries, suggestName(url), url);
get.addStatusListener(get.new CLIStatusListener(1024, 40));
get.fetch(inactivityTimeout, -1, inactivityTimeout);
mgr.destroySocketManager();
}
private static void usage() {
System.err.println("I2PSocketEepGet [-n #retries] [-t timeout] url");
}
}

View File

@@ -17,6 +17,7 @@ import net.i2p.util.Log;
/**
* Initial stub implementation for the socket
*
* @deprecated use I2PSocketFull
*/
class I2PSocketImpl implements I2PSocket {
private final static Log _log = new Log(I2PSocketImpl.class);
@@ -29,7 +30,7 @@ class I2PSocketImpl implements I2PSocket {
private Destination remote;
private String localID;
private String remoteID;
private Object remoteIDWaiter = new Object();
private final Object remoteIDWaiter = new Object();
private I2PInputStream in;
private I2POutputStream out;
private I2PSocket.SocketErrorListener _socketErrorListener;
@@ -42,7 +43,7 @@ class I2PSocketImpl implements I2PSocket {
private long _closedOn;
private long _remoteIdSetTime;
private I2PSocketOptions _options;
private Object flagLock = new Object();
private final Object flagLock = new Object();
/**
* Whether the I2P socket has already been closed.
@@ -306,7 +307,7 @@ class I2PSocketImpl implements I2PSocket {
//--------------------------------------------------
private class I2PInputStream extends InputStream {
private String streamName;
private ByteCollector bc = new ByteCollector();
private final ByteCollector bc = new ByteCollector();
private boolean inStreamClosed = false;
private long readTimeout = -1;

View File

@@ -13,7 +13,6 @@ import net.i2p.client.I2PClient;
import net.i2p.client.I2PClientFactory;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.data.Destination;
import net.i2p.util.Log;
/**
@@ -159,12 +158,12 @@ public class I2PSocketManagerFactory {
}
private static I2PSocketManager createManager(I2PSession session, Properties opts, String name) {
if (false) {
I2PSocketManagerImpl mgr = new I2PSocketManagerImpl();
mgr.setSession(session);
//if (false) {
//I2PSocketManagerImpl mgr = new I2PSocketManagerImpl();
//mgr.setSession(session);
//mgr.setDefaultOptions(new I2PSocketOptions());
return mgr;
} else {
//return mgr;
//} else {
String classname = opts.getProperty(PROP_MANAGER, DEFAULT_MANAGER);
if (classname != null) {
try {
@@ -191,7 +190,7 @@ public class I2PSocketManagerFactory {
} else {
throw new IllegalStateException("No manager class specified");
}
}
//}
}

View File

@@ -36,11 +36,12 @@ import net.i2p.util.Log;
* I2PSocketManager, it should not attempt to call I2PSession's setSessionListener
* or receive any messages with its .receiveMessage
*
* @deprecated use I2PSocketManagerFull
*/
class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
private I2PAppContext _context;
private Log _log;
private /* final */ I2PSession _session;
private /* FIXME final FIXME */ I2PSession _session;
private I2PServerSocketImpl _serverSocket = null;
private final Object lock = new Object(); // for locking socket lists
private HashMap<String,I2PSocket> _outSockets;

View File

@@ -53,7 +53,7 @@ public class I2PSocketOptionsImpl implements I2PSocketOptions {
_writeTimeout = getInt(opts, PROP_WRITE_TIMEOUT, DEFAULT_WRITE_TIMEOUT);
}
protected int getInt(Properties opts, String name, int defaultVal) {
protected static int getInt(Properties opts, String name, int defaultVal) {
if (opts == null) return defaultVal;
String val = opts.getProperty(name);
if (val == null) {

View File

@@ -16,9 +16,9 @@ net.i2p.client.streaming.I2PServerSocket#accept} method, which will provide an
application wants to create a new stream to a peer, it should do so with the
appropriate {@link net.i2p.client.streaming.I2PSocketManager#connect} call.</p>
<p>There is a simple pair of demo applications available as well - {@link
net.i2p.client.streaming.StreamSinkServer} listens to a destination and dumps
the data from all sockets it accepts to individual files, while {@link
net.i2p.client.streaming.StreamSinkClient} connects to a particular destination
<p>There is a simple pair of demo applications available as well -
net.i2p.client.streaming.StreamSinkServer listens to a destination and dumps
the data from all sockets it accepts to individual files, while
net.i2p.client.streaming.StreamSinkClient connects to a particular destination
and sends a specific amount of random data then disconnects.</p>
</body></html>

View File

@@ -117,7 +117,7 @@ public class StreamSinkClient {
}
/**
* Fire up the client. <code>Usage: StreamSinkClient [i2cpHost i2cpPort] sendSizeKB writeDelayMs serverDestFile [concurrentSends]</code> <br />
* Fire up the client. <code>Usage: StreamSinkClient [i2cpHost i2cpPort] sendSizeKB writeDelayMs serverDestFile [concurrentSends]</code> <br>
* <ul>
* <li><b>sendSizeKB</b>: how many KB to send, or -1 for unlimited</li>
* <li><b>writeDelayMs</b>: how long to wait between each .write (0 for no delay)</li>

View File

@@ -104,7 +104,7 @@ public class StreamSinkSend {
}
/**
* Fire up the client. <code>Usage: StreamSinkClient sendFile writeDelayMs serverDestFile</code> <br />
* Fire up the client. <code>Usage: StreamSinkClient sendFile writeDelayMs serverDestFile</code> <br>
* <ul>
* <li><b>sendFile</b>: filename to send</li>
* <li><b>writeDelayMs</b>: how long to wait between each .write (0 for no delay)</li>

View File

@@ -155,7 +155,7 @@ public class StreamSinkServer {
}
/**
* Fire up the streaming server. <code>Usage: StreamSinkServer [i2cpHost i2cpPort] sinkDir ourDestFile [numHandlers]</code><br />
* Fire up the streaming server. <code>Usage: StreamSinkServer [i2cpHost i2cpPort] sinkDir ourDestFile [numHandlers]</code><br>
* <ul>
* <li><b>sinkDir</b>: Directory to store received files in</li>
* <li><b>ourDestFile</b>: filename to write our binary destination to</li>

View File

@@ -123,6 +123,7 @@
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../jetty/jettylib/commons-logging.jar" />
<pathelement location="../../jetty/jettylib/commons-el.jar" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../systray/java/build/obj" />
<pathelement location="../../systray/java/lib/systray4j.jar" />
<pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" />

View File

@@ -17,6 +17,7 @@ public class ConfigAdvancedHandler extends FormHandler {
private boolean _shouldSave;
private String _config;
@Override
protected void processForm() {
if (_shouldSave) {
saveChanges();

View File

@@ -4,7 +4,6 @@ import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.router.RouterContext;
public class ConfigAdvancedHelper extends HelperBase {
public ConfigAdvancedHelper() {}

View File

@@ -20,13 +20,14 @@ import org.mortbay.jetty.Server;
* Saves changes to clients.config or webapps.config
*/
public class ConfigClientsHandler extends FormHandler {
private Log _log;
private Log configClient_log;
private Map _settings;
public ConfigClientsHandler() {
_log = ContextHelper.getContext(null).logManager().getLog(ConfigClientsHandler.class);
configClient_log = ContextHelper.getContext(null).logManager().getLog(ConfigClientsHandler.class);
}
@Override
protected void processForm() {
if (_action.startsWith("Save Client")) {
saveClientChanges();
@@ -55,7 +56,7 @@ public class ConfigClientsHandler extends FormHandler {
else
startWebApp(app);
} else {
addFormError("Unsupported " + _action);
addFormError("Unsupported " + _action + ".");
}
}
@@ -70,18 +71,18 @@ public class ConfigClientsHandler extends FormHandler {
ca.disabled = val == null;
}
ClientAppConfig.writeClientAppConfig(_context, clients);
addFormNotice("Client configuration saved successfully - restart required to take effect");
addFormNotice("Client configuration saved successfully - restart required to take effect.");
}
private void startClient(int i) {
List clients = ClientAppConfig.getClientApps(_context);
if (i >= clients.size()) {
addFormError("Bad client index");
addFormError("Bad client index.");
return;
}
ClientAppConfig ca = (ClientAppConfig) clients.get(i);
LoadClientAppsJob.runClient(ca.className, ca.clientName, LoadClientAppsJob.parseArgs(ca.args), _log);
addFormNotice("Client " + ca.clientName + " started");
LoadClientAppsJob.runClient(ca.className, ca.clientName, LoadClientAppsJob.parseArgs(ca.args), configClient_log);
addFormNotice("Client " + ca.clientName + " started.");
}
private void saveWebAppChanges() {
@@ -98,7 +99,7 @@ public class ConfigClientsHandler extends FormHandler {
props.setProperty(name, "" + (val != null));
}
RouterConsoleRunner.storeWebAppProperties(props);
addFormNotice("WebApp configuration saved successfully - restart required to take effect");
addFormNotice("WebApp configuration saved successfully - restart required to take effect.");
}
// Big hack for the moment, not using properties for directory and port
@@ -116,14 +117,14 @@ public class ConfigClientsHandler extends FormHandler {
path = new File(path, app + ".war");
s.addWebApplication("/"+ app, path.getAbsolutePath()).start();
// no passwords... initialize(wac);
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "</a> started");
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "</a> started.");
} catch (Exception ioe) {
addFormError("Failed to start " + app + " " + ioe);
addFormError("Failed to start " + app + " " + ioe + ".");
}
return;
}
}
}
addFormError("Failed to find server");
addFormError("Failed to find server.");
}
}

View File

@@ -6,7 +6,6 @@ import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.router.RouterContext;
import net.i2p.router.startup.ClientAppConfig;
public class ConfigClientsHelper extends HelperBase {
@@ -14,8 +13,8 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm1() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n");
buf.append("<tr><th>Client</th><th>Run at Startup?</th><th>Start Now</th><th>Class and arguments</th></tr>\n");
buf.append("<table>\n");
buf.append("<tr><th align=\"right\">Client</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Class and arguments</th></tr>\n");
List clients = ClientAppConfig.getClientApps(_context);
for (int cur = 0; cur < clients.size(); cur++) {
@@ -30,8 +29,8 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm2() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n");
buf.append("<tr><th>WebApp</th><th>Run at Startup?</th><th>Start Now</th><th>Description</th></tr>\n");
buf.append("<table>\n");
buf.append("<tr><th align=\"right\">WebApp</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Description</th></tr>\n");
Properties props = RouterConsoleRunner.webAppProperties();
Set keys = new TreeSet(props.keySet());
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
@@ -47,7 +46,7 @@ public class ConfigClientsHelper extends HelperBase {
}
private void renderForm(StringBuilder buf, String index, String name, boolean urlify, boolean enabled, boolean ro, String desc) {
buf.append("<tr><td>");
buf.append("<tr><td class=\"mediumtags\" align=\"right\" width=\"25%\">");
if (urlify && enabled) {
String link = "/";
if (! RouterConsoleRunner.ROUTERCONSOLE.equals(name))
@@ -56,16 +55,16 @@ public class ConfigClientsHelper extends HelperBase {
} else {
buf.append(name);
}
buf.append("</td><td align=\"center\"><input type=\"checkbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
buf.append("</td><td align=\"center\" width=\"10%\"><input type=\"checkbox\" class=\"optbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
if (enabled) {
buf.append("checked=\"true\" ");
if (ro)
buf.append("disabled=\"true\" ");
}
buf.append("/></td><td>&nbsp;");
buf.append("/></td><td align=\"center\" width=\"15%\">");
if (!enabled) {
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >Start<span class=hide> ").append(index).append("</span></button>");
}
buf.append("&nbsp;</td><td>").append(desc).append("</td></tr>\n");
buf.append("</td><td align=\"left\" width=\"50%\">").append(desc).append("</td></tr>\n");
}
}

View File

@@ -1,34 +1,49 @@
package net.i2p.router.web;
import net.i2p.I2PAppContext;
import net.i2p.data.DataFormatException;
import net.i2p.data.Hash;
import net.i2p.data.SessionKey;
import net.i2p.util.ConvertToHash;
/**
* Support additions via B64 Destkey, B64 Desthash, or blahblah.i2p
* Support additions via B64 Destkey, B64 Desthash, blahblah.i2p, and others supported by ConvertToHash
*/
public class ConfigKeyringHandler extends FormHandler {
private String _peer;
private String _key;
@Override
protected void processForm() {
if ("Add key".equals(_action)) {
if (_peer == null || _key == null) {
addFormError("You must enter a destination and a key");
if (_action == null) return;
boolean adding = _action.startsWith("Add");
if (adding || _action.startsWith("Delete")) {
if (_peer == null)
addFormError("You must enter a destination");
if (_key == null && adding)
addFormError("You must enter a key");
if (_peer == null || (_key == null && adding))
return;
}
Hash h = ConvertToHash.getHash(_peer);
SessionKey sk = new SessionKey();
try {
sk.fromBase64(_key);
} catch (DataFormatException dfe) {}
if (h != null && h.getData() != null && sk.getData() != null) {
_context.keyRing().put(h, sk);
addFormNotice("Key for " + h.toBase64() + " added to keyring");
} else {
addFormError("Invalid destination or key");
if (adding) {
SessionKey sk = new SessionKey();
try {
sk.fromBase64(_key);
} catch (DataFormatException dfe) {}
if (h != null && h.getData() != null && sk.getData() != null) {
_context.keyRing().put(h, sk);
addFormNotice("Key for " + h.toBase64() + " added to keyring");
} else {
addFormError("Invalid destination or key");
}
} else { // Delete
if (h != null && h.getData() != null) {
if (_context.keyRing().remove(h) != null)
addFormNotice("Key for " + h.toBase64() + " removed from keyring");
else
addFormNotice("Key for " + h.toBase64() + " not found in keyring");
} else {
addFormError("Invalid destination");
}
}
} else {
addFormError("Unsupported");

View File

@@ -4,7 +4,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import net.i2p.router.RouterContext;
public class ConfigKeyringHelper extends HelperBase {
public ConfigKeyringHelper() {}

View File

@@ -18,6 +18,7 @@ public class ConfigLoggingHandler extends FormHandler {
private String _dateFormat;
private String _fileSize;
@Override
protected void processForm() {
if (_shouldSave) {
saveChanges();

View File

@@ -4,7 +4,6 @@ import java.util.Iterator;
import java.util.Properties;
import java.util.TreeSet;
import net.i2p.router.RouterContext;
public class ConfigLoggingHelper extends HelperBase {
public ConfigLoggingHelper() {}
@@ -43,7 +42,7 @@ public class ConfigLoggingHelper extends HelperBase {
String level = limits.getProperty(prefix);
buf.append(prefix).append('=').append(level).append('\n');
}
buf.append("</textarea><br />\n");
buf.append("</textarea><br>\n");
buf.append("<i>Add additional logging statements above. Example: net.i2p.router.tunnel=WARN</i><br>");
buf.append("<i>Or put entries in the logger.config file. Example: logger.record.net.i2p.router.tunnel=WARN</i><br>");
buf.append("<i>Valid levels are DEBUG, INFO, WARN, ERROR, CRIT</i>\n");

View File

@@ -1,12 +1,10 @@
package net.i2p.router.web;
import net.i2p.data.RouterInfo;
import net.i2p.router.Router;
import net.i2p.router.transport.FIFOBandwidthRefiller;
import net.i2p.router.transport.TransportManager;
import net.i2p.router.transport.udp.UDPTransport;
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
import net.i2p.time.Timestamper;
/**
* Handler to deal with form submissions from the main config form and act
@@ -44,6 +42,7 @@ public class ConfigNetHandler extends FormHandler {
private static final boolean _ratesOnly = false; // always false - delete me
private static final String PROP_HIDDEN = Router.PROP_HIDDEN_HIDDEN; // see Router for other choice
@Override
protected void processForm() {
if (_saveRequested || ( (_action != null) && ("Save changes".equals(_action)) )) {
saveChanges();

View File

@@ -4,7 +4,6 @@ import net.i2p.data.DataHelper;
import net.i2p.data.RouterAddress;
import net.i2p.router.CommSystemFacade;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.transport.Addresses;
import net.i2p.router.transport.TransportManager;
import net.i2p.router.transport.udp.UDPAddress;

View File

@@ -1,12 +1,8 @@
package net.i2p.router.web;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.data.Hash;
import net.i2p.data.Base64;
import net.i2p.router.Router;
import net.i2p.router.peermanager.PeerProfile;
import net.i2p.util.Log;
/**
*
@@ -16,26 +12,27 @@ public class ConfigPeerHandler extends FormHandler {
private String _speed;
private String _capacity;
@Override
protected void processForm() {
if ("Save Configuration".equals(_action)) {
_context.router().saveConfig();
addFormNotice("Settings saved - not really!!!!!");
} else if (_action.startsWith("Shitlist")) {
} else if (_action.startsWith("Ban")) {
Hash h = getHash();
if (h != null) {
_context.shitlist().shitlistRouterForever(h, "Manually shitlisted via <a href=\"configpeer.jsp\">configpeer.jsp</a>");
addFormNotice("Peer " + _peer + " shitlisted forever");
_context.shitlist().shitlistRouterForever(h, "Manually banned via <a href=\"configpeer.jsp\">configpeer.jsp</a>");
addFormNotice("Peer " + _peer + " banned until restart");
return;
}
addFormError("Invalid peer");
} else if (_action.startsWith("Unshitlist")) {
} else if (_action.startsWith("Unban")) {
Hash h = getHash();
if (h != null) {
if (_context.shitlist().isShitlisted(h)) {
_context.shitlist().unshitlistRouter(h);
addFormNotice("Peer " + _peer + " unshitlisted");
addFormNotice("Peer " + _peer + " unbanned");
} else
addFormNotice("Peer " + _peer + " is not currently shitlisted");
addFormNotice("Peer " + _peer + " is not currently banned");
return;
}
addFormError("Invalid peer");

View File

@@ -4,7 +4,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import net.i2p.router.RouterContext;
public class ConfigPeerHelper extends HelperBase {
public ConfigPeerHelper() {}

View File

@@ -49,16 +49,16 @@ public class ConfigRestartBean {
long timeRemaining = ctx.router().getShutdownTimeRemaining();
if (shuttingDown) {
if (timeRemaining <= 0) {
return "<b>Shutdown imminent</b>";
return "<center><b>Shutdown imminent</b></center>";
} else {
return "<b>Shutdown in " + DataHelper.formatDuration(timeRemaining) + "</b><br />"
return "<center><b>Shutdown in " + DataHelper.formatDuration(timeRemaining) + "</b></center><br>"
+ buttons(urlBase, systemNonce, "shutdownImmediate,Shutdown immediately,cancelShutdown,Cancel shutdown");
}
} else if (restarting) {
if (timeRemaining <= 0) {
return "<b>Restart imminent</b>";
return "<center><b>Restart imminent</b></center>";
} else {
return "<b>Restart in " + DataHelper.formatDuration(timeRemaining) + "</b><br />"
return "<center><b>Restart in " + DataHelper.formatDuration(timeRemaining) + "</b></center><br>"
+ buttons(urlBase, systemNonce, "restartImmediate,Restart immediately,cancelShutdown,Cancel restart");
}
} else {

View File

@@ -1,13 +1,10 @@
package net.i2p.router.web;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import net.i2p.apps.systray.SysTray;
import net.i2p.apps.systray.UrlLauncher;
import net.i2p.data.DataHelper;
import net.i2p.router.Router;
import net.i2p.router.startup.ClientAppConfig;
@@ -49,6 +46,7 @@ public class ConfigServiceHandler extends FormHandler {
}
}
@Override
protected void processForm() {
if (_action == null) return;
@@ -95,9 +93,9 @@ public class ConfigServiceHandler extends FormHandler {
SysTray tray = SysTray.getInstance();
if (tray != null) {
tray.show();
addFormNotice("Systray enabled");
addFormNotice("System tray icon enabled.");
} else {
addFormNotice("Systray not supported on this platform");
addFormNotice("System tray icon feature not supported on this platform. Sorry!");
}
} catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage());
@@ -107,9 +105,9 @@ public class ConfigServiceHandler extends FormHandler {
SysTray tray = SysTray.getInstance();
if (tray != null) {
tray.hide();
addFormNotice("Systray disabled");
addFormNotice("System tray icon disabled.");
} else {
addFormNotice("Systray not supported on this platform");
addFormNotice("System tray icon feature not supported on this platform. Sorry!");
}
} catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage());

View File

@@ -28,6 +28,7 @@ public class ConfigStatsHandler extends FormHandler {
_isFull = false;
}
@Override
protected void processForm() {
saveChanges();
}

View File

@@ -8,7 +8,6 @@ import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import net.i2p.router.RouterContext;
import net.i2p.stat.FrequencyStat;
import net.i2p.stat.Rate;
import net.i2p.stat.RateStat;
@@ -35,16 +34,13 @@ public class ConfigStatsHelper extends HelperBase {
/**
* Configure this bean to query a particular router context
*
* @param contextId begging few characters of the routerHash, or null to pick
* @param contextId beginning few characters of the routerHash, or null to pick
* the first one we come across.
*/
@Override
public void setContextId(String contextId) {
try {
_context = ContextHelper.getContext(contextId);
_log = _context.logManager().getLog(ConfigStatsHelper.class);
} catch (Throwable t) {
t.printStackTrace();
}
super.setContextId(contextId);
_log = _context.logManager().getLog(ConfigStatsHelper.class);
_stats = new ArrayList();
Map groups = _context.statManager().getStatsByGroup();

View File

@@ -14,7 +14,7 @@ import net.i2p.util.Log;
*
*/
public class ConfigTunnelsHandler extends FormHandler {
private Log _log;
private Log configTunnel_log;
private Map _settings;
private boolean _shouldSave;
@@ -22,6 +22,7 @@ public class ConfigTunnelsHandler extends FormHandler {
_shouldSave = false;
}
@Override
protected void processForm() {
if (_shouldSave) {
saveChanges();
@@ -43,11 +44,11 @@ public class ConfigTunnelsHandler extends FormHandler {
*
*/
private void saveChanges() {
_log = _context.logManager().getLog(ConfigTunnelsHandler.class);
configTunnel_log = _context.logManager().getLog(ConfigTunnelsHandler.class);
boolean saveRequired = false;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Saving changes, with props = " + _settings);
if (configTunnel_log.shouldLog(Log.DEBUG))
configTunnel_log.debug("Saving changes, with props = " + _settings + ".");
int updated = 0;
int index = 0;
@@ -67,7 +68,7 @@ public class ConfigTunnelsHandler extends FormHandler {
try {
client.fromBase64(poolName);
} catch (DataFormatException dfe) {
addFormError("Internal error (pool name could not resolve - " + poolName + ")");
addFormError("Internal error (pool name could not resolve - " + poolName + ").");
index++;
continue;
}
@@ -76,7 +77,7 @@ public class ConfigTunnelsHandler extends FormHandler {
}
if ( (in == null) || (out == null) ) {
addFormError("Internal error (pool settings cound not be found for " + poolName + ")");
addFormError("Internal error (pool settings cound not be found for " + poolName + ").");
index++;
continue;
}
@@ -110,16 +111,16 @@ public class ConfigTunnelsHandler extends FormHandler {
}
if ("exploratory".equals(poolName)) {
if (_log.shouldLog(Log.DEBUG)) {
_log.debug("Inbound exploratory settings: " + in);
_log.debug("Outbound exploratory settings: " + out);
if (configTunnel_log.shouldLog(Log.DEBUG)) {
configTunnel_log.debug("Inbound exploratory settings: " + in);
configTunnel_log.debug("Outbound exploratory settings: " + out);
}
_context.tunnelManager().setInboundSettings(in);
_context.tunnelManager().setOutboundSettings(out);
} else {
if (_log.shouldLog(Log.DEBUG)) {
_log.debug("Inbound settings for " + client.toBase64() + ": " + in);
_log.debug("Outbound settings for " + client.toBase64() + ": " + out);
if (configTunnel_log.shouldLog(Log.DEBUG)) {
configTunnel_log.debug("Inbound settings for " + client.toBase64() + ": " + in);
configTunnel_log.debug("Outbound settings for " + client.toBase64() + ": " + out);
}
_context.tunnelManager().setInboundSettings(client, in);
_context.tunnelManager().setOutboundSettings(client, out);
@@ -131,14 +132,14 @@ public class ConfigTunnelsHandler extends FormHandler {
}
if (updated > 0)
addFormNotice("Updated settings for " + updated + " pools");
addFormNotice("Updated settings for " + updated + " pools.");
if (saveRequired) {
boolean saved = _context.router().saveConfig();
if (saved)
addFormNotice("Exploratory tunnel configuration saved successfully");
addFormNotice("Exploratory tunnel configuration saved successfully.");
else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs.");
}
}
private static final int getInt(Object val) {

View File

@@ -5,7 +5,6 @@ import java.util.Properties;
import java.util.Set;
import net.i2p.data.Destination;
import net.i2p.router.RouterContext;
import net.i2p.router.TunnelPoolSettings;
public class ConfigTunnelsHelper extends HelperBase {
@@ -62,20 +61,20 @@ public class ConfigTunnelsHelper extends HelperBase {
in.getLength() + in.getLengthVariance() <= 0 ||
out.getLength() <= 0 ||
out.getLength() + out.getLengthVariance() <= 0)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels.</font></th></tr>");
else if (in.getLength() <= 1 ||
in.getLength() + in.getLengthVariance() <= 1 ||
out.getLength() <= 1 ||
out.getLength() + out.getLengthVariance() <= 1)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels.</font></th></tr>");
if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels.</font></th></tr>");
if (in.getQuantity() + in.getBackupQuantity() >= WARN_QUANTITY ||
out.getQuantity() + out.getBackupQuantity() >= WARN_QUANTITY)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include high tunnel quantities</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include high tunnel quantities.</font></th></tr>");
buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\"/>&nbsp;&nbsp;Inbound</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\"/>&nbsp;&nbsp;Outbound</th></tr>\n");
buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\">&nbsp;&nbsp;Inbound</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\">&nbsp;&nbsp;Outbound</th></tr>\n");
// buf.append("<tr><th></th><th>Inbound</th><th>Outbound</th></tr>\n");
@@ -155,29 +154,36 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
buf.append("</tr>\n");
// custom options
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Inbound options:</td>\n");
buf.append("<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".inboundOptions\" type=\"text\" size=\"32\" ");
buf.append("value=\"");
// There is no facility to set these, either in ConfigTunnelsHandler or
// TunnelPoolOptions, so make the boxes readonly.
// And let's not display them at all unless they have contents, which should be rare.
Properties props = in.getUnknownOptions();
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String prop = (String)iter.next();
String val = (String)props.getProperty(prop);
buf.append(prop).append("=").append(val).append(" ");
if (props.size() > 0) {
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Inbound options:</td>\n" +
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".inboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
"value=\"");
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String prop = (String)iter.next();
String val = (String)props.getProperty(prop);
buf.append(prop).append('=').append(val).append(' ');
}
buf.append("\"></td></tr>\n");
}
buf.append("\"/></td></tr>\n");
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Outbound options:</td>\n");
buf.append("<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".outboundOptions\" type=\"text\" size=\"32\" ");
buf.append("value=\"");
props = in.getUnknownOptions();
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String prop = (String)iter.next();
String val = (String)props.getProperty(prop);
buf.append(prop).append("=").append(val).append(" ");
props = out.getUnknownOptions();
if (props.size() > 0) {
buf.append("<tr><td align=\"right\" class=\"mediumtags\">Outbound options:</td>\n" +
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".outboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
"value=\"");
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String prop = (String)iter.next();
String val = (String)props.getProperty(prop);
buf.append(prop).append('=').append(val).append(' ');
}
buf.append("\"></td></tr>\n");
}
buf.append("\"/></td></tr>\n");
// buf.append("<tr><td colspan=\"3\"><hr /></td></tr>\n");
// buf.append("<tr><td colspan=\"3\"><br></td></tr>\n");
}
private void renderOptions(StringBuilder buf, int min, int max, int now, String prefix, String name) {

View File

@@ -5,6 +5,7 @@ public class ConfigUIHandler extends FormHandler {
private boolean _shouldSave;
private String _config;
@Override
protected void processForm() {
if (_shouldSave)
saveChanges();
@@ -24,8 +25,8 @@ public class ConfigUIHandler extends FormHandler {
else
_context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
if (_context.router().saveConfig())
addFormNotice("Theme change successfully saved (<a href=\"configui.jsp\">refresh page to view</a>)");
addFormNotice("Theme change saved. <a href=\"configui.jsp\">Refresh the page</a> to view.");
else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs.");
}
}

View File

@@ -9,10 +9,10 @@ public class ConfigUIHelper extends HelperBase {
StringBuilder buf = new StringBuilder(512);
String current = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
for (String theme : themes) {
buf.append("<input type=\"radio\" name=\"theme\" ");
buf.append("<input type=\"radio\" class=\"optbox\" name=\"theme\" ");
if (theme.equals(current))
buf.append("checked=\"true\" ");
buf.append("value=\"").append(theme).append("\"/>").append(theme).append("<br />\n");
buf.append("value=\"").append(theme).append("\"/>").append(theme).append("<br>\n");
}
return buf.toString();
}

View File

@@ -16,6 +16,8 @@ public class ConfigUpdateHandler extends FormHandler {
private String _proxyPort;
private boolean _updateThroughProxy;
private String _trustedKeys;
private boolean _updateUnsigned;
private String _zipURL;
public static final String PROP_NEWS_URL = "router.newsURL";
// public static final String DEFAULT_NEWS_URL = "http://dev.i2p.net/cgi-bin/cvsweb.cgi/i2p/news.xml?rev=HEAD";
@@ -30,7 +32,12 @@ public class ConfigUpdateHandler extends FormHandler {
public static final String PROP_PROXY_HOST = "router.updateProxyHost";
public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
public static final String PROP_PROXY_PORT = "router.updateProxyPort";
public static final String DEFAULT_PROXY_PORT = "4444";
public static final int DEFAULT_PROXY_PORT_INT = 4444;
public static final String DEFAULT_PROXY_PORT = "" + DEFAULT_PROXY_PORT_INT;
/** default false */
public static final String PROP_UPDATE_UNSIGNED = "router.updateUnsigned";
/** no default */
public static final String PROP_ZIP_URL = "router.updateUnsignedURL";
public static final String PROP_UPDATE_URL = "router.updateURL";
public static final String DEFAULT_UPDATE_URL =
@@ -42,11 +49,14 @@ public class ConfigUpdateHandler extends FormHandler {
public static final String PROP_TRUSTED_KEYS = "router.trustedUpdateKeys";
@Override
protected void processForm() {
if ("Check for update now".equals(_action)) {
if (_action != null && _action.startsWith("Check")) {
NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext());
fetcher.fetchNews();
if (fetcher.updateAvailable()) {
if (fetcher.shouldFetchUnsigned())
fetcher.fetchUnsignedHead();
if (fetcher.updateAvailable() || fetcher.unsignedUpdateAvailable()) {
if ( (_updatePolicy == null) || (!_updatePolicy.equals("notify")) )
addFormNotice("Update available, attempting to download now");
else
@@ -79,11 +89,8 @@ public class ConfigUpdateHandler extends FormHandler {
}
}
if (_updateThroughProxy) {
_context.router().setConfigSetting(PROP_SHOULD_PROXY, Boolean.TRUE.toString());
} else {
_context.router().setConfigSetting(PROP_SHOULD_PROXY, Boolean.FALSE.toString());
}
_context.router().setConfigSetting(PROP_SHOULD_PROXY, "" + _updateThroughProxy);
_context.router().setConfigSetting(PROP_UPDATE_UNSIGNED, "" + _updateUnsigned);
String oldFreqStr = _context.router().getConfigSetting(PROP_REFRESH_FREQUENCY);
long oldFreq = -1;
@@ -119,6 +126,14 @@ public class ConfigUpdateHandler extends FormHandler {
}
}
if ( (_zipURL != null) && (_zipURL.length() > 0) ) {
String oldURL = _context.router().getConfigSetting(PROP_ZIP_URL);
if ( (oldURL == null) || (!_zipURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_ZIP_URL, _zipURL);
addFormNotice("Updating unsigned update URL to " + _zipURL);
}
}
_context.router().saveConfig();
}
@@ -132,4 +147,6 @@ public class ConfigUpdateHandler extends FormHandler {
public void setUpdateThroughProxy(String foo) { _updateThroughProxy = true; }
public void setProxyHost(String host) { _proxyHost = host; }
public void setProxyPort(String port) { _proxyPort = port; }
public void setUpdateUnsigned(String foo) { _updateUnsigned = true; }
public void setZipURL(String url) { _zipURL = url; }
}

View File

@@ -3,7 +3,6 @@ package net.i2p.router.web;
import net.i2p.I2PAppContext;
import net.i2p.crypto.TrustedUpdate;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
public class ConfigUpdateHelper extends HelperBase {
public ConfigUpdateHelper() {}
@@ -42,10 +41,17 @@ public class ConfigUpdateHelper extends HelperBase {
public String getUpdateThroughProxy() {
String proxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY);
if (Boolean.valueOf(proxy).booleanValue())
return "<input type=\"checkbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"true\" >";
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"true\" >";
else
return "<input type=\"checkbox\" value=\"true\" name=\"updateThroughProxy\" >";
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" >";
}
public String getUpdateUnsigned() {
String foo = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED);
if (Boolean.valueOf(foo).booleanValue())
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateUnsigned\" checked=\"true\" >";
else
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateUnsigned\" >";
}
private static final long PERIODS[] = new long[] { 12*60*60*1000l, 24*60*60*1000l, 48*60*60*1000l, -1l };
@@ -105,11 +111,11 @@ public class ConfigUpdateHelper extends HelperBase {
return new TrustedUpdate(_context).getTrustedKeysString();
}
public String getZipURL() {
return _context.getProperty(ConfigUpdateHandler.PROP_ZIP_URL, "");
}
public String getNewsStatus() {
return NewsFetcher.getInstance(_context).status();
}
public String getUpdateVersion() {
return NewsFetcher.getInstance(_context).updateVersion();
}
}

View File

@@ -1,14 +1,12 @@
package net.i2p.router.web;
import java.io.IOException;
import java.io.Writer;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
import net.i2p.stat.Rate;
public class GraphHelper extends HelperBase {
@@ -68,7 +66,7 @@ public class GraphHelper extends HelperBase {
+ "&amp;periodCount=" + _periodCount
+ "&amp;width=" + _width
+ "&amp;height=" + (_height - 14)
+ "\" title=\"Combined bandwidth graph\" /></a>\n");
+ "\" alt=\"Combined bandwidth graph\" title=\"Combined bandwidth graph\"></a>\n");
}
for (Iterator iter = ordered.iterator(); iter.hasNext(); ) {
@@ -82,7 +80,7 @@ public class GraphHelper extends HelperBase {
+ "&amp;periodCount=" + (3 * _periodCount)
+ "&amp;width=" + (3 * _width)
+ "&amp;height=" + (3 * _height)
+ "\" target=\"_blank\" />");
+ "\" target=\"_blank\">");
_out.write("<img class=\"statimage\" border=\"0\" width=\""
+ (_width + 83) + "\" height=\"" + (_height + 92)
+ "\" src=\"viewstat.jsp?stat="
@@ -92,11 +90,12 @@ public class GraphHelper extends HelperBase {
+ "&amp;periodCount=" + _periodCount
+ "&amp;width=" + _width
+ "&amp;height=" + _height
+ "\" title=\"" + title + "\" /></a>\n");
+ "\" alt=\"" + title
+ "\" title=\"" + title + "\"></a>\n");
}
if (_refreshDelaySeconds > 0)
// shorten the refresh by 3 seconds so we beat the iframe
_out.write("<meta http-equiv=\"refresh\" content=\"" + (_refreshDelaySeconds - 3) + "\" />\n");
_out.write("<meta http-equiv=\"refresh\" content=\"" + (_refreshDelaySeconds - 3) + "\">\n");
} catch (IOException ioe) {
ioe.printStackTrace();
@@ -105,17 +104,16 @@ public class GraphHelper extends HelperBase {
}
public String getForm() {
try {
_out.write("<hr /><h3>Configure Graph Display</h3>");
_out.write("<p />[<a href=\"configstats.jsp\">Select Stats to Graph</a>]<p />");
_out.write("<br><h3>Configure Graph Display [<a href=\"configstats.jsp\">Select Stats</a>]</h3>");
_out.write("<form action=\"graphs.jsp\" method=\"GET\">");
_out.write("Periods: <input size=\"3\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\" /><br />\n");
_out.write("Plot averages: <input type=\"radio\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + " /> ");
_out.write("or plot events: <input type=\"radio\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + " /><br />\n");
_out.write("Periods: <input size=\"3\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n");
_out.write("Plot averages: <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + "> ");
_out.write("or plot events: <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + "><br>\n");
_out.write("Image sizes: width: <input size=\"4\" type=\"text\" name=\"width\" value=\"" + _width
+ "\" /> pixels, height: <input size=\"4\" type=\"text\" name=\"height\" value=\"" + _height
+ "\" /><br />\n");
_out.write("Refresh delay: <select name=\"refreshDelay\"><option value=\"60\">1 minute</option><option value=\"120\">2 minutes</option><option value=\"300\">5 minutes</option><option value=\"600\">10 minutes</option><option value=\"1800\">30 minutes</option><option value=\"3600\">1 hour</option><option value=\"-1\">Never</option></select><br />\n");
_out.write("<hr /><input type=\"submit\" value=\"Redraw\" /></div>");
+ "\"> pixels, height: <input size=\"4\" type=\"text\" name=\"height\" value=\"" + _height
+ "\"><br>\n");
_out.write("Refresh delay: <select name=\"refreshDelay\"><option value=\"60\">1 minute</option><option value=\"120\">2 minutes</option><option value=\"300\">5 minutes</option><option value=\"600\">10 minutes</option><option value=\"1800\">30 minutes</option><option value=\"3600\">1 hour</option><option value=\"-1\">Never</option></select><br>\n");
_out.write("<hr><div class=\"formaction\"><input type=\"submit\" value=\"Redraw\"></div></form>");
} catch (IOException ioe) {
ioe.printStackTrace();
}

View File

@@ -14,7 +14,7 @@ public abstract class HelperBase {
/**
* Configure this bean to query a particular router context
*
* @param contextId begging few characters of the routerHash, or null to pick
* @param contextId beginning few characters of the routerHash, or null to pick
* the first one we come across.
*/
public void setContextId(String contextId) {
@@ -25,5 +25,8 @@ public abstract class HelperBase {
}
}
/** might be useful in the jsp's */
//public RouterContext getContext() { return _context; }
public void setWriter(Writer out) { _out = out; }
}

View File

@@ -3,9 +3,7 @@ package net.i2p.router.web;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import net.i2p.router.RouterContext;
public class JobQueueHelper extends HelperBase {
public JobQueueHelper() {}

View File

@@ -10,7 +10,7 @@ public class LogsHelper extends HelperBase {
public String getLogs() {
String str = formatMessages(_context.logManager().getBuffer().getMostRecentMessages());
return "Location: <code>" + _context.logManager().currentFile() + "</code><br /><br />" + str;
return "Location: <code>" + _context.logManager().currentFile() + "</code><br><br>" + str;
}
public String getCriticalLogs() {

View File

@@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.i2p.router.RouterContext;
public class NavHelper extends HelperBase {
private static Map _apps = new HashMap();

View File

@@ -3,9 +3,7 @@ package net.i2p.router.web;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import net.i2p.router.RouterContext;
public class NetDbHelper extends HelperBase {
private String _routerPrefix;

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