stun

package
v0.64.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

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