udp: Fix minor protocol errors, announces working
This commit is contained in:
parent
22e83739c9
commit
abd2b5ade4
2 changed files with 9 additions and 2 deletions
|
@ -48,3 +48,7 @@ func GenerateConnectionID(ip []byte) []byte {
|
||||||
|
|
||||||
return ct[:8]
|
return ct[:8]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
InitConnectionIDEncryption()
|
||||||
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ import (
|
||||||
"github.com/chihaya/chihaya/tracker/models"
|
"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 (
|
var (
|
||||||
errMalformedPacket = errors.New("malformed packet")
|
errMalformedPacket = errors.New("malformed packet")
|
||||||
|
@ -110,6 +110,9 @@ func (s *Server) newAnnounce(packet []byte, ip net.IP) (*models.Announce, error)
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
return nil, errMalformedIP
|
return nil, errMalformedIP
|
||||||
}
|
}
|
||||||
|
if ipv4 := ip.To4(); ipv4 != nil {
|
||||||
|
ip = ipv4
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(pushrax): what exactly is the key "key" used for?
|
// TODO(pushrax): what exactly is the key "key" used for?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue