status-go/rtt
frank 38308d48f2
feat_: log on panic ()
* feat_: log error and stacktrace when panic in goroutine

* test_: add test TestSafeGo

* chore_: rename logAndCall to call

* chore_: rename SafeGo to Go

* chore_: make lint-fix

* chore_: use t.Cleanup

* chore_: Revert "chore_: use t.Cleanup"

This reverts commit 4eb420d179cc0e208e84c13cb941e6b3d1ed9819.

* chore_: Revert "chore_: make lint-fix"

This reverts commit fcc995f157e671a4229b47419c3a0e4004b5fdab.

* chore_: Revert "chore_: rename SafeGo to Go"

This reverts commit a6d73d6df583f313032d79aac62f66328039cb55.

* chore_: Revert "chore_: rename logAndCall to call"

This reverts commit 8fbe993bedb9fbba67349a44f151e2dd5e3bc4cc.

* chore_: Revert "test_: add test TestSafeGo"

This reverts commit a1fa91839f3960398980c6bf456e6462ec944819.

* chore_: Revert "feat_: log error and stacktrace when panic in goroutine"

This reverts commit f612dd828fa2ce410d0e806fe773ecbe3e86a68a.

* feat_: log error and stacktrace when panic in goroutine

* chore_: make lint-fix

* chore_: rename logAndCall to call

* chore_: renaming LogOnPanic

* chore_: update rest goroutine function calls

* chore_: make lint-fix
2024-09-27 06:37:32 +08:00
..
README.md rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
rtt.go feat_: log on panic () 2024-09-27 06:37:32 +08:00

README.md

Description

This module is used by the Status app to select mailservers based on their RTT(Round Trip Time).

It is exposed via the JSON RPC endpoint in the services/mailservers/tcp_ping.go file.

Usage

The simplest way to use the mailserver_Ping RPC command is using curl.

The call takes one struct argument which contains two attributes:

  • addresses - A list of enode addresses to ping.
  • timeoutMs - Call timeout given in milliseconds.

The return value consists of a list of objects representing a result for each mailserver, each containing following attributes:

  • address - The enode address of given mailserver.
  • rttMs - Round Trip Time given in milliseconds. Set to null in case of an error.`
  • error - A text of error that caused the ping failure.

Example

 $ cat >payload.json <<EOL
{
  "jsonrpc": "2.0",
  "method": "mailservers_ping",
  "params": [
    {
      "addresses": [
        "enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:443",
        "enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:999"
      ],
      "timeoutMs": 500
    }
  ],
  "id": 1
}
EOL

 $ curl -s localhost:8545 -H 'content-type: application/json' -d @payload.json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:443",
      "rttMs": 31,
      "error": null
    },
    {
      "address": "enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:999",
      "rttMs": null,
      "error": "tcp check timeout: I/O timeout"
    }
  ]
}

Links