castcenter

package module
v0.0.0-...-ab5233d Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 10 Imported by: 0

README

CastCenter

CastCenter is a proxy group for multicast across subnet.

Dependencies

  • redis

Usage

Run go get -u github.com/abc950309/castcenter/cmd/castcenter to get castcenter.

Run castcenter -h to get help.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLocalIPNotFound local ip not found
	ErrLocalIPNotFound = fmt.Errorf("castcenter: local ip not found")
)

Functions

func GetBytes

func GetBytes() []byte

GetBytes .

func PutBytes

func PutBytes(buf []byte)

PutBytes .

Types

type CastCenter

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

CastCenter .

func New

func New(options ...Option) *CastCenter

New .

func (*CastCenter) GetClusterStatus

func (c *CastCenter) GetClusterStatus() *ClusterStatus

GetClusterStatus .

func (*CastCenter) Run

func (c *CastCenter) Run()

Run .

func (*CastCenter) SetClusterStatus

func (c *CastCenter) SetClusterStatus(cs *ClusterStatus)

SetClusterStatus .

type ClusterStatus

type ClusterStatus struct {
	SubNetLeader bool
	Conns        map[string]*net.UDPConn
}

ClusterStatus .

type Handler

type Handler func(*UDPEvent)

Handler .

type NetworkInfo

type NetworkInfo struct {
	HardwareName string
	IP           string
	SubNet       *net.IPNet
}

NetworkInfo .

type Option

type Option func(*CastCenter) *CastCenter

Option .

func SetCacheCleanupInterval

func SetCacheCleanupInterval(interval time.Duration) Option

SetCacheCleanupInterval .

func SetCacheTimeout

func SetCacheTimeout(timeout time.Duration) Option

SetCacheTimeout .

func SetChanSize

func SetChanSize(size int) Option

SetChanSize .

func SetClusterHeartbeat

func SetClusterHeartbeat(interval time.Duration) Option

SetClusterHeartbeat .

func SetClusterName

func SetClusterName(name string) Option

SetClusterName .

func SetClusterTimeout

func SetClusterTimeout(timeout time.Duration) Option

SetClusterTimeout .

func SetMulticastAddr

func SetMulticastAddr(addr string) Option

SetMulticastAddr .

func SetRedis

func SetRedis(redis Redis) Option

SetRedis .

func SetServicePort

func SetServicePort(port int) Option

SetServicePort .

type Redis

type Redis interface {
	Get(key string) (string, error)
	SetNX(key string, value interface{}, expiration time.Duration) (bool, error)
	Expire(key string, expiration time.Duration) (bool, error)
	ZAdd(key, member string, score float64) (int64, error)
	ZRangeByScore(key string, min, max float64) ([]string, error)
}

Redis .

type UDPEvent

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

UDPEvent .

type UDPServer

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

UDPServer .

func NewUDPServer

func NewUDPServer(handler Handler, chanSize int) *UDPServer

NewUDPServer returns a new UDPServer

func (*UDPServer) ListenUDP

func (s *UDPServer) ListenUDP(conn *net.UDPConn) error

ListenUDP Configure the UDPServer for listen on an UDP addr

Directories

Path Synopsis
cmd
tools

Jump to

Keyboard shortcuts

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