Documentation
¶
Index ¶
- Variables
- func HandlerExists(name string) bool
- func ListHandlers() []string
- type DTLSHandler
- func (D *DTLSHandler) AcceptClients(ctx context.Context) (<-chan ServerClient, error)
- func (D *DTLSHandler) Connect(ctx context.Context, dest net.Addr, relay RelayInfo, forceTURN bool) (net.Conn, error)
- func (D *DTLSHandler) ID() string
- func (D *DTLSHandler) SetLogger(log *slog.Logger)
- func (D *DTLSHandler) Start(config config.ServerConfig) error
- func (D *DTLSHandler) Stop() error
- type Handler
- type NoneHandler
- func (N *NoneHandler) AcceptClients(_ context.Context) (<-chan ServerClient, error)
- func (N *NoneHandler) Connect(ctx context.Context, dest net.Addr, relay RelayInfo, forceTURN bool) (net.Conn, error)
- func (N *NoneHandler) ID() string
- func (N *NoneHandler) SetLogger(log *slog.Logger)
- func (N *NoneHandler) Start(_ config.ServerConfig) error
- func (N *NoneHandler) Stop() error
- type RelayInfo
- type SRTPHandler
- func (S *SRTPHandler) AcceptClients(ctx context.Context) (<-chan ServerClient, error)
- func (S *SRTPHandler) Connect(ctx context.Context, dest net.Addr, relay RelayInfo, forceTURN bool) (net.Conn, error)
- func (S *SRTPHandler) ID() string
- func (S *SRTPHandler) SetLogger(log *slog.Logger)
- func (S *SRTPHandler) Start(cfg config.ServerConfig) error
- func (S *SRTPHandler) Stop() error
- type ServerClient
Constants ¶
This section is empty.
Variables ¶
var ErrQuotaReached = errors.New("turn allocation quota reached")
ErrQuotaReached indicates a TURN allocation quota has been exhausted
var Handlers = common.NewRegistry[Handler]()
Handlers represents protocol Handler registry.
Functions ¶
func HandlerExists ¶
HandlerExists checks whether a protocol Handler with specified string ID exists.
func ListHandlers ¶
func ListHandlers() []string
ListHandlers lists all protocol Handler string IDs.
Types ¶
type DTLSHandler ¶
type DTLSHandler struct {
// contains filtered or unexported fields
}
DTLSHandler represents a DTLS session handler
func (*DTLSHandler) AcceptClients ¶
func (D *DTLSHandler) AcceptClients(ctx context.Context) (<-chan ServerClient, error)
AcceptClients accepts new server clients
func (*DTLSHandler) Connect ¶
func (D *DTLSHandler) Connect(ctx context.Context, dest net.Addr, relay RelayInfo, forceTURN bool) (net.Conn, error)
Connect connects to a remote server directly or via TURN
func (*DTLSHandler) SetLogger ¶
func (D *DTLSHandler) SetLogger(log *slog.Logger)
SetLogger changes the slog logger instance
func (*DTLSHandler) Start ¶
func (D *DTLSHandler) Start(config config.ServerConfig) error
Start starts the server listener
type Handler ¶
type Handler interface {
ID() string // Returns the unique ID of this handler
Start(config config.ServerConfig) error // Starts the server listener
Stop() error // Stops the server listener
AcceptClients(ctx context.Context) (<-chan ServerClient, error) // Accepts new server clients
Connect(ctx context.Context, dest net.Addr, turn RelayInfo, forceTURN bool) (net.Conn, error) // Connects to a remote server directly or via TURN
SetLogger(log *slog.Logger) // Changes the slog logger instance
}
Handler represents a protocol handler
func GetHandler ¶
GetHandler fetches a protocol Handler by its string ID.
type NoneHandler ¶
type NoneHandler struct {
// contains filtered or unexported fields
}
NoneHandler passes traffic as raw UDP without any encryption or framing
func (*NoneHandler) AcceptClients ¶
func (N *NoneHandler) AcceptClients(_ context.Context) (<-chan ServerClient, error)
AcceptClients accepts new server clients
func (*NoneHandler) Connect ¶
func (N *NoneHandler) Connect(ctx context.Context, dest net.Addr, relay RelayInfo, forceTURN bool) (net.Conn, error)
Connect connects to a remote server directly or via TURN
func (*NoneHandler) SetLogger ¶
func (N *NoneHandler) SetLogger(log *slog.Logger)
SetLogger changes the slog logger instance
func (*NoneHandler) Start ¶
func (N *NoneHandler) Start(_ config.ServerConfig) error
Start starts the server listener
type RelayInfo ¶
type RelayInfo struct {
Address string // TURN server address
Addresses []string // All available TURN server addresses
Username string // TURN username
Password string // TURN password
}
RelayInfo describes the TURN server used to establish the packet underlay
type SRTPHandler ¶
type SRTPHandler struct {
// contains filtered or unexported fields
}
SRTPHandler disguises VPN traffic as WebRTC SRTP
func (*SRTPHandler) AcceptClients ¶
func (S *SRTPHandler) AcceptClients(ctx context.Context) (<-chan ServerClient, error)
AcceptClients accepts new server clients
func (*SRTPHandler) Connect ¶
func (S *SRTPHandler) Connect(ctx context.Context, dest net.Addr, relay RelayInfo, forceTURN bool) (net.Conn, error)
Connect connects to a remote server directly or via TURN
func (*SRTPHandler) SetLogger ¶
func (S *SRTPHandler) SetLogger(log *slog.Logger)
SetLogger changes the slog logger instance
func (*SRTPHandler) Start ¶
func (S *SRTPHandler) Start(cfg config.ServerConfig) error
Start starts the server listener