Documentation
¶
Overview ¶
Package relay opens one TURN allocation and keeps it alive.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAuthError ¶
func IsQuotaError ¶
Types ¶
type Allocation ¶
type Allocation struct {
// contains filtered or unexported fields
}
func (*Allocation) Close ¶
func (a *Allocation) Close() error
func (*Allocation) Keepalive ¶
func (a *Allocation) Keepalive(ctx context.Context, every time.Duration)
Keepalive sends STUN Binding requests until ctx ends; VK relays drop silent allocations well before the 10 minute lifetime.
func (*Allocation) Relayed ¶
func (a *Allocation) Relayed() net.PacketConn
func (*Allocation) RelayedAddr ¶
func (a *Allocation) RelayedAddr() net.Addr
type Options ¶
type Options struct {
Server string // host:port of the TURN relay
Username string
Password string
UDP bool // true: UDP transport (default and recommended); false: TCP
PeerIsIPv6 bool // request an IPv6 relayed address
Logger logging.LoggerFactory
// DialContext opens the socket towards the relay. nil uses the net
// package directly. It is called once per allocation with network "udp"
// (or "tcp" when UDP is false) and the resolved relay host:port; a UDP
// conn must be connected to that address, since it is driven as a
// PacketConn whose every write goes to the relay. Socket buffers are
// enlarged only when the returned conn is a *net.UDPConn. This is the
// hook a sing-box outbound uses for detour and bind_interface.
DialContext func(ctx context.Context, network, address string) (net.Conn, error)
}
Click to show internal directories.
Click to hide internal directories.