tcp

package
v0.0.0-...-014b5c3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	/* Buffer size to handle data from socket */
	BUFFER_SIZE = 16 * 1024

	/* Interval of pushing aggregated read/write stats */
	PROXY_STATS_PUSH_INTERVAL = 1 * time.Second
)

Variables

This section is empty.

Functions

func Copy

func Copy(to io.Writer, from io.Reader, ch chan<- core.ReadWriteCount) error

*

  • It's build by analogy of io.Copy

Types

type Server

type Server struct {

	/* Get certificate filled by external service */
	GetCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)
	// contains filtered or unexported fields
}

*

  • Server listens for client connections and
  • proxies it to backends

func New

func New(name string, cfg config.Server) (*Server, error)

*

  • Creates new server instance

func (*Server) Cfg

func (this *Server) Cfg() config.Server

*

  • Returns current server configuration

func (*Server) HandleClientConnect

func (this *Server) HandleClientConnect(ctx *core.TcpContext)

*

  • Handle new client connection

func (*Server) HandleClientDisconnect

func (this *Server) HandleClientDisconnect(client net.Conn)

*

  • Handle client disconnection

func (*Server) Listen

func (this *Server) Listen() (err error)

*

  • Listen on specified port for a connections

func (*Server) Start

func (this *Server) Start() error

*

  • Start server

func (*Server) Stop

func (this *Server) Stop()

*

  • Stop, dropping all connections

Jump to

Keyboard shortcuts

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