Documentation
¶
Index ¶
- Variables
- func HandlerExists(name string) bool
- func ListHandlers() []string
- func WithMasking(ctx context.Context) context.Context
- type DTLSHandler
- func (D *DTLSHandler) AcceptClients(ctx context.Context) (<-chan ServerClient, error)
- func (D *DTLSHandler) Connect(ctx context.Context, dest net.Addr, relay TURNInfo, forceTURN bool) (net.Conn, error)
- func (D *DTLSHandler) ID() string
- func (D *DTLSHandler) SetLogger(log *slog.Logger)
- func (D *DTLSHandler) Start(listenAddr string) error
- func (D *DTLSHandler) Stop() error
- type Handler
- type MaskState
- type NoneHandler
- func (N *NoneHandler) AcceptClients(_ context.Context) (<-chan ServerClient, error)
- func (N *NoneHandler) Connect(ctx context.Context, dest net.Addr, relay TURNInfo, forceTURN bool) (net.Conn, error)
- func (N *NoneHandler) ID() string
- func (N *NoneHandler) SetLogger(log *slog.Logger)
- func (N *NoneHandler) Start(_ string) error
- func (N *NoneHandler) Stop() error
- type SRTPHandler
- func (S *SRTPHandler) AcceptClients(ctx context.Context) (<-chan ServerClient, error)
- func (S *SRTPHandler) Connect(ctx context.Context, dest net.Addr, relay TURNInfo, forceTURN bool) (net.Conn, error)
- func (S *SRTPHandler) ID() string
- func (S *SRTPHandler) SetLogger(log *slog.Logger)
- func (S *SRTPHandler) Start(listenAddr string) error
- func (S *SRTPHandler) Stop() error
- type ServerClient
- type TURNInfo
Constants ¶
This section is empty.
Variables ¶
var ErrTURNRejected = errors.New("turn server rejected request")
ErrTURNRejected indicates a TURN server rejected a request, so its credentials must be replaced
var Handlers = common.NewRegistry[Handler]()
Handlers represents protocol Handler registry
Functions ¶
func HandlerExists ¶
HandlerExists checks whether a protocol Handler with specified string ID exists
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 TURNInfo, 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(listenAddr string) error
Start starts the server listener
type Handler ¶
type Handler interface {
ID() string // Returns the unique ID of this handler
Start(listenAddr string) 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 TURNInfo, 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 MaskState ¶
type MaskState interface {
Masked() bool
}
MaskState reports whether a conn negotiated masking; implemented by protocol conns
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 TURNInfo, 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(_ string) error
Start starts the server listener
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 TURNInfo, 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(listenAddr string) error
Start starts the server listener
type ServerClient ¶
ServerClient represents an accepted client session