Documentation ¶
Index ¶
- type Client
- type Server
- func (s *Server) Accept() (net.Conn, *Client, error)
- func (s *Server) Addr() string
- func (s *Server) Broadcast(msg *quickproto.Message) error
- func (s *Server) Listen(typ ...string) (net.Listener, error)
- func (s *Server) Read(client *Client) (*quickproto.Message, error)
- func (s *Server) RemoveClient(conn net.Conn) error
- func (s *Server) Terminate() error
- func (s *Server) Write(client *Client, msg *quickproto.Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.3.1
type Client struct { Conn net.Conn Key *[32]byte // Cookies Cookies map[string][]string // Data is used for storing extra data about the client server side. Data any // contains filtered or unexported fields }
Server-side client.
func (*Client) DeleteCookie ¶ added in v1.5.1
func (*Client) SetCookies ¶ added in v1.5.1
type Server ¶
type Server struct { // Address of the server. IP string PORT any // Listener for connections. Listener net.Listener // General configuration. CONFIG *quickproto.Config Clients map[string]*Client }
Server struct.
func New ¶ added in v1.1.6
func New(ip string, port any, conf *quickproto.Config) *Server
Initialize a new server.
func (*Server) Accept ¶
Accept a new client connection. If the server is using crypto, the first message received from the client will be the AES key. If the server is provided with a private key, it will use it to decrypt the AES key. The server will then use the AES key to decrypt and encrypt all future messages.
func (*Server) Broadcast ¶ added in v1.3.1
func (s *Server) Broadcast(msg *quickproto.Message) error
Broadcast a message to all clients.
func (*Server) Read ¶
func (s *Server) Read(client *Client) (*quickproto.Message, error)
Read a message from a client.
func (*Server) RemoveClient ¶ added in v1.3.1
Close a client connection.
Click to show internal directories.
Click to hide internal directories.