Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a4f724653 | ||
|
|
fcb0adfc3f | ||
|
|
eb2e5cc242 | ||
|
|
3e16978968 | ||
|
|
28887b9896 | ||
|
|
d4d3e804cb | ||
|
|
336e0368a1 | ||
|
|
138e4f0715 | ||
|
|
dbaa2372e2 | ||
|
|
19370a88c5 | ||
|
|
fbc33ad337 |
@@ -1,4 +1,4 @@
|
||||
2.3 2015-01-14
|
||||
2.3 2015-01-25
|
||||
- Use the same port for every profile
|
||||
- Use the same port for HTTP/Socks5/PAC
|
||||
- Fix GFWList PAC compatibility issue with IE11
|
||||
|
||||
@@ -23,11 +23,13 @@ For >= Windows 8, download Shadowsocks-win-dotnet4.0-x.x.x.zip, unless you have
|
||||
|
||||
1. Find Shadowsocks icon in notification tray
|
||||
2. You can add multiple servers in servers menu
|
||||
3. Select Enable System Proxy menu to enable system proxy
|
||||
4. After you saved PAC file with any editor, Shadowsocks will notify browsers
|
||||
about the change automatically
|
||||
5. Please disable other proxy addons in your browser, or set them to use
|
||||
system proxy
|
||||
3. Select Enable System Proxy menu to enable system proxy. Please disable other
|
||||
proxy addons in your browser, or set them to use system proxy
|
||||
4. You can also configure your browser proxy manually if you don't want to enable
|
||||
system proxy. Set Socks5 or HTTP proxy to 127.0.0.1:1080. You can change this
|
||||
port in Server -> Edit Servers
|
||||
5. You can change PAC rules by editing the PAC file. When you save the PAC file
|
||||
with any editor, Shadowsocks will notify browsers about the change automatically
|
||||
|
||||
### Develop
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Shadowsocks.Controller
|
||||
|
||||
private static string PAC_FILE = PACServer.PAC_FILE;
|
||||
|
||||
private static string USER_RULE_FILE = PACServer.USER_RULE_FILE;
|
||||
|
||||
public event EventHandler<ResultEventArgs> UpdateCompleted;
|
||||
|
||||
public event ErrorEventHandler Error;
|
||||
@@ -35,7 +37,17 @@ namespace Shadowsocks.Controller
|
||||
try
|
||||
{
|
||||
List<string> lines = ParseResult(e.Result);
|
||||
|
||||
if (File.Exists(USER_RULE_FILE))
|
||||
{
|
||||
string local = File.ReadAllText(USER_RULE_FILE, Encoding.UTF8);
|
||||
string[] rules = local.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach(string rule in rules)
|
||||
{
|
||||
if (rule.StartsWith("!") || rule.StartsWith("["))
|
||||
continue;
|
||||
lines.Add(rule);
|
||||
}
|
||||
}
|
||||
string abpContent = Utils.UnGzip(Resources.abp_js);
|
||||
abpContent = abpContent.Replace("__RULES__", SimpleJson.SimpleJson.SerializeObject(lines));
|
||||
if (File.Exists(PAC_FILE))
|
||||
|
||||
@@ -18,6 +18,10 @@ namespace Shadowsocks.Controller
|
||||
string[] lines = Regex.Split(Resources.cn, "\r\n|\r|\n");
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.StartsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string[] kv = Regex.Split(line, "=");
|
||||
if (kv.Length == 2)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
@@ -24,10 +25,29 @@ namespace Shadowsocks.Controller
|
||||
this._services = services;
|
||||
}
|
||||
|
||||
private bool CheckIfPortInUse(int port)
|
||||
{
|
||||
IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
|
||||
IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners();
|
||||
|
||||
foreach (IPEndPoint endPoint in ipEndPoints)
|
||||
{
|
||||
if (endPoint.Port == port)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Start(Configuration config)
|
||||
{
|
||||
this._config = config;
|
||||
this._shareOverLAN = config.shareOverLan;
|
||||
|
||||
if (CheckIfPortInUse(_config.localPort))
|
||||
throw new Exception(I18N.GetString("Port already in use"));
|
||||
|
||||
try
|
||||
{
|
||||
// Create a TCP/IP socket.
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Shadowsocks.Controller
|
||||
{
|
||||
public static string PAC_FILE = "pac.txt";
|
||||
|
||||
public static string USER_RULE_FILE = "user-rule.txt";
|
||||
|
||||
FileSystemWatcher watcher;
|
||||
private Configuration _config;
|
||||
|
||||
@@ -94,6 +96,19 @@ namespace Shadowsocks.Controller
|
||||
}
|
||||
}
|
||||
|
||||
internal string TouchUserRuleFile()
|
||||
{
|
||||
if (File.Exists(USER_RULE_FILE))
|
||||
{
|
||||
return USER_RULE_FILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteAllText(USER_RULE_FILE, Resources.user_rule);
|
||||
return USER_RULE_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPACContent()
|
||||
{
|
||||
if (File.Exists(PAC_FILE))
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Shadowsocks.Controller
|
||||
|
||||
// when user clicked Edit PAC, and PAC file has already created
|
||||
public event EventHandler<PathEventArgs> PACFileReadyToOpen;
|
||||
public event EventHandler<PathEventArgs> UserRuleFileReadyToOpen;
|
||||
|
||||
public event EventHandler<GFWListUpdater.ResultEventArgs> UpdatePACFromGFWListCompleted;
|
||||
|
||||
@@ -166,6 +167,15 @@ namespace Shadowsocks.Controller
|
||||
}
|
||||
}
|
||||
|
||||
public void TouchUserRuleFile()
|
||||
{
|
||||
string userRuleFilename = _pacServer.TouchUserRuleFile();
|
||||
if (UserRuleFileReadyToOpen != null)
|
||||
{
|
||||
UserRuleFileReadyToOpen(this, new PathEventArgs() { Path = userRuleFilename });
|
||||
}
|
||||
}
|
||||
|
||||
public string GetQRCodeForCurrentServer()
|
||||
{
|
||||
Server server = GetCurrentServer();
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.Controller
|
||||
public string LatestVersionURL;
|
||||
public event EventHandler NewVersionFound;
|
||||
|
||||
public const string Version = "2.3";
|
||||
public const string Version = "2.3.1";
|
||||
|
||||
public void CheckUpdate(Configuration config)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# translation for Simplified Chinese
|
||||
|
||||
Shadowsocks=Shadowsocks
|
||||
|
||||
# Menu items
|
||||
|
||||
Enable System Proxy=启用系统代理
|
||||
Mode=系统代理模式
|
||||
PAC=PAC 模式
|
||||
@@ -8,12 +13,16 @@ Edit Servers...=编辑服务器...
|
||||
Start on Boot=开机启动
|
||||
Allow Clients from LAN=允许来自局域网的连接
|
||||
Edit PAC File...=编辑 PAC 文件...
|
||||
Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
|
||||
Show QRCode...=显示二维码...
|
||||
Scan QRCode from Screen...=扫描屏幕上的二维码...
|
||||
Show Logs...=显示日志...
|
||||
About...=关于...
|
||||
Quit=退出
|
||||
Edit Servers=编辑服务器
|
||||
|
||||
# Config Form
|
||||
|
||||
&Add=添加(&A)
|
||||
&Delete=删除(&D)
|
||||
Server=服务器
|
||||
@@ -26,7 +35,13 @@ Remarks=备注
|
||||
OK=确定
|
||||
Cancel=取消
|
||||
New server=未配置的服务器
|
||||
|
||||
# QRCode Form
|
||||
|
||||
QRCode=二维码
|
||||
|
||||
# Messages
|
||||
|
||||
Shadowsocks Error: {0}=Shadowsocks 错误: {0}
|
||||
Port already in use=端口已被占用
|
||||
Illegal port number format=非法端口格式
|
||||
@@ -44,7 +59,7 @@ Update PAC from GFWList=从 GFWList 更新 PAC
|
||||
Failed to update PAC file =更新 PAC 文件失败
|
||||
PAC updated=更新 PAC 成功
|
||||
No updates found. Please report to GFWList if you have problems with it.=未发现更新。如有问题请提交给 GFWList。
|
||||
No QRCode found. Try to zoom in or move it to the center of the screen.=找不到二维码,尝试把它放大或者移动到靠近屏幕中间的位置
|
||||
No QRCode found. Try to zoom in or move it to the center of the screen.=未发现二维码,尝试把它放大或移动到靠近屏幕中间的位置
|
||||
Failed to decode QRCode=无法解析二维码
|
||||
Failed to update registry=无法修改注册表
|
||||
System Proxy On: =系统代理已启用:
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
! Put user rules line by line in this file.
|
||||
! See https://adblockplus.org/en/filter-cheatsheet
|
||||
+19
-10
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -72,15 +72,16 @@ namespace Shadowsocks.Properties {
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shadowsocks=Shadowsocks
|
||||
///Enable=启用代理
|
||||
///Mode=代理模式
|
||||
///Enable System Proxy=启用系统代理
|
||||
///Mode=系统代理模式
|
||||
///PAC=PAC 模式
|
||||
///Global=全局模式
|
||||
///Servers=服务器
|
||||
///Edit Servers...=编辑服务器...
|
||||
///Start on Boot=开机启动
|
||||
///Share over LAN=在局域网共享代理
|
||||
///Allow Clients from LAN=允许来自局域网的连接
|
||||
///Edit PAC File...=编辑 PAC 文件...
|
||||
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
|
||||
///Show QRCode...=显示二维码...
|
||||
///Scan QRCode from Screen...=扫描屏幕上的二维码...
|
||||
///Show Logs...=显示日志...
|
||||
@@ -96,11 +97,7 @@ namespace Shadowsocks.Properties {
|
||||
///Encryption=加密
|
||||
///Proxy Port=代理端口
|
||||
///Remarks=备注
|
||||
///OK=确定
|
||||
///Cancel=取消
|
||||
///New server=未配置的服务器
|
||||
///QRCode=二维码
|
||||
///Shadowsocks Error: {0}=Shadowsocks [rest of string was truncated]";.
|
||||
///OK= [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string cn {
|
||||
get {
|
||||
@@ -119,7 +116,8 @@ namespace Shadowsocks.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to proxyAddress = "__POLIPO_BIND_IP__"
|
||||
/// Looks up a localized string similar to proxyAddress = "__POLIPO_BIND_IP__"
|
||||
///proxyPort = 8123
|
||||
///
|
||||
///socksParentProxy = "127.0.0.1:__SOCKS_PORT__"
|
||||
///socksProxyType = socks5
|
||||
@@ -194,5 +192,16 @@ namespace Shadowsocks.Properties {
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ! Put user rules line by line in this file.
|
||||
///! See https://adblockplus.org/en/filter-cheatsheet
|
||||
///.
|
||||
/// </summary>
|
||||
internal static string user_rule {
|
||||
get {
|
||||
return ResourceManager.GetString("user_rule", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,4 +148,7 @@
|
||||
<data name="ssw128" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ssw128.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="user_rule" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\data\user-rule.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -46,7 +46,8 @@ namespace Shadowsocks.View
|
||||
|
||||
controller.EnableStatusChanged += controller_EnableStatusChanged;
|
||||
controller.ConfigChanged += controller_ConfigChanged;
|
||||
controller.PACFileReadyToOpen += controller_PACFileReadyToOpen;
|
||||
controller.PACFileReadyToOpen += controller_FileReadyToOpen;
|
||||
controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
|
||||
controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
|
||||
controller.EnableGlobalChanged += controller_EnableGlobalChanged;
|
||||
controller.Errored += controller_Errored;
|
||||
@@ -151,10 +152,12 @@ namespace Shadowsocks.View
|
||||
CreateMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click))
|
||||
}),
|
||||
new MenuItem("-"),
|
||||
this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)),
|
||||
this.ShareOverLANItem = CreateMenuItem("Allow Clients from LAN", new EventHandler(this.ShareOverLANItem_Click)),
|
||||
CreateMenuItem("Edit PAC File...", new EventHandler(this.EditPACFileItem_Click)),
|
||||
CreateMenuItem("Update PAC from GFWList", new EventHandler(this.UpdatePACFromGFWListItem_Click)),
|
||||
CreateMenuItem("Edit User Rule for GFWList...", new EventHandler(this.EditUserRuleFileForGFWListItem_Click)),
|
||||
new MenuItem("-"),
|
||||
this.AutoStartupItem = CreateMenuItem("Start on Boot", new EventHandler(this.AutoStartupItem_Click)),
|
||||
this.ShareOverLANItem = CreateMenuItem("Allow Clients from LAN", new EventHandler(this.ShareOverLANItem_Click)),
|
||||
new MenuItem("-"),
|
||||
CreateMenuItem("Show Logs...", new EventHandler(this.ShowLogItem_Click)),
|
||||
CreateMenuItem("About...", new EventHandler(this.AboutItem_Click)),
|
||||
@@ -186,7 +189,7 @@ namespace Shadowsocks.View
|
||||
PACModeItem.Checked = !globalModeItem.Checked;
|
||||
}
|
||||
|
||||
void controller_PACFileReadyToOpen(object sender, ShadowsocksController.PathEventArgs e)
|
||||
void controller_FileReadyToOpen(object sender, ShadowsocksController.PathEventArgs e)
|
||||
{
|
||||
string argument = @"/select, " + e.Path;
|
||||
|
||||
@@ -352,6 +355,11 @@ namespace Shadowsocks.View
|
||||
controller.UpdatePACFromGFWList();
|
||||
}
|
||||
|
||||
private void EditUserRuleFileForGFWListItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
controller.TouchUserRuleFile();
|
||||
}
|
||||
|
||||
private void AServerItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MenuItem item = (MenuItem)sender;
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
<None Include="Resources\ss24.png" />
|
||||
<None Include="Resources\ssw128.png" />
|
||||
<Content Include="Data\cn.txt" />
|
||||
<Content Include="Data\user-rule.txt" />
|
||||
<Content Include="shadowsocks.ico" />
|
||||
<None Include="Data\polipo_config.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user