docs: Add CodeBlockConfig to network coordinates page
This commit is contained in:
parent
a4d2dc0ce2
commit
a217d13e1b
|
@ -48,22 +48,30 @@ 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]
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
All values are floating point numbers in units of seconds, except for the error
|
||||
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…
Reference in New Issue