/
githubmirror
/
shadowsocks-windows
Обзор
Документация
Войти
/
githubmirror
/
shadowsocks-windows
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4
shadowsocks-csharp/Controller/Strategy/BalancingStrategy.cs
71 строка
2 KB
noisyfox
Parse dest address before connect to SS server.
14 ноя 2016, 01:58
14 ноя 2016, 01:58
4b49431
Код
Авторство
О чём код?
using Shadowsocks.Controller; using Shadowsocks.Model; using System; using System.Collections.Generic; using System.Net; using System.Text; namespace Shadowsocks.Controller.Strategy { class BalancingStrategy : IStrategy { ShadowsocksController _controller; Random _random; public BalancingStrategy(ShadowsocksController controller) { _controller = controller; _random = new Random(); } public string Name { get { return I18N.GetString("Load Balance"); } } public string ID { get { return "com.shadowsocks.strategy.balancing"; } } public void ReloadServers() { // do nothing } public Server GetAServer(IStrategyCallerType type, IPEndPoint localIPEndPoint, EndPoint destEndPoint) { var configs = _controller.GetCurrentConfiguration().configs; int index; if (type == IStrategyCallerType.TCP) { index = _random.Next(); } else { index = localIPEndPoint.GetHashCode(); } return configs[index % configs.Count]; } public void UpdateLatency(Model.Server server, TimeSpan latency) { // do nothing } public void UpdateLastRead(Model.Server server) { // do nothing } public void UpdateLastWrite(Model.Server server) { // do nothing } public void SetFailure(Model.Server server) { // do nothing } } }