connection

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONNECTION_STATE_NEW = iota + 1
	CONNECTION_STATUS_READING
	CONNECTION_STATUS_READING_ERROR
	CONNECTION_STATUS_PARSING
	CONNECTION_STATUS_PARSING_ERROR
	CONNECTION_STATUS_PROCESSING
	CONNECTION_STATUS_PROCESSING_ERROR
	CONNECTION_STATUS_WRITING
	CONNECTION_STATUS_WRITING_ERROR
	CONNECTION_STATUS_FINISHED
	CONNECTION_STATUS_CRON
)

Variables

This section is empty.

Functions

func GetUUID

func GetUUID(c net.Conn) string

Types

type ConfigInput

type ConfigInput struct {
	InitialConn net.Conn
	CurConn     net.Conn
	UUID        string

	Logger *logrus.Entry

	MaxqueryBytes int64

	Config         *ttutils.ConfigRoot
	Cache          func() ttcache.ICacheCache
	PrometheusFire func(*ttprom.PrometheusMetric) error
}

type Connection

type Connection struct {
	// at init
	InitialConn net.Conn
	CurConn     net.Conn
	Reader      *bufio.Reader
	Writer      *bufio.Writer

	Start time.Time

	Config         *ttutils.ConfigRoot
	PrometheusFire func(*ttprom.PrometheusMetric) error
	Cache          func() ttcache.ICacheCache
	Logger         *logrus.Entry

	UUID string

	Domain string
	Port   string
	SNI    string

	LocalAddress  string
	RemoteAddress string

	// misc
	Error      error
	MutexFetch sync.RWMutex

	// at end
	State      int
	ReturnCode string
	End        time.Time
}

func NewConnection

func NewConnection(connConfig *ConfigInput) *Connection

func (*Connection) CacheAdd

func (c *Connection) CacheAdd(key string, value *ttcache.Item, d time.Duration) error

func (*Connection) CacheDelete

func (c *Connection) CacheDelete(key string)

func (*Connection) CacheGet

func (c *Connection) CacheGet(key string) (*ttcache.Item, bool)

func (*Connection) CacheReplace

func (c *Connection) CacheReplace(key string, value *ttcache.Item, d time.Duration) error

func (*Connection) CacheReplaceIfExists

func (c *Connection) CacheReplaceIfExists(key string, value *ttcache.Item, d time.Duration) error

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Flush

func (c *Connection) Flush() error

func (*Connection) Write

func (c *Connection) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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