proxymap

package
v1.5.2-rc1 Latest Latest
Warning

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

Go to latest
Published: May 17, 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,
		int(unsafe.Sizeof(Proxy4Key{})),
		int(unsafe.Sizeof(Proxy4Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte) (bpf.MapKey, bpf.MapValue, error) {
			k, v := Proxy4Key{}, Proxy4Value{}

			if err := bpf.ConvertKeyValue(key, value, &k, &v); err != nil {
				return nil, nil, err
			}

			return k.ToNetwork(), v.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,
		int(unsafe.Sizeof(Proxy6Key{})),
		int(unsafe.Sizeof(Proxy6Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte) (bpf.MapKey, bpf.MapValue, error) {
			k, v := Proxy6Key{}, Proxy6Value{}

			if err := bpf.ConvertKeyValue(key, value, &k, &v); err != nil {
				return nil, nil, err
			}

			return k.ToNetwork(), v.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"`
}

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"`
}

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"`
}

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"`
}

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