mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 11:28:59 +00:00
e522811a52
The XDR encoder doesn't understart slices of strings very well. It can encode and decode them, but there's no way to set limits on the length of the strings themselves (only on the length of the slice), and the generated diagrams are incorrect. This trivially works around this, while also documenting what the string actually is (a URL).
36 lines
820 B
Go
36 lines
820 B
Go
// Copyright (C) 2014 The Syncthing Authors.
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
//go:generate -command genxdr go run ../../Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go
|
|
//go:generate genxdr -o localpackets_xdr.go localpackets.go
|
|
|
|
package discover
|
|
|
|
const (
|
|
AnnouncementMagic = 0x9D79BC40
|
|
)
|
|
|
|
type Announce struct {
|
|
Magic uint32
|
|
This Device
|
|
Extra []Device // max:16
|
|
}
|
|
|
|
type Device struct {
|
|
ID []byte // max:32
|
|
Addresses []Address // max:16
|
|
Relays []Relay // max:16
|
|
}
|
|
|
|
type Address struct {
|
|
URL string // max:2083
|
|
}
|
|
|
|
type Relay struct {
|
|
URL string `json:"url"` // max:2083
|
|
Latency int32 `json:"latency"`
|
|
}
|