gateway

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IPPktBytesSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkt_bytes_sent_total",
		Help:   "Total IP packet bytes sent to remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as", "policy_id"},
	}
	IPPktsSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_sent_total",
		Help:   "Total number of IP packets sent to remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as", "policy_id"},
	}
	IPPktBytesReceivedTotalMeta = MetricMeta{
		Name:   "gateway_ippkt_bytes_received_total",
		Help:   "Total IP packet bytes received from remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	IPPktsReceivedTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_received_total",
		Help:   "Total number of IP packets received from remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	IPPktBytesLocalSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkt_bytes_local_sent_total",
		Help:   "Total IP packet bytes sent to the local network.",
		Labels: []string{"isd_as"},
	}
	IPPktsLocalSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_local_sent_total",
		Help:   "Total number of IP packets sent to the local network.",
		Labels: []string{"isd_as"},
	}
	IPPktBytesLocalReceivedTotalMeta = MetricMeta{
		Name:   "gateway_ippkt_bytes_local_received_total",
		Help:   "Total IP packet bytes received from the local network.",
		Labels: []string{},
	}
	IPPktsLocalReceivedTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_local_received_total",
		Help:   "Total number of IP packets received from the local network.",
		Labels: []string{},
	}
	FrameBytesSentTotalMeta = MetricMeta{
		Name:   "gateway_frame_bytes_sent_total",
		Help:   "Total frame bytes sent to remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as", "policy_id"},
	}
	FramesSentTotalMeta = MetricMeta{
		Name:   "gateway_frames_sent_total",
		Help:   "Total number of frames sent to remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as", "policy_id"},
	}
	FrameBytesReceivedTotalMeta = MetricMeta{
		Name:   "gateway_frame_bytes_received_total",
		Help:   "Total frame bytes received from remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	FramesReceivedTotalMeta = MetricMeta{
		Name:   "gateway_frames_received_total",
		Help:   "Total number of frames received from remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	FramesDiscardedTotalMeta = MetricMeta{
		Name:   "gateway_frames_discarded_total",
		Help:   "Total number of discarded frames received from remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as", "reason"},
	}
	IPPktsDiscardedTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_discarded_total",
		Help:   "Total number of discarded IP packets received from the local network.",
		Labels: []string{"reason"},
	}
	SendExternalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_send_external_errors_total",
		Help:   "Total number of errors when sending frames to the network (WAN).",
		Labels: []string{"isd_as"},
	}
	SendLocalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_send_local_errors_total",
		Help:   "Total number of errors when sending IP packets to the network (LAN).",
		Labels: []string{"isd_as"},
	}
	ReceiveExternalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_receive_external_errors_total",
		Help:   "Total number of errors when receiving frames from the network (WAN).",
		Labels: []string{"isd_as"},
	}
	ReceiveLocalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_receive_local_errors_total",
		Help:   "Total number of errors when receiving IP packets from the network (LAN).",
		Labels: []string{"isd_as"},
	}
	PathsMonitoredMeta = MetricMeta{
		Name:   "gateway_paths_monitored",
		Help:   "Total number of paths being monitored by the gateway.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	PathProbesSentMeta = MetricMeta{
		Name:   "gateway_path_probes_sent",
		Help:   "Number of path probes being sent.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	PathProbesReceivedMeta = MetricMeta{
		Name:   "gateway_path_probes_received",
		Help:   "Number of replies to the path probes being received.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	PathProbesSendErrorsMeta = MetricMeta{
		Name:   "gateway_path_probes_send_errors",
		Help:   "Number of send error for path probes.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	SessionProbesMeta = MetricMeta{
		Name:   "gateway_session_probes",
		Help:   "Number of probes sent per session.",
		Labels: []string{"isd_as", "remote_isd_as", "session_id", "policy_id"},
	}
	SessionProbeRepliesMeta = MetricMeta{
		Name:   "gateway_session_probe_replies",
		Help:   "Number of probes received per session.",
		Labels: []string{"isd_as", "remote_isd_as", "session_id", "policy_id"},
	}
	SessionIsHealthyMeta = MetricMeta{
		Name:   "gateway_session_is_healthy",
		Help:   "Flag reflecting session healthiness.",
		Labels: []string{"isd_as", "remote_isd_as", "session_id", "policy_id"},
	}
	SessionStateChangesMeta = MetricMeta{
		Name:   "gateway_session_state_changes",
		Help:   "The number of state changes per session.",
		Labels: []string{"isd_as", "remote_isd_as", "session_id", "policy_id"},
	}
	SessionPathsAvailableMeta = MetricMeta{
		Name:   "gateway_session_paths_available",
		Help:   "Total number of paths available per session policy.",
		Labels: []string{"isd_as", "remote_isd_as", "policy_id", "status"},
	}
	SessionPathChangesMeta = MetricMeta{
		Name:   "gateway_session_path_changes",
		Help:   "Total number of path changes per session policy.",
		Labels: []string{"isd_as", "remote_isd_as", "session_id", "policy_id"},
	}
	RemotesMeta = MetricMeta{
		Name:   "gateway_remotes",
		Help:   "Total number of discovered remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	RemoteChangesMeta = MetricMeta{
		Name:   "gateway_remotes_changes",
		Help:   "The number of times the remotes number changed.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	RemoteDiscoveryErrorsMeta = MetricMeta{
		Name:   "gateway_remote_discovery_errors_total",
		Help:   "Total number of errors discovering remote gateways.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	RoutingChainHealthyMeta = MetricMeta{
		Name:   "gateway_routing_chain_healthiness",
		Help:   "Flag reflecting routing chain healthiness.",
		Labels: []string{"isd_as", "routing_chain_id"},
	}
	RoutingChainAliveSessionsMeta = MetricMeta{
		Name:   "gateway_routing_chain_alive_sessions",
		Help:   "The number of alive sessions associated to the routing chain.",
		Labels: []string{"isd_as", "routing_chain_id"},
	}
	RoutingChainSessionChangesMeta = MetricMeta{
		Name:   "gateway_routing_chain_session_changes",
		Help:   "The number of session changes in the routing chain.",
		Labels: []string{"isd_as", "routing_chain_id"},
	}
	RoutingChainStateChangesMeta = MetricMeta{
		Name:   "gateway_routing_chain_state_changes",
		Help:   "The number of state changes in the routing chain.",
		Labels: []string{"isd_as", "routing_chain_id"},
	}
	PrefixFetchErrorsMeta = MetricMeta{
		Name:   "gateway_prefix_fetch_errors_total",
		Help:   "Total number of errors fetching prefixes.",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	PrefixesAdvertisedMeta = MetricMeta{
		Name:   "gateway_prefixes_advertised",
		Help:   "Total number of advertised IP prefixes (outgoing).",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	PrefixesAcceptedMeta = MetricMeta{
		Name:   "gateway_prefixes_accepted",
		Help:   "Total number of accepted IP prefixes (incoming).",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
	PrefixesRejectedMeta = MetricMeta{
		Name:   "gateway_prefixes_rejected",
		Help:   "Total number of rejected IP prefixes (incoming).",
		Labels: []string{"isd_as", "remote_isd_as"},
	}
)

These are the metrics that should be exposed by any gateway implementation.

Functions

func CreateEngineMetrics

func CreateEngineMetrics(m *Metrics) control.EngineMetrics

func CreateIngressMetrics

func CreateIngressMetrics(m *Metrics) dataplane.IngressMetrics

func CreateSessionMetrics

func CreateSessionMetrics(m *Metrics) dataplane.SessionMetrics

func PathUpdateInterval

func PathUpdateInterval(ctx context.Context) time.Duration

func StartIngress

func StartIngress(ctx context.Context, scionNetwork *snet.SCIONNetwork, dataAddr *net.UDPAddr,
	deviceManager control.DeviceManager, metrics *Metrics) error

Types

type DataplaneSessionFactory

type DataplaneSessionFactory struct {
	PacketConnFactory  PacketConnFactory
	PathStatsPublisher dataplane.PathStatsPublisher
	Metrics            dataplane.SessionMetrics
}

func (DataplaneSessionFactory) New

func (dpf DataplaneSessionFactory) New(id uint8, policyID int,
	remoteIA addr.IA, remoteAddr net.Addr) control.DataplaneSession

type Gateway

type Gateway struct {
	// ID is the ID of this gateway.
	ID string
	// TrafficPolicyFile holds the location of the traffic policy file.
	TrafficPolicyFile string
	// RoutingPolicyFile holds the location of the routing policy file.
	RoutingPolicyFile string

	// ControlClientIP is the IP for network prefix discovery.
	ControlClientIP net.IP
	// ControlServerAddr is the address of the local gRPC server serving prefix
	// discovery requests. The server runs on the UDP/SCION + QUIC stack.
	ControlServerAddr *net.UDPAddr

	// ServiceDiscoveryClientIP is the IP for SCION Service Discovery UDP packets.
	ServiceDiscoveryClientIP net.IP

	// PathMonitorIP is the IP that should be used for path monitoring SCMP traceroute traffic.
	PathMonitorIP netip.Addr
	// ProbeServerAddr is the address for the probe server. The probe server replies
	// to probe traffic from other gateways.
	ProbeServerAddr *net.UDPAddr
	// ProbeClientIP is the IP from which local probes will be sent out.
	ProbeClientIP net.IP

	// DataServerAddr is the address for encapsulated data traffic received from other gateways.
	DataServerAddr *net.UDPAddr
	// DataClientIP is the IP from which encapsulated data traffic is sent to other gateways.
	DataClientIP net.IP

	// DataIP is the IP that should be used for dataplane traffic.
	DataAddr *net.UDPAddr

	// Dispatcher is the API of the SCION Dispatcher on the local host.
	Dispatcher reliable.Dispatcher

	// Daemon is the API of the SCION Daemon.
	Daemon daemon.Connector

	// RouteSourceIPv4 is the source hint for IPv4 routes added to the Linux routing table.
	RouteSourceIPv4 net.IP
	// RouteSourceIPv6 is the source hint for IPv6 routes added to the Linux routing table.
	RouteSourceIPv6 net.IP
	// TunnelName is the device name for the Linux global tunnel device.
	TunnelName string

	// RoutingTableReader is used for routing the packets.
	RoutingTableReader control.RoutingTableReader
	// RoutingTableSwapper is used for switching the routing tables.
	RoutingTableSwapper control.RoutingTableSwapper

	// ConfigReloadTrigger can be used to trigger a config reload.
	ConfigReloadTrigger chan struct{}
	// HTTPEndpoints is a map of http endpoints.
	HTTPEndpoints service.StatusPages
	// HTTPServeMux is the http server mux that is used to expose gateway http
	// endpoints.
	HTTPServeMux *http.ServeMux

	// Metrics are the metrics exported by the gateway.
	Metrics *Metrics
}

func (*Gateway) Run

func (g *Gateway) Run(ctx context.Context) error

type Loader

type Loader struct {
	// SessionPoliciesFile is the file name of the session policies. Must be set.
	SessionPoliciesFile string
	// RoutingPolicyFile is the file name of the routing policy. Must be set.
	RoutingPolicyFile string
	// Publisher is used to publish new loaded configs.
	Publisher Publisher
	// Trigger is used to trigger loading.
	Trigger <-chan struct{}
	// SessionPolicyParser is used to parse session policies.
	SessionPolicyParser control.SessionPolicyParser
	// contains filtered or unexported fields
}

Loader can be used to load gateway configurations from files. It waits on triggers.

func (*Loader) Close

func (l *Loader) Close(ctx context.Context) error

Close shuts down this loader.

func (*Loader) Run

func (l *Loader) Run(ctx context.Context) error

Run waits on trigger signals, and publishes the newly loaded files on the trigger. This blocks until the Loader is closed.

type MetricMeta

type MetricMeta struct {
	Name   string
	Help   string
	Labels []string
}

func (*MetricMeta) NewCounterVec

func (mm *MetricMeta) NewCounterVec() *prometheus.CounterVec

func (*MetricMeta) NewGaugeVec

func (mm *MetricMeta) NewGaugeVec() *prometheus.GaugeVec

type Metrics

type Metrics struct {
	// Traffic Metrics
	IPPktBytesSentTotal          *prometheus.CounterVec
	IPPktBytesReceivedTotal      *prometheus.CounterVec
	IPPktsSentTotal              *prometheus.CounterVec
	IPPktsReceivedTotal          *prometheus.CounterVec
	IPPktBytesLocalSentTotal     *prometheus.CounterVec
	IPPktBytesLocalReceivedTotal *prometheus.CounterVec
	IPPktsLocalSentTotal         *prometheus.CounterVec
	IPPktsLocalReceivedTotal     *prometheus.CounterVec
	FrameBytesSentTotal          *prometheus.CounterVec
	FrameBytesReceivedTotal      *prometheus.CounterVec
	FramesSentTotal              *prometheus.CounterVec
	FramesReceivedTotal          *prometheus.CounterVec

	// Error Metrics
	FramesDiscardedTotal       *prometheus.CounterVec
	IPPktsDiscardedTotal       *prometheus.CounterVec
	SendExternalErrorsTotal    *prometheus.CounterVec
	SendLocalErrorsTotal       *prometheus.CounterVec
	ReceiveExternalErrorsTotal *prometheus.CounterVec
	ReceiveLocalErrorsTotal    *prometheus.CounterVec

	// Path Monitoring Metrics
	PathsMonitored        *prometheus.GaugeVec
	SessionPathsAvailable *prometheus.GaugeVec
	PathProbesSent        *prometheus.CounterVec
	PathProbesReceived    *prometheus.CounterVec
	PathProbesSendErrors  *prometheus.CounterVec

	// Discovery Metrics
	Remotes               *prometheus.GaugeVec
	RemotesChanges        *prometheus.CounterVec
	RemoteDiscoveryErrors *prometheus.CounterVec
	PrefixFetchErrors     *prometheus.CounterVec
	PrefixesAdvertised    *prometheus.GaugeVec
	PrefixesAccepted      *prometheus.GaugeVec
	PrefixesRejected      *prometheus.GaugeVec

	// SessionMonitor Metrics
	SessionProbes       *prometheus.CounterVec
	SessionProbeReplies *prometheus.CounterVec
	SessionIsHealthy    *prometheus.GaugeVec
	SessionStateChanges *prometheus.CounterVec
	SessionPathChanges  *prometheus.CounterVec

	// Routing Metrics
	RoutingChainHealthy        *prometheus.GaugeVec
	RoutingChainAliveSessions  *prometheus.GaugeVec
	RoutingChainSessionChanges *prometheus.CounterVec
	RoutingChainStateChanges   *prometheus.CounterVec

	// Scion Network Metrics
	SCIONNetworkMetrics    snet.SCIONNetworkMetrics
	SCMPErrors             metrics.Counter
	SCIONPacketConnMetrics snet.SCIONPacketConnMetrics
}

Metrics defines the metrics exported by the gateway.

func NewMetrics

func NewMetrics(ia addr.IA) *Metrics

NewMetrics initializes the metrics for the gateway and registers them with the default registry.

type PacketConnFactory

type PacketConnFactory struct {
	Network *snet.SCIONNetwork
	Addr    *net.UDPAddr
}

func (PacketConnFactory) New

func (pcf PacketConnFactory) New() (net.PacketConn, error)

type PathMonitor

type PathMonitor struct {
	*pathhealth.Monitor
	// contains filtered or unexported fields
}

PathMonitor implements control.PathMonitor using a pathhealth path monitor.

func (*PathMonitor) Register

func (pm *PathMonitor) Register(
	ctx context.Context,
	remote addr.IA,
	policies *policies.Policies,
	policyID string,
) control.PathMonitorRegistration

type ProbeConnFactory

type ProbeConnFactory struct {
	Dispatcher *reconnect.DispatcherService
	LocalIA    addr.IA
	LocalIP    netip.Addr
}

func (ProbeConnFactory) New

type Publisher

type Publisher interface {
	Publish(control.SessionPolicies, *routing.Policy)
}

Publisher publishes new configurations.

type RoutingPolicyPublisherAdapter

type RoutingPolicyPublisherAdapter struct {
	*control.ConfigPublisher
}

func (RoutingPolicyPublisherAdapter) PublishRoutingPolicy

func (cp RoutingPolicyPublisherAdapter) PublishRoutingPolicy(rp *routing.Policy)

type RoutingTableFactory

type RoutingTableFactory struct {
	RoutePublisherFactory control.PublisherFactory
}

func (RoutingTableFactory) New

func (rtf RoutingTableFactory) New(
	routingChains []*control.RoutingChain,
) (control.RoutingTable, error)

type SelectAdvertisedRoutes

type SelectAdvertisedRoutes struct {
	ConfigPublisher *control.ConfigPublisher
}

SelectAdvertisedRoutes computes the networks that should be advertised depending on the state of the last published routing policy file.

func (*SelectAdvertisedRoutes) AdvertiseList

func (a *SelectAdvertisedRoutes) AdvertiseList(from, to addr.IA) ([]netip.Prefix, error)

type TunnelReader

type TunnelReader struct {
	DeviceOpener control.DeviceOpener
	Router       control.RoutingTableReader
	Metrics      dataplane.IPForwarderMetrics
}

func (*TunnelReader) GetDeviceOpenerWithAsyncReader

func (r *TunnelReader) GetDeviceOpenerWithAsyncReader(ctx context.Context) control.DeviceOpener

type WatcherFactory

type WatcherFactory struct {
	Dialer      libgrpc.Dialer
	PathMonitor control.PathMonitor
	Aggregator  control.PrefixConsumer
	Policies    *policies.Policies
}

func (*WatcherFactory) New

func (wf *WatcherFactory) New(
	ctx context.Context,
	remote addr.IA,
	metrics control.GatewayWatcherMetrics,
) control.Runner

Directories

Path Synopsis
cmd
grpc/mock_grpc
Package mock_grpc is a generated GoMock package.
Package mock_grpc is a generated GoMock package.
mock_control
Package mock_control is a generated GoMock package.
Package mock_control is a generated GoMock package.
Package dataplane defines implementations required to run a gateway dataplane.
Package dataplane defines implementations required to run a gateway dataplane.
Package mgmtapi provides primitives to interact with the openapi HTTP API.
Package mgmtapi provides primitives to interact with the openapi HTTP API.
Package mock_gateway is a generated GoMock package.
Package mock_gateway is a generated GoMock package.
Package pathhealth monitors paths to different ASes.
Package pathhealth monitors paths to different ASes.
Package pktcls implements tools for classifying and acting on network packets.
Package pktcls implements tools for classifying and acting on network packets.
mock_pktcls
Package mock_pktcls is a generated GoMock package.
Package mock_pktcls is a generated GoMock package.
Package routing defines implementations around the routing decisions for the gateway.
Package routing defines implementations around the routing decisions for the gateway.
mock_routing
Package mock_routing is a generated GoMock package.
Package mock_routing is a generated GoMock package.
Package xnet contains low level Linux networking calls (generally related to netlink and tunneling)
Package xnet contains low level Linux networking calls (generally related to netlink and tunneling)

Jump to

Keyboard shortcuts

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