Skip to content

Latest commit

 

History

History
95 lines (60 loc) · 3.53 KB

api.md

File metadata and controls

95 lines (60 loc) · 3.53 KB

REST API


GET - /info - Info

Info:

  • software - string - Software information of turn server
  • uptime - uint64 - Turn the server's running time in seconds
  • port_allocated - uint16 - The number of allocated ports
  • port_capacity - uint16 - The total number of ports available for allocation
  • interfaces - Interface[] - Turn all interfaces bound to the server

Interface:

  • transport - int - 0 = UDP, 1 = TCP
  • bind - string - turn server listen address
  • external - string - specify the node external address and port

Get the information of the turn server, including version information, listening interface, startup time, etc.


GET /session?address=&interface= - Session[]

Session:

  • address - string - The IP address and port number currently used by the session
  • username - string - Username used in session authentication
  • channels - uint16[] - Channel numbers that have been assigned to the session
  • port - uint16 - Port numbers that have been assigned to the session
  • expires - uint32 - The validity period of the current session application, in seconds
  • permissions - uint16[] - What ports have forwarding privileges for the session.

Get session information. A session corresponds to each UDP socket. It should be noted that a user can have multiple sessions at the same time.


GET - /session/statistics?address=&interface= - Statistics

Statistics:

  • received_bytes - uint64 - Number of bytes received in the current session
  • send_bytes - uint64 - The number of bytes sent by the current session
  • received_pkts - uint64 - Number of packets received in the current session
  • send_pkts - uint64 - The number of packets sent by the current session

Get session statistics, which is mainly the traffic statistics of the current session.


DELETE - /session?address=&interface=

Delete the session. Deleting the session will cause the turn server to delete all routing information of the current session. If there is a peer, the peer will also be disconnected.


GET - /events (EventSource)

This is an sse push event interface through which clients can subscribe to server events.

[Session]:

  • address - string - The IP address and port number of the UDP or TCP connection used by the client.
  • interface - string - The network interface used by the current session.

allocate:

  • session - Session
  • username - string - The username used for the turn session.
  • port - uint16 - The port to which the request is assigned.

channel binding:

  • session - Session
  • username - string - The username used for the turn session.
  • channel - uint16 - The channel to which the request is binding.

create permission:

  • session - Session
  • username - string - The username used for the turn session.
  • ports - uint16[] - The port number of the other side specified when the privilege was created.

refresh:

  • session - Session
  • username - string - The username used for the turn session.
  • lifetime - uint32 - Time to expiration in seconds.

closed:

  • session - Session
  • username - string - The username used for the turn session.