35 lines
731 B
Go
35 lines
731 B
Go
package node
|
|
|
|
import (
|
|
"time"
|
|
"vppn/m"
|
|
)
|
|
|
|
const (
|
|
dialTimeout = 8 * time.Second
|
|
connectTimeout = 6 * time.Second
|
|
pingInterval = 6 * time.Second
|
|
timeoutInterval = 20 * time.Second
|
|
)
|
|
|
|
func (rp *remotePeer) supervise(conf m.PeerConfig) {
|
|
defer panicHandler()
|
|
|
|
super := &peerSuper{
|
|
published: rp.route,
|
|
peers: rp.peers,
|
|
localIP: rp.localIP,
|
|
localPub: addrIsValid(conf.PublicIP),
|
|
remoteIP: rp.remoteIP,
|
|
privKey: conf.EncPrivKey,
|
|
conn: rp.conn,
|
|
counter: &rp.counter,
|
|
peerUpdates: rp.peerUpdates,
|
|
controlPackets: rp.controlPackets,
|
|
buf: make([]byte, bufferSize),
|
|
encBuf: make([]byte, bufferSize),
|
|
}
|
|
|
|
go super.Run()
|
|
}
|