rpc

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: ISC Imports: 19 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func FileExists

func FileExists(name string) bool

FileExists reports whether the named file or directory exists.

func ParseListeners

func ParseListeners(addrs []string) ([]string, []string, error)

ParseListeners splits the list of listen addresses passed in addrs into IPv4 and IPv6 slices and returns them. This allows easy creation of the listeners on the correct interface "tcp4" and "tcp6". It also properly detects addresses which apply to "all interfaces" and adds the address to both slices.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type Config

type Config struct {
	DisableTLS bool
	Key        string
	Cert       string
	User       string
	Pass       string
	LimitUser  string
	LimitPass  string
	MaxClients uint32
	Listeners  []string
}

Config provides configuration parameters of the rpc server.

type Server

type Server struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Server holds the items the rpc server may need to access (config, shutdown, main server, etc.)

func NewRPCServer

func NewRPCServer(cfg *Config) (*Server, error)

NewRPCServer returns a new instance of the Server struct.

func (*Server) GRPC

func (s *Server) GRPC() *grpc.Server

GRPC returns the grpc server.

func (*Server) RestrictAdmin

func (s *Server) RestrictAdmin(ctx context.Context) codes.Code

RestrictAdmin restricts access of the client, returning an error if the client is not already authenticated as an admin.

func (*Server) RestrictAuth

func (s *Server) RestrictAuth(ctx context.Context) codes.Code

RestrictAuth restricts access of the client, returning an error if the client is not already authenticated.

func (*Server) Running

func (s *Server) Running() bool

Running tells whether the server is running.

func (*Server) Start

func (s *Server) Start()

Start is used by server.go to start the rpc listener.

func (*Server) Stop

func (s *Server) Stop() error

Stop is used by server.go to stop the rpc listener.

Jump to

Keyboard shortcuts

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