endpoint

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialRPC

func DialRPC(preference RPCPreference, rpc RPC, dialer Dialer) *rpc.Client

DialRPC navigates the RPC interface, to find the optimal version of the PRC to dial or attach to.

func SelectRPC

func SelectRPC(preference RPCPreference, rpc RPC) string

SelectRPC selects an endpoint URL, based on preference. For more optimal dialing, use DialRPC.

Types

type ClientRPC

type ClientRPC interface {
	RPC
	ClientRPC() *rpc.Client
}

ClientRPC is an RPC extension interface, providing the option to attach in-process to a client, rather than dialing an endpoint.

type Dialer

type Dialer func(v string) *rpc.Client

type HttpRPC

type HttpRPC interface {
	RPC
	HttpRPC() string
}

HttpRPC is an RPC extension interface, to explicitly provide the HTTP RPC option.

type HttpURL

type HttpURL string

HttpURL is an HTTP endpoint URL

func (HttpURL) HttpRPC

func (url HttpURL) HttpRPC() string

func (HttpURL) RPC

func (url HttpURL) RPC() string

type RPC

type RPC interface {
	RPC() string
}

RPC is an interface for an endpoint to provide flexibility. By default the RPC just returns an RPC endpoint string. But the RPC can implement one or more extension interfaces, to provide alternative ways of establishing a connection, or even a fully initialized client binding.

type RPCPreference

type RPCPreference int
const (
	PreferAnyRPC RPCPreference = iota
	PreferHttpRPC
	PreferWSRPC
)

type RestHTTP

type RestHTTP interface {
	RestHTTP() string
}

RestHTTP is an interface for an endpoint to provide flexibility. By default the RestHTTP just returns an REST-ful HTTP endpoint string. But the RestHTTP can implement one or more extension interfaces, to provide alternative ways of establishing a connection, or even a fully initialized client binding.

type RestHTTPURL

type RestHTTPURL string

RestHTTPURL is an HTTP endpoint URL string

func (RestHTTPURL) RestHTTP

func (url RestHTTPURL) RestHTTP() string

type ServerRPC

type ServerRPC struct {
	Fallback WsOrHttpRPC
	Server   *rpc.Server
}

ServerRPC is a very flexible RPC: it can attach in-process to a server, or select one of the fallback RPC methods.

func (*ServerRPC) ClientRPC

func (e *ServerRPC) ClientRPC() *rpc.Client

func (*ServerRPC) HttpRPC

func (e *ServerRPC) HttpRPC() string

func (*ServerRPC) RPC

func (e *ServerRPC) RPC() string

func (*ServerRPC) WsRPC

func (e *ServerRPC) WsRPC() string

type WsOrHttpRPC

type WsOrHttpRPC struct {
	WsURL   string
	HttpURL string
}

WsOrHttpRPC provides optionality between a websocket RPC endpoint and a HTTP RPC endpoint. The default is the websocket endpoint.

func (WsOrHttpRPC) HttpRPC

func (r WsOrHttpRPC) HttpRPC() string

func (WsOrHttpRPC) RPC

func (r WsOrHttpRPC) RPC() string

func (WsOrHttpRPC) WsRPC

func (r WsOrHttpRPC) WsRPC() string

type WsRPC

type WsRPC interface {
	RPC
	WsRPC() string
}

WsRPC is an RPC extension interface, to explicitly provide the Websocket RPC option.

type WsURL

type WsURL string

WsURL is a websocket endpoint URL

func (WsURL) RPC

func (url WsURL) RPC() string

func (WsURL) WsRPC

func (url WsURL) WsRPC() string

Jump to

Keyboard shortcuts

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