keyvalue

package
v0.0.0-...-24e3e83 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright © 2020 GUILLAUME FOURNIER

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CookieListContains

func CookieListContains(cookies []Cookie, cookie Cookie) int

CookieListContains - Checks if a cookie is in a list of cookies. The functions returns the first id in the map if there is a match.

func NewRandomMapName

func NewRandomMapName() string

NewRandomMapName - Returns a new map name randomly generated

Types

type ActionKey

type ActionKey struct {
	Cookie Cookie
}

ActionKey - Action key structure

func (*ActionKey) GetMapSection

func (ak *ActionKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*ActionKey) GetUnsafePointer

func (ak *ActionKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*ActionKey) String

func (ak *ActionKey) String() string

type ActionValue

type ActionValue struct {
	Action kernel.SecurityProfileAction
}

ActionValue - Action value

type BinaryPathKey

type BinaryPathKey struct {
	Cookie Cookie
	Path   [kernel.PathMax]byte
}

BinaryPathKey - Binary path key

func (BinaryPathKey) GetMapSection

func (bpk BinaryPathKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*BinaryPathKey) GetUnsafePointer

func (bpk *BinaryPathKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*BinaryPathKey) String

func (bpk *BinaryPathKey) String() string

type CIDRKey

type CIDRKey struct {
	Prefix uint32
	Data   [16]uint8
}

CIDRKey - CIDR key

func (*CIDRKey) GetMapSection

func (k *CIDRKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*CIDRKey) GetUnsafePointer

func (k *CIDRKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*CIDRKey) String

func (k *CIDRKey) String() string

type CIDRRouterKey

type CIDRRouterKey struct {
	Cookie      Cookie
	IPVersion   kernel.NetworkProtocol
	TrafficType kernel.TrafficType
}

CIDRRouterKey - CIDR router key

func (*CIDRRouterKey) GetMapSection

func (k *CIDRRouterKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*CIDRRouterKey) GetUnsafePointer

func (k *CIDRRouterKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*CIDRRouterKey) String

func (k *CIDRRouterKey) String() string
type Cookie uint32

Cookie - Unique cookie used to identify a profile in the kernel

func NewCookie

func NewCookie() Cookie

NewCookie - Returns a new cookie randomly generated

type CookieValue

type CookieValue struct {
	Cookie Cookie
}

CookieValue - Cookie structure used as value in hashmaps

func (*CookieValue) GetUnsafePointer

func (cv *CookieValue) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

type DNSKey

type DNSKey struct {
	DNS         [kernel.DNSMaxLength]byte
	Cookie      Cookie
	TrafficType kernel.TrafficType
	Layer       uint8
}

DNSKey - DNS key structure

func NewDNSKey

func NewDNSKey(tt kernel.TrafficType, cookie Cookie, layer uint8, dns string) (*DNSKey, error)

NewDNSKey - Creates a new DNSKey and encodes the domain string appropriately

func (*DNSKey) GetMapSection

func (k *DNSKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*DNSKey) GetUnsafePointer

func (k *DNSKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*DNSKey) String

func (k *DNSKey) String() string

type HTTPKey

type HTTPKey struct {
	TrafficType kernel.TrafficType
	Cookie      Cookie
	Method      [kernel.HTTPMaxMethodLength]byte
	URI         [kernel.HTTPMaxURILength]byte
}

HTTPKey - Http key structure

func NewHTTPKey

func NewHTTPKey(tt kernel.TrafficType, cookie Cookie, method string, uri string) *HTTPKey

NewHTTPKey - Creates a new HTTPKey and encodes the method and URI appropriately

func (HTTPKey) GetMapSection

func (k HTTPKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*HTTPKey) GetUnsafePointer

func (k *HTTPKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*HTTPKey) String

func (k *HTTPKey) String() string

type Key

type Key interface {
	GetMapSection() string
	GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)
	String() string
}

Key - Key interface

type KeyValue

type KeyValue struct {
	Key   Key
	Value interface{}
}

KeyValue - Key value of a rule in a profile

func (*KeyValue) GetKey

