Versions in this module Expand all Collapse all v2 v2.0.15 Nov 8, 2023 v2.0.13 Nov 8, 2023 Changes in this version + func GenerateAuthKey(username, realm, password string) []byte + func GenerateLongTermCredentials(sharedSecret string, duration time.Duration) (string, string, error) + type AuthHandler func(username, realm string, srcAddr net.Addr) (key []byte, ok bool) + func NewLongTermAuthHandler(sharedSecret string, l logging.LeveledLogger) AuthHandler + type Client struct + func NewClient(config *ClientConfig) (*Client, error) + func (c *Client) Allocate() (net.PacketConn, error) + func (c *Client) Close() + func (c *Client) HandleInbound(data []byte, from net.Addr) (bool, error) + func (c *Client) Listen() error + func (c *Client) OnDeallocated(relayedAddr net.Addr) + func (c *Client) PerformTransaction(msg *stun.Message, to net.Addr, ignoreResult bool) (client.TransactionResult, error) + func (c *Client) Realm() stun.Realm + func (c *Client) STUNServerAddr() net.Addr + func (c *Client) SendBindingRequest() (net.Addr, error) + func (c *Client) SendBindingRequestTo(to net.Addr) (net.Addr, error) + func (c *Client) TURNServerAddr() net.Addr + func (c *Client) Username() stun.Username + func (c *Client) WriteTo(data []byte, to net.Addr) (int, error) + type ClientConfig struct + Conn net.PacketConn + LoggerFactory logging.LoggerFactory + Net *vnet.Net + Password string + RTO time.Duration + Realm string + STUNServerAddr string + Software string + TURNServerAddr string + Username string + type ListenerConfig struct + Listener net.Listener + RelayAddressGenerator RelayAddressGenerator + type PacketConnConfig struct + PacketConn net.PacketConn + RelayAddressGenerator RelayAddressGenerator + type RelayAddressGenerator interface + AllocateConn func(network string, requestedPort int) (net.Conn, net.Addr, error) + AllocatePacketConn func(network string, requestedPort int) (net.PacketConn, net.Addr, error) + Validate func() error + type RelayAddressGeneratorNone struct + Address string + Net *vnet.Net + func (r *RelayAddressGeneratorNone) AllocateConn(network string, requestedPort int) (net.Conn, net.Addr, error) + func (r *RelayAddressGeneratorNone) AllocatePacketConn(network string, requestedPort int) (net.PacketConn, net.Addr, error) + func (r *RelayAddressGeneratorNone) Validate() error + type RelayAddressGeneratorPortRange struct + Address string + MaxPort uint16 + MaxRetries int + MinPort uint16 + Net *vnet.Net + Rand randutil.MathRandomGenerator + RelayAddress net.IP + func (r *RelayAddressGeneratorPortRange) AllocateConn(network string, requestedPort int) (net.Conn, net.Addr, error) + func (r *RelayAddressGeneratorPortRange) AllocatePacketConn(network string, requestedPort int) (net.PacketConn, net.Addr, error) + func (r *RelayAddressGeneratorPortRange) Validate() error + type RelayAddressGeneratorStatic struct + Address string + Net *vnet.Net + RelayAddress net.IP + func (r *RelayAddressGeneratorStatic) AllocateConn(network string, requestedPort int) (net.Conn, net.Addr, error) + func (r *RelayAddressGeneratorStatic) AllocatePacketConn(network string, requestedPort int) (net.PacketConn, net.Addr, error) + func (r *RelayAddressGeneratorStatic) Validate() error + type STUNConn struct + func NewSTUNConn(nextConn net.Conn) *STUNConn + func (s *STUNConn) Close() error + func (s *STUNConn) LocalAddr() net.Addr + func (s *STUNConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) + func (s *STUNConn) SetDeadline(t time.Time) error + func (s *STUNConn) SetReadDeadline(t time.Time) error + func (s *STUNConn) SetWriteDeadline(t time.Time) error + func (s *STUNConn) WriteTo(p []byte, addr net.Addr) (n int, err error) + type Server struct + func NewServer(config ServerConfig) (*Server, error) + func (s *Server) Close() error + type ServerConfig struct + AuthHandler AuthHandler + ChannelBindTimeout time.Duration + InboundMTU int + ListenerConfigs []ListenerConfig + LoggerFactory logging.LoggerFactory + PacketConnConfigs []PacketConnConfig + Realm string