bareneter

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(net string, addr string,
	handler func(conn Conn),
	accept func(conn Conn) bool,
	closed func(conn Conn, err error),
) error

ListenAndServe creates a new server and binds to addr configured on "tcp" network net.

func ListenAndServeNetwork

func ListenAndServeNetwork(
	net, laddr string,
	handler func(conn Conn),
	accept func(conn Conn) bool,
	closed func(conn Conn, err error),
) error

ListenAndServeNetwork creates a new server and binds to addr. The network net must be a stream-oriented network: "tcp", "tcp4", "tcp6", "unix" or "unixpacket"

Types

type Conn

type Conn interface {
	// RemoteAddr returns the remote address of the client connection.
	RemoteAddr() string

	// Close closes the connection.
	Close() error
	IsClosed() bool
	Context() interface{}

	// SetContext sets a user-defined context
	SetContext(v interface{})
	NetConn() net.Conn
}

Conn represents a client connection

type Server

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

Server defines a server for clients for managing client connections.

func NewServerNetwork

func NewServerNetwork(
	net, laddr string,
	handler func(conn Conn),
	accept func(conn Conn) bool,
	closed func(conn Conn, err error)) *Server

NewServerNetwork Create a new web server

func (*Server) ChmodUnixFile

func (s *Server) ChmodUnixFile(fileMode os.FileMode) (err error)

ChmodUnixFile do chmod UNIX bind file

func (*Server) Close

func (s *Server) Close() error

Close stops listening on the TCP address. Already Accepted connections will be closed.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe serves incoming connections.

func (*Server) ListenServeAndSignal

func (s *Server) ListenServeAndSignal(signal chan error) error

ListenServeAndSignal begin listen server and listen signal

func (*Server) RmUnixFile

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

RmUnixFile do remove UNIX bind file

Jump to

Keyboard shortcuts

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