All Projects → iceonsun → Rsock

iceonsun / Rsock

The best companion of kcptun

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Rsock

Blinksocks
A framework for building composable proxy protocol stack.
Stars: ✭ 587 (+142.56%)
Mutual labels:  tcp, shadowsocks, udp
Mirror
#1 Open Source Unity Networking Library
Stars: ✭ 2,905 (+1100.41%)
Mutual labels:  libuv, tcp, udp
Netlink
Socket and Networking Library using msgpack.org[C++11]
Stars: ✭ 197 (-18.6%)
Mutual labels:  tcp, udp, cross-platform
Lan Share
Cross platform LAN File transfer application built with Qt C++ framework
Stars: ✭ 317 (+30.99%)
Mutual labels:  tcp, udp, cross-platform
Proxy admin free
Proxy是高性能全功能的http代理、https代理、socks5代理、内网穿透、内网穿透p2p、内网穿透代理、内网穿透反向代理、内网穿透服务器、Websocket代理、TCP代理、UDP代理、DNS代理、DNS加密代理,代理API认证,全能跨平台代理服务器。
Stars: ✭ 487 (+101.24%)
Mutual labels:  tcp, shadowsocks, udp
Hp Socket
High Performance TCP/UDP/HTTP Communication Component
Stars: ✭ 4,420 (+1726.45%)
Mutual labels:  tcp, udp, cross-platform
ccxx
This is a cross-platform library software library about c, c ++, unix4, posix. Include gtest, benchmark, cmake, process lock, daemon, libuv, lua, cpython, re2, json, yaml, mysql, redis, opencv, qt, lz4, oci ... https://hub.docker.com/u/oudream
Stars: ✭ 31 (-87.19%)
Mutual labels:  tcp, udp, libuv
Leaf
A lightweight and fast proxy utility tries to include any useful features.
Stars: ✭ 530 (+119.01%)
Mutual labels:  tcp, shadowsocks, udp
Packetsender
Network utility for sending / receiving TCP, UDP, SSL
Stars: ✭ 1,349 (+457.44%)
Mutual labels:  tcp, udp, cross-platform
Qtswissarmyknife
QSAK (Qt Swiss Army Knife) is a multi-functional, cross-platform debugging tool based on Qt.
Stars: ✭ 196 (-19.01%)
Mutual labels:  tcp, udp
Computer Networking
Free resources for a self-taught education in Computer Networking
Stars: ✭ 201 (-16.94%)
Mutual labels:  tcp, udp
Hprose Html5
Hprose is a cross-language RPC. This project is Hprose 2.0 Client for HTML5
Stars: ✭ 237 (-2.07%)
Mutual labels:  tcp, cross-platform
Hazel Networking
Hazel Networking is a low level networking library for C# providing connection orientated, message based communication via TCP, UDP and RUDP.
Stars: ✭ 194 (-19.83%)
Mutual labels:  tcp, udp
Httpcanary
A powerful capture and injection tool for the Android platform
Stars: ✭ 2,188 (+804.13%)
Mutual labels:  tcp, udp
Python Nat Hole Punching
UDP and TCP NAT hole punching examples in python
Stars: ✭ 190 (-21.49%)
Mutual labels:  tcp, udp
Fq Book
📖《这本书能让你连接互联网》详细阐述代理、隧道、VPN运作过程,并对GFW策略如:地址端口封锁、服务器缓存投毒、数字验证攻击、SSL连接阻断做相关的原理说明
Stars: ✭ 2,393 (+888.84%)
Mutual labels:  tcp, shadowsocks
Asio2
Header only c++ network library, based on asio,support tcp,udp,http,websocket,rpc,ssl,icmp,serial_port.
Stars: ✭ 202 (-16.53%)
Mutual labels:  tcp, udp
Frpc Android
Android,安卓版frpc,一个快速反向代理,可帮助您将NAT或防火墙后面的本地服务器暴露给Internet。
Stars: ✭ 205 (-15.29%)
Mutual labels:  tcp, udp
Ohsce
PHP HI-REL SOCKET TCP/UDP/ICMP/Serial .高可靠性PHP通信&控制框架SOCKET-TCP/UDP/ICMP/硬件Serial-RS232/RS422/RS485 AND MORE!
Stars: ✭ 206 (-14.88%)
Mutual labels:  tcp, udp
Network
C# Network Library
Stars: ✭ 237 (-2.07%)
Mutual labels:  tcp, udp

Build Status Build status Downloads


Introduction

中文请点击这里.

rsock is neither accelerator, nor vpn. It merely turns a udp connection into multiple fake tcp connections, or multiple normal udp connections or both. It's very similar with udp because it's not reliable and has no flow control, timeout retransmission algorithms, etc. It's cross platform. It's supposed to used together with kcptun or other udp client with ARQ. The purpose of rsock is that prevent qos to udp from ISP if any. It supports Windows, Mac and Linux. To see introduction and usage of kcptun click here . And shadowsocks, click here .

REPEAT: Data transfer of rsock is NOT reliable. Reliable data tranfer should be taked care of by app level(kcptun).

The following picture brifely shows principles

Installation

There are precompiled binaries for 64bit Linux, 64bit Mac and x86/x64 windows. They can be downloaded from here.

For Windows users, you have to install winpcap first. winpcap

For other platforms, you can download source code and compile it by yourself. Compilation guide is here

Quick start

Server

