This was a convenient but rather suspect coupling. In particular, it will break if the period gossip logic changes s.t. it no longer sends gossip on all connections every interval.
30 lines
467 B
Go
30 lines
467 B
Go
package router
|
|
|
|
const (
|
|
Protocol = "weave"
|
|
ProtocolVersion = 15
|
|
)
|
|
|
|
type ProtocolTag byte
|
|
|
|
const (
|
|
ProtocolHeartbeat ProtocolTag = iota
|
|
ProtocolConnectionEstablished
|
|
ProtocolFragmentationReceived
|
|
ProtocolStartFragmentationTest
|
|
ProtocolNonce
|
|
ProtocolPMTUVerified
|
|
ProtocolGossip
|
|
ProtocolGossipUnicast
|
|
ProtocolGossipBroadcast
|
|
)
|
|
|
|
type ProtocolMsg struct {
|
|
tag ProtocolTag
|
|
msg []byte
|
|
}
|
|
|
|
type ProtocolSender interface {
|
|
SendProtocolMsg(m ProtocolMsg)
|
|
}
|