Giter Club home page Giter Club logo

doturn's Introduction

doturn

A C#(.NET Core) implementation of STUN/TURN

doturn's People

Contributors

kadoshita avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

doturn's Issues

docs/Flowchart

graph TD
    Start --> STUN_MESSAGE_CHECK{Is STUN Message?};
    STUN_MESSAGE_CHECK --> |No| CHANNEL_NUMBER_CHECK{Has Channel Number?};
    CHANNEL_NUMBER_CHECK --> |Yes| SEND_APP_DATA_TO_PEER[Send Application Data to peer];
    CHANNEL_NUMBER_CHECK --> |No| FROM_PEER_CHECK{Receive From Peer?};
    FROM_PEER_CHECK --> |Yes| HAS_CHANNEL_NUMBER_CHECK{Has Channel Number?};
    HAS_CHANNEL_NUMBER_CHECK --> |Yes| SEND_CHANNEL_DATA_TO_CLIENT[Send Channel Data to client];
    HAS_CHANNEL_NUMBER_CHECK --> |No| SEND_DATA_INDICATE_TO_CLIENT[Send Data Indication to client];
    FROM_PEER_CHECK --> |No| UNKNOWN_DATA[Unknown Data];
    STUN_MESSAGE_CHECK --> |Binding Request| SEND_BIDING_RESPONSE[Send Binding Success/Error Response];
    STUN_MESSAGE_CHECK --> |Allocate Request| IS_CORRECT_USER_CHECK{Is Correct User?};
    IS_CORRECT_USER_CHECK --> |Yes| STORE_CLIENT_ENDPOINT[Store client endpoint];
    IS_CORRECT_USER_CHECK --> |No| SEND_ALLOCATE_ERROR_RESPONSE[Send Allocate Error Respoinse];
    STORE_CLIENT_ENDPOINT --> SEND_ALLOCATE_SUCCESS_RESPONSE[Send Allocate Success Response];
    STUN_MESSAGE_CHECK --> |Create Permission Request| IS_CLIENT_ENDPOINT_STORED_CHECK{Is client endpoint stored?};
    IS_CLIENT_ENDPOINT_STORED_CHECK --> |YES| STORE_PEER_ENDPOINT[Store peer endpoint];
    IS_CLIENT_ENDPOINT_STORED_CHECK --> |No| SEND_CREATE_PERMISSION_ERROR_RESPONSE[Send Create Permission Error Response];
    STORE_PEER_ENDPOINT --> SEND_CREATE_PERMISSION_SUCCESS_RESPONSE[Send Create Permission Success Response];
    STUN_MESSAGE_CHECK --> |Refresh Request| LIFETIME_ZERO_CHECK{Lifetime is 0?};
    LIFETIME_ZERO_CHECK --> |Yes| TERMINATE_CONNECTION[Terminate Connection];
    LIFETIME_ZERO_CHECK --> |No| SEND_REFRESH_RESPONSE[Send Refresh Success/Error Response];
    STUN_MESSAGE_CHECK --> |Channel Bind Request| STORE_CHANNEL_NUMBER_AND_PEER_ENDPOINT[Store Channel Number and Peer endpoint];
    STORE_CHANNEL_NUMBER_AND_PEER_ENDPOINT --> SEND_CHANEL_BIND_RESPONSE[Send Channel Bind Success/Error Response];
    STUN_MESSAGE_CHECK --> |Send Indicate| HAS_PERMISSION_CHECK{Has Permission?};
    HAS_PERMISSION_CHECK --> |Yes| P[Send Application Data to peer];
    HAS_PERMISSION_CHECK --> |No| UNKNOWN_DATA[Unknown Data];

TURNServer_Flowchart

TURNの実装

とりあえずパケットを受け取ってみる

docs/初めてTURNが動いた(かも?)のログ

