udp

package
v0.0.0-...-c640e2a Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package udp provides a simple package that implements a udp protocol transmission for the octo.TranmissionProtocol interface. Which allows a uniform response cycle with a udp based connection either for single/multicast connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client defines the structure which communicates with other udp connections.

func (*Client) Close

func (c *Client) Close() error

Close usually closes the connection patterning to the giving client, but in udp the server connection handles the response, so operation happens here.

func (*Client) Contact

func (c *Client) Contact() (octo.Contact, octo.Contact)

Contact returns the Contact objects of the giving client and server.

func (*Client) Ctx

func (c *Client) Ctx() context.Context

Ctx returns the giving context pertaining to the specific request.

func (*Client) Send

func (c *Client) Send(data []byte, flush bool) error

Send delivers the message to the giving addr associated with the client.

func (*Client) SendAll

func (c *Client) SendAll(data []byte, flush bool) error

SendAll delivers the message to the giving addr associated with the client.

type Server

type Server struct {
	Attr ServerAttr
	// contains filtered or unexported fields
}

Server defines a struct for a managing the internals of a UDP server.

func New

func New(instrument octo.Instrumentation, attr ServerAttr) *Server

New returns a new instance of the UDP server.

func (*Server) Close

func (s *Server) Close() error

Close returns the error from closing the listener.

func (*Server) Contact

func (s *Server) Contact() octo.Contact

Contact returns the octo.Contact related with this server.

func (*Server) Credential

func (s *Server) Credential() octo.AuthCredential

Credential returns the Credential related to the giving server.

func (*Server) IsRunning

func (s *Server) IsRunning() bool

IsRunning returns true/false if the giving server is running.

func (*Server) Listen

func (s *Server) Listen(system server.System) error

Listen fires up the server and internal operations of the udp server.

func (*Server) Register

func (s *Server) Register(tm server.StateHandlerType, hmi interface{})

Register registers the handler for a given handler.

func (*Server) Wait

func (s *Server) Wait()

Wait causes a wait on the server.

type ServerAttr

type ServerAttr struct {
	Addr               string
	Authenticate       bool
	Version            Version
	Credential         octo.AuthCredential
	MulticastInterface *net.Interface
}

ServerAttr defines the giving attributes that determines how a UDP server intializes and behaves.

type Version

type Version int

Version determines the ip type used for generating the udp ip.

const (
	Ver0 Version = iota
	Ver4
	Ver6
)

contains the set of ip versions for which is used to generate ip value.

Jump to

Keyboard shortcuts

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