grpc_quick

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEmptyClientConfig

func CreateEmptyClientConfig()

CreateEmptyClientConfig creates an empty config

func CreateEmptyServerConfig

func CreateEmptyServerConfig()

CreateEmptyServerConfig creates an empty config

func SignalContext

func SignalContext(ctx context.Context) context.Context

SignalContext does cool magic see github.com/rodaine/grpc-chat.git

Types

type Client

type Client struct {
	Connection *grpc.ClientConn
	// contains filtered or unexported fields
}

Client object

func CreateClient

func CreateClient(c *ClientConf) *Client

CreateClient is a factory for servers

func (*Client) Connect

func (s *Client) Connect()

Connect start serving

func (*Client) Disconnect

func (s *Client) Disconnect()

Disconnect from remote server

type ClientConf

type ClientConf struct {
	ServerPort      int    `yaml:"serverport"`
	TLSServerName   string `yaml:"tlsservername"`
	UseTLS          bool   `yaml:"useTLS"`
	PerCallSecurity bool   `yaml:"percallsecurity"`
	KeyWord         string `yaml:"keyword"`
}

ClientConf is a client configuraiton struct

func GetClientConfig

func GetClientConfig() *ClientConf

GetClientConfig attempts to retrieve configuration from the environment, then a YAML file

type Server

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

Server object

func CreateServer

func CreateServer(c *ServerConf) *Server

CreateServer is a factory for servers

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, regcb registerCallback)

Serve start serving

type ServerConf

type ServerConf struct {
	ServerPort      int    `yaml:"serverport"`
	ServerCertPort  int    `yaml:"servercertport"`
	TLSServerName   string `yaml:"tlsservername"`
	UseTLS          bool   `yaml:"usetls"`
	PerCallSecurity bool   `yaml:"percallsecurity"`
	TLSCacheDir     string `yaml:"tlscachedir"`
	KeyWord         string `yaml:"keyword"`
}

ServerConf is the server configuration struct

func GetServerConfig

func GetServerConfig() *ServerConf

GetServerConfig attempts to retrieve configuration from the environment, then a YAML file

Jump to

Keyboard shortcuts

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