proxymap

package
v1.5.1-rc1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxEntries = 524288
)

Variables

View Source
var (
	// Proxy4Map represents the BPF map for IPv4 proxy
	Proxy4Map = bpf.NewMap(Proxy4MapName,
		bpf.MapTypeHash,
		&Proxy4Key{},
		int(unsafe.Sizeof(Proxy4Key{})),
		&Proxy4Value{},
		int(unsafe.Sizeof(Proxy4Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			proxyKey, proxyValue := mapKey.(*Proxy4Key), mapValue.(*Proxy4Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, proxyKey, proxyValue); err != nil {
				return nil, nil, err
			}

			return proxyKey.ToNetwork(), proxyValue.ToNetwork(), nil

		}).WithNonPersistent()
)
View Source
var (
	Proxy4MapName = "cilium_proxy4"
)
View Source
var (
	// Proxy6Map represents the BPF map for IPv6 proxy
	Proxy6Map = bpf.NewMap(Proxy6MapName,
		bpf.MapTypeHash,
		&Proxy6Key{},
		int(unsafe.Sizeof(Proxy6Key{})),
		&Proxy6Value{},
		int(unsafe.Sizeof(Proxy6Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			proxyKey, proxyValue := mapKey.(*Proxy6Key), mapValue.(*Proxy6Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, proxyKey, proxyValue); err != nil {
				return nil, nil, err
			}

			return proxyKey.ToNetwork(), proxyValue.ToNetwork(), nil

		}).WithNonPersistent()
)
View Source
var Proxy6MapName = "cilium_proxy6"

Functions

func CleanupOnRedirectClose

func CleanupOnRedirectClose(p uint16)

CleanupOnRedirectClose cleans up the proxymap after a redirect has been closed. It will remove all proxymap entries to the proxy port.

func Delete

func Delete(key ProxyMapKey) error

Delete removes a proxymap map entry

func Flush

func Flush() int

Flush flushes all proxymap entries, returns the number of entries removed.

func GC

func GC() int

GC garbage collects entries whose lifetime has expired. Returns the number of entries removed.

Types

type Proxy4Key

type Proxy4Key struct {
	SAddr   types.IPv4 `align:"saddr"`
	DPort   uint16     `align:"dport"`
	SPort   uint16     `align:"sport"`
	Nexthdr uint8      `align:"nexthdr"`
	Pad     uint8      `align:"pad"`
}

Proxy4Key +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func (*Proxy4Key) DeepCopy added in v1.5.1

func (in *Proxy4Key) DeepCopy() *Proxy4Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Proxy4Key.

func (*Proxy4Key) DeepCopyInto added in v1.5.1

func (in *Proxy4Key) DeepCopyInto(out *Proxy4Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Proxy4Key) DeepCopyMapKey added in v1.5.1

func (in *Proxy4Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Proxy4Key) GetKeyPtr

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

func (*Proxy4Key) HostPort

func (k *Proxy4Key) HostPort() string

HostPort returns host port for provided proxy key

func (Proxy4Key) NewValue

func (k Proxy4Key) NewValue() bpf.MapValue

func (*Proxy4Key) String

func (k *Proxy4Key) String() string

func (*Proxy4Key) ToNetwork

func (k *Proxy4Key) ToNetwork() *Proxy4Key

ToNetwork converts Proxy4Key ports to network byte order.

type Proxy4Value

type Proxy4Value struct {
	OrigDAddr      types.IPv4 `align:"orig_daddr"`
	OrigDPort      uint16     `align:"orig_dport"`
	Pad            uint16     `align:"pad"`
	SourceIdentity uint32     `align:"identity"`
	Lifetime       uint32     `align:"lifetime"`
}

Proxy4Value +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func (*Proxy4Value) DeepCopy added in v1.5.1

func (in *Proxy4Value) DeepCopy() *Proxy4Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Proxy4Value.

func (*Proxy4Value) DeepCopyInto added in v1.5.1

func (in *Proxy4Value) DeepCopyInto(out *Proxy4Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Proxy4Value) DeepCopyMapValue added in v1.5.1

func (in *Proxy4Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Proxy4Value) GetSourceIdentity

func (v *Proxy4Value) GetSourceIdentity() uint32

GetSourceIdentity returns the source identity

func (*Proxy4Value) GetValuePtr

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

func (*Proxy4Value) HostPort

func (v *Proxy4Value) HostPort() string

func (*Proxy4Value) String

func (v *Proxy4Value) String() string

func (*Proxy4Value) ToNetwork

func (v *Proxy4Value) ToNetwork() *Proxy4Value

ToNetwork converts Proxy4Value to network byte order.

type Proxy6Key

type Proxy6Key struct {
	SAddr   types.IPv6 `align:"saddr"`
	DPort   uint16     `align:"dport"`
	SPort   uint16     `align:"sport"`
	Nexthdr uint8      `align:"nexthdr"`
	Pad     uint8      `align:"pad"`
}

Proxy6Key +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func (*Proxy6Key) DeepCopy added in v1.5.1

func (in *Proxy6Key) DeepCopy() *Proxy6Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Proxy6Key.

func (*Proxy6Key) DeepCopyInto added in v1.5.1

func (in *Proxy6Key) DeepCopyInto(out *Proxy6Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Proxy6Key) DeepCopyMapKey added in v1.5.1

func (in *Proxy6Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Proxy6Key) GetKeyPtr

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

func (*Proxy6Key) HostPort

func (k *Proxy6Key) HostPort() string

HostPort returns host port for provided proxy key

func (Proxy6Key) NewValue

func (k Proxy6Key) NewValue() bpf.MapValue

func (*Proxy6Key) String

func (k *Proxy6Key) String() string

func (*Proxy6Key) ToNetwork

func (k *Proxy6Key) ToNetwork() *Proxy6Key

ToNetwork converts Proxy6Key ports to network byte order.

type Proxy6Value

type Proxy6Value struct {
	OrigDAddr      types.IPv6 `align:"orig_daddr"`
	OrigDPort      uint16     `align:"orig_dport"`
	Pad            uint16     `align:"pad"`
	SourceIdentity uint32     `align:"identity"`
	Lifetime       uint32     `align:"lifetime"`
}

Proxy6Value +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func (*Proxy6Value) DeepCopy added in v1.5.1

func (in *Proxy6Value) DeepCopy() *Proxy6Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Proxy6Value.

func (*Proxy6Value) DeepCopyInto added in v1.5.1

func (in *Proxy6Value) DeepCopyInto(out *Proxy6Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Proxy6Value) DeepCopyMapValue added in v1.5.1

func (in *Proxy6Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Proxy6Value) GetSourceIdentity

func (v *Proxy6Value) GetSourceIdentity() uint32

GetSourceIdentity returns the source identity

func (*Proxy6Value) GetValuePtr

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

func (*Proxy6Value) HostPort

func (v *Proxy6Value) HostPort() string

func (*Proxy6Value) String

func (v *Proxy6Value) String() string

func (*Proxy6Value) ToNetwork

func (v *Proxy6Value) ToNetwork() *Proxy6Value

ToNetwork converts Proxy6Value to network byte order.

type ProxyMapKey

type ProxyMapKey interface{}

ProxyMapKey is the generic type for Proxy6Key or Proxy4Key

type ProxyMapValue

type ProxyMapValue interface {
	GetSourceIdentity() uint32
	HostPort() string
	String() string
}

func Lookup

func Lookup(key ProxyMapKey) (ProxyMapValue, error)

Lookup looks up an entry in the proxymap

Jump to

Keyboard shortcuts

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