Versions in this module Expand all Collapse all v2 v2.0.0 Aug 8, 2022 Changes in this version + const MaxPacketSize + const ResponseTimeout + var ErrClosed = errors.New("socket closed") + var ErrInvalidMessage = errors.New("invalid message") + var ErrNoMessage = errors.New("packet does not contain a message") + var ErrTimeout = errors.New("response timeout") + func PacketHash(data []byte) []byte + type Handler interface + HandleMessage func(s *Server, fromAddr *net.UDPAddr, from *identity.Identity, data []byte) (bool, error) + type HandlerFunc func(*Server, *net.UDPAddr, *identity.Identity, []byte) (bool, error) + func (f HandlerFunc) HandleMessage(s *Server, fromAddr *net.UDPAddr, from *identity.Identity, data []byte) (bool, error) + type MType uint32 + type Message interface + Type func() MType + type NetConn interface + Close func() error + LocalAddr func() net.Addr + ReadFromUDP func([]byte) (int, *net.UDPAddr, error) + WriteToUDP func([]byte, *net.UDPAddr) (int, error) + type Protocol struct + Sender Sender + func (p *Protocol) IsExpired(ts int64) bool + func (p *Protocol) Send(to *peer.Peer, data []byte) + func (p *Protocol) SendExpectingReply(dstAddr *net.UDPAddr, toID identity.ID, data []byte, replyType MType, ...) <-chan error + type Sender interface + Send func(toAddr *net.UDPAddr, data []byte) + SendExpectingReply func(toAddr *net.UDPAddr, toID identity.ID, data []byte, replyType MType, ...) <-chan error + type Server struct + func Serve(local *peer.Local, conn NetConn, log *logger.Logger, h ...Handler) *Server + func (s *Server) Close() + func (s *Server) IsExpectedReply(fromIP net.IP, fromID identity.ID, msg Message) bool + func (s *Server) Local() *peer.Local + func (s *Server) LocalAddr() *net.UDPAddr + func (s *Server) Send(toAddr *net.UDPAddr, data []byte) + func (s *Server) SendExpectingReply(toAddr *net.UDPAddr, toID identity.ID, data []byte, replyType MType, ...) <-chan error Other modules containing this package github.com/finderAUT/hive.go/v3