stun

package
v0.83.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stun provides an embedded STUN server for NAT traversal discovery.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoListeners = errors.New("stun: no listeners configured")

ErrNoListeners is returned by Listen when no UDP connections were provided.

View Source
var ErrServerClosed = errors.New("stun: server closed")

ErrServerClosed is returned by Listen when the server is shut down gracefully.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements a STUN server that responds to binding requests with the client's reflexive transport address.

func NewServer

func NewServer(conns []*net.UDPConn, logLevel string) *Server

NewServer creates a new STUN server with the given UDP listeners. The caller is responsible for creating and providing the listeners. logLevel can be: panic, fatal, error, warn, info, debug, trace

func (*Server) Listen

func (s *Server) Listen() error

Listen starts the STUN server and blocks until the server is shut down. Returns ErrServerClosed when shut down gracefully via Shutdown. Returns ErrNoListeners if no UDP connections were provided.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown gracefully stops the STUN server.

Jump to

Keyboard shortcuts

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