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 ¶
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Contact() (octo.Contact, octo.Contact)
- func (c *Client) IsRunning() bool
- func (c *Client) Listen() error
- func (c *Client) Send(data []byte, flush bool) error
- func (c *Client) SendAll(data []byte, flush bool) error
- func (c *Client) Transmission() *Transmission
- func (c *Client) Wait()
- type Server
- func (s *Server) CLContact() octo.Contact
- func (s *Server) ClientList() []*Client
- func (s *Server) Clients() []octo.Contact
- func (s *Server) Close() error
- func (s *Server) ClusterList() []*Client
- func (s *Server) Clusters() []octo.Contact
- func (s *Server) Contact() octo.Contact
- func (s *Server) Credential() octo.AuthCredential
- func (s *Server) DeliverToClients(data []byte) error
- func (s *Server) HandleClusters(infos []octo.Contact)
- func (s *Server) IsRunning() bool
- func (s *Server) Listen(system server.System) error
- func (s *Server) Register(tm server.StateHandlerType, hmi interface{})
- func (s *Server) RelateWithCluster(addr string) error
- func (s *Server) Wait()
- type ServerAttr
- type Transmission
Constants ¶
This section is empty.
Variables ¶
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.
var ErrInvalidContactResponse = errors.New("Invalid Response")
ErrInvalidContactResponse defines the error returned when a response recieved does not match info response standards.
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 ¶
Close ends the client connections and stops reception/server. of any messages.
func (*Client) SendAll ¶
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.
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 ¶
CLContact returns the octo.Contact related with this server cluster listener.
func (*Server) ClientList ¶
ClientList returns the slice of clients.
func (*Server) ClusterList ¶
ClusterList returns the slice of clusters clients.
func (*Server) Credential ¶
func (s *Server) Credential() octo.AuthCredential
Credential returns the Credential related to the giving server.
func (*Server) DeliverToClients ¶
DeliverToClients transmit the provided data to all clients.
func (*Server) HandleClusters ¶
HandleClusters handles the connection to provided clusters lists.
func (*Server) Listen ¶
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 ¶
RelateWithCluster asks the server to connect and initialize a relationship with the giving cluster at the giving address.
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.