gateway

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 35 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{"remote_isd_as", "policy_id"},
	}
	IPPktsSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_sent_total",
		Help:   "Total number of IP packets sent to remote gateways.",
		Labels: []string{"remote_isd_as", "policy_id"},
	}
	IPPktBytesReceivedTotalMeta = MetricMeta{
		Name:   "gateway_ippkt_bytes_received_total",
		Help:   "Total IP packet bytes received from remote gateways.",
		Labels: []string{"remote_isd_as"},
	}
	IPPktsReceivedTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_received_total",
		Help:   "Total number of IP packets received from remote gateways.",
		Labels: []string{"remote_isd_as"},
	}
	IPPktBytesLocalSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkt_bytes_local_sent_total",
		Help:   "Total IP packet bytes sent to the local network.",
		Labels: []string{},
	}
	IPPktsLocalSentTotalMeta = MetricMeta{
		Name:   "gateway_ippkts_local_sent_total",
		Help:   "Total number of IP packets sent to the local network.",
		Labels: []string{},
	}
	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{"remote_isd_as", "policy_id"},
	}
	FramesSentTotalMeta = MetricMeta{
		Name:   "gateway_frames_sent_total",
		Help:   "Total number of frames sent to remote gateways.",
		Labels: []string{"remote_isd_as", "policy_id"},
	}
	FrameBytesReceivedTotalMeta = MetricMeta{
		Name:   "gateway_frame_bytes_received_total",
		Help:   "gateway_frame_bytes_received_total",
		Labels: []string{"remote_isd_as"},
	}
	FramesReceivedTotalMeta = MetricMeta{
		Name:   "gateway_frames_received_total",
		Help:   "Total number of frames received from remote gateways.",
		Labels: []string{"remote_isd_as"},
	}
	FramesDiscardedTotalMeta = MetricMeta{
		Name:   "gateway_frames_discarded_total",
		Help:   "Total number of discarded frames received from remote gateways.",
		Labels: []string{"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{},
	}
	SendLocalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_send_local_errors_total",
		Help:   "Total number of errors when sending IP packets to the network (LAN).",
		Labels: []string{},
	}
	ReceiveExternalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_receive_external_errors_total",
		Help:   "Total number of errors when receiving frames from the network (WAN).",
		Labels: []string{},
	}
	ReceiveLocalErrorsTotalMeta = MetricMeta{
		Name:   "gateway_receive_local_errors_total",
		Help:   "Total number of errors when receiving IP packets from the network (LAN).",
		Labels: []string{},
	}
	PathsMonitoredMeta = MetricMeta{
		Name:   "gateway_paths_monitored",
		Help:   "Total number of paths being monitored by the gateway.",
		Labels: []string{"remote_isd_as"},
	}
	SessionPathsAvailableMeta = MetricMeta{
		Name:   "gateway_session_paths_available",
		Help:   "Total number of paths available per session policy.",
		Labels: []string{"remote_isd_as", "policy_id", "status"},
	}
	RemotesMeta = MetricMeta{
		Name:   "gateway_remotes",
		Help:   "Total number of discovered remote gateways.",
		Labels: []string{"remote_isd_as"},
	}
	PrefixesAdvertisedMeta = MetricMeta{
		Name:   "gateway_prefixes_advertised",
		Help:   "Total number of advertised IP prefixes (outgoing).",
		Labels: []string{"remote_isd_as"},
	}
	PrefixesAcceptedMeta = MetricMeta{
		Name:   "gateway_prefixes_accepted",
		Help:   "Total number of accepted IP prefixes (incoming).",
		Labels: []string{"remote_isd_as"},
	}
	PrefixesRejectedMeta = MetricMeta{
		Name:   "gateway_prefixes_rejected",
		Help:   "Total number of rejected IP prefixes (incoming).",
		Labels: []string{"remote_isd_as"},
	}
)

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

Functions

func CreateIngressMetrics

func CreateIngressMetrics(m *Metrics) dataplane.IngressMetrics

func CreateSessionMetrics

func CreateSessionMetrics(m *Metrics) dataplane.SessionMetrics

func ExperimentalExportMainRT

func ExperimentalExportMainRT() bool

Types

type ConfigPublisherAdvertiser

type ConfigPublisherAdvertiser struct {
	ConfigPublisher *control.ConfigPublisher
}

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

func (*ConfigPublisherAdvertiser) AdvertiseList

func (a *ConfigPublisherAdvertiser) AdvertiseList(from, to addr.IA) []*net.IPNet

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 net.IP
	// 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 sciond.Connector

	// InternalDevice is the tunnel interface from which packets are read.
	InternalDevice io.ReadWriteCloser
	// RouteDevice is the device for routes added to the Linux routing table.
	RouteDevice netlink.Link
	// RouteSource is the source for routes added to the Linux routing table.
	RouteSource net.IP

	// 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

	// Logger is the base logger for all modules initialized by the gateway.
	Logger log.Logger
	// Metrics are the metrics exported by the gateway.
	Metrics *Metrics
}

func (*Gateway) Run

func (g *Gateway) Run() error

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

	// Discovery Metrics
	Remotes            *prometheus.GaugeVec
	PrefixesAdvertised *prometheus.GaugeVec
	PrefixesAccepted   *prometheus.GaugeVec
	PrefixesRejected   *prometheus.GaugeVec
}

Metrics defines the metrics exported by the gateway.

func NewMetrics

func NewMetrics() *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(remote addr.IA, policies *policies.Policies,
	policyID int) control.PathMonitorRegistration

type RoutingPolicyPublisherAdapter

type RoutingPolicyPublisherAdapter struct {
	*control.ConfigPublisher
}

func (RoutingPolicyPublisherAdapter) PublishRoutingPolicy

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

type RoutingTableFactory

type RoutingTableFactory struct {
	Device netlink.Link
	Source net.IP
}

func (RoutingTableFactory) New

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

type WatcherFactory

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

func (*WatcherFactory) New

Directories

Path Synopsis
mock_config
Package mock_config is a generated GoMock package.
Package mock_config is a generated GoMock package.
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 pathhealth monitors paths to different ASes.
Package pathhealth monitors paths to different ASes.
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