roomdisco

package
v0.0.0-...-47ad847 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package roomdisco provides discovery for room servers, allowing clients to automatically find servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(ctx context.Context, r *room.Room, servers chan<- *Server) error

Query finds server applications with rooms that look like r. Query ignores the instance name of advertised services and relies only on the service identifier.

BUG? Not sure how mdns lookup handled channels when an error is encountered.

Types

type Discoverable

type Discoverable interface {
	Close() error
	// contains filtered or unexported methods
}

Discoverable is an opaque type that contains an mDNS discovery server.

func NewDiscoverable

func NewDiscoverable(zc *ZoneConfig) (Discoverable, error)

NewDiscoverable returns a new Discoverable server that is advertizing the Room in zc.

func NewDiscoverableServer

func NewDiscoverableServer(s *room.Server) (Discoverable, error)

NewDiscoverableServer returns a Discoverable using the default ZoneConfig for s.

type List

type List interface {
	Room() *room.Room
	Servers() []*Server
	Refresh(context.Context, func(error))
}

List is a list of servers hosting a room.Room.

func NewList

func NewList(r *room.Room) List

NewList returns an empty List of servers hosting r. The list is populated by calling the Refresh method.

type Server

type Server struct {
	Room    *room.Room
	TCPAddr *net.TCPAddr
	Entry   *mdns.ServiceEntry
}

Server is a running instance of Room accesable at Addr.

type ZoneConfig

type ZoneConfig struct {
	Room *room.Room
	Port int
	IPs  []net.IP
	TXT  []string
}

ZoneConfig configures mDNS for a Room.

func NewZoneConfig

func NewZoneConfig(r *room.Room) *ZoneConfig

NewZoneConfig returns a new ZoneConfig for r.

func ServerConfig

func ServerConfig(s *room.Server) (*ZoneConfig, error)

ServerConfig returns a ZoneConfig with address information derived from s.

func (*ZoneConfig) Instance

func (zc *ZoneConfig) Instance() string

Instance returns the mdns instance identifier corresponding to zc.Room.Name.

Jump to

Keyboard shortcuts

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