telemetry

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConnection added in v0.11.3

func AddConnection(n string, c ConnType)

func Close added in v0.11.3

func Close()

func IncrementBytes added in v0.11.3

func IncrementBytes(n string, c ConnType, d Direction, count uint64)

func IncrementPackets added in v0.11.3

func IncrementPackets(n string, c ConnType, d Direction, count uint64)

func Init added in v0.11.3

func Init()

func SubConnection added in v0.11.3

func SubConnection(n string, c ConnType)

Types

type Conn added in v0.11.3

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is a net.Conn that knows how to report to Prometheus.

func NewConn added in v0.11.3

func NewConn(c net.Conn, n string, t ConnType) *Conn

NewConn allocates a stats conn that knows its name and type.

func (*Conn) Close added in v0.11.3

func (c *Conn) Close() error

Close closes the Conn.

func (*Conn) Read added in v0.11.3

func (c *Conn) Read(b []byte) (n int, err error)

Read reads from the Conn.

func (*Conn) Write added in v0.11.3

func (c *Conn) Write(b []byte) (n int, err error)

Write writes to the Conn.

type ConnType added in v0.11.3

type ConnType int

ConnType species whether a conn stat was collected at a listener or a cluster.

const (
	ListenerType ConnType = iota + 1
	ClusterType
)

func (ConnType) String added in v0.11.3

func (c ConnType) String() string

String returns a string representation for a ConnType.

type Direction added in v0.11.3

type Direction int

Direction species whether a conn stat applies in the sender or a receiving direction from the standpoint of STUNner.

const (
	Incoming Direction = iota + 1
	Outgoing
)

func (Direction) String added in v0.11.3

func (d Direction) String() string

String returns a string representation for a Direction.

type Listener added in v0.11.3

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

Listener is a net.Listener that knows how to report to Prometheus.

func NewListener added in v0.11.3

func NewListener(l net.Listener, n string, t ConnType) *Listener

NewListener creates a net.Listener that knows its name and type.

func (*Listener) Accept added in v0.11.3

func (l *Listener) Accept() (net.Conn, error)

Accept accepts a new connection on a Listener.

type PacketConn added in v0.11.3

type PacketConn struct {
	net.PacketConn
	// contains filtered or unexported fields
}

PacketConn is a net.PacketConn that knows how to report to Prometheus.

func NewPacketConn added in v0.11.3

func NewPacketConn(c net.PacketConn, n string, t ConnType) *PacketConn

NewPacketConn allocates a stats conn that knows its name and type.

func (*PacketConn) Close added in v0.11.3

func (c *PacketConn) Close() error

ReadFrom reads from the PacketConn. WriteTo writes to the PacketConn. Close closes the PacketConn.

func (*PacketConn) ReadFrom added in v0.11.3

func (c *PacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

ReadFrom reads from the PacketConn.

func (*PacketConn) WriteTo added in v0.11.3

func (c *PacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

WriteTo writes to the PacketConn.

type RelayAddressGenerator added in v0.11.3

type RelayAddressGenerator struct {
	// Name is the name of the listener this relay address generator belongs to. Note that
	// packets sent to/received from upstream cluster are reported with the name of the
	// *listener* that the packet belongs to, and not the cluster.
	Name string

	// RelayAddress is the IP returned to the user when the relay is created.
	RelayAddress net.IP

	// MinPort the minimum port to allocate.
	MinPort uint16
	// MaxPort the maximum (inclusive) port to allocate.
	MaxPort uint16

	// MaxRetries the amount of tries to allocate a random port in the defined range.
	MaxRetries int

	// Rand the random source of numbers.
	Rand randutil.MathRandomGenerator

	// Address is passed to Listen/ListenPacket when creating the Relay.
	Address string

	// Net is a pion/transport VNet, used for testing.
	Net transport.Net
}

RelayAddressGenerator can be used to only allocate connections inside a defined port range. A static ip address can be set.

func (*RelayAddressGenerator) AllocateConn added in v0.11.3

func (g *RelayAddressGenerator) AllocateConn(network string, requestedPort int) (net.Conn, net.Addr, error)

AllocateConn generates a new Conn to receive traffic on and the IP/Port to populate the allocation response with

func (*RelayAddressGenerator) AllocatePacketConn added in v0.11.3

func (r *RelayAddressGenerator) AllocatePacketConn(network string, requestedPort int) (net.PacketConn, net.Addr, error)

AllocatePacketConn generates a new PacketConn to receive traffic on and the IP/Port to populate the allocation response with

func (*RelayAddressGenerator) Validate added in v0.11.3

func (r *RelayAddressGenerator) Validate() error

Validate is called on server startup and confirms the RelayAddressGenerator is properly configured

Jump to

Keyboard shortcuts

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