srvreader

package module
v0.0.0-...-ae0ce1e Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 10 Imported by: 1

README

srvreader

Servers io.Reader implementations

IMPLEMENTATIONS

  • TCPServerReader
  • HTTPServerReader
  • UDPServerReader

Author

Moises P. Sena

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsProto

func IsProto(address, proto string) bool

Types

type HTTPServerReader

type HTTPServerReader struct {
	KeepAlivePeriod time.Duration
	// contains filtered or unexported fields
}

func NewHTTPServerReader

func NewHTTPServerReader(addr string, w io.Writer) *HTTPServerReader

func (*HTTPServerReader) Close

func (this *HTTPServerReader) Close() error

func (*HTTPServerReader) ListenAndServe

func (this *HTTPServerReader) ListenAndServe() (err error)

func (*HTTPServerReader) ServeHTTP

func (this *HTTPServerReader) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TCPKeepAliveListener

type TCPKeepAliveListener struct {
	*net.TCPListener
	Period time.Duration
}

TCPKeepAliveListener sets TCP keep-alive timeouts on accepted connections. It's used by ListenAndServe and ListenAndServeTLS so dead TCP connections (e.g. closing laptop mid-download) eventually go away.

func NewTCPKeepAliveListener

func NewTCPKeepAliveListener(TCPListener *net.TCPListener, Period ...time.Duration) *TCPKeepAliveListener

func (TCPKeepAliveListener) Accept

func (this TCPKeepAliveListener) Accept() (net.Conn, error)

type TCPServerReader

type TCPServerReader struct {
	KeepAlivePeriod time.Duration
	// contains filtered or unexported fields
}

func NewTCPServerReader

func NewTCPServerReader(addr string, w io.Writer) *TCPServerReader

func (*TCPServerReader) Close

func (this *TCPServerReader) Close() error

func (*TCPServerReader) ListenAndServe

func (this *TCPServerReader) ListenAndServe() (err error)

type UDPServerReader

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

func NewUDPServer

func NewUDPServer(addr string, maxBufferSize int16, w io.Writer) *UDPServerReader

func (*UDPServerReader) Close

func (this *UDPServerReader) Close() error

func (*UDPServerReader) ListenAndServe

func (this *UDPServerReader) ListenAndServe() (err error)

Jump to

Keyboard shortcuts

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