mppq

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: AFL-3.0 Imports: 9 Imported by: 0

README

// marcoPoloPQ project
// Copyright 2014 Philippe Quesnel
// Licensed under the Academic Free License version 3.0

repos to hold work in progress,
yet another, very basic 'marco polo' / service discovery
and some JSONRPC tests

Goal is to use multicast UDP,
even though currently (March 2014), my Windows platform (Win8.1) has probs with this !?
Probably will need to support broadcast UDP for this

Also considered 'borrowing' techniques from SLP .. ?

Using addresses:

RFC 2365 - Administratively Scoped IP Multicast

The IPv4 Local Scope -- 239.255.0.0/16
(??The IPv4 Organization Local Scope -- 239.192.0.0/14)

Picked port 1440 (not listed in wikipedia well know ports)
(-> eicon-SLP ?)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOutboundIP

func GetOutboundIP() net.IP

Get preferred outbound ip of this machine

func IsValidMppqResponse

func IsValidMppqResponse(r MppqResponse) bool

Validate MppqResponse, based on header / mppqResponseHeader

Types

type MppqQuery

type MppqQuery struct {
	Query string
}

MppqQuery defines the mppq query (cf NewStdMppqQuery)

func NewStdMppqQuery

func NewStdMppqQuery() MppqQuery

Create a MppqQuery, with the query's correct values

type MppqResponse

type MppqResponse struct {
	Header      string // holds the expected mppqResponseHeader
	ServiceDefs []ServiceDef
}

MppqResponse defines the mppq response

func NewMppqResponse

func NewMppqResponse(serviceDefs []ServiceDef) MppqResponse

Create a MppqResponse, with header set to correct value

func QueryServiceDefs

func QueryServiceDefs(nbTries int) (*MppqResponse, error)

QueryServiceDefs sends a MppqQuery to get service definitions from all mppq servers nbTries: number of tries (1 second timeout each)

type MppqServer

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

MppqServer implements a mppq server

func NewMppqServer

func NewMppqServer(serviceDefs []ServiceDef) *MppqServer

Create a new MppqServer

func (*MppqServer) Serve

func (s *MppqServer) Serve(ctx context.Context)

Listen on udp and process / respond to received MppqQuery

type ServiceDef

type ServiceDef struct {
	ServiceName  string // the name of the service provided
	ProviderName string // the name of the provider
	HostIP       string // IP address on which the service is available
	HostPort     int    // port on which the service is available
	Protocol     string // app arbitrary protocol name, ie "jsonrpcv1"
}

ServiceDef describes a service the provider offers.

func NewLocalServiceDef

func NewLocalServiceDef(serviceName string, hostPort int, protocol string) ServiceDef

Create a service definition using local hostname and local IP

func NewServiceDef

func NewServiceDef(serviceName, providerName string, hostIP string, hostPort int, protocol string) ServiceDef

Create a service definition

Directories

Path Synopsis
examples
marcopolo.old
v0.1/go
main.go
main.go
v0.2/go/src/google.code/p/marcoPoloGo/clientQryTest
clientQryTest, queries marcopolo for an app address
clientQryTest, queries marcopolo for an app address
marcoPoloClientTest
v0.2/go/src/google.code/p/marcoPoloGo/marcopolo
marcopolo contains ClientConn & ServerConn that lets apps register to marcoPolo server (UDP), other apps then send requests for registered apps addresses by name
marcopolo contains ClientConn & ServerConn that lets apps register to marcoPolo server (UDP), other apps then send requests for registered apps addresses by name
v0.2/go/src/google.code/p/marcoPoloGo/marcopolo/notbuild
marcopolo lets apps register for msgs they are interested in, other apps then requests for the registered app's address for a msg
marcopolo lets apps register for msgs they are interested in, other apps then requests for the registered app's address for a msg
marcoPoloSrv.go
v0.3/examples
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
Package provider
v0.3/examples/libprovider/provider/gen
Package go_provider is an autogenerated binder stub for package provider.
Package go_provider is an autogenerated binder stub for package provider.
v0.3/examples/provider
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
v0.3/examples/query
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
v0.3/examples/queryAsynch
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
MarcoPoloPQ project Copyright 2014 Philippe Quesnel Licensed under the Academic Free License version 3.0
misctests
udp.go
main.go
main.go

Jump to

Keyboard shortcuts

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