Table of Contents

Struct Traffic

Namespace
VpnHood.Core.Common.Messaging
Assembly
VpnHood.Core.Common.dll

Represents an amount each way: bytes, or a rate where a member says so.

public readonly record struct Traffic : IEquatable<Traffic>
Implements
Inherited Members

Constructors

Traffic()

Initializes a new instance of the Traffic structure, with nothing either way.

public Traffic()

Traffic(long, long)

Initializes a new instance of the Traffic structure.

public Traffic(long sent, long received)

Parameters

sent long

The amount sent.

received long

The amount received.

Properties

Received

Gets the amount received.

public long Received { get; init; }

Property Value

long

Sent

Gets the amount sent.

public long Sent { get; init; }

Property Value

long

Total

Gets the sum of both ways.

[JsonIgnore]
public long Total { get; }

Property Value

long

Operators

operator +(Traffic, Traffic)

Adds two amounts, each way.

public static Traffic operator +(Traffic traffic1, Traffic traffic2)

Parameters

traffic1 Traffic

The first amount.

traffic2 Traffic

The second amount.

Returns

Traffic

The sum.

operator -(Traffic, Traffic)

Subtracts an amount from another, each way.

public static Traffic operator -(Traffic traffic1, Traffic traffic2)

Parameters

traffic1 Traffic

The amount to subtract from.

traffic2 Traffic

The amount to subtract.

Returns

Traffic

The difference, which may be negative.