turnutils_uclient -v -u username -w password host.docker.internal -y -s -X
0: : IPv4. Connected from: 172.19.0.2:60853
0: : IPv4. Connected from: 172.19.0.2:60853
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected to: 192.168.65.2:3478
0: : allocate sent
0: : allocate sent
0: : allocate response received:
0: : allocate response received:
0: : success
0: : success
0: : IPv4. Received relay addr: 127.0.0.1:49152
0: : IPv4. Received relay addr: 127.0.0.1:49152
0: : clnet_allocate: rtv=0
0: : clnet_allocate: rtv=0
0: : refresh sent
0: : refresh sent
0: : refresh response received:
0: : refresh response received:
0: : success
0: : success
0: : IPv4. Connected from: 172.19.0.2:41428
0: : IPv4. Connected from: 172.19.0.2:41428
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected from: 172.19.0.2:36830
0: : IPv4. Connected from: 172.19.0.2:36830
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected from: 172.19.0.2:54656
0: : IPv4. Connected from: 172.19.0.2:54656
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected from: 172.19.0.2:53678
0: : IPv4. Connected from: 172.19.0.2:53678
0: : IPv4. Connected to: 192.168.65.2:3478
0: : IPv4. Connected to: 192.168.65.2:3478
0: : allocate sent
0: : allocate sent
0: : allocate response received:
0: : allocate response received:
0: : success
0: : success
0: : IPv4. Received relay addr: 127.0.0.1:49153
0: : IPv4. Received relay addr: 127.0.0.1:49153
0: : clnet_allocate: rtv=0
0: : clnet_allocate: rtv=0
0: : refresh sent
0: : refresh sent
0: : refresh response received:
0: : refresh response received:
0: : success
0: : success
0: : allocate sent
0: : allocate sent
0: : allocate response received:
0: : allocate response received:
0: : success
0: : success
0: : IPv4. Received relay addr: 127.0.0.1:49154
0: : IPv4. Received relay addr: 127.0.0.1:49154
0: : clnet_allocate: rtv=0
0: : clnet_allocate: rtv=0
0: : refresh sent
0: : refresh sent
0: : refresh response received:
0: : refresh response received:
0: : success
0: : success
0: : allocate sent
0: : allocate sent
0: : allocate response received:
0: : allocate response received:
0: : success
0: : success
0: : IPv4. Received relay addr: 127.0.0.1:49155
0: : IPv4. Received relay addr: 127.0.0.1:49155
0: : clnet_allocate: rtv=0
0: : clnet_allocate: rtv=0
0: : refresh sent
0: : refresh sent
0: : refresh response received:
0: : refresh response received:
0: : success
0: : success
0: : allocate sent
0: : allocate sent
0: : allocate response received:
0: : allocate response received:
0: : success
0: : success
0: : IPv4. Received relay addr: 127.0.0.1:49156
0: : IPv4. Received relay addr: 127.0.0.1:49156
0: : clnet_allocate: rtv=0
0: : clnet_allocate: rtv=0
0: : refresh sent
0: : refresh sent
0: : refresh response received:
0: : refresh response received:
0: : success
0: : success
0: : create perm sent: 127.0.0.1:49155
0: : create perm sent: 127.0.0.1:49155
0: : cp response received:
0: : cp response received:
0: : success
0: : success
0: : create perm sent: 127.0.0.1:49156
0: : create perm sent: 127.0.0.1:49156
0: : cp response received:
0: : cp response received:
0: : success
0: : success
0: : create perm sent: 127.0.0.1:49153
0: : create perm sent: 127.0.0.1:49153
0: : cp response received:
0: : cp response received:
0: : success
0: : success
0: : create perm sent: 127.0.0.1:49154
0: : create perm sent: 127.0.0.1:49154
0: : cp response received:
0: : cp response received:
0: : success
0: : success
0: : Total connect time is 0
0: : Total connect time is 0
1: : start_mclient: msz=4, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: : start_mclient: msz=4, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: : start_mclient: msz=4, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: : start_mclient: msz=4, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: : start_mclient: msz=4, tot_send_msgs=5, tot_recv_msgs=5, tot_send_bytes ~ 500, tot_recv_bytes ~ 500
3: : start_mclient: msz=4, tot_send_msgs=5, tot_recv_msgs=5, tot_send_bytes ~ 500, tot_recv_bytes ~ 500
4: : start_mclient: msz=4, tot_send_msgs=10, tot_recv_msgs=10, tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000
4: : start_mclient: msz=4, tot_send_msgs=10, tot_recv_msgs=10, tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000
5: : start_mclient: msz=4, tot_send_msgs=15, tot_recv_msgs=15, tot_send_bytes ~ 1500, tot_recv_bytes ~ 1500
5: : start_mclient: msz=4, tot_send_msgs=15, tot_recv_msgs=15, tot_send_bytes ~ 1500, tot_recv_bytes ~ 1500
5: : done, connection 0x7fc90000a010 closed.
5: : done, connection 0x7fc90000a010 closed.
5: : done, connection 0x7fc8fffe9010 closed.
5: : done, connection 0x7fc8fffe9010 closed.
5: : done, connection 0x7fc8fffc8010 closed.
5: : done, connection 0x7fc8fffc8010 closed.
5: : done, connection 0x7fc90002b010 closed.
5: : done, connection 0x7fc90002b010 closed.
5: : start_mclient: tot_send_msgs=20, tot_recv_msgs=20
5: : start_mclient: tot_send_msgs=20, tot_recv_msgs=20
5: : start_mclient: tot_send_bytes ~ 2000, tot_recv_bytes ~ 2000
5: : start_mclient: tot_send_bytes ~ 2000, tot_recv_bytes ~ 2000
5: : Total transmit time is 5
5: : Total transmit time is 5
5: : Total lost packets 0 (0.000000%), total send dropped 0 (0.000000%)
5: : Total lost packets 0 (0.000000%), total send dropped 0 (0.000000%)
5: : Average round trip delay 1.400000 ms; min = 0 ms, max = 7 ms
5: : Average round trip delay 1.400000 ms; min = 0 ms, max = 7 ms
5: : Average jitter 1.300000 ms; min = 0 ms, max = 5 ms
5: : Average jitter 1.300000 ms; min = 0 ms, max = 5 ms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.