remote

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(req Request, code int, message string) []byte

Error returs jsonrpc error

Types

type Method

type Method struct {
	Host             string
	Version          string
	Name             string
	RemoteName       string
	Roles            []string
	ParamConverters  []converter.Converter
	ResultConverters []converter.Converter
}

Method struct.

func (*Method) IsGranted

func (m *Method) IsGranted(roles []string) bool

IsGranted check is it possible to use Method with provided roles

type MethodCollection

type MethodCollection struct {
	Methods []Method
}

MethodCollection keeps collection of Methods

func NewMethodCollection

func NewMethodCollection() MethodCollection

NewMethodCollection returns new collection

func (*MethodCollection) Add

func (c *MethodCollection) Add(m Method)

Add adds methos to collection

func (*MethodCollection) Find

func (c *MethodCollection) Find(methodName string) *Method

Find returns method from collection by its name

func (*MethodCollection) Merge

Merge combines collection to a new one

type Remote

type Remote struct {
	Client  *http.Client
	Methods MethodCollection
}

func (*Remote) Call

func (r *Remote) Call(req Request) []byte

Call makes requests to hidden services

type Request

type Request struct {
	ID        interface{}
	Method    string
	Roles     []string
	Headers   map[string][]string
	RawParams gjson.Result
}

Request represents client request

Jump to

Keyboard shortcuts

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