Remember to add firewall rule if firewall enabled.

Take Linux as an exmaple:

# port=10000
# while [ $port -le 10010 ]
do
sudo ufw allow $port
port=$[ $port + 1]
done

It means allow client connects to server from port 10000 to 10010. (rsock use port range 10001-10010 by default. If you want to change the default value, please check Parameter Explanation section.)

sudo ./server_rsock_Linux -t 127.0.0.1:9999

Parameter explanation:

127.0.0.1:9999, target address,aka address of kcptun server working on.

Client

Take mac as an example:

sudo ./client_rsock_Darwin --taddr=x.x.x.x -l 127.0.0.1:30000

Parameter explanation:

-t x.x.x.x , Address of rsock server。Attention. This is different from server. It only contains ip.

-l , local listened udp address, aka target address of kcptun client(the address specified by -t).

NOTE

  1. If rsock doesn't work, you have to check whether your NIC supoorts winpcap. And routers may also filter packets, especially when you use Windows.

  2. For Windows users, speed is far slow than rsock on mac/Linux. (500-800KB/s during my test) e.g. On Mac/Linux, rsock can support to watch 1080P youtube video smoothly. For windows users, rsock can only support 720P youtube video.

Exit

ps axu|grep rsock

sudo kill -SIGUSR1 pid # pid is id of rsock. It's 72294 in image above.

Parameters in detail


	-t, --taddr=[addr]		target address. e.g. 8.8.8.8:88,7.7.7.7. Required.
	-l, --ludp=[addr]		local listened udp address. Only valid for client. Required by client.
	-d, --dev=[device]		name of network interface card of Internet.e.g,eth0, en0. rsock can auto detect right device to work on. Use this when the default can't work.
	-h, --help			Display help menu. Not available now.
	-f				json config file
	--lcapIp=[ip]			Internet IP. Can omit the -d if this parameter sepcified. rsock can auto detect right device to work on. Use this when the default can't work.
	--unPath			Local unix domain socket. Not available now.
	-p, --ports=[...]		tcp/udp port list for rsock server. e.g.10001,10010(2 ports); 10001-10010(11 ports); 80,443,10001-10010(12 ports). **NO** white spaces allowed. Default value: 10001-10010
	--duration=[timeSec]		Time for app connection to persist if no data is transfered in the app connection. unit: seconds. defalt 30s
	--hash=[hashKey]		Not for encryption. Only for judgement if data belong to rsock. REPEAT: rsock don't encrypt data. Encryption is done by kcptun.
	--type=[tcp|udp|all]		type of communication. One of tcp, udp or all. Default is tcp.
	--daemon=[1|0]			Run as daemon. 1 yes. 0 no. default 1.
	-v				verbose mode. (Better not change default value. There is an unsolved bug that will cause slow speed right now)
	--log=[path/to/log]		Directory of log. Will create if not exist. Default: /var/log/rsock
	--cap_timeout			timeout of libpcap. Don't change this value if know what it really means.

Principle

  1. Server listens on some ports. (tcp 10001-10010, 10 ports by default)
  2. Client connects to all of server ports.
  3. For each of communications, client send data by libnet to one of server ports, which should have been connected.
  4. Server receive data by libpcap. It's same for server to send data to client. Now they make communication.
  5. For application, local_ip:app_udp_port and server_ip:app_udp_port make a connection。If no data flows thourgh this connection for a period of time(default 30s), it will be closed.
  6. When client receive rst or fin, it will close that real network connection and reconnect to server.

Disadvantage

Under tcp mode, since we don't send/recv data from socket, it will send an ack with 0 length, telling peer next seq it expects. This due to standard. And that will waste bandwith.

Comparison

Comparing objects:rsock, kcptun

Server test environment

digitalocean NY vps. 1G RAM

Client test environment 1. digitalocean Singaport vps.

rsock(tcp only, 11 ports). 1.25M

rsock(udp only, 11 ports). 1.5M

rsock(doc/tcp and udp, 11 ports each. 1.1M

kcptun. The fastest, around 1.5MB.

Client test environment 1. China telecom with 100Mb downloading and 10Mb upload speed.

rsock(tcp only, 11 ports). 1.4M

rsock(udp only, 11 ports. 1.7M

rsock(udp and tcp, 11 ports each)900K. I've tested twice. The speed is slower.

kcptun. extremely fast. Around 2MB.

note: There is no evidence that more ports rsock use, the faster it is. It's mainly determined by your bandwith.

Conclusion

rsock only has 70%-90% speed of kcptun.

Note

If you find no network connection, please check if rsock and kcptun still running.

You can run flowing commands to check:

ps axu|egrep 'kcptun|rsock'

It is strongly recommended that kcptun server and rsock server run in background. For kcptun server, run

nohup sudo -u nobody ./server_linux_amd64 -r ":port1" -l ":port2" -mode fast2 -key aKey >/dev/null 2>&1 &

For rsock server, only need to specify parameter --daemon=1

If servers run normally, try to restart kcptun client(turn shadowsocks on/off, this will restart kcptun).

rsock DOES NOT encrypt data. Encrption happens in app level(kcptun).

Other projects

udp2raw-tunnel

kcptun-raw

icmptunnel

TODO

  1. Refactor code.

  2. Add randomize port listening.

  3. Add idle mode. Don't repeatedly connect to server if no data for a period.

  4. Add other fake conn. e.g. ICMP, DNS.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].