github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/networking-connection-metric.go (about)

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package protocol
     4  
     5  // ConnectionMetrics
     6  type ConnectionMetrics interface {
     7  	LastUsage() Time                     // Last use of the connection
     8  	MaxBandwidth() uint64                // Byte/Second and Connection can limit to a fixed number
     9  	BytesSent() uint64                   // Counts the bytes of packets sent
    10  	PacketsSent() uint64                 // Counts sent packets
    11  	BytesReceived() uint64               // Counts the bytes of packets receive
    12  	PacketsReceived() uint64             // Counts received packets
    13  	LostPackets() uint64                 // Counts any lost packet that peer request to resend it
    14  	LostBytes() uint64                   //
    15  	ResendPackets() uint64               // Counts any duplicate packet that not request to resend it, use to prevent attacks
    16  	ResendBytes() uint64                 //
    17  	FailedPacketsSent() uint64           //
    18  	FailedPacketsReceived() uint64       // Counts failed packets receive for firewalling server from some attack types
    19  	NotRequestedPacketsReceived() uint64 // Counts not requested packets received for firewalling server from some attack types
    20  	SucceedStreamCount() uint64          // Count successful request
    21  	FailedStreamCount() uint64           // Count failed services call e.g. data validation failed, ...
    22  
    23  	StreamSucceed()
    24  	StreamFailed()
    25  	PacketReceived(packetLength uint64)
    26  	DuplicatePacketReceived(packetLength uint64)
    27  	PacketSent(packetLength uint64)
    28  	PacketResend(packetLength uint64)
    29  
    30  	// Rate() uint // Byte/Second
    31  }