namespace Sandbox.Network;
public struct ConnectionStats
{
///
/// Current ping for this connection.
///
public int Ping { get; set; }
///
/// How many packets per second we're sending to this connection.
///
public float OutPacketsPerSecond { get; set; }
///
/// How many bytes per second we're sending to this connection.
///
public float OutBytesPerSecond { get; set; }
///
/// How many packets per second we're receiving from this connection.
///
public float InPacketsPerSecond { get; set; }
///
/// How many bytes per second we're receiving from this connection.
///
public float InBytesPerSecond { get; set; }
///
/// Estimate rate that we believe we can send data to this connection.
///
public int SendRateBytesPerSecond { get; set; }
///
/// From 0 to 1 how good is our connection to this?
///
public float ConnectionQuality { get; set; }
private string Name { get; set; }
internal ConnectionStats( string name )
{
Name = name;
}
public override string ToString()
{
if ( string.IsNullOrEmpty( Name ) )
return $"ConnectionStats( OutBps: {OutBytesPerSecond}, InBps: {InBytesPerSecond}, Quality: {ConnectionQuality}";
else
return $"ConnectionStats( {Name}, OutBps: {OutBytesPerSecond}, InBps: {InBytesPerSecond}, Quality: {ConnectionQuality}";
}
}