mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-13 09:38:36 -07:00
udp: Fix minor protocol errors, announces working
This commit is contained in:
@@ -48,3 +48,7 @@ func GenerateConnectionID(ip []byte) []byte {
|
||||
|
||||
return ct[:8]
|
||||
}
|
||||
|
||||
func init() {
|
||||
InitConnectionIDEncryption()
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ import (
|
||||
"github.com/chihaya/chihaya/tracker/models"
|
||||
)
|
||||
|
||||
var initialConnectionID = []byte{0x04, 0x17, 0x27, 0x10, 0x19, 0x80}
|
||||
var initialConnectionID = []byte{0, 0, 0x04, 0x17, 0x27, 0x10, 0x19, 0x80}
|
||||
|
||||
var eventIDs = []string{"none", "completed", "started", "stopped"}
|
||||
var eventIDs = []string{"", "completed", "started", "stopped"}
|
||||
|
||||
var (
|
||||
errMalformedPacket = errors.New("malformed packet")
|
||||
@@ -110,6 +110,9 @@ func (s *Server) newAnnounce(packet []byte, ip net.IP) (*models.Announce, error)
|
||||
if ip == nil {
|
||||
return nil, errMalformedIP
|
||||
}
|
||||
if ipv4 := ip.To4(); ipv4 != nil {
|
||||
ip = ipv4
|
||||
}
|
||||
|
||||
// TODO(pushrax): what exactly is the key "key" used for?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user