ssgrpc

package
v0.0.0-...-008069a Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package ssgrpc provides a ss.MultihomeBackend interface that uses grpc with profobufs for synchronizing broadcasts and roomcasts between multiple Sacrificial Socket instances.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRPCCredentials = errors.New("the client provided invalid RPC credentials")

	ErrNilBroadcastChannel = errors.New("broadcast channel is not open yet")
	ErrNilRoomcastChannel  = errors.New("roomcast channel is not open yet")

	ErrBadDataType = errors.New("bad data type used")
	ErrBadContext  = errors.New("bad context used in transport")
)

Functions

This section is empty.

Types

type GRPCMHB

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

GRPCMHB... yep that's what I'm calling it. All you need to know is that GRPCMHB satisfies the ss.MultihomeBackend interface

func NewBackend

func NewBackend(tlsKeyFile, tlsCertFile, grpcHostPort string, sharedKey []byte, peerList []string) *GRPCMHB

NewBackend returns a GRPCMHB that will use TLS and HMAC-SHA256 signed JWTs to connect and authenticate to the peers in peerList

func NewInsecureBackend

func NewInsecureBackend(grpcHostPort string, peerList []string) *GRPCMHB

NewInsecureBackend returns a GRPCMHB that will use no encryption or authentication to connect to the peers in peerList

It is highly discouraged to use this for production systems, as all data will be sent in clear text and no authentication will be done on peer connections

func (*GRPCMHB) BroadcastFromBackend

func (g *GRPCMHB) BroadcastFromBackend(b chan<- *ss.BroadcastMsg)

BroadcastFromBackend listens on the local grpc service for calls from remote peers and propagates broadcasts to locally connected websockets

func (*GRPCMHB) BroadcastToBackend

func (g *GRPCMHB) BroadcastToBackend(b *ss.BroadcastMsg)

BroadcastToBackend propagates the broadcast to all active peer connections

func (*GRPCMHB) Init

func (g *GRPCMHB) Init()

Init sets up the grpc server and creates connections to all grpc peers

func (*GRPCMHB) RoomcastFromBackend

func (g *GRPCMHB) RoomcastFromBackend(r chan<- *ss.RoomMsg)

RoomcastFromBackend listens on the local grpc service for calls from remote peers and propagates roomcasts to locally connected websockets

func (*GRPCMHB) RoomcastToBackend

func (g *GRPCMHB) RoomcastToBackend(r *ss.RoomMsg)

RoomcastToBackend propagates the roomcast to all active peer connections

func (*GRPCMHB) Shutdown

func (g *GRPCMHB) Shutdown()

Shutdown stops the grpc service and closes any peer connections

Directories

Path Synopsis
Package token is used by package ssgrpc for generating and validating HMAC-SHA256 tokens sent as "per RPC credentials".
Package token is used by package ssgrpc for generating and validating HMAC-SHA256 tokens sent as "per RPC credentials".
Package transport is a generated protocol buffer package.
Package transport is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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