httpjson

package
v0.3.9-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2018 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFileIPFS

func AddFileIPFS(filepath string, useCluster bool) (string, error)

func GetFileIPFS

func GetFileIPFS(ref, outPath string) error

Types

type Authorization

type Authorization interface {
	GetAuthType() RPCAuthType
	CheckAuth(s *RPCServer, r *http.Request) bool
}

func NewUserPassword

func NewUserPassword(username string, passwordHash string) Authorization

type RPCAuthType

type RPCAuthType byte
const (
	UsernamePassword RPCAuthType = 0x01
)

type RPCServer

type RPCServer struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(node protocol.Noder, wallet vault.Wallet) *RPCServer

NewServer will create a new RPC server instance.

func (*RPCServer) GetNetNode

func (s *RPCServer) GetNetNode() (protocol.Noder, error)

func (*RPCServer) GetWallet

func (s *RPCServer) GetWallet() (vault.Wallet, error)

func (*RPCServer) Handle

func (s *RPCServer) Handle(w http.ResponseWriter, r *http.Request)

this is the funciton that should be called in order to answer an rpc call should be registered like "http.HandleFunc("/", httpjsonrpc.Handle)"

func (*RPCServer) HandleFunc

func (s *RPCServer) HandleFunc(pattern string, handler common.Handler)

a function to register functions to be called for specific rpc calls

func (*RPCServer) SetDefaultFunc

func (s *RPCServer) SetDefaultFunc(def func(http.ResponseWriter, *http.Request))

a function to be called if the request is not a HTTP JSON RPC call

func (*RPCServer) Start

func (s *RPCServer) Start()

type ServeMux

type ServeMux struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type UserPassword

type UserPassword struct {
	Username     string
	PasswordHash string
}

func (*UserPassword) CheckAuth

func (up *UserPassword) CheckAuth(s *RPCServer, r *http.Request) bool

func (*UserPassword) GetAuthType

func (up *UserPassword) GetAuthType() RPCAuthType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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