Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// UDP listener (TURN over UDP)
ListenAddr string
// TCP/TLS listeners (optional)
TCPListenAddr string
TLSListenAddr string
// TLS configuration (either provide Cert/Key files or TLSConfig)
TLSCertFile string
TLSKeyFile string
TLSConfig *tls.Config
// Public relay settings
PublicIP string
RelayMinPort uint16 // optional; if zero, default system range is used
RelayMaxPort uint16 // optional; if zero, default system range is used
Realm string
Users []User // static users
// Dynamic (REST) credentials
Dynamic *DynamicAuth
}
Config controls the TURN server.
ListenAddr is the local UDP address to bind, e.g. ":3478". PublicIP is the external/public IP address that peers will use to reach relays. RelayMinPort/RelayMaxPort control the relay port range. Realm is the authentication realm. Users is a static list of username/password pairs (long-term credential).
type DynamicAuth ¶
DynamicAuth enables time-limited credentials. Username is an expiry epoch (seconds), credential is base64(HMAC-SHA1(secret, username)). Requests are accepted if not expired and within MaxTTL.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a TURN server using pion/turn. It also handles STUN Binding requests on the same port.
func (*Server) GenerateRESTCredentials ¶
GenerateRESTCredentials returns (username, credential) for time-limited TURN auth.
func (*Server) ICEServerFor ¶
ICEServer returns a webrtc.ICEServer for a given static user. The PublicAddr should be the externally reachable host:port, i.e., PublicIP:port.