Commit Graph
713 Commits
Author SHA1 Message Date
Syrone Wong ebc8d9c5bd Catch more exceptions
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-07 10:11:32 +08:00
Syrone Wong af139d7587 Only integer is allowed for timeout
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-07 08:57:55 +08:00
Syrone Wong 04ed25e16f Add timeout support for server and forward proxy
Also, fix typo in ProxyForm

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-06 21:03:45 +08:00
Syrone Wong a74fa34d45 Upgrade to .NET Framework 4.6.2
Be sure to install develop package and runtime library if needed
since Visual Studio has 4.6.1 included.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-06 16:45:11 +08:00
Syrone Wong 70bff7d7cc Use wininet API to setup system proxy
Get rid of tricky registry handling

Several files come from https://code.msdn.microsoft.com/windowsapps/CSWebBrowserWithProxy-c8535715/view/SourceCode

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-06 16:12:35 +08:00
Syrone Wong f910400449 Update CHANGES and bump version
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-03 18:58:45 +08:00
Syrone Wong 3ba5c491d2 Update libsscrypto
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-03 18:56:00 +08:00
Syrone Wong 13ebb5ef01 Fix RegistryKey dispose
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-01 06:53:43 +08:00
Syrone Wong c46149a375 Fix hotkey dispose
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-30 15:15:48 +08:00
Syrone Wong 6e8d6d3d21 Adjust garbage collection
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-30 15:15:39 +08:00
破娃酱 c7adac5fb0 Remove lock in SodiumEncryptor (#754)
- Use separate encrypt/decrypt buffer when creating instances
- Revert 3bc77d212a
2016-09-29 19:03:43 -05:00
Syrone Wong 41eb43b54e Drop retry connect
Shadowsocks don't need to reconnect, which is the software's
responsibility to retry.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-29 16:39:58 +08:00
Syrone Wong 46d95e7411 Get rid of lock(this)
- Use readonly object as lock

Info from stackoverflow:

If I want to be sure that it will be locked for all threads inside my
application:
The lock object has to be static, if it locks access to static state.
Otherwise it has to be instance, because there's no need to lock state of
one class instance, and prevent other threads to work with another class
instance at the same time.

everyone says that the object has to be "readonly" I didn't found the
reason
Well, it doesn't have to be. This is just a best practice, which helps you
to avoid errors.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-29 16:39:58 +08:00
Syrone Wong d5f24df128 Don't suppress exceptions
It is better to log them.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-29 16:38:54 +08:00
Syrone Wong a0fd003099 Close connection in the caller if exception is caught
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-29 16:38:24 +08:00
Syrone Wong 4bd9fd8a6b Replace treewide polipo with privoxy
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-28 16:35:51 +08:00
Syrone Wong 1dc992e806 Refine encryption
introduce a constructor to store inner method name

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-28 10:46:19 +08:00
Noisyfox 4acae9de9b Fix a bug that the callback will be invoked twice if http proxy request failed. (#751) 2016-09-24 23:52:04 -05:00
Noisyfox 35fc73b58b Add HTTP proxy support in forward proxy (#745)
* Add HTTP proxy support in forward proxy

Signed-off-by: noisyfox <timemanager.rick@gmail.com>

* Typo

* Throw exception if forward proxy not supported.
2016-09-24 23:37:24 -05:00
Syrone Wong 156b3acd9b Misc
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-22 09:45:08 +08:00
Syrone Wong 8cf582803d Fix #740
>_<

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-22 08:40:22 +08:00
Syrone Wong c8d070fb09 Free unmanaged memory
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-21 20:01:52 +08:00
Syrone Wong c671c7c32d Add easter egg
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-21 20:00:55 +08:00
Syrone Wong b8c5f8e331 Update CHANGES and bump version
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-20 14:54:57 +08:00
Syrone Wong b10f7cb3a6 Refine duplicate behaviour in ConfigForm
- Use insert instead and move to newly inserted
  item instead of the last one after operation

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-20 08:43:34 +08:00
Syrone Wong 78957e29d6 Refine traditional Chinese translation
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-19 09:09:29 +08:00
Syrone Wong ef17b72d25 Refine PR #730
Squashed commit of the following:

commit 48eb4d88391b85986190ace825ec0a167df16f8a
Author: Syrone Wong <wong.syrone@gmail.com>
Date:   Sun Sep 18 15:46:09 2016 +0800

    Drop useless interface impl

    Signed-off-by: Syrone Wong <wong.syrone@gmail.com>

commit c0a4f3421a
Author: Logan Zhou <xorcererzc@gmail.com>
Date:   Sun Sep 18 00:58:02 2016 +0800

    Revert "Updated to meet the hint from Wongsyrone."

    This reverts commit 84c8053577.

commit 84c8053577
Author: Logan Zhou <xorcererzc@gmail.com>
Date:   Sun Sep 18 00:52:21 2016 +0800

    Updated to meet the hint from Wongsyrone.

commit 333ccb6d1f
Author: Logan Zhou <xorcererzc@gmail.com>
Date:   Sun Sep 18 00:34:52 2016 +0800

    Added duplicate button to config form.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-18 16:06:00 +08:00
破娃酱 fabe270813 Resize the button 2016-09-17 20:22:29 +08:00
破娃酱 d284cd04e8 Set the newline mode to CRLF 2016-09-17 20:01:08 +08:00
破娃酱 db626dac42 set AutoScaleMode is DPI 2016-09-17 19:27:52 +08:00
Syrone Wong aa99d56e2c Merge pull request #726 from Noisyfox/master
Improve Socket Handling
2016-09-17 03:44:32 -05:00
noisyfox 063cf111cb Fix a bug that a TCPHandler may be shutdown immediately
after creation.

Becuase we put handler.Start() call after timeout check and
lastActivity is initialized in Start(), this will lead to a
incorrect timeout.

Also because we will call handler.Start() right after the
constructor and timeout check, so it makes no difference
where we put the initializtion of lastActivity. We won't do
this again in Start() because DateTime.Now will consumes a
lot of cpu time.
2016-09-17 16:21:03 +10:00
noisyfox 390144351a Fix #710
When using http proxy, this will cause distinct latency
if we are trying to resolve localhost.

Currently it's unnecessary to do that because our privoxy
doesn't listern on ipv6 address, so it's ok to hard code
the ipv4 address.

There is a plan to add a cache to record the ipv6 connectivity
so that we needn't to try both ipv4 and ipv6 every time when we
attempt to connect a DnsEndPoint.
2016-09-17 16:13:12 +10:00
Syrone Wong 433c3bfbcc Delay 5 seconds to start controller when OS is about to resume
Workaround for slow computers

Credit to GangZhou's code

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-17 13:24:30 +08:00
noisyfox 5e082e2961 Fix comment
Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-09-17 15:12:48 +10:00
noisyfox 2a12ac5578 Merge branch 'master' of https://github.com/shadowsocks/shadowsocks-windows.git 2016-09-17 14:57:54 +10:00
Syrone Wong 99bdec334c Add global hotkey support (#724)
Design:

Use the plain string for both config and hotkey parsing
and make use of KeyConverter, ModifierKeysConverter
to make it more rubust.

Find corresponding label (to display operation result) and callback (to do the real work) based on textbox name. In this case, they should be named as `<Feature-Name><Control-Name>`.

ShowLogsTextBox,
ShowLogsLabel,
ShowLogsCallback.

If this requirement doesn't meet, throw an exception at runtime.

Logic:

How to input keys:
1. put focus in the corresponding textbox
2. press the key combination you want to use
3. when you think it is ready, release all keys
4. the textbox shows your input

How to change keys:
1. put focus in the corresponding textbox
2. press BackSpace to clear content
3. re-input new one

How to deactivate:
1. clear content in the textbox
2. press OK button

Meaning of label color:
- Green: this combination is not occupied by other programs and register successfully
- Yellow: this combination is occupied by other programs and you have to change to another one
- Transparent without color: initial status

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-16 23:42:16 -05:00
Syrone Wong 6e6be823ad Fix #710 by @breakwa11
- Drop irrelevant changes
- Closes #723

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-16 13:33:14 +08:00
破娃酱 7586739a52 remove all tuple (#718) 2016-09-15 22:02:55 -05:00
Syrone Wong 33b2ca8c8a Refactor
- Only use one instance of LogForm

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-16 00:47:05 +08:00
Syrone Wong be63f96d50 Merge branch 'proxy-form' 2016-09-15 10:21:52 +08:00
破娃酱 836a58775f optimize LogMessageTextBox (#719)
* optimize LogMessageTextBox

* StringBuilder instead
2016-09-14 21:14:33 -05:00
Syrone Wong c1ec851627 Refine ProxyForm
- Save empty config if null ref
- only save config when clicking OK button

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-15 10:09:04 +08:00
Syrone Wong d3c6039c61 Refine Proxy config
- Move to seperate model

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-14 23:19:39 +08:00
破娃酱 ea9c7b093a Refine Encryption module (#717)
- use EncryptorInfo struct instead of Dictionary<string, int[]>>
2016-09-13 22:16:37 -05:00
破娃酱 a9cf3992e1 Refine traditional Chinese translation (#716) 2016-09-13 21:27:22 -05:00
noisyfox 05063f074a Fix an issue that the socket may not be released.
- New wrapper to handle tcp socket connection.
- Fix some memory leak.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-09-14 04:23:18 +10:00
Syrone Wong ab464ca8b1 change controller status if needed
- Change controller based on power mode
- Stop before exiting

Based on GangZhuo's code

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-12 16:23:03 +08:00
破娃酱 2a6da8af3f smooth traffic chart lines (#709) 2016-09-11 06:32:37 +08:00
Syrone Wong 4b6d641d17 Update CHANGES and bump version
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-09 17:48:22 +08:00