Documentation ¶
Index ¶
- func AddConnection(n string, c ConnType)
- func Close()
- func IncrementBytes(n string, c ConnType, d Direction, count uint64)
- func IncrementPackets(n string, c ConnType, d Direction, count uint64)
- func Init()
- func SubConnection(n string, c ConnType)
- type Conn
- type ConnType
- type Direction
- type Listener
- type PacketConn
- type RelayAddressGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddConnection ¶ added in v0.11.3
func IncrementBytes ¶ added in v0.11.3
func IncrementPackets ¶ added in v0.11.3
func SubConnection ¶ added in v0.11.3
Types ¶
type Conn ¶ added in v0.11.3
Conn is a net.Conn that knows how to report to Prometheus.
type ConnType ¶ added in v0.11.3
type ConnType int
ConnType species whether a conn stat was collected at a listener or a cluster.
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.
type Listener ¶ added in v0.11.3
Listener is a net.Listener that knows how to report to Prometheus.
func NewListener ¶ added in v0.11.3
NewListener creates a net.Listener that knows its name and type.
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.
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