requester

package
v0.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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 GetSeed

func GetSeed(url string) ([]byte, error)

GetSeed makes rpc request to seed.Get method and extracts it

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)

func SetVerbose

func SetVerbose(verb bool)

SetVerbose switches on verbose mode

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 PostParams

type PostParams = map[string]interface{}

PostParams represents params struct

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL