localpackets.go 820 B

1234567891011121314151617181920212223242526272829303132333435
  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. )
  12. type Announce struct {
  13. Magic uint32
  14. This Device
  15. Extra []Device // max:16
  16. }
  17. type Device struct {
  18. ID []byte // max:32
  19. Addresses []Address // max:16
  20. Relays []Relay // max:16
  21. }
  22. type Address struct {
  23. URL string // max:2083
  24. }
  25. type Relay struct {
  26. URL string `json:"url"` // max:2083
  27. Latency int32 `json:"latency"`
  28. }