72 Commits
Author SHA1 Message Date
Raif Atef f04b497d79 SIP002 and SIP003 support 2017-08-14 11:48:41 +02:00
Syrone Wong 3de14098d7 add AEAD support 2017-03-31 21:36:45 +08:00
Noisyfox 2e7518d802 Send first chunk with Socks5 header (#984)
* Send socks5 handshake respond before read the target address
So that the next package will (hopefully) contain the first data chunk which means we could get a 'random' first package size.

* Try read available data before send first packet

* Add random size first packet
But commented out ^u^

* Oops forget to delete some test code
2017-01-04 07:59:41 +08:00
noisyfox 5741133d5c Fix compile error.
And farewell.
2016-12-16 12:25:14 +11:00
noisyfox 28954600a2 Revert "Rename Shadowsocks.Proxy -> Shadowsocks.ForwardProxy"
This reverts commit be3cc3f3a6.
2016-12-16 12:19:52 +11:00
noisyfox efe6d5ba81 Revert "http -> shadowsocks protocol directly"
This reverts commit b04c59d8e6.
2016-12-16 12:18:51 +11:00
noisyfox eef990f529 Check close before create reomte
Check null ref (#940)
2016-12-15 17:23:12 +11:00
noisyfox b04c59d8e6 http -> shadowsocks protocol directly
No more http->socks5 transform.
2016-12-09 02:17:46 +11:00
noisyfox be3cc3f3a6 Rename Shadowsocks.Proxy -> Shadowsocks.ForwardProxy 2016-12-09 02:17:46 +11:00
noisyfox 4b49431800 Parse dest address before connect to SS server.
This gives us the possibility to chose SS server based on dest address.
2016-11-14 09:58:48 +11: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 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
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
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 2a12ac5578 Merge branch 'master' of https://github.com/shadowsocks/shadowsocks-windows.git 2016-09-17 14:57:54 +10: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
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
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
noisyfox e364457b1b Fix a memory leak.
Caused by not call SocketAsyncEventArgs.Dispose().
2016-09-03 15:17:16 +08:00
Syrone Wong f70b177e56 Misc
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-29 21:30:05 +08:00
noisyfox ed54b249db Close services while closing listener.
Now it will close all existing TCP relay connections
while reloading the listener.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-26 21:08:04 +10:00
noisyfox 37d894594e Use immutable remote reference during async process.
To prevent "The IAsyncResult object was not returned from
the corresponding asynchronous method on this class." exception.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-22 11:49:53 +10:00
noisyfox 2ed8ab50cd Only parse socks5 header once per connection.
To avoid unreadable and uncessary output

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-19 13:36:49 +10:00
noisyfox 6cb58b229d Fix a null ref exception.
At that time the remote even doesn't exist.
Also this debug output doesn't make any sense because when handling
udp request, this tcp connection won't have any meaningful data.
So I simply removed these two lines.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-16 20:52:53 +10:00
noisyfox 53ce1948e4 Unified ipv4, ipv6 and domain connections.
-Use dual-mode socket & DnsEndPoint to handle all domain name connection.
-Move all socket creation into one single function.

So that we could treat domain name just like ipv4 & ipv6 address.
This also solves the async domain solving problem because the os will
hanlde it for us.
2016-08-16 20:40:09 +10:00
noisyfox ad15c7e64b Improve host address handling using DnsEndPoint
Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-16 17:28:26 +10:00
noisyfox a02cd11dc9 Let proxy module handle name resolving itself.
Fix wrong output in proxyConnectTimer_Elapsed.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-16 01:11:33 +10:00
Syrone Wong a9af9fdfc0 Refactor
- use null conditional access in case some connections been
  cancelled unexpectedly and may cause null reference exception
- Refine error message
- use conditional operator to simplify some code

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-10 15:27:38 +08:00
Syrone Wong 93e7641446 Minor changes
- display user-friendly server name
- clarify proxy type

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-09 08:24:44 +08:00
Noisyfox He e23641c522 Improved debug info output by using isVerboseLogging 2016-08-08 22:24:00 +10:00
Noisyfox He 6a3e06cdb3 Merge branch 'master' of https://github.com/shadowsocks/shadowsocks-windows.git into dev_proxy
# Conflicts:
#	shadowsocks-csharp/Controller/Service/TCPRelay.cs
#	shadowsocks-csharp/Controller/ShadowsocksController.cs
#	shadowsocks-csharp/View/MenuViewController.cs
2016-08-08 21:21:53 +10:00
Syrone Wong d3acb3e681 Refine verbose logging handling
I can't wait until PR #604 get merged, do it manually.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-08 15:36:04 +08:00
Syrone Wong fb3fcdb90d Add verbose logging to log every connection
Note:
- Added a configuration entry, user should add this
  by hand or reset from scratch.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-08 10:33:17 +08:00
Syrone Wong f21c534704 minor changes
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-05 16:31:05 +08:00
noisyfox 4a1aa01a4f Enable proxy switch 2016-06-30 00:09:45 +08:00
noisyfox 95d4e3a0c0 Add proxy support 2016-06-29 22:38:51 +08:00
kimw f9296b49b1 clean up buggy parameter.
Replaced SocketFlags.None (an enum which euqals 0) from zero.
2016-05-15 02:17:05 -04:00
kimw ff04a2a18a clean up code in C# 6 2016-05-15 02:04:04 -04:00
kimw 0cee110e59 renamed private properties with prefix underline 2016-05-15 01:44:03 -04:00
kimw 4b3ec38691 featured print "connect to hostname:port" to log 2016-05-15 01:34:28 -04:00
icylogic a99fef37d3 track multiple servers at the same time
Correct AvailabilityStatistics's behavior under special strategies like "LoadBalance", which may switch the server several times in a short period.
2016-03-01 21:32:43 +08:00
icylogic 7599704d1f add speed to statistics 2016-01-18 01:31:50 +08:00
Gang Zhuo b918cb85ae tiny fix 2016-01-05 01:54:42 -05:00
kimw 2cce646700 featured show bandwidth in log form's title 2016-01-04 23:21:53 +08:00
kimw 0b16ef7445 Merge upstream
# Conflicts:
#	README.md
#	shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs
#	shadowsocks-csharp/Controller/Service/PACServer.cs
#	shadowsocks-csharp/Controller/Strategy/SimplyChooseByStatisticsStrategy.cs
#	shadowsocks-csharp/Data/cn.txt
#	shadowsocks-csharp/Model/Configuration.cs
#	shadowsocks-csharp/Model/LogViewerConfig.cs
#	shadowsocks-csharp/View/LogForm.Designer.cs
#	shadowsocks-csharp/View/LogForm.cs
#	shadowsocks-csharp/View/MenuViewController.cs
2016-01-04 09:14:55 +08:00
10people d0e16dc658 Add debug log in network transfer. 2015-11-16 14:59:10 +08:00
Gang Zhuo 29d70acfb5 replace 'one_time_auth' to 'auth' 2015-10-07 23:43:41 -04:00