- .devcontainer
- .github
- .nvim
- .vscode
-
Documentation
-
_api
-
_exts
-
_static
-
_templates
-
bpf
-
cmdref
-
community
-
configuration
-
contributing
-
gettingstarted
-
images
-
installation
-
internals
-
network
-
observability
-
operations
-
overview
-
requirements-min
-
robots
-
security
- .dockerignore
- .gitignore
- .readthedocs.yaml
- Dockerfile
- Makefile
- api.rst
- beta.rst
- cheatsheet.rst
- check-build.sh
- check-cmdref.sh
- check-codeowners.sh
- check-crd-compat-table.sh
- check-crdlist.sh
- check-examples.sh
- check-flaggen.sh
- check-helmvalues.sh
- check-links.sh
- codeowners.rst
- conf.py
- crdlist.rst
- further_reading.rst
- glossary.rst
- grpcapi.rst
- helm-reference.rst
- helm-values.rst
- helm-values.tmp.tmpl
- index.rst
- kvstore.rst
- requirements.txt
- runtime.txt
- spelling_wordlist.txt
- update-cmdref.sh
- update-codeowners.sh
- update-docs-builder-image.sh
- update-spelling_wordlist.sh
- yaml.config
-
_api
- api
- bpf
- bugtool
- cilium-dbg
- cilium-health
- clustermesh-apiserver
- contrib
- daemon
-
examples
-
crds
-
hubble
-
kubernetes
-
kubernetes-cassandra
-
kubernetes-dns
-
kubernetes-egress-gateway
-
kubernetes-es
-
kubernetes-external-ips
-
kubernetes-grpc
-
kubernetes-ip-masq-agent
-
kubernetes-istio
-
kubernetes-kafka
-
kubernetes-local-redirect
-
kubernetes-memcached
-
kubernetes-tls-inspection
-
minikube
-
misc
-
policies
- valid-labels.lpc
-
crds
- hack
- hubble-relay
- images
- install
- operator
-
pkg
-
alibabacloud
-
alignchecker
-
allocator
-
annotation
-
api
-
auth
-
aws
-
azure
-
backoff
-
bgp
-
bgpv1
-
bpf
-
byteorder
-
cgroups
-
checker
-
cidr
-
ciliumenvoyconfig
-
cleanup
-
client
-
clustermesh
-
command
-
common
-
comparator
-
completion
-
components
-
container
-
controller
-
counter
-
crypto
-
datapath
-
debug
-
defaults
-
ebpf
-
egressgateway
-
elf
-
endpoint
-
endpointcleanup
-
endpointmanager
-
endpointstate
-
envoy
-
eventqueue
-
flowdebug
-
fqdn
-
fswatcher
-
gops
-
health
-
healthv2
-
hive
-
hubble
-
iana
-
identity
-
idpool
-
inctimer
-
ip
-
ipalloc
-
ipam
-
ipcache
-
ipmasq
-
k8s
-
kvstore
-
l2announcer
-
labels
-
labelsfilter
-
launcher
-
loadbalancer
-
loadinfo
-
lock
-
logging
-
mac
-
maglev
-
maps
-
math
-
mcastmanager
-
metrics
-
monitor
-
mountinfo
-
mtu
-
multicast
-
murmur3
-
netns
-
node
-
nodediscovery
-
option
-
pidfile
-
policy
-
pprof
-
promise
-
proxy
-
rand
-
rate
-
recorder
-
redirectpolicy
-
resiliency
-
revert
-
safeio
-
safetime
-
service
-
signal
-
slices
-
socketlb
-
source
-
spanstat
-
statedb
-
status
-
testutils
-
time
-
trigger
-
tuple
-
types
-
u8proto
-
version
-
versioncheck
-
wireguard
-
alibabacloud
- plugins
-
test
-
bigtcp
-
bpf
-
config
-
consul
-
controlplane
-
eks
-
envoy
-
fuzzing
-
ginkgo-ext
-
gke
-
helpers
-
k8s
-
l4lb
-
logger
-
nat46x64
-
packet
-
provision
-
runtime
-
standalone
-
verifier
-
vtep
- Makefile
- README.md
- Vagrantfile
- archive_test_results.sh
- archive_test_results_eks.sh
- get-gh-comment-info.py
- get-vagrant-kubeconfig.sh
- kubernetes-test.sh
- post_build_agent.sh
- print-node-ip.sh
- test_suite_test.go
- vagrant-ci-start.sh
- vagrant-local-create-box.sh
- vagrant-local-start-runtime.sh
- vagrant-local-start.sh
- vagrant_cleanup.sh
-
bigtcp
- tools
- vendor
- .authors.aux
- .clang-format
- .clomonitor.yml
- .gitattributes
- .gitignore
- .golangci.yaml
- .mailmap
- .openvex.json
- AUTHORS
- CODEOWNERS
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- FURTHER_READINGS.rst
- LICENSE
- MAINTAINERS.md
- Makefile
- Makefile.defs
- Makefile.docker
- Makefile.kind
- Makefile.quiet
- README.rst
- SECURITY-INSIGHTS.yml
- SECURITY.md
- USERS.md
- VERSION
- Vagrantfile
- go.mod
- go.sum
- netlify.toml
- stable.txt
- vagrant_box_defaults.rb
Explanation
This code defines types and interfaces for a BGP router implementation, likely for use in the Cilium networking project. It defines various structures for BGP configuration, state, requests and responses. Here’s a breakdown of the code:
BGP Configuration and State:
- BGPGlobal: Holds global BGP configuration parameters like ASN, Router ID, Listen Port, and route selection options.
- RouteSelectionOptions: Contains options for BGP route selection.
- Family: Represents an address family (AFI) and subsequent address family (SAFI) used in Multi-Protocol BGP.
- Path: Represents a BGP routing path with fields like Network Layer Reachability Information (NLRI), path attributes, family, age, best path indication, and UUID.
- NeighborRequest: Defines parameters for configuring or removing a BGP neighbor. It uses structures from the Cilium k8s API (
CiliumBGPNeighbor
,CiliumBGPNodePeer
,CiliumBGPPeerConfigSpec
) to represent the neighbor configuration. - ResetNeighborRequest: Parameters for resetting a BGP neighbor connection.
Route Policy:
- RoutePolicyPrefixMatch: Used to match a prefix in a route policy, supporting both exact and variable prefix length matching.
- RoutePolicyConditions: Represents conditions of a route policy statement, including neighbor and prefix matching.
- RoutePolicyAction: Defines actions to be taken on a route matched by a policy (Accept, Reject, None).
- RoutePolicyActions: Specifies actions taken on a matched route.
- RoutePolicyStatement: Defines a single statement within a route policy with conditions and actions.
- RoutePolicyType: Indicates the type of route policy (Import or Export).
- RoutePolicy: Represents a BGP route policy with a name, type, and a list of statements.
- RoutePolicyRequest: Parameters for adding or removing a route policy.
Requests and Responses:
- PathRequest: Contains a BGP path to be advertised or withdrawn.
- PathResponse: Response to a path advertisement or withdrawal, containing the advertised path.
- GetPeerStateResponse: Contains the state of all configured BGP peers.
- GetBGPResponse: Contains the global BGP configuration.
- GetRoutesRequest: Parameters for retrieving routes from the RIB of the underlying router.
- GetRoutesResponse: Contains retrieved routes.
- GetRoutePoliciesResponse: Contains retrieved route policies.
Router Interface:
- Router: Interface defining the BGP router functionality. This interface allows interacting with a BGP router implementation in a vendor-agnostic way. It defines methods for:
- Stopping the router.
- Adding, updating, and removing BGP neighbors.
- Resetting a BGP neighbor connection.
- Advertising and withdrawing BGP paths.
- Adding and removing route policies.
- Getting BGP peer state, global configuration, RIB routes, and route policies.
Key Points:
- The code uses
netip
for representing IP addresses and prefixes, providing a more performant and immutable type compared tonet.IP
. - It leverages structures from the Cilium k8s API to represent BGP neighbor configurations.
- It uses Go’s
context
package to provide cancellation and timeout capabilities to functions. - The
Router
interface is central to abstracting the BGP functionality, allowing for different underlying implementations.
This code serves as a core component for a BGP router implementation within the Cilium project, enabling configuration, state management, and programmatic interaction with BGP routing.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph