Commit Graph
169 Commits
Author SHA1 Message Date
noisyfox 5ba0dffa5d First working built-in http proxy 2016-12-09 02:17:46 +11:00
noisyfox 0d4d01af3b Remove privoxy 2016-12-09 02:17:46 +11:00
noisyfox be3cc3f3a6 Rename Shadowsocks.Proxy -> Shadowsocks.ForwardProxy 2016-12-09 02:17:46 +11:00
noisyfox 4b067346bf Refine random string generate. 2016-12-09 01:39:07 +11:00
noisyfox 983c1adb28 Check secret in PACServer 2016-12-08 18:54:57 +11:00
noisyfox 22d8cdeff7 Add secret in local pac url. 2016-12-08 18:13:22 +11:00
noisyfox b6cd8e0750 Update CHANGES and bump version 2016-12-06 22:43:19 +11:00
noisyfox cc6f77efa5 Refine code 2016-12-06 22:34:17 +11:00
noisyfox 65b9c9f5fa Allow check pre-release version 2016-12-06 22:01:00 +11:00
Syrone Wong 1e7a8de34a Fix privoxy listening port conflict (#920)
Let TCP stack find a free port for us

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-12-03 03:00:31 +11:00
noisyfox 41827f283e Refine code 2016-11-23 03:22:00 +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
noisyfox da6466e247 Improve exception handling 2016-11-08 18:49:09 +11:00
noisyfox 24db6438bd Update CHANGES and bump version 2016-11-07 16:52:28 +11:00
Syrone Wong 89b7043a4e Update CHANGES and bump version
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-21 09:57:08 +08:00
Syrone Wong a12ae96443 Update CHANGES and bump version
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-10-10 13:53:45 +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 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 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
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 b8c5f8e331 Update CHANGES and bump version
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-09-20 14:54:57 +08: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
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
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
noisyfox e364457b1b Fix a memory leak.
Caused by not call SocketAsyncEventArgs.Dispose().
2016-09-03 15:17:16 +08:00
noisyfox 0266ad9d59 Remove redundant lock.
Lock is evil.

This will actually affect the accuracy of GetDelta because
inboundDelta and outboundDelta may be calculated based on
the data collected at different time (eg. UpdateOutbound
get called before Interlocked.Read(ref _outbound)).

But that's not a problem. We can tolerate this little
inaccuracy. Besides, the _inbound, _outbound, _lastInbound
and _lastOutbound will be totally good because we use Interlocked.
2016-09-03 08:57:30 +08:00
Syrone Wong f70b177e56 Misc
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-29 21:30:05 +08:00
noisyfox 5b2327776a Fix a null ref exception. 2016-08-27 03:35:33 +10: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 65d72fdfed New approach to record and calculate inbound/outbound speed.
Use lock to sync between threads.This should fix issue #679
and other same issue.

Fix a bug in UpdateSpeed() that only save the first xxxSpeedRecord.
2016-08-26 13:49:44 +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 28fe2fdc54 Only output some debug exceptions in debug mode.
Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-22 10:53:18 +10:00
noisyfox f676d2185e Use Socket.ConnectAsync instead of socket.BeginConnect.
Socket.ConnectAsync will create socket and handle the address family
itself. This solves some compatibility issues on win7.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-20 11:36:27 +10:00
noisyfox b335e6c8f5 Revert changes in UDPRelay.cs
UDP SendTo doesn't support DnsEndPoint.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-20 11:33:59 +10:00
noisyfox 80fc8b4ccf Fix an exception caused by process.MainModule.
Try to access a dead process's MainModule will cause
"A 32 bit processes cannot access modules of
a 64 bit process." exception on win7 x64.
Simply ignore it.

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-20 10:57:13 +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 a1eef6eac1 Multiple instances of ss_privoxy (#665)
* Use job object to manage polipo service's external processes.

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

* Only kill those ss_privoxy.exe created by this ss instance.

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

* Update README

Signed-off-by: noisyfox <timemanager.rick@gmail.com>
2016-08-18 19:31:01 +08: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 5d554d966a Bump version and update CHANGES
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-08-13 19:01:15 +08:00