socket

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

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
}

func NewClient

func NewClient(host string, port uint16, handler connection.Handler, protocol connection.Protocol) *Client

func NewTcpClient

func NewTcpClient(host string, port uint16, handler connection.Handler) *Client

func NewTlsClient

func NewTlsClient(host string, port uint16, handle connection.Handler, caCert []byte, verifyServer bool) *Client

func NewUdpClient

func NewUdpClient(host string, port uint16, handler connection.Handler) *Client

func NewUnixClient

func NewUnixClient(path string, port uint16, handler connection.Handler) *Client

func (*Client) Connect

func (c *Client) Connect() (err error)

func (*Client) Disconnect

func (c *Client) Disconnect() (err error)

func (*Client) Send

func (c *Client) Send(msg []byte) error

func (*Client) TlsConfig

func (c *Client) TlsConfig(caCertificates []byte, verifyCert bool) error

type Server

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

func NewServer

func NewServer(host string, port uint16, handler connection.Handler, protocol connection.Protocol) *Server

func NewTcpServer

func NewTcpServer(host string, port uint16, handler connection.Handler) *Server

func NewTlsServer

func NewTlsServer(host string, port uint16, handle connection.Handler, certificate []byte, privateKey []byte) *Server

func NewUdpServer

func NewUdpServer(host string, port uint16, handler connection.Handler) *Server

func NewUnixServer

func NewUnixServer(host string, port uint16, handler connection.Handler) *Server

func (*Server) Broadcast

func (s *Server) Broadcast(msg []byte) (err error)

func (*Server) ClientIp

func (s *Server) ClientIp(id int) (ip string, err error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() (err error)

func (*Server) Send

func (s *Server) Send(id int, msg []byte) (err error)

func (*Server) Stop

func (s *Server) Stop()

func (*Server) TlsConfig

func (s *Server) TlsConfig(certificate []byte, privateKey []byte) (err error)

Jump to

Keyboard shortcuts

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