proxy

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VerdictForwared indicates that the request/response was forwarded
	VerdictForwared FlowVerdict = "Forwarded"

	// VerdictDenied indicates that the request/response was denied
	VerdictDenied = "Denied"

	// VerdictError indicates that there was an error processing the request/response
	VerdictError = "Error"
)

Variables

This section is empty.

Functions

func CloseLogfile added in v0.10.0

func CloseLogfile()

CloseLogfile closes the logfile

func Dump

func Dump(cb bpf.DumpCallback) error

func Dump6 added in v0.9.0

func Dump6(cb bpf.DumpCallback) error

func GC

func GC() int

func GC6 added in v0.9.0

func GC6() int

func Log added in v0.10.0

func Log(l *LogRecord, typ FlowType, verdict FlowVerdict, code int)

Log logs a record to the logfile and flushes the buffer

func OpenLogfile added in v0.10.0

func OpenLogfile(lf string) error

OpenLogfile opens a file for logging

func SetMetadata added in v0.10.0

func SetMetadata(md []string)

SetMetadata sets the metadata to include in each record

Types

type Configuration added in v0.10.0

type Configuration struct {
}

Configuration is used to pass configuration into CreateOrUpdateRedirect

type EndpointInfo added in v0.10.0

type EndpointInfo struct {
	ID       uint64
	IPv4     string
	IPv6     string
	Port     uint16
	Identity uint64
	Labels   []string
}

EndpointInfo contains information about the endpoint sending/receiving the request/response

type FlowType added in v0.10.0

type FlowType string

FlowType is the type to indicate the flow direction

const (
	// TypeRequest is a request message
	TypeRequest FlowType = "Request"

	// TypeResponse is a response to a request
	TypeResponse FlowType = "Response"
)

type FlowVerdict added in v0.10.0

type FlowVerdict string

FlowVerdict is the verdict taken on request/response

type IPPort added in v0.10.0

type IPPort struct {
	IP   string
	Port uint16
}

IPPort bundles an IP address and port number

type IPVersion added in v0.10.0

type IPVersion byte

IPVersion is the type used to indicate IP version

const (
	// VersionIPv4 indicates IPv4
	VersionIPv4 IPVersion = iota
	// VersionIPV6 indicates IPv6
	VersionIPV6
)

type LogRecord

type LogRecord struct {
	// Type is the type of the flow { request | response }
	Type FlowType

	// Timestamp is the start of a request and then end of a response
	Timestamp string

	// NodeAddressInfo contains the IPs of the node where the event was generated
	NodeAddressInfo NodeAddressInfo

	// ObservationPoint indicates where the request/response was observed
	ObservationPoint ObservationPoint

	// SourceEndpoint is information about the soure endpoint if available
	SourceEndpoint EndpointInfo

	// DestinationEndpoint is information about the soure endpoint if available
	DestinationEndpoint EndpointInfo

	// IPVersion indicates the version of the IP protocol in use
	IPVersion IPVersion

	// Verdict is the verdict on the flow taken
	Verdict FlowVerdict

	// Info includes information about the rule that matched or the error
	// that occurred. This is informational.
	Info string

	// Metadata is additional arbitrary metadata
	Metadata []string

	// HTTP contains information for HTTP request/responses
	HTTP *LogRecordHTTP `json:"HTTP,omitempty"`
	// contains filtered or unexported fields
}

LogRecord is the structure used to log individual request/response processing events

type LogRecordHTTP added in v0.10.0

type LogRecordHTTP struct {
	// Code is the HTTP code being returned
	Code int

	// Method is the method of the request
	Method string

	// URL is the URL of the request
	URL *url.URL

	// Protocol is the HTTP protocol in use
	Protocol string

	// Header is the HTTP header in use
	Header http.Header
}

LogRecordHTTP contains the HTTP specific portion of a log record

type NodeAddressInfo added in v0.10.0

type NodeAddressInfo struct {
	IPv4 string
	IPv6 string
}

NodeAddressInfo holds addressing information of the node the agent runs on

type ObservationPoint added in v0.10.0

type ObservationPoint string

ObservationPoint is the type used to describe point of observation

const (
	// Ingress indicates event was generated at ingress
	Ingress ObservationPoint = "Ingress"

	// Egress indicates event was generated at egress
	Egress ObservationPoint = "Egress"
)

