stun

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is an embedded STUN Binding server that responds to RFC 5389 Binding Requests with the client's reflexive transport address.

func New

func New(port int) *Server

New creates a STUN server that will listen on the given UDP port.

func (*Server) LocalAddr

func (s *Server) LocalAddr() net.Addr

LocalAddr returns the server's bound address, or nil if not yet listening.

func (*Server) Run

func (s *Server) Run()

Run starts the STUN server. It blocks until Stop is called.

func (*Server) Stop

func (s *Server) Stop()

Stop signals the server to shut down. If the server has already bound its socket, Stop closes it and waits for the read loop to exit. If Stop races with Run (socket not yet bound), it sets a flag that Run checks after binding. Safe to call even if Run was never called.

Jump to

Keyboard shortcuts

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