Encapsulate local discovery address in struct

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).
This commit is contained in:
Jakob Borg
2015-09-22 23:27:58 +02:00
parent 6124bbb12a
commit e522811a52
3 changed files with 212 additions and 133 deletions

View File

@@ -19,13 +19,17 @@ type Announce struct {
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"`
}
type Device struct {
ID []byte // max:32
Addresses []string // max:16
Relays []Relay // max:16
}