Violet - Lightweight STUN/TURN server

Overview

Violet - Lightweight STUN/TURN server

Violet is a lightweight STUN/TURN server (RFC8489 and RFC8656) based on libjuice.

Oompa-Loompas rolling Violet, from Charlie and the Chocolate Factory

"Mercy! Save us!" yelled Mrs Beauregarde. "[...] Violet, you’re turning violet, Violet!" [...]

"Squeeze her," said Mr Wonka. "We've got to squeeze the juice out of her immediately."

-- Charlie and the Chocolate Factory, Roald Dahl

Dependencies

None!

Building

Clone repository and submodules

$ git clone https://github.com/paullouisageneau/violet.git
$ cd violet
$ git submodule update --init --recursive

Building with CMake

$ cmake -B build
$ cd build
$ make -j2

Running

$ ./violet -c USER:PASSWORD
You might also like...
A Lightweight and fully asynchronous WebSocket client library based on libev

libuwsc(中文) A Lightweight and fully asynchronous WebSocket client library based on libev for Embedded Linux. And provide Lua-binding. Why should I cho

Lightweight, header-only, Boost-based socket pool library

Stream-client This is a lightweight, header-only, Boost-based library providing client-side network primitives to easily organize and implement data t

A lightweight firewall for nuttx

iptables-lite A lightweight firewall for nuttx Prerequisites The first step to get started with NuttX is to install a series of required tools. They c

Lightweight Python Web framework

fly Python lightweight web application framework. Event driven architecture. Usable as Web server and Application server. Lightweight and fast. Since

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line.

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

C++ framework for building lightweight HTTP interfaces
C++ framework for building lightweight HTTP interfaces

Pion Network Library C++ framework for building lightweight HTTP interfaces Project Home: https://github.com/rimmartin/pion-ng Documentation Retrievin

Sling - Lightweight C++ Signals and Slots implementation

sling sling is a lightweight C++ implementation of signals and slots. A slot is essentially a callback wrapper which can be created from different kin

Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation
Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift Introduction Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation. Thrift provides clean a

SimpleSockets is a lightweight set of classes that allow developers to implement IP based network programs.

------------------------------------------------------------------------------------------ * History -------------------------------------------------