type Proxy

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

func NewProxy

func NewProxy(minPort uint16, maxPort uint16) *Proxy

func (*Proxy) CreateOrUpdateRedirect

func (p *Proxy) CreateOrUpdateRedirect(l4 *policy.L4Filter, id string, source ProxySource) (*Redirect, error)

CreateOrUpdateRedirect creates or updates a L4 redirect with corresponding proxy configuration. This will allocate a proxy port as required and launch a proxy instance. If the redirect is aleady in place, only the rules will be updated.

func (*Proxy) RemoveRedirect

func (p *Proxy) RemoveRedirect(id string) error

type Proxy4Key

type Proxy4Key struct {
	SAddr   types.IPv4
	DPort   uint16
	SPort   uint16
	Nexthdr uint8
	Pad     uint8
}

func (*Proxy4Key) GetKeyPtr

func (k *Proxy4Key) GetKeyPtr() unsafe.Pointer

func (*Proxy4Key) HostPort

func (k *Proxy4Key) HostPort() string

func (Proxy4Key) NewValue

func (k Proxy4Key) NewValue() bpf.MapValue

func (*Proxy4Key) String

func (k *Proxy4Key) String() string

func (*Proxy4Key) ToNetwork added in v0.10.0

func (k *Proxy4Key) ToNetwork() *Proxy4Key

ToNetwork converts Proxy4Key ports to network byte order.

type Proxy4Value

type Proxy4Value struct {
	OrigDAddr      types.IPv4
	OrigDPort      uint16
	Lifetime       uint16
	SourceIdentity uint32
}

func LookupEgress4

func LookupEgress4(key *Proxy4Key) (*Proxy4Value, error)

func (*Proxy4Value) GetValuePtr

func (v *Proxy4Value) GetValuePtr() unsafe.Pointer

func (*Proxy4Value) HostPort

func (p *Proxy4Value) HostPort() string

func (*Proxy4Value) String

func (v *Proxy4Value) String() string

func (*Proxy4Value) ToNetwork added in v0.10.0

func (p *Proxy4Value) ToNetwork() *Proxy4Value

ToNetwork converts Proxy4Value to network byte order.

type Proxy6Key added in v0.9.0

type Proxy6Key struct {
	SAddr   types.IPv6
	DPort   uint16
	SPort   uint16
	Nexthdr uint8
	Pad     uint8
}

func (*Proxy6Key) GetKeyPtr added in v0.9.0

func (k *Proxy6Key) GetKeyPtr() unsafe.Pointer

func (*Proxy6Key) HostPort added in v0.9.0

func (k *Proxy6Key) HostPort() string

func (Proxy6Key) NewValue added in v0.9.0

func (k Proxy6Key) NewValue() bpf.MapValue

func (*Proxy6Key) String added in v0.9.0

func (k *Proxy6Key) String() string

func (*Proxy6Key) ToNetwork added in v0.10.0

func (k *Proxy6Key) ToNetwork() *Proxy6Key

ToNetwork converts Proxy6Key ports to network byte order.

type Proxy6Value added in v0.9.0

type Proxy6Value struct {
	OrigDAddr      types.IPv6
	OrigDPort      uint16
	Lifetime       uint16
	SourceIdentity uint32
}

func LookupEgress6 added in v0.9.0

func LookupEgress6(key *Proxy6Key) (*Proxy6Value, error)

func (*Proxy6Value) GetValuePtr added in v0.9.0

func (v *Proxy6Value) GetValuePtr() unsafe.Pointer

func (*Proxy6Value) HostPort added in v0.9.0

func (p *Proxy6Value) HostPort() string

func (*Proxy6Value) String added in v0.9.0

func (v *Proxy6Value) String() string

func (*Proxy6Value) ToNetwork added in v0.10.0

func (p *Proxy6Value) ToNetwork() *Proxy6Value

ToNetwork converts Proxy6Value to network byte order.

type ProxySource

type ProxySource interface {
	GetID() uint64
	RLock()
	GetLabels() []string
	GetIdentity() policy.NumericIdentity
	GetIPv4Address() string
	GetIPv6Address() string
	RUnlock()
}

type Redirect

type Redirect struct {
	FromPort uint16
	ToPort   uint16

	Rules []policy.AuxRule
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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