mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-18 05:00:03 +02:00
src/api: change v1 and v2 constructor to not expose eosapi package structs.
This commit is contained in:
parent
303995ffda
commit
5d27bf0ad2
3 changed files with 12 additions and 7 deletions
|
|
@ -13,9 +13,12 @@ type EosioV1 struct {
|
|||
block_time float64
|
||||
}
|
||||
|
||||
func NewEosioV1(params eosapi.ReqParams, block_time float64) EosioV1 {
|
||||
func NewEosioV1(url string, host string, block_time float64) EosioV1 {
|
||||
return EosioV1{
|
||||
params: params,
|
||||
params: eosapi.ReqParams{
|
||||
Url: url,
|
||||
Host: host,
|
||||
},
|
||||
block_time: block_time,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,12 @@ type EosioV2 struct {
|
|||
offset int64
|
||||
}
|
||||
|
||||
func NewEosioV2(params eosapi.ReqParams, offset int64) EosioV2 {
|
||||
func NewEosioV2(url string, host string, offset int64) EosioV2 {
|
||||
return EosioV2{
|
||||
params: params,
|
||||
params: eosapi.ReqParams{
|
||||
Url: url,
|
||||
Host: host,
|
||||
},
|
||||
offset: offset,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"strings"
|
||||
"strconv"
|
||||
"github.com/eosswedenorg/eosio-api-healthcheck/src/api"
|
||||
"github.com/eosswedenorg-go/eosapi"
|
||||
"github.com/eosswedenorg-go/haproxy/agentcheck"
|
||||
"github.com/eosswedenorg-go/tcp_server"
|
||||
)
|
||||
|
|
@ -21,9 +20,9 @@ func createApi(a *arguments) (api.ApiInterface, error) {
|
|||
|
||||
switch a.api {
|
||||
case "v1":
|
||||
return api.NewEosioV1(eosapi.ReqParams{Url: a.url, Host: a.host}, float64(a.num_blocks / 2)), nil
|
||||
return api.NewEosioV1(a.url, a.host, float64(a.num_blocks / 2)), nil
|
||||
case "v2":
|
||||
return api.NewEosioV2(eosapi.ReqParams{Url: a.url, Host: a.host}, int64(a.num_blocks)), nil
|
||||
return api.NewEosioV2(a.url, a.host, int64(a.num_blocks)), nil
|
||||
case "contract":
|
||||
return api.NewEosioContract(a.url, float64(a.num_blocks / 2)), nil
|
||||
case "test":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue