util

package
v0.0.0-...-5e97d5f Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package util provides auxiliary utilities used in examples

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chat

func Chat(conn io.ReadWriter)

Chat simulates a simple text chat session over the connection

func Check

func Check(err error)

Check is a helper to throw errors in the examples

func LoadCertificate

func LoadCertificate(path string) (*tls.Certificate, error)

LoadCertificate Load/read certificate(s) from file

func LoadKeyAndCertificate

func LoadKeyAndCertificate(keyPath string, certificatePath string) (tls.Certificate, error)

LoadKeyAndCertificate reads certificates or key from file

Types

type Hub

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

Hub is a helper to handle one to many chat

func NewHub

func NewHub() *Hub

NewHub builds a new hub

func (*Hub) Chat

func (h *Hub) Chat()

Chat starts the stdin readloop to dispatch messages to the hub

func (*Hub) Register

func (h *Hub) Register(conn net.Conn)

Register adds a new conn to the Hub

Jump to

Keyboard shortcuts

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