packets.go 582 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file).
  2. // All rights reserved. Use of this source code is governed by an MIT-style
  3. // license that can be found in the LICENSE file.
  4. package discover
  5. const (
  6. AnnouncementMagic = 0x9D79BC39
  7. QueryMagic = 0x2CA856F5
  8. )
  9. type Query struct {
  10. Magic uint32
  11. NodeID []byte // max:32
  12. }
  13. type Announce struct {
  14. Magic uint32
  15. This Node
  16. Extra []Node // max:16
  17. }
  18. type Node struct {
  19. ID []byte // max:32
  20. Addresses []Address // max:16
  21. }
  22. type Address struct {
  23. IP []byte // max:16
  24. Port uint16
  25. }