Documentation ¶
Overview ¶
Package socket is a wrapper around net package to make it convinient to use for UNIX domain sockets.
Index ¶
- type Socket
- func (s *Socket) Accept() (net.Conn, error)
- func (s *Socket) Close() error
- func (s *Socket) CloseConnection() error
- func (s *Socket) Connect() error
- func (s *Socket) Create() error
- func (s *Socket) Exists() bool
- func (s *Socket) Listen(cb func())
- func (s *Socket) Reader() (io.Reader, error)
- func (s *Socket) Receive() ([]byte, error)
- func (s *Socket) ReceiveJSON(v any) error
- func (s *Socket) Send(msg string) (int, error)
- func (s *Socket) SendJSON(v any) (int, error)
- func (s *Socket) Writer() (io.Writer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Socket ¶
Socket stores the socket information.
func (*Socket) CloseConnection ¶
CloseConnection only closes the connection but not the socket.
func (*Socket) Listen ¶
func (s *Socket) Listen(cb func())
Listen waits for a connection, when a connection is made, it will run the callback function with the connection as argument.
func (*Socket) ReceiveJSON ¶
ReceiveJSON receives and parses JSON from the socket. Returns an unmarshaled JSON object using the provided interface.
Click to show internal directories.
Click to hide internal directories.