Documentation ¶
Index ¶
- Constants
- func GetResponseBody(url string, postP PostParams) ([]byte, error)
- func GetSeed(url string) ([]byte, error)
- func Send(ctx context.Context, url string, userCfg *UserConfigJSON, ...) ([]byte, error)
- func SendWithSeed(ctx context.Context, url string, userCfg *UserConfigJSON, ...) ([]byte, error)
- func SetTimeout(timeout uint)
- func SetVerbose(verb bool)
- type InfoResponse
- type PostParams
- type RequestConfigJSON
- type StatusResponse
- type UserConfigJSON
Constants ¶
View Source
const (
RequestTimeout = 15 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func GetResponseBody ¶
func GetResponseBody(url string, postP PostParams) ([]byte, error)
GetResponseBody makes request and extracts body
func Send ¶
func Send(ctx context.Context, url string, userCfg *UserConfigJSON, reqCfg *RequestConfigJSON) ([]byte, error)
Send first gets seed and after that makes target request
func SendWithSeed ¶
func SendWithSeed(ctx context.Context, url string, userCfg *UserConfigJSON, reqCfg *RequestConfigJSON, seed []byte) ([]byte, error)
SendWithSeed sends request with known seed
func SetTimeout ¶ added in v0.7.5
func SetTimeout(timeout uint)
Types ¶
type InfoResponse ¶
type InfoResponse struct { RootDomain string `json:"RootDomain"` RootMember string `json:"RootMember"` NodeDomain string `json:"NodeDomain"` TraceID string `json:"TraceID"` }
InfoResponse represents response from rpc on info.Get method
func Info ¶
func Info(url string) (*InfoResponse, error)
Info makes rpc request to info.Get method and extracts it
type RequestConfigJSON ¶
type RequestConfigJSON struct { Params []interface{} `json:"params"` Method string `json:"method"` }
RequestConfigJSON holds info about request
func ReadRequestConfigFromFile ¶
func ReadRequestConfigFromFile(path string) (*RequestConfigJSON, error)
ReadRequestConfigFromFile read request config from file
type StatusResponse ¶ added in v0.7.5
type StatusResponse struct {
NetworkState string `json:"NetworkState"`
}
StatusResponse represents response from rpc on status.Get method
func Status ¶ added in v0.7.5
func Status(url string) (*StatusResponse, error)
Status makes rpc request to info.Status method and extracts it
type UserConfigJSON ¶
type UserConfigJSON struct { PrivateKey string `json:"private_key"` Caller string `json:"caller"` // contains filtered or unexported fields }
UserConfigJSON holds info about user
func CreateUserConfig ¶
func CreateUserConfig(caller string, privKey string) (*UserConfigJSON, error)
CreateUserConfig creates user config from arguments
func ReadUserConfigFromFile ¶
func ReadUserConfigFromFile(path string) (*UserConfigJSON, error)
ReadUserConfigFromFile read user config from file
Click to show internal directories.
Click to hide internal directories.