package util

import "github.com/pion/dtls/v3/examples/util"

Package util provides auxiliary utilities used in examples

Index

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

Source Files

hub.go util.go

Version
v3.0.4 (latest)
Published
Nov 4, 2024
Platform
linux/amd64
Imports
11 packages
Last checked
1 week ago

Tools for package owners.