docs: Add CodeBlockConfig to network coordinates page

pull/12026/head
Anthony 3 years ago committed by GitHub
parent 7c3e8bd1c3
commit 1ad3ed3a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,14 +48,20 @@ Computing the estimated network round trip time between any two nodes is simple
once you have their coordinates. Here's a sample coordinate, as returned from the
[Coordinate endpoint](/api/coordinate).
<CodeBlockConfig heading="Sample coordinate from Coordinate endpoint" hideClipboard>
```json
...
"Coord": {
"Adjustment": 0.1,
"Error": 1.5,
"Height": 0.02,
"Vec": [0.34,0.68,0.003,0.01,0.05,0.1,0.34,0.06]
}
...
```
"Coord": {
"Adjustment": 0.1,
"Error": 1.5,
"Height": 0.02,
"Vec": [0.34,0.68,0.003,0.01,0.05,0.1,0.34,0.06]
}
```
</CodeBlockConfig>
All values are floating point numbers in units of seconds, except for the error
term which isn't used for distance calculations.
@ -63,7 +69,9 @@ term which isn't used for distance calculations.
Here's a complete example in Go showing how to compute the distance between two
coordinates:
```
<CodeBlockConfig heading="Computing distance between two coordinates with Go">
```go
import (
"math"
"time"
@ -97,3 +105,5 @@ func dist(a *coordinate.Coordinate, b *coordinate.Coordinate) time.Duration {
return time.Duration(rtt * secondsToNanoseconds)
}
```
</CodeBlockConfig>

Loading…
Cancel
Save