lanbroadcast

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ErrInvalidPort invalid port provided
	ErrInvalidPort = errors.Error("lanBroadcast: Invalid port provided")
	//ErrHost unable to get the host address
	ErrHost = errors.Error("lanBroadcast: unable to get the host address or interface")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LANBroadcast

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

LANBroadcast a lan broadcaster

func New

func New(ip net.IP, port int, motd string) (l *LANBroadcast, err error)

New creates a new lan broadcaster

func (*LANBroadcast) Broadcast

func (l *LANBroadcast) Broadcast(ctx context.Context)

Broadcast broadcasts the game to LAN. This function blocks until the given ctx is canceled or Close is called.

func (*LANBroadcast) Close

func (l *LANBroadcast) Close()

Close close the LAN broadcaster. This function does not block and may be called more than once.

func (*LANBroadcast) SetInterval

func (l *LANBroadcast) SetInterval(t uint)

SetInterval set the interval between broadcasts in seconds. This has no effect if called after calling `Broadcast()`.

func (*LANBroadcast) SetMOTD

func (l *LANBroadcast) SetMOTD(message string)

SetMOTD set the message of the day

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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