Skip to content

solcates/broadcast

Repository files navigation

Broadcast

CircleCI codecov GoDoc Go Report Card

broadcast is a go module for discovering devices/services on a LAN using UDP4 broadcasting(not multicasting).

Requirements

  • Go 1.11+ for go module support

Usage

library

To use broadcast in your Go application:

package main

import (
	"github.com/solcates/broadcast"
	"log"
)

func main() {

	// Create a broadcaster instance
	bc := broadcast.NewBroadcaster(8080, "Is there anybody out there?")

	// to include this node as well, set findself to true
	bc.SetFindself(true)

	// discover the nodes on this LAN
	nodes, err := bc.Discover()
	if err != nil {
		log.Fatal(err)
	}
	// iterate over the nodes found.
	for _, node := range nodes {
		log.Printf("Found Node @ %v", node)
	}
}

binary

To install broadcast the cli...

go get -u github.com/solcates/broadcast/broadcast

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages