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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
lanBroadcast command

Jump to

Keyboard shortcuts

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