tcplite

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

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 6 Imported by: 0

README

tcplite

lite and fast TCP server for Linux in Go

GitHub Go Reference Go Report Card Go GitHub go.mod Go version (branch)

Documentation

Index

Constants

View Source
const (
	// EpollERR EpollErr report errors
	EpollERR = 0x8
	// EpollET set edge trigger
	EpollET = 0x80000000
	// EpollHUP reports close
	EpollHUP = 0x10
	// EpollIN reports input
	EpollIN = 0x1
	// EpollONESHOT set one shot pulling
	EpollONESHOT = 0x40000000
	// EpollRDHUP reports read side close
	EpollRDHUP = 0x2000
)

Variables

ConnEvents are connection pulling events

View Source
var ErrAgain = syscall.EAGAIN

Functions

func ResolveAddr

func ResolveAddr(addr string) syscall.Sockaddr

Types

type Conn

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

func (*Conn) Addr

func (r *Conn) Addr() syscall.Sockaddr

Addr return the conn addr

func (*Conn) Close

func (r *Conn) Close() error

func (*Conn) Fd

func (r *Conn) Fd() int

Fd returns conn fd

func (*Conn) Read

func (r *Conn) Read(b []byte) (int, error)

Read impl io.Reader for conn

func (*Conn) Write

func (r *Conn) Write(b []byte) (int, error)

Write impl io.Writer for conn

type Event

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

func (*Event) Allow

func (ev *Event) Allow() error

func (*Event) Conn

func (ev *Event) Conn() *Conn

func (*Event) Kind

func (ev *Event) Kind() EventKind

func (*Event) Server

func (ev *Event) Server() *Server

func (*Event) String

func (ev *Event) String() string

type EventKind

type EventKind = int
const (
	EventConn EventKind = iota + 1
	EventData
	EventClose
)

type Server

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

func New

func New(addr syscall.Sockaddr) (server *Server, err error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Pull

func (s *Server) Pull(maxN uint, timeout time.Duration) ([]Event, error)

Jump to

Keyboard shortcuts

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