Skip to content

Commit

Permalink
Finish 4.8.0
Browse files Browse the repository at this point in the history
添加auth_chain_c/d
修正各个下载链接
  • Loading branch information
Akkariiin committed Aug 8, 2017
2 parents 932b86e + 0bb1998 commit 3678d9b
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 14 deletions.
4 changes: 2 additions & 2 deletions shadowsocks-csharp/Controller/GfwListUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class GFWListUpdater
{
private const string GFWLIST_URL = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt";

private const string GFWLIST_BACKUP_URL = "https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/ssr/gfwlist.txt";
private const string GFWLIST_BACKUP_URL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/ssr/gfwlist.txt";

private const string GFWLIST_TEMPLATE_URL = "https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/ssr/ss_gfw.pac";
private const string GFWLIST_TEMPLATE_URL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/ssr/ss_gfw.pac";

private static string PAC_FILE = PACServer.PAC_FILE;

Expand Down
4 changes: 2 additions & 2 deletions shadowsocks-csharp/Controller/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ namespace Shadowsocks.Controller
{
public class UpdateChecker
{
private const string UpdateURL = "https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/update/ssr-win-4.0.xml";
private const string UpdateURL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/update/ssr-win-4.0.xml";

public string LatestVersionNumber;
public string LatestVersionURL;
public event EventHandler NewVersionFound;

public const string Name = "ShadowsocksR";
public const string Copyright = "Copyright © BreakWa11 2017. Fork from Shadowsocks by clowwindy";
public const string Version = "4.7.0";
public const string Version = "4.8.0";
#if !_DOTNET_4_0
public const string NetVer = "2.0";
#elif !_CONSOLE
Expand Down
2 changes: 1 addition & 1 deletion shadowsocks-csharp/Controller/UpdateFreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Shadowsocks.Controller
{
public class UpdateFreeNode
{
private const string UpdateURL = "https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/free/freenodeplain.txt";
private const string UpdateURL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/free/freenodeplain.txt";

public event EventHandler NewFreeNodeFound;
public string FreeNodeResult;
Expand Down
4 changes: 2 additions & 2 deletions shadowsocks-csharp/Model/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public class PortMapConfigCache
[Serializable]
public class ServerSubscribe
{
private static string DEFAULT_FEED_URL = "https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/free/freenodeplain.txt";
//private static string OLD_DEFAULT_FEED_URL = "https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/free/freenode.txt";
private static string DEFAULT_FEED_URL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/free/freenodeplain.txt";
//private static string OLD_DEFAULT_FEED_URL = "https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/free/freenode.txt";

public string URL = DEFAULT_FEED_URL;
public string Group;
Expand Down
144 changes: 144 additions & 0 deletions shadowsocks-csharp/Obfs/AuthChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,148 @@ protected override int GetRandLen(int datalength, xorshift128plus random, byte[]
}

}

class AuthChain_c : AuthChain_b
{
public AuthChain_c(string method)
: base(method)
{

}

private static Dictionary<string, int[]> _obfs = new Dictionary<string, int[]> {
{"auth_chain_c", new int[]{1, 0, 1}},
};

protected int[] data_size_list0 = null;

public static new List<string> SupportedObfs()
{
return new List<string>(_obfs.Keys);
}

public override Dictionary<string, int[]> GetObfs()
{
return _obfs;
}

protected new void InitDataSizeList()
{
xorshift128plus random = new xorshift128plus();
random.init_from_bin(Server.key);
int len = (int)(random.next() % (8 + 16) + (4 + 8));
List<int> data_list = new List<int>();
for (int i = 0; i < len; ++i)
{
data_list.Add((int)(random.next() % 2340 % 2040 % 1440));
}
data_list.Sort();
data_size_list0 = data_list.ToArray();
}

public override void SetServerInfo(ServerInfo serverInfo)
{
Server = serverInfo;
InitDataSizeList();
}

protected override int GetRandLen(int datalength, xorshift128plus random, byte[] last_hash)
{
int other_data_size = datalength + Server.overhead;

// 一定要在random使用前初始化,以保证服务器与客户端同步,保证包大小验证结果正确
random.init_from_bin(last_hash, datalength);
if (other_data_size >= data_size_list0[data_size_list0.Length - 1])
{
if (datalength >= 1440)
return 0;
if (datalength > 1300)
return (int)(random.next() % 31);
if (datalength > 900)
return (int)(random.next() % 127);
if (datalength > 400)
return (int)(random.next() % 521);
return (int)(random.next() % 1021);
}

int pos = FindPos(data_size_list0, other_data_size);
int final_pos = pos + (int)(random.next() % (ulong)(data_size_list0.Length - pos));
return data_size_list0[final_pos] - other_data_size;
}

}

class AuthChain_d : AuthChain_c
{
public AuthChain_d(string method)
: base(method)
{

}

private static Dictionary<string, int[]> _obfs = new Dictionary<string, int[]> {
{"auth_chain_d", new int[]{1, 0, 1}},
};

public static new List<string> SupportedObfs()
{
return new List<string>(_obfs.Keys);
}

public override Dictionary<string, int[]> GetObfs()
{
return _obfs;
}

protected void CheckAndPatchDataSize(List<int> data_list, xorshift128plus random)
{
if (data_list[data_list.Count - 1] < 1300 && data_list.Count < 64)
{
data_list.Add((int)(random.next() % 2340 % 2040 % 1440));
CheckAndPatchDataSize(data_list, random);
}
}

protected new void InitDataSizeList()
{
xorshift128plus random = new xorshift128plus();
random.init_from_bin(Server.key);
int len = (int)(random.next() % (8 + 16) + (4 + 8));
List<int> data_list = new List<int>();
for (int i = 0; i < len; ++i)
{
data_list.Add((int)(random.next() % 2340 % 2040 % 1440));
}
data_list.Sort();
int old_len = data_list.Count;
CheckAndPatchDataSize(data_list, random);
if (old_len != data_list.Count)
{
data_list.Sort();
}
data_size_list0 = data_list.ToArray();
}

public override void SetServerInfo(ServerInfo serverInfo)
{
Server = serverInfo;
InitDataSizeList();
}

protected override int GetRandLen(int datalength, xorshift128plus random, byte[] last_hash)
{
int other_data_size = datalength + Server.overhead;

if (other_data_size >= data_size_list0[data_size_list0.Length - 1])
{
return 0;
}

random.init_from_bin(last_hash, datalength);
int pos = FindPos(data_size_list0, other_data_size);
int final_pos = pos + (int)(random.next() % (ulong)(data_size_list0.Length - pos));
return data_size_list0[final_pos] - other_data_size;
}

}
}
8 changes: 8 additions & 0 deletions shadowsocks-csharp/Obfs/ObfsFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ static ObfsFactory()
{
_registeredObfs.Add(method, typeof(AuthChain_b));
}
foreach (string method in AuthChain_c.SupportedObfs())
{
_registeredObfs.Add(method, typeof(AuthChain_c));
}
foreach (string method in AuthChain_d.SupportedObfs())
{
_registeredObfs.Add(method, typeof(AuthChain_d));
}
}

public static IObfs GetObfs(string method)
Expand Down
4 changes: 3 additions & 1 deletion shadowsocks-csharp/View/ConfigForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions shadowsocks-csharp/View/MenuViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -909,12 +909,12 @@ private void Quit_Click(object sender, EventArgs e)

private void OpenWiki_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/breakwa11/shadowsocks-rss/wiki");
Process.Start("https://github.com/shadowsocksrr/shadowsocks-rss/wiki");
}

private void FeedbackItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/shadowsocksr/shadowsocksr-csharp/issues/new");
Process.Start("https://github.com/shadowsocksrr/shadowsocksr-csharp/issues/new");
}

private void ResetPasswordItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1051,22 +1051,22 @@ private void UpdatePACFromGFWListItem_Click(object sender, EventArgs e)

private void UpdatePACFromLanIPListItem_Click(object sender, EventArgs e)
{
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/ssr/ss_lanip.pac");
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/ssr/ss_lanip.pac");
}

private void UpdatePACFromCNWhiteListItem_Click(object sender, EventArgs e)
{
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/ssr/ss_white.pac");
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/ssr/ss_white.pac");
}

private void UpdatePACFromCNOnlyListItem_Click(object sender, EventArgs e)
{
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/ssr/ss_white_r.pac");
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/ssr/ss_white_r.pac");
}

private void UpdatePACFromCNIPListItem_Click(object sender, EventArgs e)
{
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/breakwa11/breakwa11.github.io/master/ssr/ss_cnip.pac");
controller.UpdatePACFromOnlinePac("https://raw.githubusercontent.com/shadowsocksrr/breakwa11.github.io/master/ssr/ss_cnip.pac");
}

private void EditUserRuleFileForGFWListItem_Click(object sender, EventArgs e)
Expand Down

0 comments on commit 3678d9b

Please sign in to comment.