Documentation ¶
Index ¶
- type HttpContext
- type HttpHandler
- func (h *HttpHandler) AddNamespace(namespace string)
- func (h *HttpHandler) AddPeer(peer string) error
- func (h *HttpHandler) AddProxyHandler(path string)
- func (h *HttpHandler) Address() string
- func (h *HttpHandler) ConnectionType() string
- func (h *HttpHandler) Init(c *types.Connection) error
- func (h *HttpHandler) Listen(receiver chan<- types.Message)
- func (h *HttpHandler) Send(msg types.Message)
- func (h *HttpHandler) SendUnicast(address string, msg types.Message)
- func (h *HttpHandler) SetBootnodes(bootnodes []string)
- func (h *HttpHandler) SetProxy(p *Proxy)
- func (h *HttpHandler) String() string
- type HttpWsHandler
- func (h *HttpWsHandler) AddNamespace(namespace string)
- func (h *HttpWsHandler) AddPeer(peer string) error
- func (h *HttpWsHandler) AddProxyHandler(path string)
- func (h *HttpWsHandler) Address() string
- func (h *HttpWsHandler) ConnectionType() string
- func (h *HttpWsHandler) Init(c *types.Connection) error
- func (h *HttpWsHandler) Listen(receiver chan<- types.Message)
- func (h *HttpWsHandler) Send(msg types.Message)
- func (h *HttpWsHandler) SendUnicast(address string, msg types.Message)
- func (h *HttpWsHandler) SetBootnodes(bootnodes []string)
- func (h *HttpWsHandler) SetProxy(p *Proxy)
- func (h *HttpWsHandler) String() string
- type Proxy
- func (p *Proxy) AddEndpoint(url string) func(writer http.ResponseWriter, reader *http.Request)
- func (p *Proxy) AddHandler(path string, handler http.HandlerFunc)
- func (p *Proxy) AddMixedHandler(path string, HTTPhandler http.HandlerFunc, WShandler ProxyWsHandler)
- func (p *Proxy) AddWsHTTPBridge(url string) ProxyWsHandler
- func (p *Proxy) AddWsHandler(path string, handler ProxyWsHandler)
- func (p *Proxy) AddWsWsBridge(url string) ProxyWsHandler
- func (p *Proxy) GenerateSSLCertificate() (*http.Server, *autocert.Manager)
- func (p *Proxy) Init() error
- func (p *Proxy) ProxyIPC(path string) http.HandlerFunc
- type ProxyWsHandler
- type SubPubHandle
- func (s *SubPubHandle) AddNamespace(namespace string)
- func (s *SubPubHandle) AddPeer(peer string) error
- func (s *SubPubHandle) Address() string
- func (s *SubPubHandle) ConnectionType() string
- func (p *SubPubHandle) Init(c *types.Connection) error
- func (s *SubPubHandle) Listen(reciever chan<- types.Message)
- func (s *SubPubHandle) Send(msg types.Message)
- func (s *SubPubHandle) SendUnicast(address string, msg types.Message)
- func (s *SubPubHandle) SetBootnodes(bootnodes []string)
- func (s *SubPubHandle) String() string
- type Transport
- type TransportID
- type WebsocketContext
- type WebsocketHandle
- func (w *WebsocketHandle) AddNamespace(namespace string)
- func (w *WebsocketHandle) AddPeer(peer string) error
- func (w *WebsocketHandle) AddProxyHandler(path string)
- func (w *WebsocketHandle) Address() string
- func (w *WebsocketHandle) ConnectionType() string
- func (w *WebsocketHandle) Init(c *types.Connection) error
- func (w *WebsocketHandle) Listen(receiver chan<- types.Message)
- func (w *WebsocketHandle) Send(msg types.Message)
- func (w *WebsocketHandle) SendUnicast(address string, msg types.Message)
- func (w *WebsocketHandle) SetBootnodes(bootnodes []string)
- func (w *WebsocketHandle) SetProxy(p *Proxy)
- func (w *WebsocketHandle) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpContext ¶
type HttpContext struct { Writer http.ResponseWriter Request *http.Request // contains filtered or unexported fields }
func (*HttpContext) ConnectionType ¶
func (h *HttpContext) ConnectionType() string
func (*HttpContext) Send ¶
func (h *HttpContext) Send(msg types.Message)
type HttpHandler ¶
type HttpHandler struct { Proxy *Proxy // proxy where the ws will be associated // contains filtered or unexported fields }
func (*HttpHandler) AddNamespace ¶
func (h *HttpHandler) AddNamespace(namespace string)
AddNamespace adds a new namespace to the transport
func (*HttpHandler) AddPeer ¶
func (h *HttpHandler) AddPeer(peer string) error
func (*HttpHandler) AddProxyHandler ¶
func (h *HttpHandler) AddProxyHandler(path string)
AddProxyHandler adds the current websocket handler into the Proxy
func (*HttpHandler) Address ¶
func (h *HttpHandler) Address() string
func (*HttpHandler) ConnectionType ¶
func (h *HttpHandler) ConnectionType() string
func (*HttpHandler) Init ¶
func (h *HttpHandler) Init(c *types.Connection) error
func (*HttpHandler) Listen ¶
func (h *HttpHandler) Listen(receiver chan<- types.Message)
func (*HttpHandler) Send ¶
func (h *HttpHandler) Send(msg types.Message)
func (*HttpHandler) SendUnicast ¶
func (h *HttpHandler) SendUnicast(address string, msg types.Message)
func (*HttpHandler) SetBootnodes ¶
func (h *HttpHandler) SetBootnodes(bootnodes []string)
func (*HttpHandler) SetProxy ¶
func (h *HttpHandler) SetProxy(p *Proxy)
func (*HttpHandler) String ¶
func (h *HttpHandler) String() string
type HttpWsHandler ¶
type HttpWsHandler struct { Proxy *Proxy // proxy where the ws will be associated Connection *types.Connection // the ws connection // contains filtered or unexported fields }
HttpWsHandler is a Mixed handler websockets/http
func (*HttpWsHandler) AddNamespace ¶
func (h *HttpWsHandler) AddNamespace(namespace string)
AddNamespace adds a new namespace to the transport
func (*HttpWsHandler) AddPeer ¶
func (h *HttpWsHandler) AddPeer(peer string) error
func (*HttpWsHandler) AddProxyHandler ¶
func (h *HttpWsHandler) AddProxyHandler(path string)
AddProxyHandler adds the current websocket handler into the Proxy
func (*HttpWsHandler) Address ¶
func (h *HttpWsHandler) Address() string
func (*HttpWsHandler) ConnectionType ¶
func (h *HttpWsHandler) ConnectionType() string
func (*HttpWsHandler) Init ¶
func (h *HttpWsHandler) Init(c *types.Connection) error
func (*HttpWsHandler) Listen ¶
func (h *HttpWsHandler) Listen(receiver chan<- types.Message)
func (*HttpWsHandler) Send ¶
func (h *HttpWsHandler) Send(msg types.Message)
func (*HttpWsHandler) SendUnicast ¶
func (h *HttpWsHandler) SendUnicast(address string, msg types.Message)
func (*HttpWsHandler) SetBootnodes ¶
func (h *HttpWsHandler) SetBootnodes(bootnodes []string)
func (*HttpWsHandler) SetProxy ¶
func (h *HttpWsHandler) SetProxy(p *Proxy)
func (*HttpWsHandler) String ¶
func (h *HttpWsHandler) String() string
type Proxy ¶
Proxy represents a proxy
func (*Proxy) AddEndpoint ¶
AddEndpoint adds an endpoint representing the url where the request will be handled
func (*Proxy) AddHandler ¶
func (p *Proxy) AddHandler(path string, handler http.HandlerFunc)
AddHandler adds a HTTP handler in the proxy
func (*Proxy) AddMixedHandler ¶
func (p *Proxy) AddMixedHandler(path string, HTTPhandler http.HandlerFunc, WShandler ProxyWsHandler)
AddMixedHandler adds a mixed (websockets and HTTP) handler in the proxy
func (*Proxy) AddWsHTTPBridge ¶
func (p *Proxy) AddWsHTTPBridge(url string) ProxyWsHandler
AddWsHTTPBridge adds a WS endpoint to interact with the underlying web3
func (*Proxy) AddWsHandler ¶
func (p *Proxy) AddWsHandler(path string, handler ProxyWsHandler)
AddWsHandler adds a websocket handler in the proxy
func (*Proxy) AddWsWsBridge ¶
func (p *Proxy) AddWsWsBridge(url string) ProxyWsHandler
AddWsWsBridge adds a WS endpoint to interact with the underlying web3
func (*Proxy) GenerateSSLCertificate ¶
GenerateSSLCertificate generates a SSL certificated for the proxy
type ProxyWsHandler ¶
ProxyWsHandler function signature required to add a handler in the net/http Server
type SubPubHandle ¶
type SubPubHandle struct { Conn *types.Connection SubPub *subpub.SubPub BootNodes []string }
func (*SubPubHandle) AddNamespace ¶
func (s *SubPubHandle) AddNamespace(namespace string)
func (*SubPubHandle) AddPeer ¶
func (s *SubPubHandle) AddPeer(peer string) error
func (*SubPubHandle) Address ¶
func (s *SubPubHandle) Address() string
func (*SubPubHandle) ConnectionType ¶
func (s *SubPubHandle) ConnectionType() string
func (*SubPubHandle) Init ¶
func (p *SubPubHandle) Init(c *types.Connection) error
func (*SubPubHandle) Listen ¶
func (s *SubPubHandle) Listen(reciever chan<- types.Message)
func (*SubPubHandle) Send ¶
func (s *SubPubHandle) Send(msg types.Message)
func (*SubPubHandle) SendUnicast ¶
func (s *SubPubHandle) SendUnicast(address string, msg types.Message)
func (*SubPubHandle) SetBootnodes ¶
func (s *SubPubHandle) SetBootnodes(bootnodes []string)
func (*SubPubHandle) String ¶
func (s *SubPubHandle) String() string
type Transport ¶
type Transport interface { ConnectionType() string Listen(reciever chan<- types.Message) Send(msg types.Message) AddNamespace(namespace string) SendUnicast(address string, msg types.Message) Init(c *types.Connection) error Address() string SetBootnodes(bootnodes []string) AddPeer(peer string) error String() string }
func Init ¶
func Init(t TransportID, c *types.Connection) (Transport, error)
func InitDefault ¶
func InitDefault(t TransportID) (Transport, error)
type TransportID ¶
type TransportID int
const (
SubPub TransportID = iota + 1
)
func TransportIDFromString ¶
func TransportIDFromString(i string) TransportID
type WebsocketContext ¶
func (WebsocketContext) ConnectionType ¶
func (c WebsocketContext) ConnectionType() string
func (*WebsocketContext) Send ¶
func (c *WebsocketContext) Send(msg types.Message)
type WebsocketHandle ¶
type WebsocketHandle struct { Connection *types.Connection // the ws connection WsProxy *Proxy // proxy where the ws will be associated // contains filtered or unexported fields }
WebsocketHandle handles the websockets connection on the go-dvote proxy
func (*WebsocketHandle) AddNamespace ¶
func (w *WebsocketHandle) AddNamespace(namespace string)
Listen will listen the websockets handler and write the received data into the channel
func (*WebsocketHandle) AddPeer ¶
func (w *WebsocketHandle) AddPeer(peer string) error
func (*WebsocketHandle) AddProxyHandler ¶
func (w *WebsocketHandle) AddProxyHandler(path string)
AddProxyHandler adds the current websocket handler into the Proxy
func (*WebsocketHandle) Address ¶
func (w *WebsocketHandle) Address() string
func (*WebsocketHandle) ConnectionType ¶
func (w *WebsocketHandle) ConnectionType() string
ConnectionType returns a string identifying the transport connection type
func (*WebsocketHandle) Init ¶
func (w *WebsocketHandle) Init(c *types.Connection) error
Init initializes the websockets handler and the internal channel to communicate with other go-dvote components
func (*WebsocketHandle) Listen ¶
func (w *WebsocketHandle) Listen(receiver chan<- types.Message)
Listen will listen the websockets handler and write the received data into the channel
func (*WebsocketHandle) Send ¶
func (w *WebsocketHandle) Send(msg types.Message)
Send sends the response given a message
func (*WebsocketHandle) SendUnicast ¶
func (w *WebsocketHandle) SendUnicast(address string, msg types.Message)
func (*WebsocketHandle) SetBootnodes ¶
func (w *WebsocketHandle) SetBootnodes(bootnodes []string)
func (*WebsocketHandle) SetProxy ¶
func (w *WebsocketHandle) SetProxy(p *Proxy)
SetProxy sets the proxy for the ws
func (*WebsocketHandle) String ¶
func (w *WebsocketHandle) String() string