localpackets.go 867 B

12345678910111213141516171819202122232425262728293031323334353637
  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 localpackets_xdr.go localpackets.go
  8. package discover
  9. const (
  10. AnnouncementMagic = 0x9D79BC40
  11. QueryMagic = 0x2CA856F6
  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 Relay struct {
  23. URL string `json:"url"` // max:2083
  24. Latency int32 `json:"latency"`
  25. }
  26. type Device struct {
  27. ID []byte // max:32
  28. Addresses []string // max:16
  29. Relays []Relay // max:16
  30. }