This repository has been archived by the owner on May 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
peer.go
75 lines (53 loc) · 1.62 KB
/
peer.go
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
65
66
67
68
69
70
71
72
73
74
75
package wireguard
import (
"net"
"time"
)
// A Peer is a remote endpoint that can be communicated with via an Interface.
type Peer struct {
// PublicKey is the static Curve25519 public key of the peer. It must be
// exactly 32 bytes.
PublicKey []byte
// AllowedIPs is the list of IP networks that will be routed to and accepted
// from the peer.
AllowedIPs []*net.IPNet
// Endpoint is the network address that packets destined for the peer will
// be sent to. If it is nil, packets destined for this peer will not be
// routable until an incoming handshake is received.
Endpoint *net.UDPAddr
// PersistentKeepaliveInterval, if non-zero, is the number of seconds
// between keep-alive packets sent to the peer.
PersistentKeepaliveInterval int
// LastHandshake is the timestamp of the last successful handshake with the
// peer. This field is read-only.
LastHandshake time.Time
// RxBytes is the number of bytes received from the peer. This field is
// read-only.
RxBytes int64
// TxBytes is the number of bytes transmitted to the peer. This field is
// read-only.
TxBytes int64
}
type peer struct {
endpointAddr *net.UDPAddr
handshake noiseHandshake
lastSentHandshake time.Time
latestCookie cookie
keypairs noiseKeypairs
rxBytes, txBytes uint64
}
func (p *peer) public() *Peer {
return nil
}
func (p *peer) updateLatestAddr(a *net.UDPAddr) {
}
func (p *peer) rxStats(n int) {
}
func (p *peer) timerAnyAuthenticatedPacketReceived() {
}
func (p *peer) timerAnyAuthenticatedPacketTraversal() {
}
func (p *peer) timerEphemeralKeyCreated() {
}
func (p *peer) timerHandshakeComplete() {
}