Documentation
¶
Overview ¶
Package maps provides the logic for data and map management.
This package is responsible for managing the BPF maps, and the data that is stored in them. It is also responsible for the creation of the maps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDNSName ¶
FormatDNSName takes a domain name in string format and returns a byte array containing the domain name in DNS format. The returned byte array is intended for use as a key in an eBPF map.
Parameters:
- domain: A domain name in string format.
Returns:
- A byte array containing the domain name in DNS format.
- An error if the domain name is invalid.
func Ipv6ToInet6 ¶
Ipv6ToInet6 takes an IPv6 address in string format and returns a struct containing the IPv6 address in byte format. The returned struct is intended for use as a key in an eBPF map.
Parameters:
- ipv6Addr: An IPv6 address in string format.
Returns:
- A struct containing a 128-bit IPv6 address in byte format.
func SidToInet6Sid ¶
SidToInet6Sid takes a slice of IPv6 Segment IDs (SIDs) in string format and returns an array of 10 structs containing the IPv6 SIDs in reversed order. The returned array is intended for use in constructing the SID List for the Segment Routing Header (SRH) in IPv6 packets.
Specifically, the function performs the following:
- The first index [0] of the returned array is left empty. This is intended for the last hop, which should be sourced from the IPv6 destination address of the original packet.
- The remaining IPv6 SIDs are reversed, meaning that the last SID in the input slice becomes the first SID in the output array, the second to last becomes the second, and so on.
Parameters:
- sidList: A slice of IPv6 SIDs in string format.
Returns:
- An array of 10 structs, each containing a 128-bit IPv6 address in byte format.
Types ¶
type ClientMap ¶
type ClientMap struct {
Outer *OuterMap
Inners map[string]*InnerMap
Lookup *LookupMap
Reverse *ReverseMap
// contains filtered or unexported fields
}
func NewClientMap ¶
func (*ClientMap) BuildClientDataMap ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func (*Map) Lookup ¶
Lookup looks up the value corresponding to the given key in the map.
Parameters:
- key: The key to lookup.
- value: The value to store the result in.
Returns:
- An error if the map could not be opened or the lookup failed.
func (*Map) OpenOrCreate ¶
OpenOrCreate opens or creates the map.
Returns:
- An error if the map could not be opened or created.
func (*Map) UpdateInner ¶
UpdateInner updates the inner map corresponding to the given outer key with the given inner key and value.
Parameters:
- outerKey: The key of the outer map.
- innerKey: The key of the inner map.
- innerValue: The value to update the inner map with.
Returns:
- An error if the inner map could not be updated.
type ReverseMap ¶
type ReverseMap struct {
Map
}
func NewReverseMap ¶
func NewReverseMap(bpf bpf.Bpf, spec *ebpf.MapSpec) *ReverseMap
type SidListData ¶
type SidListData struct {
SidlistSize uint32
Sidlist [10]struct{ In6U struct{ U6Addr8 [16]uint8 } }
}
func GenerateSidLookupValue ¶
func GenerateSidLookupValue(sidList []string) (SidListData, error)
GenerateSidLookupValue takes a slice of IPv6 Segment IDs (SIDs) in string format and returns a SidListData struct containing the IPv6 SIDs in reversed order. The returned struct is intended for use as a value in an eBPF map.
Parameters:
- sidList: A slice of IPv6 SIDs in string format.
Returns:
- A SidListData struct containing the IPv6 SIDs in reversed order.