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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user