Comments
  • Segmentation fault during TURN allocate request

    Segmentation fault during TURN allocate request

    Hello,

    I wanted to report a segmentation fault during a TURN allocate request. The bugs happens 4 times in a row. (out of 4 try, so every time). It happens when the connection is closing or when I start a second one.

    I'm creating the webrtc peer with libdatachannel and libjuice on one side:

    IceServer turn("160.98.47.137", 8000, "user", "password", IceServer::RelayType::TurnUdp);
    config.iceServers.emplace_back("stun:stun.1.google.com:19302");
    config.iceServers.emplace_back(turn);
    

    And on the web browser side:

    if (document.getElementById('use-stun').checked) {
        config.iceServers = [
        {
            urls: ['stun:stun.l.google.com:19302']
        },
        {
            urls: ['turn:160.98.47.137:8000'],
            username: 'user',
            credential: 'password'
        }
        ];
    }
    
    let pc = new RTCPeerConnection(config);
    

    Here is the log:

    Starting program: /opt/violet --file=example.conf
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    2021-07-28 17:41:03 DEBUG   udp.c:139: UDP socket bound to any:8000
    2021-07-28 17:41:03 INFO    server.c:235: Created server on port 8000
    [New Thread 0x7ffff7d39700 (LWP 5675)]
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 160.98.47.35:60510
    2021-07-28 17:41:11 DEBUG   server.c:607: Answering STUN unauthorized error response
    2021-07-28 17:41:11 DEBUG   server.c:717: Answering STUN error response with code 401
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 160.98.47.35:60510
    2021-07-28 17:41:11 DEBUG   server.c:752: Processing TURN Allocate request
    2021-07-28 17:41:11 DEBUG   udp.c:157: UDP socket bound to any:65275
    2021-07-28 17:41:11 INFO    server.c:869: Allocated TURN relayed address 160.98.47.137:65275 for client 160.98.47.35:60510
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 INFO    server.c:737: Got STUN binding from client 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:690: Answering STUN Binding request
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:607: Answering STUN unauthorized error response
    2021-07-28 17:41:11 DEBUG   server.c:717: Answering STUN error response with code 401
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:752: Processing TURN Allocate request
    2021-07-28 17:41:11 DEBUG   udp.c:157: UDP socket bound to any:65276
    2021-07-28 17:41:11 INFO    server.c:869: Allocated TURN relayed address 160.98.47.137:65276 for client 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:899: Processing STUN CreatePermission request
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:899: Processing STUN CreatePermission request
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:899: Processing STUN CreatePermission request
    2021-07-28 17:41:11 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:11 DEBUG   server.c:994: Processing STUN Send indication
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:12 DEBUG   server.c:994: Processing STUN Send indication
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:12 DEBUG   server.c:994: Processing STUN Send indication
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 160.98.47.35:60510
    2021-07-28 17:41:12 DEBUG   server.c:899: Processing STUN CreatePermission request
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 160.98.47.35:60510
    2021-07-28 17:41:12 DEBUG   server.c:994: Processing STUN Send indication
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:12 DEBUG   server.c:941: Processing STUN ChannelBind request
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:12 DEBUG   server.c:994: Processing STUN Send indication
    2021-07-28 17:41:12 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:12 DEBUG   server.c:994: Processing STUN Send indication
    2021-07-28 17:41:12 DEBUG   server.c:481: Received ChannelData datagram from 194.230.158.225:59603
    2021-07-28 17:41:15 DEBUG   server.c:467: Received STUN datagram from 194.230.158.225:59603
    2021-07-28 17:41:15 DEBUG   server.c:752: Processing TURN Allocate request
    
    Thread 2 "violet" received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0x7ffff7d39700 (LWP 4822)]
    0x000055555556537d in addr_get_len (sa=0x0) at /opt/violet_src/deps/libjuice/src/addr.c:26
    26		switch (sa->sa_family) {
    (gdb) list
    21	
    22	#include <stdio.h>
    23	#include <string.h>
    24	
    25	socklen_t addr_get_len(const struct sockaddr *sa) {
    26		switch (sa->sa_family) {
    27		case AF_INET:
    28			return sizeof(struct sockaddr_in);
    29		case AF_INET6:
    30			return sizeof(struct sockaddr_in6);
    (gdb) bt
    #0  0x000055555556537d in addr_get_len (sa=0x0) at /opt/violet_src/deps/libjuice/src/addr.c:26
    #1  0x0000555555565b6a in addr_to_string (sa=0x0, buffer=0x7ffff7d36d00 " }\323\367\377\177", size=64) at /opt/violet_src/deps/libjuice/src/addr.c:203
    #2  0x000055555556600e in addr_record_to_string (record=0x0, buffer=0x7ffff7d36d00 " }\323\367\377\177", size=64) at /opt/violet_src/deps/libjuice/src/addr.c:304
    #3  0x000055555555d267 in server_process_turn_allocate (server=0x555555582500, msg=0x7ffff7d370f0, src=0x7ffff7d37d20, credentials=0x555555583570)
        at /opt/violet_src/deps/libjuice/src/server.c:868
    #4  0x000055555555c5cc in server_dispatch_stun (server=0x555555582500, buf=0x7ffff7d37db0, size=124, msg=0x7ffff7d370f0, src=0x7ffff7d37d20)
        at /opt/violet_src/deps/libjuice/src/server.c:671
    #5  0x000055555555b9d1 in server_input (server=0x555555582500, buf=0x7ffff7d37db0 "", len=124, src=0x7ffff7d37d20) at /opt/violet_src/deps/libjuice/src/server.c:474
    #6  0x000055555555b44b in server_recv (server=0x555555582500) at /opt/violet_src/deps/libjuice/src/server.c:402
    #7  0x000055555555b0ba in server_run (server=0x555555582500) at /opt/violet_src/deps/libjuice/src/server.c:348
    #8  0x000055555555a2bb in server_thread_entry (arg=0x555555582500) at /opt/violet_src/deps/libjuice/src/server.c:111
    #9  0x00007ffff7fa6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
    #10 0x00007ffff7ecd293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
    

    And here is the configuration file that I used:

    log-level=debug
    
    # Port for STUN/TURN server
    port=8000
    
    # Port range for TURN relay
    range=49152:65535
    
    # TURN credentials with optional quota (default none)
    credentials=user:password
    

    Thank you for your work by the way.

    opened by peclatj 6
  • Docker image

    Docker image

    This project is super awesome. I would like to offer it as a coturn alternative for people that like to install my Open Source tool https://github.com/holtwick/briefing/

    Did you consider bundling it for Docker via https://hub.docker.com ? I think this would make it very attractive for regular users.

    opened by holtwick 4
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    paullouisageneau/violet now has a Chat Room on Gitter

    @paullouisageneau has just created a chat room. You can visit it here: https://gitter.im/libjuice/violet.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
Releases(v0.4.3)
  • v0.4.3(Dec 11, 2022)

    What's Changed

    • Add Dockerfile by @tinpotnick in https://github.com/paullouisageneau/violet/pull/14
    • Add CMake option to use libjuice from the system by @paullouisageneau in https://github.com/paullouisageneau/violet/pull/15
    • Updated libjuice to v1.1.0

    New Contributors

    • @tinpotnick made their first contribution in https://github.com/paullouisageneau/violet/pull/14

    Full Changelog: https://github.com/paullouisageneau/violet/compare/v0.4.2...v0.4.3

    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Oct 13, 2022)

  • v0.4.1(Aug 26, 2022)

  • v0.4.0(May 10, 2022)

Owner
Paul-Louis Ageneau
Computer engineer and computer science PhD. Network expert and tireless tinkerer. I'm open to contract missions, drop me an email if interested.
Paul-Louis Ageneau
Netstick client for Nintendo 3DS -- turn your portable console into a Linux compatible WiFi gamepad!

Netstick turns your 3DS into a wifi enabled gamepad! Control any linux-based device (such as a Raspberry Pi running Retropie) using your 3DS!

null 33 Oct 6, 2022
A lightweight plugin loader for Bedorck Dedicated Server

LiteLoader 简体中文 Donate us(afdian) Forum A lightweight Bedorck Dedicated Server Plugin Loader Based on BedrockX Install Download LiteLoader from Releas

null 574 Jan 2, 2023
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ <-> Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

null 48 Oct 13, 2022
Windows named pipe server that forwards connections to given TCP server

PipeTcp An asynchronous Windows named pipe server that forwards connections to given TCP server. Pre-built binaries can be found in Releases. Invocati

Jinoh Kang 5 Nov 3, 2022
A project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server.

PS4 Server 9.00 This is a project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server. this is fo

null 14 Nov 28, 2022
Doom classic port to lightweight RISC‑V

Doom classic port to lightweight RISC-V This is a port to try and make adapting/running doom to simple RISC-V platform easier with the code to adapt w

Sylvain 56 Dec 1, 2022
A lightweight Universal Windows proxy app based on https://github.com/eycorsican/leaf

Maple A lightweight Universal Windows proxy app based on https://github.com/eycorsican/leaf Features Configuration management Outbound network adapter

YtFlow 784 Jan 6, 2023
Ultra-lightweight web browser based on Qt Ultralight webview, powered by Ultralight HTML renderer

Qt Ultralight Browser This is an ultra-lightweight web browser powered by the Ultralight web engine embedded in Qt 5 app as a custom webview widget -

niu tech 43 Jan 7, 2023
HevSocks5Core is a simple, lightweight socks5 library

A simple, lightweight socks5 library. (IPv4/IPv6/TCP/UDP/Client/Server)

hev 19 Nov 22, 2022
a lightweight and performant multicast DNS (mDNS) reflector with modern design, supports zone based reflection and IPv6

mDNS Reflector mDNS Reflector (mdns-reflector) is a lightweight and performant multicast DNS (mDNS) reflector with a modern design. It reflects mDNS q

Yuxiang Zhu 90 Dec 10, 2022