refactor-for-testability (#3)
Co-authored-by: jdl <jdl@desktop> Co-authored-by: jdl <jdl@crumpington.com> Reviewed-on: #3
This commit is contained in:
37
peer/globals.go
Normal file
37
peer/globals.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package peer
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/netip"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
version = 1
|
||||
|
||||
bufferSize = 1536
|
||||
|
||||
if_mtu = 1200
|
||||
if_queue_len = 2048
|
||||
|
||||
controlCipherOverhead = 16
|
||||
dataCipherOverhead = 16
|
||||
signOverhead = 64
|
||||
|
||||
pingInterval = 8 * time.Second
|
||||
timeoutInterval = 30 * time.Second
|
||||
broadcastInterval = 16 * time.Second
|
||||
broadcastErrorTimeoutInterval = 8 * time.Second
|
||||
)
|
||||
|
||||
var multicastAddr = net.UDPAddrFromAddrPort(netip.AddrPortFrom(
|
||||
netip.AddrFrom4([4]byte{224, 0, 0, 157}),
|
||||
4560))
|
||||
|
||||
func newBuf() []byte {
|
||||
return make([]byte, bufferSize)
|
||||
}
|
||||
|
||||
type marshaller interface {
|
||||
Marshal([]byte) []byte
|
||||
}
|
||||
Reference in New Issue
Block a user