/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/tools/validatormon/local.go
49 строк
898 B
zoom-ua
enable gosec (#28775)
08 янв 2026, 19:26
Не верифицирован
08 янв 2026, 19:26
5670f73
Код
Авторство
О чём код?
package main import ( "encoding/json" "fmt" "io" "net/http" ) type LocalReader struct{} type quorumRes struct { Node string Qset struct { Ledger int Phase string Missing []string } } func (r *LocalReader) StatusRead(accountID string) (*Status, error) { url := fmt.Sprintf("http://localhost:11626/quorum?node=%s", accountID) res, err := http.Get(url) //nolint:gosec // G107: Localhost Stellar validator monitoring endpoint with account ID parameter if err != nil { return nil, err } body, err := io.ReadAll(res.Body) res.Body.Close() if err != nil { return nil, err } return statusFromJSON(body) } func statusFromJSON(data []byte) (*Status, error) { var q quorumRes if err := json.Unmarshal(data, &q); err != nil { return nil, err } return &Status{ Node: q.Node, Ledger: q.Qset.Ledger, Phase: q.Qset.Phase, Missing: q.Qset.Missing, }, nil }