func (kv *KeyValue) GetKey(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetKey - Returns the unsafe pointer to the key

func (*KeyValue) GetMapSection

func (kv *KeyValue) GetMapSection() string

GetMapSection - Returns the map section of the hashmap in which the key-value should live

func (*KeyValue) GetValue

func (kv *KeyValue) GetValue(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetValue - Returns the unsafe pointer to the value

func (*KeyValue) String

func (kv *KeyValue) String() string

type MapOfMapsKeyValue

type MapOfMapsKeyValue struct {
	MapOfMapsKey      *KeyValue
	MapSectionToClone string
	Keys              []*KeyValue
}

MapOfMapsKeyValue - Key value of a rule in a profile

func NewCIDRMapOfMapsKeyValue

func NewCIDRMapOfMapsKeyValue(cidrs []string, cookie Cookie, tt kernel.TrafficType, ipVersion kernel.NetworkProtocol, action interface{}) (*MapOfMapsKeyValue, error)

NewCIDRMapOfMapsKeyValue - Creates a new MapOfMaps key-value for the provided cidrs

func (*MapOfMapsKeyValue) String

func (momkv *MapOfMapsKeyValue) String() string

type NETnsKey

type NETnsKey struct {
	NS uint64
}

NETnsKey - Process namespace key

func (NETnsKey) GetMapSection

func (nk NETnsKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*NETnsKey) GetUnsafePointer

func (nk *NETnsKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*NETnsKey) String

func (nk *NETnsKey) String() string

type NetworkAttack

type NetworkAttack uint32

NetworkAttack - Network attack

const (
	// EmptyNetworkAttack - Used to specify that no attacks was selected. This is the default.
	EmptyNetworkAttack NetworkAttack = 0
	// ArpSpoofing - ARP spoofing network attack
	ArpSpoofing NetworkAttack = 1 << 0
)

func (NetworkAttack) String

func (na NetworkAttack) String() string

type NetworkAttacksKey

type NetworkAttacksKey struct {
	Cookie Cookie
}

NetworkAttacksKey - Network attacks key structure

func (*NetworkAttacksKey) GetMapSection

func (nak *NetworkAttacksKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*NetworkAttacksKey) GetUnsafePointer

func (nak *NetworkAttacksKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*NetworkAttacksKey) String

func (nak *NetworkAttacksKey) String() string

type NetworkAttacksValue

type NetworkAttacksValue struct {
	Value NetworkAttack
}

NetworkAttacksValue - Network attack value

type PIDKey

type PIDKey struct {
	PID uint32
}

PIDKey - Process key

func (PIDKey) GetMapSection

func (pk PIDKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*PIDKey) GetUnsafePointer

func (pk *PIDKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*PIDKey) String

func (pk *PIDKey) String() string

type PIDnsKey

type PIDnsKey struct {
	NS uint64
}

PIDnsKey - Process namespace key

func (PIDnsKey) GetMapSection

func (pk PIDnsKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*PIDnsKey) GetUnsafePointer

func (pk *PIDnsKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*PIDnsKey) String

func (pk *PIDnsKey) String() string

type ProtocolKey

type ProtocolKey struct {
	Cookie      Cookie
	Protocol    uint16
	TrafficType kernel.TrafficType
	Layer       uint8
}

ProtocolKey - Protocol key structure

func (*ProtocolKey) GetMapSection

func (pk *ProtocolKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*ProtocolKey) GetUnsafePointer

func (pk *ProtocolKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*ProtocolKey) String

func (pk *ProtocolKey) String() string

type ProtocolPortKey

type ProtocolPortKey struct {
	Cookie      Cookie
	Protocol    uint16
	Port        uint16
	TrafficType kernel.TrafficType
}

ProtocolPortKey - ProtocolPortKey key structure

func (*ProtocolPortKey) GetMapSection

func (ppk *ProtocolPortKey) GetMapSection() string

GetMapSection - Returns the kernel map section of the hasmap for this key

func (*ProtocolPortKey) GetUnsafePointer

func (ppk *ProtocolPortKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)

GetUnsafePointer - Returns an unsafe Pointer to the data

func (*ProtocolPortKey) String

func (ppk *ProtocolPortKey) String() string

type SecurityProfileActionValue

type SecurityProfileActionValue struct {
	Action kernel.SecurityProfileAction
}

SecurityProfileActionValue - Security profile action used for value in hashmaps

Jump to

Keyboard shortcuts

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