Compare commits

...
335 Commits
Author SHA1 Message Date
clowwindy c688584d48 rm 2015-08-22 12:27:05 +08:00
clowwindy 31f98d01b7 rm 2015-08-22 12:26:31 +08:00
clowwindy 3e16978968 Merge branch 'minoscc-master' 2015-03-04 18:33:41 +08:00
Siuzuk Zan 28887b9896 自定义规则使用user-rule.txt保存 2015-03-04 18:33:13 +08:00
clowwindy d4d3e804cb Merge pull request #174 from wenxiao/master
新增了端口占用检测
2015-02-17 23:35:08 +09:00
WenX 336e0368a1 新增了端口占用检测 2015-02-14 00:14:55 +08:00
clowwindy 138e4f0715 language 2015-01-25 01:18:53 +08:00
clowwindy dbaa2372e2 update README for 2.3 2015-01-25 01:15:49 +08:00
clowwindy 19370a88c5 fix date 2015-01-25 01:10:07 +08:00
clowwindy fbc33ad337 update designer.cs 2015-01-25 01:09:55 +08:00
clowwindy ec5cf089c1 cancel socks5 proxy for chrome 2015-01-25 01:04:26 +08:00
clowwindy 7dca90aef5 update CHANGES 2015-01-25 00:52:40 +08:00
clowwindy 5eaa1b9e2b encourage users to report to gfwlist 2015-01-25 00:51:12 +08:00
clowwindy 700cd3a7e7 show less detail 2015-01-25 00:33:50 +08:00
clowwindy 7cb863b0c2 update some menu title 2015-01-24 23:58:18 +08:00
clowwindy 2d18d8306f update CHANGES 2015-01-24 23:48:48 +08:00
clowwindy f4007b685b update name for share over lan 2015-01-24 23:48:48 +08:00
clowwindy 01f033225b fix typo 2015-01-21 18:53:11 +08:00
clowwindy d3365a8fa4 remove unecessary code 2015-01-21 16:48:57 +08:00
clowwindy 09d57ef0c0 revert 2015-01-21 16:44:00 +08:00
clowwindy b6f1def40f Merge branch 'Sharuru' 2015-01-21 16:40:06 +08:00
Sharuru 7918cb4bd2 Show current mode in tray menu 2015-01-21 16:39:12 +08:00
clowwindy ce53273f33 gzip more 2015-01-19 23:13:22 +08:00
clowwindy b7611a7db7 Merge pull request #140 from GangZhuo/master
fix https://github.com/shadowsocks/shadowsocks-csharp/issues/137
2015-01-19 23:06:20 +08:00
Gang Zhuo b57edeb082 fix https://github.com/shadowsocks/shadowsocks-csharp/issues/137 2015-01-19 05:34:01 -05:00
clowwindy fe991db6da filter prerelase version 2015-01-18 20:31:18 +08:00
Jenkins CI Bot 25386c2f8c Update CONTRIBUTING.md 2015-01-18 19:02:42 +08:00
Jenkins CI Bot 24e5235d59 Update CONTRIBUTING.md 2015-01-18 18:54:36 +08:00
clowwindy 1a0f4807c2 use polipo port in port forwarder 2015-01-18 17:56:43 +08:00
clowwindy 3a34bad62f fix port range 2015-01-18 17:38:27 +08:00
clowwindy b2b11bb97b add fallback for access denied 2015-01-18 17:37:52 +08:00
clowwindy 5463b2859a no hard code 8123 2015-01-18 17:30:42 +08:00
clowwindy 8c8c947356 use local port in gfwlist updater 2015-01-18 17:16:01 +08:00
clowwindy 3e56b3d3a4 use local port in update checker 2015-01-18 17:15:06 +08:00
clowwindy 5aa2822904 use local port in pac 2015-01-18 17:12:59 +08:00
clowwindy 43a952d3d7 update readme 2015-01-18 17:03:38 +08:00
clowwindy 65f0257e6d bump 2015-01-18 17:02:28 +08:00
clowwindy 18e6daf47d update system proxy 2015-01-18 17:01:37 +08:00
clowwindy 788d74cefd add port forwarder 2015-01-18 16:44:09 +08:00
clowwindy edde91c17d lint code 2015-01-18 16:27:08 +08:00
clowwindy e81b87e7df move pac server to listener 2015-01-18 16:26:12 +08:00
clowwindy aa6c38ece3 move local to listener service 2015-01-18 15:53:45 +08:00
clowwindy 444fabaa79 local port now is the same for different servers 2015-01-18 14:44:54 +08:00
clowwindy 42c3776aa5 move proxy port out of group box 2015-01-18 14:30:48 +08:00
clowwindy fb51f30fd9 rename Enable 2015-01-18 14:15:57 +08:00
clowwindy d4bdd2e598 bump 2015-01-18 04:01:20 +08:00
clowwindy 3064314a23 Merge pull request #132 from bombless/patch-1
解决 QRcode 地址解析中密码可能带@符号、服务器名可能带冒号的问题
2015-01-17 11:55:21 +08:00
York Xiang 32941478d7 冒号写成逗号了,我错了…… 2015-01-16 23:19:19 +08:00
York Xiang 3aa325edec 解决 QRcode 地址解析中密码可能带@符号、服务器名可能带冒号的问题
关掉 https://github.com/shadowsocks/shadowsocks-csharp/issues/131
我就是爱用中文,哼~
2015-01-16 23:01:06 +08:00
clowwindy 1bf0c8bd46 refine qr code scan 2015-01-15 19:57:26 +08:00
clowwindy 0040972886 support multiple screens 2015-01-15 19:57:25 +08:00
clowwindy 15f57a4d04 Update README.md 2015-01-15 01:12:04 +08:00
clowwindy 5cfb870bbc update CHANGES 2015-01-14 21:40:12 +08:00
clowwindy a231cba73b refine animation 2015-01-14 21:08:53 +08:00
clowwindy 40aded9571 refine error message 2015-01-14 01:45:27 +08:00
clowwindy 38c597ba0c bump 2015-01-14 01:22:29 +08:00
clowwindy 4dae44c59b don't unpack polipo every time 2015-01-14 01:17:41 +08:00
clowwindy 179eb818a7 fix typo 2015-01-14 01:17:33 +08:00
clowwindy 1b38b9060d add TODO: test on high DPI 2015-01-13 22:17:24 +08:00
clowwindy ef74cd497c remove qrrectview 2015-01-13 22:15:24 +08:00
clowwindy 794c8bb080 refine qrcode 2015-01-13 22:13:52 +08:00
clowwindy 25c133070f remove some methods 2015-01-13 02:26:31 +08:00
clowwindy c2f7145980 remove ECI 2015-01-13 02:12:22 +08:00
clowwindy b8fbc20858 remove some class 2015-01-13 02:06:11 +08:00
clowwindy 49d04316cd remove some class 2015-01-13 01:53:49 +08:00
clowwindy dce38883a5 refactor 2015-01-13 01:51:51 +08:00
clowwindy 0f1aff24a5 try 5 different focus 2015-01-13 01:32:08 +08:00
clowwindy d995169fec add feedback 2015-01-12 03:06:21 +08:00
clowwindy de0f752cc8 add visual feedback 2015-01-12 02:44:24 +08:00
clowwindy e878b41519 implement ssurl scan 2015-01-12 01:55:03 +08:00
clowwindy f6939f1119 qrcode scan works 2015-01-12 01:04:36 +08:00
clowwindy 7927811ba3 add reader 2015-01-12 00:38:12 +08:00
clowwindy 418941cb75 add qrcode detector 2015-01-12 00:20:09 +08:00
clowwindy 70d7e813a4 try fix #105 2015-01-11 22:22:55 +08:00
clowwindy 797bd863aa add develop section 2015-01-09 07:59:45 +08:00
clowwindy b9b9202cde lint code 2015-01-08 22:10:15 +08:00
clowwindy a0a5cafe3d lint code 2015-01-08 21:57:51 +08:00
clowwindy 6192e09970 revert stop call 2015-01-08 21:16:45 +08:00
clowwindy 082494d587 combine duplicated code 2015-01-08 20:14:43 +08:00
clowwindy b3e83bbe57 Merge branch 'gfwlist' of https://github.com/GangZhuo/shadowsocks-csharp into GangZhuo-gfwlist 2015-01-08 19:58:36 +08:00
Gang Zhuo 075069ef16 not update all pac.txt, but only update the rules 2015-01-08 05:28:43 -05:00
clowwindy b646b41c81 Merge pull request #121 from sinsinpub/log_timestamp
Logging timestamp
2015-01-08 17:00:48 +08:00
Gang Zhuo a984014267 remove unuse import packages 2015-01-08 02:14:09 -05:00
sin_sin 1d21f2504d * Remove stop event log 2015-01-08 15:10:26 +08:00
Gang Zhuo 4860d5b32a fire error event when the pac server is not run 2015-01-08 01:38:31 -05:00
Gang Zhuo 77aa5e8280 change prompt message 2015-01-08 00:45:47 -05:00
Gang Zhuo 74c61ca76a remove unuse code and resources 2015-01-08 00:24:34 -05:00
Gang Zhuo 45d4667aa9 prompt user when the job which update pac via gfwlist have been ran on background 2015-01-08 00:21:02 -05:00
Gang Zhuo d4f2ea6765 fix abp.js error 2015-01-08 00:10:26 -05:00
Gang Zhuo c24c1d44b7 add new menu to update pac file via gfwlist 2015-01-07 23:41:45 -05:00
sin_sin 8a1ea1eee4 * Clean unused tmp, fix spelling of the comment 2015-01-08 10:29:38 +08:00
Gang Zhuo dd00516587 refine, remove duplicate domains 2015-01-08 03:30:55 +08:00
Gang Zhuo d93adb16c4 support build in gfwlist 2015-01-08 03:07:26 +08:00
Gang Zhuo 78c58b3a23 add co.hk 2015-01-08 03:06:15 +08:00
Gang Zhuo b7a8360449 Log more error information 2015-01-08 01:40:08 +08:00
Gang Zhuo a2f3116ca8 auto update gfwlist, see https://github.com/shadowsocks/shadowsocks-csharp/issues/115 2015-01-08 00:54:12 +08:00
Gang Zhuo a984e90727 Stop the PACServer when controller stop 2015-01-07 23:10:12 +08:00
Gang Zhuo f1c821a9cd call controller.Stop() when application exit 2015-01-07 23:08:25 +08:00
sin_sin b10d06dd4b * Add logging timestamp, ref #113 2015-01-07 15:43:05 +08:00
clowwindy 1c5fcbc137 Merge pull request #117 from GangZhuo/master
Bring config form to front when it's opened before.
2015-01-07 15:37:57 +08:00
Gang Zhuo 1d8c414c9f Bring ConfigForm to front when it's opened before. 2015-01-07 02:22:47 -05:00
clowwindy aa8a816f9f Update CONTRIBUTING.md 2015-01-06 20:13:36 +08:00
clowwindy 4856b1c74a Create CONTRIBUTING.md 2015-01-06 19:37:59 +08:00
clowwindy 988bf98fed Update LICENSE.txt 2015-01-02 19:15:12 +08:00
clowwindy 431b638feb Update LICENSE.txt 2015-01-02 19:13:48 +08:00
clowwindy 0e152d56ab remove settings file 2015-01-02 00:23:23 +08:00
clowwindy 25b8ef7166 bump 2015-01-02 00:20:19 +08:00
clowwindy 604feb76d4 fix about item 2015-01-01 23:53:28 +08:00
clowwindy 7002a666a7 clean more 2015-01-01 22:57:17 +08:00
clowwindy 73d32b0dc7 clean more 2015-01-01 22:56:09 +08:00
clowwindy 3da1e7f95b clean code 2015-01-01 22:55:00 +08:00
clowwindy 3f87ab6bfb lint code 2015-01-01 22:52:41 +08:00
clowwindy e26a63737d remove duplicated code 2015-01-01 22:43:40 +08:00
clowwindy bff33ae5c8 remove some code 2015-01-01 22:37:07 +08:00
clowwindy db6701b1b2 refactor package name 2015-01-01 22:05:16 +08:00
clowwindy 5010a01d14 move encrypt package into encryption 2015-01-01 22:04:37 +08:00
clowwindy 07dc69fbc9 format 2015-01-01 21:57:28 +08:00
clowwindy e4b66928f1 log more exceptions 2015-01-01 21:55:55 +08:00
clowwindy a9aede0bad fix #106 2015-01-01 21:55:54 +08:00
clowwindy 13968bbf45 Merge pull request #107 from kxjhlele/patch-1
Update MenuViewController.cs
2015-01-01 11:03:27 +08:00
kxjhlele fa82d6b93d Update MenuViewController.cs
修改关于链接到 https://github.com/shadowsocks/shadowsocks-csharp
2015-01-01 09:17:33 +08:00
clowwindy ba353a5062 close #99 2014-12-27 22:04:36 +08:00
clowwindy 8043f34d3c bump 2014-12-25 21:55:06 +08:00
clowwindy 20023339d3 only left button will trigger double click on notify icon 2014-12-25 21:49:17 +08:00
clowwindy d6ef6ba917 add upload script 2014-12-25 21:31:17 +08:00
clowwindy f97f38bc46 update changes 2014-12-25 21:11:57 +08:00
clowwindy 076fbd9626 reduce code size 2014-12-25 21:10:01 +08:00
clowwindy 456bffc76c clean simplejson 2014-12-24 09:23:14 +08:00
clowwindy 42f976cdc6 clean zxing 2014-12-24 09:18:59 +08:00
clowwindy 1b126fa78e use zxing instead 2014-12-24 08:08:55 +08:00
clowwindy e4e56f8f26 update changes 2014-12-21 15:55:47 +08:00
clowwindy 5d194b42bc fix #89 2014-12-21 15:52:30 +08:00
clowwindy 8c59f4eea0 update CHANGES 2014-12-20 20:59:08 +08:00
clowwindy b2c01254bc fix font on Windows 8 2014-12-20 20:35:46 +08:00
clowwindy f339acf380 fix qrcode on high dpi 2014-12-20 20:28:07 +08:00
clowwindy bcdbcae305 don't serialize FriendlyName 2014-12-20 20:10:11 +08:00
clowwindy 06b92a3c0a auto layout 2014-12-20 19:59:05 +08:00
clowwindy ba95aab7f5 update font 2014-12-20 19:01:19 +08:00
clowwindy a2cc753d5a update translation 2014-12-20 18:29:53 +08:00
clowwindy c40e908d05 remove CheckRemark 2014-12-20 18:22:02 +08:00
clowwindy e943247150 update texts 2014-12-20 18:19:43 +08:00
clowwindy eaaacd398d minor fixes 2014-12-20 17:26:40 +08:00
clowwindy 52ca609e3e i18n 2014-12-20 16:56:25 +08:00
clowwindy 254f0ef622 save RAM a little more in PAC server 2014-12-20 14:28:36 +08:00
clowwindy 41850e2931 update project 2014-12-20 13:59:59 +08:00
clowwindy 58f51fcfe9 gzip more 2014-12-20 13:53:43 +08:00
clowwindy cdac52c19c fix LoadLibrary 2014-12-20 13:17:48 +08:00
clowwindy 7122f82f0b merge polarssl and libsodium into a single dll 2014-12-20 13:07:07 +08:00
clowwindy e53873276f translate Microsoft language into human language 2014-12-17 17:21:39 +08:00
clowwindy d94d3074ec update CHANGES 2014-12-15 20:56:23 +08:00
clowwindy ecdb36ff3b bump 2014-12-15 20:54:15 +08:00
clowwindy 41329ff712 Update README.md 2014-12-15 16:18:19 +08:00
clowwindy 3a0cf596e8 Update CHANGES 2014-12-15 11:49:31 +08:00
clowwindy fab822c8bb fix #66 2014-12-15 10:36:50 +08:00
clowwindy 2b6a86d04a fix a typo 2014-12-14 18:15:17 +08:00
clowwindy ebcb5e08f1 Update README.md 2014-12-14 18:00:29 +08:00
clowwindy c1c29da664 bump 2014-12-14 17:43:33 +08:00
clowwindy 5ed49ac6b6 add global mode 2014-12-14 17:43:04 +08:00
clowwindy c65efc17fc update CHANGES 2014-12-13 17:56:45 +08:00
clowwindy 3fff8220e6 make it simpler 2014-12-13 14:25:46 +08:00
clowwindy 104a401b63 Update README.md 2014-12-13 14:25:09 +08:00
clowwindy 639b6b20ee refine logging 2014-12-13 13:36:22 +08:00
clowwindy 05d8d5f6dc refine tests 2014-12-13 12:49:59 +08:00
clowwindy 34b9e2e08a fix rc4 2014-12-13 12:28:30 +08:00
clowwindy b30bb7ef5e fix aes 2014-12-13 11:19:17 +08:00
clowwindy 12047ca70b refine factory 2014-12-13 10:40:42 +08:00
clowwindy f0920098ad sodium works 2014-12-13 10:15:15 +08:00
clowwindy f62c0b92bb refactor 2014-12-13 00:00:10 +08:00
clowwindy ee7056c080 add libsodium 2014-12-12 18:59:05 +08:00
clowwindy 3e70289944 change PAC port into 8093 2014-12-04 14:19:31 +08:00
clowwindy 58e0bdba28 update changes 2014-11-23 01:10:34 +08:00
clowwindy a8f2435c89 bump 2014-11-23 01:09:17 +08:00
clowwindy 3b5c09907d only switch the system proxy off if we have switched it on 2014-11-23 01:09:17 +08:00
clowwindy e13d2287aa just log useful exceptions 2014-11-23 01:09:16 +08:00
clowwindy 506721435d fix a crash 2014-11-23 01:09:16 +08:00
clowwindy 9c3471a303 Update README.md 2014-11-19 00:34:15 +08:00
clowwindy 68f7e3cc9f update changes 2014-11-18 22:40:06 +08:00
clowwindy 05caa5c8c3 fix filename 2014-11-18 22:38:45 +08:00
clowwindy cdcb9897f9 fix OK button 2014-11-18 22:24:10 +08:00
clowwindy 12f418a009 bump 2014-11-18 22:08:31 +08:00
clowwindy 09ad2ca272 release memory periodically 2014-11-18 21:55:45 +08:00
clowwindy 919f9b5ce3 remove blowfish 2014-11-18 20:46:54 +08:00
clowwindy f88b086322 reduce binary size 2014-11-17 19:09:21 +08:00
clowwindy ccea7a4f3e remove unused comments 2014-11-16 13:31:06 +08:00
clowwindy 59976979bd start pac server even when local failed to start 2014-11-16 13:18:13 +08:00
clowwindy f968870414 Update README.md 2014-11-15 12:39:17 +08:00
clowwindy 58d1091ccc update readme 2014-11-15 03:24:40 +08:00
clowwindy d121215c8e set qrcode window background to white 2014-11-15 03:21:59 +08:00
clowwindy ca0774ddb3 enable visual styles before alert() 2014-11-15 03:21:39 +08:00
clowwindy a63ba03a2f remove unused code 2014-11-15 03:14:28 +08:00
clowwindy 7f76141ca2 seperate tray menu from ConfigForm 2014-11-15 03:08:53 +08:00
clowwindy 88b4eac850 make polarssl smaller 2014-11-13 23:23:29 +08:00
clowwindy 3d7b820d3e bump 2014-11-13 22:28:19 +08:00
clowwindy 0d78051318 fix #60 2014-11-13 22:24:51 +08:00
clowwindy b8252d11e4 remove OpenSSL 2014-11-12 23:19:02 +08:00
clowwindy 7626d07ad8 fix #43 2014-11-12 22:47:04 +08:00
clowwindy cec8378fea add commented code of auto proxy type choosing, not enabled now 2014-11-12 22:38:11 +08:00
clowwindy b2e066a888 update changes 2014-11-12 22:04:25 +08:00
clowwindy 2fc3cb920d back to .net 2.0 2014-11-12 22:02:34 +08:00
clowwindy 078ae6c032 bump 2014-11-12 22:00:52 +08:00
clowwindy 3b5777d830 lint code 2014-11-12 21:40:31 +08:00
clowwindy ef050cd3c3 check close actively 2014-11-12 21:27:27 +08:00
clowwindy a65cdd913d Merge branch 'kookxiang-master' 2014-11-12 21:08:54 +08:00
kookxiang 3d4262d11d move code to controller/autostartup 2014-11-12 21:05:31 +08:00
kookxiang c75941fe14 config path 2014-11-12 21:05:23 +08:00
kookxiang 8c90452b90 option to start on boot 2014-11-12 21:05:22 +08:00
clowwindy 6f358c74be Merge pull request #49 from GhostFlying/master
enable proxy for all connections
2014-11-12 15:09:01 +08:00
GhostFlying 58ba4e28e7 enable proxy for all connections 2014-11-12 14:36:08 +08:00
clowwindy ed2722a993 back to polarssl 2014-11-12 02:24:50 +08:00
clowwindy 519232211c iv_off back to ref int 2014-11-12 01:57:32 +08:00
clowwindy aa8e6558d5 move polarssl context to unmanaged heap; fix #32 2014-11-12 01:51:11 +08:00
clowwindy bbbde8a64d add unit test for encryption 2014-11-11 21:52:26 +08:00
clowwindy 1defa4a59a fix index out of range 2014-11-11 21:51:46 +08:00
clowwindy acf2f807a8 experimental 2014-11-11 20:31:10 +08:00
clowwindy 87ec8147d9 bump 2014-11-11 10:29:47 +08:00
clowwindy b538a89fdf add openssl 2014-11-11 10:16:30 +08:00
clowwindy afc5137355 some fix 2014-11-11 02:28:12 +08:00
clowwindy 61c17f65b9 high dpi support; close #47 2014-11-11 00:44:37 +08:00
clowwindy 5cf800729e fix #54 2014-11-10 23:34:40 +08:00
clowwindy b6da609cff update update notification 2014-11-10 03:18:37 +08:00
clowwindy 5c2a93e901 use a fixed GUID 2014-11-10 03:02:31 +08:00
clowwindy 0461e2ca89 try fixing shutdown 2014-11-10 02:42:06 +08:00
clowwindy 8d9375ac11 add nodelay 2014-11-10 00:42:23 +08:00
clowwindy 1297af77fc check disposed in encryption #46 #42 2014-11-09 23:59:53 +08:00
clowwindy a46b7d90c9 back to 2.0 2014-11-09 23:36:58 +08:00
clowwindy 71b8a2817a Merge branch 'wzxjohn-dev' 2014-11-09 20:44:10 +08:00
wzxjohn ac4748d6bf lint code 2014-11-09 20:41:42 +08:00
clowwindy 2477fb816a add locks to all encryption contexts 2014-11-09 19:54:56 +08:00
clowwindy 1ecd7daac8 add lock for Close() 2014-11-09 19:16:02 +08:00
clowwindy 3b2976950a add comments about .net 4.0 crash 2014-11-09 19:02:26 +08:00
clowwindy cfb56c22ae back to 2.0 2014-11-09 17:40:59 +08:00
clowwindy e0780c0ff8 version check 2014-11-09 17:35:44 +08:00
clowwindy 0bcf4324d2 bump 2014-11-09 15:42:03 +08:00
clowwindy 08ee6172bd update CHANGES 2014-11-09 15:40:12 +08:00
clowwindy 212cf6b11a lint code 2014-11-09 15:02:03 +08:00
clowwindy 40efee471d refine qrcode 2014-11-09 14:57:58 +08:00
clowwindy 7faf2c992b do not expose SaveConfig to Views 2014-11-09 14:01:26 +08:00
clowwindy 59502c1984 fix UseShellExecute problem 2014-11-09 13:50:49 +08:00
clowwindy e4ff27a1fc share over LAN 2014-11-09 13:31:33 +08:00
clowwindy 492869fd5c move log to temp path 2014-11-09 11:56:30 +08:00
clowwindy 1f92b48eaf update license 2014-11-09 04:34:08 +08:00
clowwindy 6f35577feb add padding; clean project 2014-11-09 04:21:07 +08:00
clowwindy 7d8f50bb3f remove duplicated icon resource 2014-11-09 04:08:56 +08:00
clowwindy 1c763cba6e Merge branch 'wzxjohn-master' 2014-11-09 04:08:31 +08:00
clowwindy 6c861d455c Merge branch 'master' of https://github.com/wzxjohn/shadowsocks-csharp into wzxjohn-master 2014-11-09 04:06:12 +08:00
clowwindy 165f016a82 refine qrcode form 2014-11-09 03:47:53 +08:00
wzxjohn 5253cc3ca5 Merge remote-tracking branch 'upstream/master' 2014-11-09 03:24:06 +08:00
wzxjohn d28e646ec7 change QR code generator
Use QRCode4CS as the QR code generator, which is much more fast
2014-11-09 03:23:34 +08:00
clowwindy 2585f4d615 remove x64 and AnyCPU again 2014-11-09 02:58:43 +08:00
clowwindy f67413bdc6 Merge pull request #35 from wzxjohn/master
add cancel button for config
2014-11-09 02:55:47 +08:00
clowwindy 0bdd5d298b add comments in readme about the .net framework difference 2014-11-09 02:47:42 +08:00
clowwindy 0bf26002e4 change back to 2.0 2014-11-09 02:45:42 +08:00
clowwindy b9bfbe0522 fix build for .net 4 2014-11-09 02:40:21 +08:00
wzxjohn 262791228d Merge remote-tracking branch 'upstream/master' 2014-11-09 02:28:26 +08:00
wzxjohn efefe274a6 handle no privilege error
Popup an error window when don't have enough privilege to change
Registry.
2014-11-09 02:27:44 +08:00
wzxjohn fc53a07203 change function to C# style
Change the first letter of function to upper case letter to fit C# code
style
2014-11-09 02:18:47 +08:00
wzxjohn 9f50a5a34b add cancel button for config
Now can use esc key to cancel, and don't change focus after change
server from list
2014-11-09 02:13:35 +08:00
wzxjohn b5eac341b3 revert 2014-11-09 02:10:43 +08:00
wzxjohn 24614ba2a7 add cancel button for config
Now can use esc key to cancel, and don't change focus after change
server from list
2014-11-09 02:04:11 +08:00
wzxjohn ac21a0960f add config lock
Add a lock on config form to avoid accidental changes
2014-11-09 01:50:47 +08:00
clowwindy 2ce10ace53 bump 2014-11-09 01:38:00 +08:00
clowwindy 8327c0f289 remove AnyCPU configuration 2014-11-09 01:34:50 +08:00
clowwindy 97eac82c89 remove AnyCPU configuration 2014-11-09 01:34:22 +08:00
clowwindy 3932c4a393 add lock in encryption; #32 2014-11-09 00:11:19 +08:00
clowwindy 772f591633 add qrcodejs 2014-11-08 22:47:35 +08:00
clowwindy c76ffce3ab catch exception when trying to kill polipo 2014-11-08 21:51:08 +08:00
clowwindy 22a7457c3a bump 2014-11-08 21:36:44 +08:00
clowwindy f1872e6c79 fix qrcode size 2014-11-08 21:36:20 +08:00
clowwindy 040ae7981c add qrcode form 2014-11-08 21:36:20 +08:00
clowwindy ddc6183e49 add qrcode.htm 2014-11-08 21:36:19 +08:00
clowwindy 8288b4eda3 add CHANGES 2014-11-08 21:36:08 +08:00
clowwindy 243984efd4 Merge pull request #23 from mengskysama/master
fix pac does not work well on 38.0.2125.111 m
2014-11-08 21:12:57 +08:00
mengskysama 435ab2fbbf fix pac does not work well on 38.0.2125.111 m 2014-11-08 20:54:21 +08:00
clowwindy a2863f1413 fix balloon 2014-11-08 18:43:07 +08:00
clowwindy 2dd2e239f5 bump 2014-11-08 18:40:29 +08:00
clowwindy 2a270445b9 fix #18 2014-11-08 18:28:06 +08:00
clowwindy c26c1dddd4 remarks should be plural 2014-11-08 17:11:56 +08:00
clowwindy a37d21db69 Merge pull request #21 2014-11-08 17:11:04 +08:00
clowwindy b976699172 Merge branch 'master' of https://github.com/Sharuru/shadowsocks-csharp into Sharuru-master 2014-11-08 17:03:22 +08:00
clowwindy 2a1bdae258 update badge 2014-11-08 16:54:50 +08:00
clowwindy 4f50dae77e add build status 2014-11-08 16:52:30 +08:00
clowwindy 3a5d46d909 add 3rd party license 2014-11-08 16:49:42 +08:00
Sharuru 197ddd3d78 Add remark function 2014-11-08 16:41:25 +08:00
clowwindy 1c0bbfd1ab try adding .net 4.0 compat 2014-11-08 16:20:46 +08:00
clowwindy 3d6ee55f5a close #17 2014-11-08 15:27:49 +08:00
clowwindy bed6a6f29c update readme 2014-11-08 14:41:22 +08:00
clowwindy 17791d5451 update readme 2014-11-08 14:22:39 +08:00
clowwindy f0b2cb49a4 auto focus IP textbox 2014-11-08 14:20:32 +08:00
clowwindy 53dab0a049 fix pac watching 2014-11-08 14:12:19 +08:00
clowwindy f34a4d7784 hide password 2014-11-08 14:07:05 +08:00
clowwindy 00b535b112 remove polarssl.dll from repo 2014-11-08 13:54:11 +08:00
clowwindy 23adfd28c7 remove .gitmodules 2014-11-08 13:53:22 +08:00
clowwindy 3be33f7630 add license 2014-11-08 13:52:37 +08:00
clowwindy a56b6013be update readme 2014-11-08 13:44:53 +08:00
clowwindy 508d163d01 add download 2014-11-08 13:44:05 +08:00
clowwindy cc2ce94598 update README 2014-11-08 13:39:07 +08:00
clowwindy 47edb40ba5 implement server switching menu 2014-11-08 13:28:53 +08:00
clowwindy 691e4c4573 better json format 2014-11-08 12:52:33 +08:00
clowwindy 5f1e348a16 remove simple-json submodule 2014-11-08 12:46:59 +08:00
clowwindy afa46b63b7 implement removing server and saving 2014-11-08 12:33:00 +08:00
clowwindy ac1172c3ec implement adding server 2014-11-08 12:17:20 +08:00
clowwindy 366d08c3db remove default items in server list 2014-11-08 04:38:27 +08:00
clowwindy 4c7f393003 half way done 2014-11-08 04:37:38 +08:00
clowwindy fe6c48bdef update UI 2014-11-08 03:50:40 +08:00
clowwindy d2a2731887 update proj settings 2014-11-08 02:00:06 +08:00
clowwindy 17e71c590b update UI 2014-11-08 01:52:07 +08:00
clowwindy 3d5af1c6d8 use upper case Shadowsocks in notify icon text 2014-11-08 01:13:29 +08:00
clowwindy 80ec2787a0 remove unused files 2014-11-08 01:06:05 +08:00
clowwindy 719afc5817 update namespace 2014-11-08 01:03:19 +08:00
clowwindy 04a4427cff update namespace 2014-11-08 01:02:50 +08:00
clowwindy 28b582590a update namespace 2014-11-08 01:01:30 +08:00
clowwindy 22f2a43281 update form 2014-11-08 00:58:23 +08:00
clowwindy 0a21d8a4ae compat 2014-11-08 00:22:23 +08:00
clowwindy 0eb0e8c9e6 use gui-config.json from shadowsocks-gui 2014-11-07 23:53:37 +08:00
clowwindy 97accf0be8 remove comments from polipo config 2014-11-07 22:32:24 +08:00
clowwindy 9269ea2d9b refine logging 2014-11-07 22:27:20 +08:00
clowwindy 39f11b364e fix free 2014-11-07 22:23:59 +08:00
clowwindy 085532e8fa watch PAC changes 2014-11-07 22:06:22 +08:00
clowwindy ce6d4964be PAC edit 2014-11-07 21:46:27 +08:00
clowwindy d4c3a4c331 update icon 2014-11-07 20:14:39 +08:00
clowwindy 8c09e4a9a5 remove TODO 2014-11-07 03:12:47 +08:00
clowwindy 32cadc3c18 use different namespace 2014-11-07 03:11:14 +08:00
clowwindy b3164e5553 adjust layout 2014-11-07 02:19:53 +08:00
clowwindy edd0021a03 fix warning 2014-11-07 01:57:02 +08:00
clowwindy 68246e2653 add timestamp in pac url 2014-11-07 01:48:40 +08:00
clowwindy 0859d03f4d input validation 2014-11-07 01:44:31 +08:00
clowwindy 1de2d001d7 lint project 2014-11-07 01:33:36 +08:00
clowwindy aa105ccfe3 seperate controller and view 2014-11-07 01:26:32 +08:00
clowwindy 27aa95f432 update license 2014-11-06 02:15:51 +08:00
clowwindy 6044af4962 update license 2014-11-06 02:14:53 +08:00
clowwindy 53401a4b9b rename ConfigForm 2014-11-06 02:04:36 +08:00
clowwindy 17765a772f embed polarssl into exe 2014-11-06 01:55:37 +08:00
clowwindy 56365fdf96 add blowfish 2014-11-06 01:31:48 +08:00
clowwindy 5f56ee2d2c only close once 2014-11-06 01:10:03 +08:00
clowwindy d185481726 remove OpenSSL 2014-11-06 01:01:30 +08:00
36 changed files with 1 additions and 4422 deletions
-3
View File
@@ -1,3 +0,0 @@
[submodule "shadowsocks-csharp/simple-json"]
path = shadowsocks-csharp/simple-json
url = git@github.com:facebook-csharp-sdk/simple-json.git
-24
View File
@@ -1,24 +0,0 @@
shadowsocks-csharp
Copyright (c) 2013 clowwindy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1 -6
View File
@@ -1,6 +1 @@
shadowsocks-csharp
===========
This is C# version of shadowsocks.
In progress.
Removed according to regulations.
Binary file not shown.
Binary file not shown.
-27
View File
@@ -1,27 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "shadowsocks-csharp", "shadowsocks-csharp\shadowsocks-csharp.csproj", "{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x86.ActiveCfg = Debug|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x86.Build.0 = Debug|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Debug|x86.Deploy.0 = Debug|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|Any CPU.Build.0 = Release|Any CPU
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|x86.ActiveCfg = Release|x86
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
-86
View File
@@ -1,86 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using SimpleJson;
namespace shadowsocks_csharp
{
[Serializable]
public class Config
{
public bool enabled;
public string server;
public int server_port;
public int local_port;
public string password;
public string method;
public bool isDefault;
private static void assert(bool condition)
{
if(!condition)
{
throw new Exception("assertion failure");
}
}
public static Config Load()
{
try
{
using (StreamReader sr = new StreamReader(File.OpenRead(@"config.json")))
{
Config config = SimpleJson.SimpleJson.DeserializeObject<Config>(sr.ReadToEnd());
assert(!string.IsNullOrEmpty(config.server));
assert(!string.IsNullOrEmpty(config.password));
assert(config.local_port > 0);
assert(config.server_port > 0);
config.isDefault = false;
return config;
}
}
catch (Exception e)
{
Console.WriteLine(e);
return new Config
{
server = "127.0.0.1",
server_port = 8388,
local_port = 1080,
password = "barfoo!",
method = "table",
enabled = true,
isDefault = true
};
}
}
public static void Save(Config config)
{
try
{
using (StreamWriter sw = new StreamWriter(File.Open(@"config.json", FileMode.Create)))
{
string jsonString = SimpleJson.SimpleJson.SerializeObject(new
{
server = config.server,
server_port = config.server_port,
local_port = config.local_port,
password = config.password,
method = config.method,
enabled = config.enabled
});
sw.Write(jsonString);
sw.Flush();
}
}
catch (IOException e)
{
Console.Error.WriteLine(e);
}
}
}
}
@@ -1,31 +0,0 @@
using System.Security.Cryptography;
using System.Text;
namespace shadowsocks_csharp.Encrypt
{
public abstract class EncryptorBase
: IEncryptor
{
protected EncryptorBase(string method, string password)
{
Method = method;
Password = password;
}
protected string Method;
protected string Password;
protected byte[] GetPasswordHash()
{
byte[] inputBytes = Encoding.UTF8.GetBytes(Password);
byte[] hash = MD5.Create().ComputeHash(inputBytes);
return hash;
}
public abstract void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength);
public abstract void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength);
public abstract void Dispose();
}
}
@@ -1,16 +0,0 @@
namespace shadowsocks_csharp.Encrypt
{
public static class EncryptorFactory
{
public static IEncryptor GetEncryptor(string method, string password)
{
if (string.IsNullOrEmpty(method) || method.ToLowerInvariant() == "table")
{
return new TableEncryptor(method, password);
}
return new PolarSSLEncryptor(method, password);
}
}
}
-12
View File
@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace shadowsocks_csharp.Encrypt
{
public interface IEncryptor : IDisposable
{
void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength);
void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength);
}
}
-45
View File
@@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace shadowsocks_csharp.Encrypt
{
public class OpenSSL
{
const string DLLNAME = "libeay32";
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void OpenSSL_add_all_ciphers();
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr EVP_md5();
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int EVP_BytesToKey(IntPtr type, IntPtr md, IntPtr salt, byte[] data, int datal, int count, byte[] key, byte[] iv);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int RAND_bytes(byte[] buf, int num);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr EVP_get_cipherbyname(byte[] name);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr EVP_CIPHER_CTX_new();
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int EVP_CipherInit_ex(IntPtr ctx, IntPtr type, IntPtr impl, byte[] key, byte[] iv, int enc);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int EVP_CIPHER_CTX_cleanup(IntPtr a);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int EVP_CIPHER_CTX_free(IntPtr a);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int EVP_CipherUpdate(IntPtr ctx, byte[] outb, out int outl, byte[] inb, int inl);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr MD5(byte[] d, long n, byte[] md);
}
}
@@ -1,170 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace shadowsocks_csharp.Encrypt
{
public class OpensslEncryptor
: EncryptorBase, IDisposable
{
static Dictionary<string, int[]> ciphers = new Dictionary<string, int[]> {
{"aes-128-cfb", new int[]{16, 16}},
{"aes-192-cfb", new int[]{24, 16}},
{"aes-256-cfb", new int[]{32, 16}},
{"bf-cfb", new int[]{16, 8}},
{"rc4", new int[]{16, 0}},
{"rc4-md5", new int[]{16, 16}},
};
static OpensslEncryptor()
{
OpenSSL.OpenSSL_add_all_ciphers();
}
public OpensslEncryptor(string method, string password)
: base(method, password)
{
InitKey(method, password);
}
static byte[] tempbuf = new byte[32768];
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
{
if (_encryptCtx == IntPtr.Zero)
{
OpenSSL.RAND_bytes(outbuf, ivLen);
InitCipher(ref _encryptCtx, outbuf, true);
outlength = length + ivLen;
OpenSSL.EVP_CipherUpdate(_encryptCtx, tempbuf, out outlength, buf, length);
outlength = length + ivLen;
Buffer.BlockCopy(tempbuf, 0, outbuf, ivLen, outlength);
}
else
{
outlength = length;
OpenSSL.EVP_CipherUpdate(_encryptCtx, outbuf, out outlength, buf, length);
}
}
public override void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
{
if (_decryptCtx == IntPtr.Zero)
{
InitCipher(ref _decryptCtx, buf, false);
outlength = length - ivLen;
Buffer.BlockCopy(buf, ivLen, tempbuf, 0, length - ivLen);
OpenSSL.EVP_CipherUpdate(_decryptCtx, outbuf, out outlength, tempbuf, length - ivLen);
}
else
{
outlength = length;
OpenSSL.EVP_CipherUpdate(_decryptCtx, outbuf, out outlength, buf, length);
}
}
private static readonly Dictionary<string, byte[]> CachedKeys = new Dictionary<string, byte[]>();
private byte[] _key;
private IntPtr _encryptCtx;
private IntPtr _decryptCtx;
private IntPtr _cipher;
private string _method;
private int keyLen;
private int ivLen;
private void InitKey(string method, string password)
{
method = method.ToLower();
_method = method;
string k = method + ":" + password;
if (method == "rc4-md5")
{
method = "rc4";
}
_cipher = OpenSSL.EVP_get_cipherbyname(System.Text.Encoding.UTF8.GetBytes(method));
if (_cipher == null)
{
throw new Exception("method not found");
}
keyLen = ciphers[_method][0];
ivLen = ciphers[_method][1];
if (CachedKeys.ContainsKey(k))
{
_key = CachedKeys[k];
}
else
{
byte[] passbuf = Encoding.UTF8.GetBytes(password);
_key = new byte[32];
byte[] iv = new byte[16];
OpenSSL.EVP_BytesToKey(_cipher, OpenSSL.EVP_md5(), IntPtr.Zero, passbuf, passbuf.Length, 1, _key, iv);
CachedKeys[k] = _key;
}
}
private void InitCipher(ref IntPtr ctx, byte[] iv, bool isCipher)
{
ctx = OpenSSL.EVP_CIPHER_CTX_new();
int enc = isCipher ? 1 : 0;
byte[] realkey;
IntPtr r = IntPtr.Zero;
if (_method == "rc4-md5")
{
byte[] temp = new byte[keyLen + ivLen];
realkey = new byte[keyLen];
Array.Copy(_key, 0, temp, 0, keyLen);
Array.Copy(iv, 0, temp, keyLen, ivLen);
r = OpenSSL.MD5(temp, keyLen + ivLen, null);
Marshal.Copy(r, realkey, 0, keyLen);
}
else
{
realkey = _key;
}
OpenSSL.EVP_CipherInit_ex(ctx, _cipher, IntPtr.Zero, realkey, iv, enc);
}
#region IDisposable
private bool _disposed;
public override void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~OpensslEncryptor()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
}
if (_encryptCtx.ToInt64() != 0)
{
OpenSSL.EVP_CIPHER_CTX_cleanup(_encryptCtx);
OpenSSL.EVP_CIPHER_CTX_free(_encryptCtx);
_encryptCtx = IntPtr.Zero;
}
if (_decryptCtx.ToInt64() != 0)
{
OpenSSL.EVP_CIPHER_CTX_cleanup(_decryptCtx);
OpenSSL.EVP_CIPHER_CTX_free(_decryptCtx);
_decryptCtx = IntPtr.Zero;
}
_disposed = true;
}
}
#endregion
}
}
-44
View File
@@ -1,44 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace shadowsocks_csharp.Encrypt
{
public class PolarSSL
{
const string DLLNAME = "polarssl";
public const int AES_CTX_SIZE = 8 + 4 * 68;
public const int AES_ENCRYPT = 1;
public const int AES_DECRYPT = 0;
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void aes_init(byte[] ctx);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void aes_free(byte[] ctx);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int aes_setkey_enc(byte[] ctx, byte[] key, int keysize);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int aes_crypt_cfb128(byte[] ctx, int mode, int length, ref int iv_off, byte[] iv, byte[] input, byte[] output);
public const int ARC4_CTX_SIZE = 264;
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void arc4_init(byte[] ctx);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void arc4_free(byte[] ctx);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static void arc4_setup(byte[] ctx, byte[] key, int keysize);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public extern static int arc4_crypt(byte[] ctx, int length, byte[] input, byte[] output);
}
}
@@ -1,219 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
namespace shadowsocks_csharp.Encrypt
{
public class PolarSSLEncryptor
: EncryptorBase, IDisposable
{
const int CIPHER_AES = 1;
const int CIPHER_RC4 = 2;
const int CIPHER_BF = 3;
static Dictionary<string, int[]> ciphers = new Dictionary<string, int[]> {
{"aes-128-cfb", new int[]{16, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}},
{"aes-192-cfb", new int[]{24, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}},
{"aes-256-cfb", new int[]{32, 16, CIPHER_AES, PolarSSL.AES_CTX_SIZE}},
//{"bf-cfb", new int[]{16, 8, CIPHER_BF, PolarSSL.BF_CTX_SIZE}},
{"rc4", new int[]{16, 0, CIPHER_RC4, PolarSSL.ARC4_CTX_SIZE}},
{"rc4-md5", new int[]{16, 16, CIPHER_RC4, PolarSSL.ARC4_CTX_SIZE}},
};
private static readonly Dictionary<string, byte[]> CachedKeys = new Dictionary<string, byte[]>();
private int _cipher;
private int[] _cipherInfo;
private byte[] _key;
private byte[] _encryptCtx;
private byte[] _decryptCtx;
private byte[] _encryptIV;
private byte[] _decryptIV;
private int _encryptIVOffset;
private int _decryptIVOffset;
private string _method;
private int keyLen;
private int ivLen;
public PolarSSLEncryptor(string method, string password)
: base(method, password)
{
InitKey(method, password);
}
private static void randBytes(byte[] buf, int length)
{
byte[] temp = new byte[length];
new Random().NextBytes(temp);
temp.CopyTo(buf, 0);
}
private void bytesToKey(byte[] password, byte[] key)
{
byte[] result = new byte[password.Length + 16];
int i = 0;
byte[] md5sum = null;
while (i < key.Length)
{
MD5 md5 = MD5.Create();
if (i == 0)
{
md5sum = md5.ComputeHash(password);
}
else
{
md5sum.CopyTo(result, 0);
password.CopyTo(result, md5sum.Length);
md5sum = md5.ComputeHash(result);
}
md5sum.CopyTo(key, i);
i += md5sum.Length;
}
}
private void InitKey(string method, string password)
{
method = method.ToLower();
_method = method;
string k = method + ":" + password;
_cipherInfo = ciphers[_method];
_cipher = _cipherInfo[2];
if (_cipher == 0)
{
throw new Exception("method not found");
}
keyLen = ciphers[_method][0];
ivLen = ciphers[_method][1];
if (CachedKeys.ContainsKey(k))
{
_key = CachedKeys[k];
}
else
{
byte[] passbuf = Encoding.UTF8.GetBytes(password);
_key = new byte[32];
byte[] iv = new byte[16];
bytesToKey(passbuf, _key);
CachedKeys[k] = _key;
}
}
private void InitCipher(ref byte[] ctx, byte[] iv, bool isCipher)
{
ctx = new byte[_cipherInfo[3]];
byte[] realkey;
if (_method == "rc4-md5")
{
byte[] temp = new byte[keyLen + ivLen];
realkey = new byte[keyLen];
Array.Copy(_key, 0, temp, 0, keyLen);
Array.Copy(iv, 0, temp, keyLen, ivLen);
realkey = MD5.Create().ComputeHash(temp);
}
else
{
realkey = _key;
}
if (_cipher == CIPHER_AES)
{
PolarSSL.aes_init(ctx);
if (isCipher)
{
// PolarSSL takes key length by bit
PolarSSL.aes_setkey_enc(ctx, realkey, keyLen * 8);
_encryptIV = new byte[ivLen];
Array.Copy(iv, _encryptIV, ivLen);
}
else
{
// PolarSSL takes key length by bit
// since we'll use CFB mode, here we also do enc, not dec
PolarSSL.aes_setkey_enc(ctx, realkey, keyLen * 8);
_decryptIV = new byte[ivLen];
Array.Copy(iv, _decryptIV, ivLen);
}
}
else if (_cipher == CIPHER_RC4)
{
PolarSSL.arc4_init(ctx);
PolarSSL.arc4_setup(ctx, realkey, keyLen);
}
}
static byte[] tempbuf = new byte[32768];
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
{
if (_encryptCtx == null)
{
randBytes(outbuf, ivLen);
InitCipher(ref _encryptCtx, outbuf, true);
outlength = length + ivLen;
switch (_cipher)
{
case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_encryptCtx, PolarSSL.AES_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, tempbuf);
break;
case CIPHER_RC4:
PolarSSL.arc4_crypt(_encryptCtx, length, buf, tempbuf);
break;
}
outlength = length + ivLen;
Buffer.BlockCopy(tempbuf, 0, outbuf, ivLen, outlength);
}
else
{
outlength = length;
switch (_cipher)
{
case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_encryptCtx, PolarSSL.AES_ENCRYPT, length, ref _encryptIVOffset, _encryptIV, buf, outbuf);
break;
case CIPHER_RC4:
PolarSSL.arc4_crypt(_encryptCtx, length, buf, outbuf);
break;
}
}
}
public override void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
{
if (_decryptCtx == null)
{
InitCipher(ref _decryptCtx, buf, false);
outlength = length - ivLen;
Buffer.BlockCopy(buf, ivLen, tempbuf, 0, length - ivLen);
switch (_cipher)
{
case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_decryptCtx, PolarSSL.AES_DECRYPT, length - ivLen, ref _decryptIVOffset, _decryptIV, tempbuf, outbuf);
break;
case CIPHER_RC4:
PolarSSL.arc4_crypt(_decryptCtx, length - ivLen, tempbuf, outbuf);
break;
}
}
else
{
outlength = length;
switch (_cipher)
{
case CIPHER_AES:
PolarSSL.aes_crypt_cfb128(_decryptCtx, PolarSSL.AES_DECRYPT, length, ref _decryptIVOffset, _decryptIV, buf, outbuf);
break;
case CIPHER_RC4:
PolarSSL.arc4_crypt(_decryptCtx, length, buf, outbuf);
break;
}
}
}
public override void Dispose()
{
}
}
}
@@ -1,102 +0,0 @@
using System;
namespace shadowsocks_csharp.Encrypt
{
public class TableEncryptor
: EncryptorBase
{
public TableEncryptor(string method, string password)
: base(method, password)
{
byte[] hash = GetPasswordHash();
// TODO endian
ulong a = BitConverter.ToUInt64(hash, 0);
for (int i = 0; i < 256; i++)
{
_encryptTable[i] = (byte)i;
}
for (int i = 1; i < 1024; i++)
{
_encryptTable = MergeSort(_encryptTable, a, i);
}
for (int i = 0; i < 256; i++)
{
_decryptTable[_encryptTable[i]] = (byte)i;
}
}
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
{
byte[] result = new byte[length];
for (int i = 0; i < length; i++)
{
outbuf[i] = _encryptTable[buf[i]];
}
outlength = length;
}
public override void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength)
{
byte[] result = new byte[length];
for (int i = 0; i < length; i++)
{
outbuf[i] = _decryptTable[buf[i]];
}
outlength = length;
}
private readonly byte[] _encryptTable = new byte[256];
private readonly byte[] _decryptTable = new byte[256];
private static long Compare(byte x, byte y, ulong a, int i)
{
return (long)(a % (ulong)(x + i)) - (long)(a % (ulong)(y + i));
}
private byte[] MergeSort(byte[] array, ulong a, int j)
{
if (array.Length == 1)
{
return array;
}
int middle = array.Length / 2;
byte[] left = new byte[middle];
for (int i = 0; i < middle; i++)
{
left[i] = array[i];
}
byte[] right = new byte[array.Length - middle];
for (int i = 0; i < array.Length - middle; i++)
{
right[i] = array[i + middle];
}
left = MergeSort(left, a, j);
right = MergeSort(right, a, j);
int leftptr = 0;
int rightptr = 0;
byte[] sorted = new byte[array.Length];
for (int k = 0; k < array.Length; k++)
{
if (rightptr == right.Length || ((leftptr < left.Length) && (Compare(left[leftptr], right[rightptr], a, j) <= 0)))
{
sorted[k] = left[leftptr];
leftptr++;
}
else if (leftptr == left.Length || ((rightptr < right.Length) && (Compare(right[rightptr], left[leftptr], a, j)) <= 0))
{
sorted[k] = right[rightptr];
rightptr++;
}
}
return sorted;
}
public override void Dispose()
{
}
}
}
-333
View File
@@ -1,333 +0,0 @@
namespace shadowsocks_csharp
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label5 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.panel2 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.enableItem = new System.Windows.Forms.MenuItem();
this.aboutItem = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.quitItem = new System.Windows.Forms.MenuItem();
this.configItem = new System.Windows.Forms.MenuItem();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.textBox2, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.textBox3, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.textBox4, 1, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(22, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(196, 131);
this.tableLayoutPanel1.TabIndex = 0;
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(11, 111);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(52, 13);
this.label5.TabIndex = 8;
this.label5.Text = "Encryptor";
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Server IP";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Server Port";
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.comboBox1.ItemHeight = 13;
this.comboBox1.Items.AddRange(new object[] {
"table",
"rc4-md5",
"aes-256-cfb",
"aes-192-cfb",
"aes-128-cfb",
"bf-cfb",
"rc4"});
this.comboBox1.Location = new System.Drawing.Point(69, 107);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(124, 21);
this.comboBox1.TabIndex = 9;
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Password";
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(8, 84);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 13);
this.label4.TabIndex = 3;
this.label4.Text = "Proxy Port";
//
// textBox1
//
this.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox1.Location = new System.Drawing.Point(69, 3);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(124, 20);
this.textBox1.TabIndex = 4;
this.textBox1.WordWrap = false;
//
// textBox2
//
this.textBox2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox2.Location = new System.Drawing.Point(69, 29);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(124, 20);
this.textBox2.TabIndex = 5;
this.textBox2.WordWrap = false;
//
// textBox3
//
this.textBox3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox3.Location = new System.Drawing.Point(69, 55);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(124, 20);
this.textBox3.TabIndex = 6;
this.textBox3.WordWrap = false;
//
// textBox4
//
this.textBox4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBox4.Location = new System.Drawing.Point(69, 81);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(124, 20);
this.textBox4.TabIndex = 7;
this.textBox4.WordWrap = false;
//
// notifyIcon1
//
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "shadowsocks";
this.notifyIcon1.Visible = true;
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
//
// panel2
//
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.panel2.AutoSize = true;
this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel2.Location = new System.Drawing.Point(61, 175);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(0, 0);
this.panel2.TabIndex = 1;
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(4, 4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.OKButton_Click);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(86, 4);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.cancelButton_Click);
//
// panel1
//
this.panel1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.panel1.AutoSize = true;
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.button1);
this.panel1.Location = new System.Drawing.Point(61, 153);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(164, 30);
this.panel1.TabIndex = 1;
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.enableItem,
this.configItem,
this.aboutItem,
this.menuItem3,
this.quitItem});
//
// enableItem
//
this.enableItem.Index = 0;
this.enableItem.Text = "Enable";
this.enableItem.Click += new System.EventHandler(this.EnableItem_Click);
//
// aboutItem
//
this.aboutItem.Index = 2;
this.aboutItem.Text = "About";
this.aboutItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// menuItem3
//
this.menuItem3.Index = 3;
this.menuItem3.Text = "-";
//
// quitItem
//
this.quitItem.Index = 4;
this.quitItem.Text = "Quit";
this.quitItem.Click += new System.EventHandler(this.Quit_Click);
//
// configItem
//
this.configItem.Index = 1;
this.configItem.Text = "Options...";
this.configItem.Click += new System.EventHandler(this.Config_Click);
//
// Form1
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(282, 206);
this.Controls.Add(this.panel2);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Shadowsocks";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem enableItem;
private System.Windows.Forms.MenuItem aboutItem;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem quitItem;
private System.Windows.Forms.MenuItem configItem;
}
}
-163
View File
@@ -1,163 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace shadowsocks_csharp
{
public partial class Form1 : Form
{
Local local;
PACServer pacServer;
Config config;
PolipoRunner polipoRunner;
public Form1()
{
config = Config.Load();
InitializeComponent();
notifyIcon1.ContextMenu = contextMenu1;
enableItem.Checked = config.enabled;
configToTextBox();
}
private void showWindow()
{
this.Opacity = 1;
this.Show();
}
private void configToTextBox()
{
textBox1.Text = config.server;
textBox2.Text = config.server_port.ToString();
textBox3.Text = config.password;
textBox4.Text = config.local_port.ToString();
comboBox1.Text = config.method == null ? "table" : config.method;
}
private void Form1_Load(object sender, EventArgs e)
{
if (!config.isDefault)
{
this.Opacity = 0;
reload(config); BeginInvoke(new MethodInvoker(delegate
{
this.Hide();
}));
}
pacServer = new PACServer();
pacServer.Start();
updateSystemProxy();
}
private void reload(Config config)
{
if (local != null)
{
local.Stop();
if (polipoRunner != null)
{
polipoRunner.Stop();
}
}
if (polipoRunner == null)
{
polipoRunner = new PolipoRunner();
}
polipoRunner.Start(config);
local = new Local(config);
local.Start();
}
private void Config_Click(object sender, EventArgs e)
{
showWindow();
}
private void Quit_Click(object sender, EventArgs e)
{
this.Close();
}
private void OKButton_Click(object sender, EventArgs e)
{
try
{
Config config = new Config
{
server = textBox1.Text,
server_port = int.Parse(textBox2.Text),
password = textBox3.Text,
local_port = int.Parse(textBox4.Text),
method = comboBox1.Text,
isDefault = false
};
Config.Save(config);
this.config = config;
reload(config);
this.Hide();
}
catch (FormatException)
{
MessageBox.Show("there is format problem");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
this.Hide();
configToTextBox();
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
if (local != null) local.Stop();
if (polipoRunner != null) polipoRunner.Stop();
if (config.enabled)
{
SystemProxy.Disable();
}
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/clowwindy/shadowsocks-csharp");
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
showWindow();
}
private void updateSystemProxy()
{
if (config.enabled)
{
SystemProxy.Enable();
}
else
{
SystemProxy.Disable();
}
}
private void EnableItem_Click(object sender, EventArgs e)
{
enableItem.Checked = !enableItem.Checked;
config.enabled = enableItem.Checked;
Config.Save(config);
updateSystemProxy();
}
}
}
File diff suppressed because it is too large Load Diff
-380
View File
@@ -1,380 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Net;
using shadowsocks_csharp.Encrypt;
namespace shadowsocks_csharp
{
class Local
{
private Config config;
//private Encryptor encryptor;
Socket listener;
public Local(Config config)
{
this.config = config;
//this.encryptor = new Encryptor(config.method, config.password);
}
public void Start()
{
// Create a TCP/IP socket.
listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndPoint = new IPEndPoint(0, config.local_port);
// Bind the socket to the local endpoint and listen for incoming connections.
listener.Bind(localEndPoint);
listener.Listen(100);
// Start an asynchronous socket to listen for connections.
Console.WriteLine("Waiting for a connection...");
listener.BeginAccept(
new AsyncCallback(AcceptCallback),
listener);
}
public void Stop()
{
listener.Close();
}
public void AcceptCallback(IAsyncResult ar)
{
try
{
// Get the socket that handles the client request.
Socket listener = (Socket)ar.AsyncState;
//if (!listener.Connected)
//{
// return;
//}
listener.BeginAccept(
new AsyncCallback(AcceptCallback),
listener);
Socket conn = listener.EndAccept(ar);
// Create the state object.
Handler handler = new Handler();
handler.connection = conn;
//if (encryptor.method == "table")
//{
// handler.encryptor = encryptor;
//}
//else
//{
// handler.encryptor = new Encryptor(config.method, config.password);
//}
handler.encryptor = EncryptorFactory.GetEncryptor(config.method, config.password);
handler.config = config;
handler.Start();
//handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0,
// new AsyncCallback(ReadCallback), state);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
class Handler
{
//public Encryptor encryptor;
public IEncryptor encryptor;
public Config config;
// Client socket.
public Socket remote;
public Socket connection;
// Size of receive buffer.
public const int RecvSize = 16384;
public const int BufferSize = RecvSize + 32;
// remote receive buffer
public byte[] remoteRecvBuffer = new byte[RecvSize];
// remote send buffer
public byte[] remoteSendBuffer = new byte[BufferSize];
// connection receive buffer
public byte[] connetionRecvBuffer = new byte[RecvSize];
// connection send buffer
public byte[] connetionSendBuffer = new byte[BufferSize];
// Received data string.
public StringBuilder sb = new StringBuilder();
public void Start()
{
try
{
// TODO async resolving
IPAddress ipAddress;
bool parsed = IPAddress.TryParse(config.server, out ipAddress);
if (!parsed)
{
IPHostEntry ipHostInfo = Dns.GetHostEntry(config.server);
ipAddress = ipHostInfo.AddressList[0];
}
IPEndPoint remoteEP = new IPEndPoint(ipAddress, config.server_port);
remote = new Socket(ipAddress.AddressFamily,
SocketType.Stream, ProtocolType.Tcp);
// Connect to the remote endpoint.
remote.BeginConnect(remoteEP,
new AsyncCallback(connectCallback), null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
public void Close()
{
if (connection != null)
{
try
{
connection.Shutdown(SocketShutdown.Send);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
if (remote != null)
{
try
{
remote.Shutdown(SocketShutdown.Send);
}
catch (SocketException e)
{
Console.WriteLine(e.ToString());
}
}
((IDisposable)encryptor).Dispose();
}
private void connectCallback(IAsyncResult ar)
{
try
{
// Complete the connection.
remote.EndConnect(ar);
Console.WriteLine("Socket connected to {0}",
remote.RemoteEndPoint.ToString());
handshakeReceive();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void handshakeReceive()
{
try
{
connection.BeginReceive(connetionRecvBuffer, 0, 256, 0,
new AsyncCallback(handshakeReceiveCallback), null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void handshakeReceiveCallback(IAsyncResult ar)
{
try
{
int bytesRead = connection.EndReceive(ar);
if (bytesRead > 1)
{
byte[] response = { 5, 0 };
if (connetionRecvBuffer[0] != 5)
{
// reject socks 4
response = new byte[]{ 0, 91 };
}
connection.BeginSend(response, 0, response.Length, 0, new AsyncCallback(handshakeSendCallback), null);
}
else
{
this.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void handshakeSendCallback(IAsyncResult ar)
{
try
{
connection.EndSend(ar);
// +----+-----+-------+------+----------+----------+
// |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
// +----+-----+-------+------+----------+----------+
// | 1 | 1 | X'00' | 1 | Variable | 2 |
// +----+-----+-------+------+----------+----------+
// Skip first 3 bytes
// TODO validate
connection.BeginReceive(connetionRecvBuffer, 0, 3, 0,
new AsyncCallback(handshakeReceive2Callback), null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void handshakeReceive2Callback(IAsyncResult ar)
{
try
{
int bytesRead = connection.EndReceive(ar);
if (bytesRead > 0)
{
byte[] response = { 5, 0, 0, 1, 0, 0, 0, 0, 0, 0 };
connection.BeginSend(response, 0, response.Length, 0, new AsyncCallback(startPipe), null);
}
else
{
this.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void startPipe(IAsyncResult ar)
{
try
{
connection.EndReceive(ar);
remote.BeginReceive(remoteRecvBuffer, 0, RecvSize, 0,
new AsyncCallback(pipeRemoteReceiveCallback), null);
connection.BeginReceive(connetionRecvBuffer, 0, RecvSize, 0,
new AsyncCallback(pipeConnectionReceiveCallback), null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void pipeRemoteReceiveCallback(IAsyncResult ar)
{
try
{
int bytesRead = remote.EndReceive(ar);
if (bytesRead > 0)
{
int bytesToSend;
encryptor.Decrypt(remoteRecvBuffer, bytesRead, remoteSendBuffer, out bytesToSend);
connection.BeginSend(remoteSendBuffer, 0, bytesToSend, 0, new AsyncCallback(pipeConnectionSendCallback), null);
}
else
{
Console.WriteLine("bytesRead: " + bytesRead.ToString());
this.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void pipeConnectionReceiveCallback(IAsyncResult ar)
{
try
{
int bytesRead = connection.EndReceive(ar);
if (bytesRead > 0)
{
int bytesToSend;
encryptor.Encrypt(connetionRecvBuffer, bytesRead, connetionSendBuffer, out bytesToSend);
remote.BeginSend(connetionSendBuffer, 0, bytesToSend, 0, new AsyncCallback(pipeRemoteSendCallback), null);
}
else
{
Console.WriteLine("bytesRead: " + bytesRead.ToString());
this.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void pipeRemoteSendCallback(IAsyncResult ar)
{
try
{
remote.EndSend(ar);
connection.BeginReceive(this.connetionRecvBuffer, 0, RecvSize, 0,
new AsyncCallback(pipeConnectionReceiveCallback), null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
private void pipeConnectionSendCallback(IAsyncResult ar)
{
try
{
connection.EndSend(ar);
remote.BeginReceive(this.remoteRecvBuffer, 0, RecvSize, 0,
new AsyncCallback(pipeRemoteReceiveCallback), null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
this.Close();
}
}
}
}
-115
View File
@@ -1,115 +0,0 @@
using shadowsocks_csharp.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace shadowsocks_csharp
{
class PACServer
{
Socket listener;
public void Start()
{
// Create a TCP/IP socket.
listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndPoint = new IPEndPoint(0, 8090);
// Bind the socket to the local endpoint and listen for incoming connections.
listener.Bind(localEndPoint);
listener.Listen(100);
listener.BeginAccept(
new AsyncCallback(AcceptCallback),
listener);
}
public void AcceptCallback(IAsyncResult ar)
{
try
{
Socket listener = (Socket)ar.AsyncState;
listener.BeginAccept(
new AsyncCallback(AcceptCallback),
listener);
Socket conn = listener.EndAccept(ar);
conn.BeginReceive(new byte[1024], 0, 256, 0,
new AsyncCallback(receiveCallback), conn);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
private string getPACContent()
{
// TODO try pac.txt in current directory
byte[] pacGZ = Resources.proxy_pac_txt;
byte[] buffer = new byte[1024 * 1024]; // builtin pac gzip size: maximum 1M
int n;
using (GZipStream input = new GZipStream(new MemoryStream(pacGZ),
CompressionMode.Decompress, false))
{
n = input.Read(buffer, 0, buffer.Length);
if (n == 0)
{
throw new IOException("can not decompress pac");
}
return System.Text.Encoding.UTF8.GetString(buffer, 0, n);
}
}
private void receiveCallback(IAsyncResult ar)
{
Socket conn = (Socket)ar.AsyncState;
try
{
int bytesRead = conn.EndReceive(ar);
string pac = getPACContent();
string proxy = "PROXY 127.0.0.1:8123; DIRECT;";
pac = pac.Replace("__PROXY__", proxy);
if (bytesRead > 0)
{
string text = String.Format(@"HTTP/1.1 200 OK
Server: Shadowsocks
Content-Type: application/x-ns-proxy-autoconfig
Content-Length: {0}
Connection: Close
", System.Text.Encoding.UTF8.GetBytes(pac).Length) + pac;
byte[] response = System.Text.Encoding.UTF8.GetBytes(text);
conn.BeginSend(response, 0, response.Length, 0, new AsyncCallback(sendCallback), conn);
}
else
{
conn.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
conn.Close();
}
}
private void sendCallback(IAsyncResult ar)
{
Socket conn = (Socket)ar.AsyncState;
conn.Shutdown(SocketShutdown.Send);
}
}
}
-98
View File
@@ -1,98 +0,0 @@
using shadowsocks_csharp.Properties;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Text;
namespace shadowsocks_csharp
{
class PolipoRunner
{
private Process process;
private bool ByteArrayToFile(string fileName, byte[] content)
{
try
{
System.IO.FileStream _FileStream =
new System.IO.FileStream(fileName, System.IO.FileMode.Create,
System.IO.FileAccess.Write);
_FileStream.Write(content, 0, content.Length);
_FileStream.Close();
return true;
}
catch (Exception _Exception)
{
Console.WriteLine("Exception caught in process: {0}",
_Exception.ToString());
}
return false;
}
public static void UncompressFile(string fileName, byte[] content)
{
FileStream destinationFile = File.Create(fileName);
// Because the uncompressed size of the file is unknown,
// we are using an arbitrary buffer size.
byte[] buffer = new byte[4096];
int n;
using (GZipStream input = new GZipStream(new MemoryStream(content),
CompressionMode.Decompress, false))
{
while (true)
{
n = input.Read(buffer, 0, buffer.Length);
if (n == 0)
{
break;
}
destinationFile.Write(buffer, 0, n);
}
}
destinationFile.Close();
}
public void Start(Config config)
{
if (process == null)
{
Process[] existingPolipo = Process.GetProcessesByName("ss_polipo");
foreach (Process p in existingPolipo)
{
p.Kill();
p.WaitForExit();
}
string temppath = Path.GetTempPath();
string polipoConfig = Resources.polipo_config;
polipoConfig = polipoConfig.Replace("__SOCKS_PORT__", config.local_port.ToString());
ByteArrayToFile(temppath + "/polipo.conf", System.Text.Encoding.UTF8.GetBytes(polipoConfig));
UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe);
process = new Process();
// Configure the process using the StartInfo properties.
process.StartInfo.FileName = temppath + "/ss_polipo.exe";
process.StartInfo.Arguments = "-c \"" + temppath + "/polipo.conf\"";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
//process.StandardOutput
process.Start();
}
}
public void Stop()
{
if (process != null)
{
process.Kill();
process.WaitForExit();
process = null;
}
}
}
}
-37
View File
@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
namespace shadowsocks_csharp
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
try
{
FileStream fs = new FileStream("shadowsocks.log", FileMode.Append);
TextWriter tmp = Console.Out;
StreamWriter sw = new StreamWriter(fs);
sw.AutoFlush = true;
Console.SetOut(sw);
Console.SetError(sw);
}
catch (IOException e)
{
Console.WriteLine(e.ToString());
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过下列属性集
// 控制。更改这些属性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("shadowsocks-csharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("clowwindy")]
[assembly: AssemblyProduct("shadowsocks-csharp")]
[assembly: AssemblyCopyright("Copyright © clowwindy 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 属性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f8334709-4309-436a-8bbd-6165dcf4a660")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 内部版本号
// 修订号
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2")]
[assembly: AssemblyFileVersion("1.1.2")]
-108
View File
@@ -1,108 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace shadowsocks_csharp.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("shadowsocks_csharp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to # Sample configuration file for Polipo. -*-sh-*-
///
///# You should not need to use a configuration file; all configuration
///# variables have reasonable defaults. If you want to use one, you
///# can copy this to /etc/polipo/config or to ~/.polipo and modify.
///
///# This file only contains some of the configuration variables; see the
///# list given by ``polipo -v&apos;&apos; and the manual for more.
///
///
///### Basic configuration
///### *******************
///
///# Uncomment one of these if you want to allow remote clients to
///# connect:
///
///# prox [rest of string was truncated]&quot;;.
/// </summary>
internal static string polipo_config {
get {
return ResourceManager.GetString("polipo_config", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] polipo_exe {
get {
object obj = ResourceManager.GetObject("polipo_exe", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] proxy_pac_txt {
get {
object obj = ResourceManager.GetObject("proxy_pac_txt", resourceCulture);
return ((byte[])(obj));
}
}
}
}
@@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="polipo_config" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\config.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
</data>
<data name="polipo_exe" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\polipo.exe.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="proxy_pac_txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\proxy.pac.txt.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
-26
View File
@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace shadowsocks_csharp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
-44
View File
@@ -1,44 +0,0 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace shadowsocks_csharp
{
class SystemProxy
{
[DllImport("wininet.dll")]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
public const int INTERNET_OPTION_SETTINGS_CHANGED = 39;
public const int INTERNET_OPTION_REFRESH = 37;
static bool settingsReturn, refreshReturn;
public static void NotifyIE()
{
// These lines implement the Interface in the beginning of program
// They cause the OS to refresh the settings, causing IP to realy update
settingsReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
refreshReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
}
public static void Enable()
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 0);
registry.SetValue("ProxyServer", "");
registry.SetValue("AutoConfigURL", "http://127.0.0.1:8090/pac");
SystemProxy.NotifyIE();
}
public static void Disable()
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 0);
registry.SetValue("ProxyServer", "");
registry.SetValue("AutoConfigURL", "");
SystemProxy.NotifyIE();
}
}
}
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
-161
View File
@@ -1,161 +0,0 @@
# Sample configuration file for Polipo. -*-sh-*-
# You should not need to use a configuration file; all configuration
# variables have reasonable defaults. If you want to use one, you
# can copy this to /etc/polipo/config or to ~/.polipo and modify.
# This file only contains some of the configuration variables; see the
# list given by ``polipo -v'' and the manual for more.
### Basic configuration
### *******************
# Uncomment one of these if you want to allow remote clients to
# connect:
# proxyAddress = "::0" # both IPv4 and IPv6
# proxyAddress = "0.0.0.0" # IPv4 only
# If you do that, you'll want to restrict the set of hosts allowed to
# connect:
# allowedClients = 127.0.0.1, 134.157.168.57
# allowedClients = 127.0.0.1, 134.157.168.0/24
# Uncomment this if you want your Polipo to identify itself by
# something else than the host name:
# proxyName = "polipo.example.org"
# Uncomment this if there's only one user using this instance of Polipo:
# cacheIsShared = false
# Uncomment this if you want to use a parent proxy:
# parentProxy = "squid.example.org:3128"
# Uncomment this if you want to use a parent SOCKS proxy:
socksParentProxy = "127.0.0.1:__SOCKS_PORT__"
socksProxyType = socks5
# Uncomment this if you want to scrub private information from the log:
# scrubLogs = true
### Memory
### ******
# Uncomment this if you want Polipo to use a ridiculously small amount
# of memory (a hundred C-64 worth or so):
# chunkHighMark = 819200
# objectHighMark = 128
# Uncomment this if you've got plenty of memory:
# chunkHighMark = 50331648
# objectHighMark = 16384
### On-disk data
### ************
# Uncomment this if you want to disable the on-disk cache:
diskCacheRoot = ""
# Uncomment this if you want to put the on-disk cache in a
# non-standard location:
# diskCacheRoot = "~/.polipo-cache/"
# Uncomment this if you want to disable the local web server:
localDocumentRoot = ""
# Uncomment this if you want to enable the pages under /polipo/index?
# and /polipo/servers?. This is a serious privacy leak if your proxy
# is shared.
# disableIndexing = false
# disableServersList = false
### Domain Name System
### ******************
# Uncomment this if you want to contact IPv4 hosts only (and make DNS
# queries somewhat faster):
# dnsQueryIPv6 = no
# Uncomment this if you want Polipo to prefer IPv4 to IPv6 for
# double-stack hosts:
# dnsQueryIPv6 = reluctantly
# Uncomment this to disable Polipo's DNS resolver and use the system's
# default resolver instead. If you do that, Polipo will freeze during
# every DNS query:
# dnsUseGethostbyname = yes
### HTTP
### ****
# Uncomment this if you want to enable detection of proxy loops.
# This will cause your hostname (or whatever you put into proxyName
# above) to be included in every request:
# disableVia=false
# Uncomment this if you want to slightly reduce the amount of
# information that you leak about yourself:
# censoredHeaders = from, accept-language
# censorReferer = maybe
# Uncomment this if you're paranoid. This will break a lot of sites,
# though:
# censoredHeaders = set-cookie, cookie, cookie2, from, accept-language
# censorReferer = true
# Uncomment this if you want to use Poor Man's Multiplexing; increase
# the sizes if you're on a fast line. They should each amount to a few
# seconds' worth of transfer; if pmmSize is small, you'll want
# pmmFirstSize to be larger.
# Note that PMM is somewhat unreliable.
# pmmFirstSize = 16384
# pmmSize = 8192
# Uncomment this if your user-agent does something reasonable with
# Warning headers (most don't):
# relaxTransparency = maybe
# Uncomment this if you never want to revalidate instances for which
# data is available (this is not a good idea):
# relaxTransparency = yes
# Uncomment this if you have no network:
# proxyOffline = yes
# Uncomment this if you want to avoid revalidating instances with a
# Vary header (this is not a good idea):
# mindlesslyCacheVary = true
# Uncomment this if you want to add a no-transform directive to all
# outgoing requests.
# alwaysAddNoTransform = true
Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.
Binary file not shown.
@@ -1,178 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>shadowsocks_csharp</RootNamespace>
<AssemblyName>Shadowsocks</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
<ApplicationIcon>icon144.ico</ApplicationIcon>
<IsWebBootstrapper>false</IsWebBootstrapper>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;SIMPLE_JSON_NO_LINQ_EXPRESSION</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;SIMPLE_JSON_NO_LINQ_EXPRESSION</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;SIMPLE_JSON_NO_LINQ_EXPRESSION</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;SIMPLE_JSON_NO_LINQ_EXPRESSION</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Encrypt\EncryptorBase.cs" />
<Compile Include="Encrypt\EncryptorFactory.cs" />
<Compile Include="Encrypt\OpenSSL.cs" />
<Compile Include="Encrypt\OpensslEncryptor.cs" />
<Compile Include="Encrypt\PolarSSL.cs" />
<Compile Include="Encrypt\PolarSSLEncryptor.cs" />
<Compile Include="Encrypt\TableEncryptor.cs" />
<Compile Include="Encrypt\IEncryptor.cs" />
<Compile Include="PACServer.cs" />
<Compile Include="Config.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Local.cs" />
<Compile Include="PolipoRunner.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SystemProxy.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="polipo.exe.gz" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="simple-json\src\SimpleJson\SimpleJson.cs" />
<None Include="proxy.pac.txt.gz" />
</ItemGroup>
<ItemGroup>
<None Include="config.txt" />
<Content Include="icon144.ico" />
<None Include="proxy.pac.txt" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB