-
Notifications
You must be signed in to change notification settings - Fork 523
Expand file tree
/
Copy pathPeerStatistics.java
More file actions
64 lines (56 loc) · 1.87 KB
/
PeerStatistics.java
File metadata and controls
64 lines (56 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright © 2017-2021 WireGuard LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package com.wireguard.android.backend;
import com.wireguard.util.NonNullForAll;
import java.time.LocalDateTime;
/**
* Class representing transfer statistics and last handshake time for a
* {@link com.wireguard.config.Peer} instance.
*/
@NonNullForAll
public class PeerStatistics {
private final long rx;
private final long tx;
private final LocalDateTime lastHandshakeTime;
/**
* Create a peer statistics data object.
*
* @param rx The received traffic for the {@link com.wireguard.config.Peer}.
* This value is in bytes
* @param tx The transmitted traffic for the {@link com.wireguard.config.Peer}.
* This value is in bytes.
* @param lastHandshakeTime The last handshake time for the {@link com.wireguard.config.Peer}.
* This value is in LocalDateTime.
*/
PeerStatistics(long rx, long tx, LocalDateTime lastHandshakeTime) {
this.rx = rx;
this.tx = tx;
this.lastHandshakeTime = lastHandshakeTime;
}
/**
* Get the received traffic (in bytes) for the {@link com.wireguard.config.Peer}
*
* @return a long representing the number of bytes received by this peer.
*/
public long getRx() {
return rx;
}
/**
* Get the transmitted traffic (in bytes) for the {@link com.wireguard.config.Peer}
*
* @return a long representing the number of bytes transmitted by this peer.
*/
public long getTx() {
return tx;
}
/**
* Get last handshake time for the {@link com.wireguard.config.Peer}
*
* @return a LocalDateTime.
*/
public LocalDateTime getLastHandshakeTime() {
return lastHandshakeTime;
}
}