connection

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CKey

type CKey [2]uint64

func NewConnKeyByString

func NewConnKeyByString(host, port string) (CKey, error)

func NewConnKeyFromNetConn

func NewConnKeyFromNetConn(conn net.Conn) (CKey, error)

type ConnTable

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

func New

func New() *ConnTable

func (*ConnTable) FlushOlderThan

func (t *ConnTable) FlushOlderThan(s time.Duration)

func (*ConnTable) Get

func (t *ConnTable) Get(ck CKey) *Metadata

TODO: what happens when I return a *Metadata and then FlushOlderThan() deletes it?

func (*ConnTable) Register

func (t *ConnTable) Register(srcIP, srcPort string, dstPort uint16, rule *rules.Rule) (*Metadata, error)

Register a connection in the table

func (*ConnTable) RegisterConn

func (t *ConnTable) RegisterConn(conn net.Conn, rule *rules.Rule) (*Metadata, error)

RegisterConn a connection in the table

type Metadata

type Metadata struct {
	Added      time.Time
	Rule       *rules.Rule
	TargetPort uint16
}

Jump to

Keyboard shortcuts

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