tcp

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: 18 Imported by: 0

Documentation

Overview

Package tcp provides a simple package that implements a udp protocol server. for the octo.TranmissionProtocol interface. Which allows a uniform response cycle with a tcp based connection. More so the tcp servers support clustering and allow delivery messages down the pipeline to all clients in all clusters.

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthInvalidResponse = errors.New("Invalid Response")

ErrAuthInvalidResponse defines the error returned when a response recieved does not match authentication standards and either provides invalid authentication data from the connection.

View Source
var ErrInvalidContactResponse = errors.New("Invalid Response")

ErrInvalidContactResponse defines the error returned when a response recieved does not match info response standards.

View Source
var ErrInvalidResponse = errors.New("Invalid Response")

ErrInvalidResponse defines the error returned when a response recieved does not match standards.

Functions

This section is empty.

Types

type Client

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

Client defines the tcp struct which implements the server.Stream interface for communication between a server.

func (*Client) Close

func (c *Client) Close() error

Close ends the client connections and stops reception/server. of any messages.

func (*Client) Contact

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

Contact returns the client and server information.

func (*Client) IsRunning

func (c *Client) IsRunning() bool

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

func (*Client) Listen

func (c *Client) Listen() error

Listen calls the client to begin listening for connection requests.

func (*Client) Send

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

Send delivers a message into the clients connection stream.

func (*Client) SendAll

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

SendAll sends the giving data to all clients and clusters the giving set of data.

func (*Client) Transmission

func (c *Client) Transmission() *Transmission

Transmission returns a new server. based on the giving client.

func (*Client) Wait

func (c *Client) Wait()

Wait calls the internal waiting mechanism for the client connection.

type Server

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

Server defines a core structure which manages the intenals of the way tcp works.

func New

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

New returns a new Server which handles connections from clients and clusters if allowed.

func (*Server) CLContact

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

CLContact returns the octo.Contact related with this server cluster listener.

func (*Server) ClientList

func (s *Server) ClientList() []*Client

ClientList returns the slice of clients.

func (*Server) Clients

func (s *Server) Clients() []octo.Contact

Clients returns the giving list of clients and clusters.

func (*Server) Close

func (s *Server) Close() error

Close returns the error from closing the listener.

func (*Server) ClusterList

func (s *Server) ClusterList() []*Client

ClusterList returns the slice of clusters clients.

func (*Server) Clusters

func (s *Server) Clusters() []octo.Contact

Clusters returns all Contact related to each registered cluster.

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) DeliverToClients

func (s *Server) DeliverToClients(data []byte) error

DeliverToClients transmit the provided data to all clients.

func (*Server) HandleClusters

func (s *Server) HandleClusters(infos []octo.Contact)

HandleClusters handles the connection to provided clusters lists.

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 sets up the listener and begins listening for connection requests from the listener.

func (*Server) Register

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

Register registers the handler for a given handler.

func (*Server) RelateWithCluster

func (s *Server) RelateWithCluster(addr string) error

RelateWithCluster asks the server to connect and initialize a relationship with the giving cluster at the giving address.

func (*Server) Wait

func (s *Server) Wait()

Wait causes a wait on the server.

type ServerAttr

type ServerAttr struct {
	Addr         string
	ClusterAddr  string
	Authenticate bool
	Clusters     []string
	TLS          *tls.Config
	Credential   octo.AuthCredential // Credential for the server.
}

ServerAttr defines a struct which holds the attributes and config values for a tcp.Server.

type Transmission

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

Transmission defines a structure which implements the the server.Stream interface.

func (*Transmission) Close

func (t *Transmission) Close() error

Close ends the internal conneciton.

func (*Transmission) Contact

func (t *Transmission) Contact() (octo.Contact, octo.Contact)

Contact returns the giving information for the internal client and server.

func (*Transmission) Ctx

func (t *Transmission) Ctx() context.Context

Ctx returns the context that is related to this object.

func (*Transmission) Send

func (t *Transmission) Send(data []byte, flush bool) error

Send pipes the giving data down the provided pipeline.

func (*Transmission) SendAll

func (t *Transmission) SendAll(data []byte, flush bool) error

SendAll pipes the giving data down the provided pipeline.

Jump to

Keyboard shortcuts

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