You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Network/Proxies/ProxyBalancer.cs

33 lines
791 B

4 years ago
using System.Collections.Generic;
using System.Net;
using ZeroLevel.Services.Collections;
namespace ZeroLevel.Services.Network.Proxies
{
internal sealed class ProxyBalancer
{
private RoundRobinCollection<IPEndPoint> _servers;
public ProxyBalancer()
{
_servers = new RoundRobinCollection<IPEndPoint>();
}
public ProxyBalancer(IEnumerable<IPEndPoint> endpoints)
{
_servers = new RoundRobinCollection<IPEndPoint>(endpoints);
}
public void AddEndpoint(IPEndPoint ep) => _servers.Add(ep);
public IPEndPoint GetServerProxy()
{
if (_servers.MoveNext())
{
return _servers.Current;
}
7 months ago
return null!;
4 years ago
}
}
}

Powered by TurnKey Linux.