packets.go 793 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (C) 2014 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at http://mozilla.org/MPL/2.0/.
  6. //go:generate -command genxdr go run ../../Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go
  7. //go:generate genxdr -o packets_xdr.go packets.go
  8. package discover
  9. const (
  10. AnnouncementMagic = 0x9D79BC39
  11. QueryMagic = 0x2CA856F5
  12. )
  13. type Query struct {
  14. Magic uint32
  15. DeviceID []byte // max:32
  16. }
  17. type Announce struct {
  18. Magic uint32
  19. This Device
  20. Extra []Device // max:16
  21. }
  22. type Device struct {
  23. ID []byte // max:32
  24. Addresses []Address // max:16
  25. }
  26. type Address struct {
  27. IP []byte // max:16
  28. Port uint16
  29. }