Cleanup.
This commit is contained in:
1 parent
b86b43f1de
commit
fe9f15bec9
2 files changed
+12
-2
No files matched your search
@@ -7,6 +7,7 @@ import (
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
|
||||
"vppn/peer/control"
|
||||
"vppn/peer/wginterface"
|
||||
)
|
||||
|
||||
type PeerState string
|
||||
@@ -61,6 +62,11 @@ func (p *Peer) Up() bool {
|
||||
return time.Since(p.LastPing) < 3*PingInterval
|
||||
}
|
||||
|
||||
func (p *Peer) DirectAlive() bool {
|
||||
return p.WGEndpoint().IsValid() &&
|
||||
time.Since(p.LastHandshakeTime()) < 2*wginterface.ProbeKeepalive
|
||||
}
|
||||
|
||||
func (p *Peer) CanRelay() bool {
|
||||
return p.IsRelay && p.Up()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user