util

package
v2.0.0-...-726cbbc Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 11 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