connection

package
v3.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RejectReported represents that flow was reported as rejected
	RejectReported bool = true

	// AcceptReported represents that flow was reported as accepted
	AcceptReported bool = false
)

Variables

View Source
var (
	// TraceLogging provides very high level of detail logs for connections
	TraceLogging int
)

Functions

func TCPConnectionExpirationNotifier

func TCPConnectionExpirationNotifier(c cache.DataStore, id interface{}, item interface{})

TCPConnectionExpirationNotifier handles processing the expiration of an element

Types

type AuthInfo

type AuthInfo struct {
	LocalContext    []byte
	RemoteContext   []byte
	RemoteContextID string
	RemotePublicKey interface{}
	RemoteIP        string
	RemotePort      string
}

AuthInfo keeps authentication information about a connection

type ProxyConnState

type ProxyConnState int

ProxyConnState identifies the constants of the state of a proxied connection

const (
	// ClientTokenSend Init token send for client
	ClientTokenSend ProxyConnState = iota

	// ServerReceivePeerToken -- waiting to receive peer token
	ServerReceivePeerToken

	// ServerSendToken -- Send our own token and the client tokens
	ServerSendToken

	// ClientPeerTokenReceive -- Receive signed tokens from server
	ClientPeerTokenReceive

	// ClientSendSignedPair -- Sign the (token/nonce pair) and send
	ClientSendSignedPair

	// ServerAuthenticatePair -- Authenticate pair of tokens
	ServerAuthenticatePair
)

type ProxyConnection

type ProxyConnection struct {
	sync.Mutex

	Auth       AuthInfo
	FlowPolicy *policy.FlowPolicy
	// contains filtered or unexported fields
}

ProxyConnection -- Connection to track state of proxy auth

func NewProxyConnection

func NewProxyConnection() *ProxyConnection

NewProxyConnection returns a new Proxy Connection

func (*ProxyConnection) GetState

func (c *ProxyConnection) GetState() ProxyConnState

GetState returns the state of a proxy connection

func (*ProxyConnection) SetReported

func (c *ProxyConnection) SetReported(reported bool)

SetReported -- Set the flag to reported when the conn is reported

func (*ProxyConnection) SetState

func (c *ProxyConnection) SetState(state ProxyConnState)

SetState is used to setup the state for the Proxy Connection

type TCPConnection

type TCPConnection struct {
	sync.Mutex

	Auth AuthInfo

	// ServiceData allows services to associate state with a connection
	ServiceData interface{}

	// Context is the pucontext.PUContext that is associated with this connection
	// Minimizes the number of caches and lookups
	//we can store opaque data here
	Context interface{}

	// TimeOut signals the timeout to be used by the state machines
	TimeOut time.Duration

	// ServiceConnection indicates that this connection is handled by a service
	ServiceConnection bool

	// FlowPolicy holds the last matched policy
	FlowPolicy *policy.FlowPolicy
	// contains filtered or unexported fields
}

TCPConnection is information regarding TCP Connection

func NewTCPConnection

func NewTCPConnection() *TCPConnection

NewTCPConnection returns a TCPConnection information struct

func (*TCPConnection) Cleanup

func (c *TCPConnection) Cleanup(expiration bool)

Cleanup will provide information when a connection is removed by a timer.

func (*TCPConnection) GetState

func (c *TCPConnection) GetState() TCPFlowState

GetState is used to return the state

func (*TCPConnection) SetPacketInfo

func (c *TCPConnection) SetPacketInfo(flowHash, tcpFlags string)

SetPacketInfo is used to setup the state for the TCP connection

func (*TCPConnection) SetReported

func (c *TCPConnection) SetReported(flowState bool)

SetReported is used to track if a flow is reported

func (*TCPConnection) SetState

func (c *TCPConnection) SetState(state TCPFlowState)

SetState is used to setup the state for the TCP connection

func (*TCPConnection) String

func (c *TCPConnection) String() string

String returns a printable version of connection

type TCPFlowState

type TCPFlowState int

TCPFlowState identifies the constants of the state of a TCP connectioncon

const (

	// TCPSynSend is the state where the Syn packets has been send, but no response has been received
	TCPSynSend TCPFlowState = iota

	// TCPSynReceived indicates that the syn packet has been received
	TCPSynReceived

	// TCPSynAckSend indicates that the SynAck packet has been send
	TCPSynAckSend

	// TCPSynAckReceived is the state where the SynAck has been received
	TCPSynAckReceived

	// TCPAckSend indicates that the ack packets has been sent
	TCPAckSend

	// TCPAckProcessed is the state that the negotiation has been completed
	TCPAckProcessed

	// TCPData indicates that the packets are now data packets
	TCPData
)

Jump to

Keyboard shortcuts

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