Giter Club home page Giter Club logo

udp2raw's Introduction

Udp2raw-tunnel

A Tunnel which turns UDP Traffic into Encrypted FakeTCP/UDP/ICMP Traffic by using Raw Socket, helps you Bypass UDP FireWalls(or Unstable UDP Environment).

When used alone,udp2raw tunnels only UDP traffic. Nevertheless,if you used udp2raw + any UDP-based VPN together,you can tunnel any traffic(include TCP/UDP/ICMP),currently OpenVPN/L2TP/ShadowVPN and tinyfecVPN are confirmed to be supported.

image0

or

image_vpn

udp2raw wiki

简体中文

Support Platforms

Linux host (including desktop Linux,Android phone/tablet,OpenWRT router,or Raspberry PI) with root account or cap_net_raw capability.

For Windows and MacOS users, use the udp2raw in this repo.

Features

Send/Receive UDP Packets with ICMP/FakeTCP/UDP headers

ICMP/FakeTCP headers help you bypass UDP blocking, UDP QOS or improper UDP NAT behavior on some ISPs. In ICMP header mode,udp2raw works like an ICMP tunnel.

UDP headers are also supported. In UDP header mode, it behaves just like a normal UDP tunnel, and you can just make use of the other features (such as encryption, anti-replay, or connection stabilization).

Simulated TCP with Real-time/Out-of-Order Delivery

In FakeTCP header mode,udp2raw simulates 3-way handshake while establishing a connection,simulates seq and ack_seq while data transferring. It also simulates a few TCP options such as: MSS, sackOk, TS, TS_ack, wscale. Firewalls will regard FakeTCP as a TCP connection, but its essentially UDP: it supports real-time/out-of-order delivery(just as normal UDP does), no congestion control or re-transmission. So there wont be any TCP over TCP problem when using OpenVPN.

Encryption, Anti-Replay

  • Encrypt your traffic with AES-128-CBC.
  • Protect data integrity by HMAC-SHA1 (or weaker MD5/CRC32).
  • Defense replay attack with anti-replay window.

Notes on encryption

Failure Dectection & Stabilization (Connection Recovery)

Conection failures are detected by heartbeats. If timed-out, client will automatically change port number and reconnect. If reconnection is successful, the previous connection will be recovered, and all existing UDP conversations will stay vaild.

For example, if you use udp2raw + OpenVPN, OpenVPN won't lose connection after any reconnect, even if network cable is re-plugged or WiFi access point is changed.

Other Features

  • Multiplexing One client can handle multiple UDP connections, all of which share the same raw connection.

  • Multiple Clients One server can have multiple clients.

  • NAT Support All of the 3 modes work in NAT environments.

  • OpenVZ Support Tested on BandwagonHost VPS.

  • Easy to Build No dependencies.To cross-compile udp2raw,all you need to do is just to download a toolchain,modify makefile to point at the toolchain,run make cross then everything is done.(Note:Pre-compiled binaries for Desktop,RaspberryPi,Android,some Openwrt Routers are already included in Releases)

Keywords

Bypass UDP QoS Bypass UDP Blocking Bypass OpenVPN TCP over TCP problem OpenVPN over ICMP UDP to ICMP tunnel UDP to TCP tunnel UDP over ICMP UDP over TCP

Getting Started

Installing

Download binary release from https://github.com/wangyu-/udp2raw-tunnel/releases

Running

Assume your UDP is blocked or being QOS-ed or just poorly supported. Assume your server ip is 44.55.66.77, you have a service listening on udp port 7777.

# Run at server side:
./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777    -k "passwd" --raw-mode faketcp -a

# Run at client side
./udp2raw_amd64 -c -l0.0.0.0:3333  -r44.55.66.77:4096  -k "passwd" --raw-mode faketcp -a

(The above commands need to be run as root. For better security, with some extra steps, you can run udp2raw as non-root. Check this link for more info )

Server Output:

Client Output:

Now,an encrypted raw tunnel has been established between client and server through TCP port 4096. Connecting to UDP port 3333 at the client side is equivalent to connecting to port 7777 at the server side. No UDP traffic will be exposed.

Note

To run on Android, check Android_Guide

-a option automatically adds an iptables rule (or a few iptables rules) for you, udp2raw relies on this iptables rule to work stably. Be aware you dont forget -a (its a common mistake). If you dont want udp2raw to add iptables rule automatically, you can add it manually(take a look at -g option) and omit -a.

Advanced Topic

Usage

udp2raw-tunnel
git version:6e1df4b39f    build date:Oct 24 2017 09:21:15
repository: https://github.com/wangyu-/udp2raw-tunnel

usage:
    run as client : ./this_program -c -l local_listen_ip:local_port -r server_address:server_port  [options]
    run as server : ./this_program -s -l server_listen_ip:server_port -r remote_address:remote_port  [options]

common options,these options must be same on both side:
    --raw-mode            <string>        avaliable values:faketcp(default),udp,icmp
    -k,--key              <string>        password to gen symetric key,default:"secret key"
    --cipher-mode         <string>        avaliable values:aes128cbc(default),xor,none
    --auth-mode           <string>        avaliable values:hmac_sha1,md5(default),crc32,simple,none
    -a,--auto-rule                        auto add (and delete) iptables rule
    -g,--gen-rule                         generate iptables rule then exit,so that you can copy and
                                          add it manually.overrides -a
    --disable-anti-replay                 disable anti-replay,not suggested
client options:
    --source-ip           <ip>            force source-ip for raw socket
    --source-port         <port>          force source-port for raw socket,tcp/udp only
                                          this option disables port changing while re-connecting
other options:
    --conf-file           <string>        read options from a configuration file instead of command line.
                                          check example.conf in repo for format
    --fifo                <string>        use a fifo(named pipe) for sending commands to the running program,
                                          check readme.md in repository for supported commands.
    --log-level           <number>        0:never    1:fatal   2:error   3:warn
                                          4:info (default)     5:debug   6:trace
    --log-position                        enable file name,function name,line number in log
    --disable-color                       disable log color
    --disable-bpf                         disable the kernel space filter,most time its not necessary
                                          unless you suspect there is a bug
    --sock-buf            <number>        buf size for socket,>=10 and <=10240,unit:kbyte,default:1024
    --force-sock-buf                      bypass system limitation while setting sock-buf
    --seq-mode            <number>        seq increase mode for faketcp:
                                          0:static header,do not increase seq and ack_seq
                                          1:increase seq for every packet,simply ack last seq
                                          2:increase seq randomly, about every 3 packets,simply ack last seq
                                          3:simulate an almost real seq/ack procedure(default)
                                          4:similiar to 3,but do not consider TCP Option Window_Scale,
                                          maybe useful when firewall doesnt support TCP Option
    --lower-level         <string>        send packets at OSI level 2, format:'if_name#dest_mac_adress'
                                          ie:'eth0#00:23:45:67:89:b9'.or try '--lower-level auto' to obtain
                                          the parameter automatically,specify it manually if 'auto' failed
    --gen-add                             generate iptables rule and add it permanently,then exit.overrides -g
    --keep-rule                           monitor iptables and auto re-add if necessary.implys -a
    --clear                               clear any iptables rules added by this program.overrides everything
    -h,--help                             print this help message

Iptables rules,-a and -g

This program sends packets via raw socket. In FakeTCP mode, Linux kernel TCP packet processing has to be blocked by a iptables rule on both sides, otherwise the kernel will automatically send RST for an unrecongized TCP packet and you will sustain from stability / peformance problems. You can use -a option to let the program automatically add / delete iptables rule on start / exit. You can also use the -g option to generate iptables rule and add it manually.

--cipher-mode and --auth-mode

It is suggested to use aes128cbc + hmac_sha1 to obtain maximum security. If you want to run the program on a router, you can try xor + simple, which can fool packet inspection by firewalls the most of time, but it cannot protect you from serious attacks. Mode none is only for debugging purpose. It is not recommended to set the cipher-mode or auth-mode to none.

--seq-mode

The FakeTCP mode does not behave 100% like a real tcp connection. ISPs may be able to distinguish the simulated tcp traffic from the real TCP traffic (though it's costly). seq-mode can help you change the seq increase behavior slightly. If you experience connection problems, try to change the value.

--lower-level

--lower-level allows you to send packet at OSI level 2(link level),so that you can bypass any local iptables rules. If you have a complicated iptables rules which conflicts with udp2raw and you cant(or too lazy to) edit the iptables rules,--lower-level can be very useful. Try --lower-level auto to auto detect the parameters,you can specify it manually if auto fails.

Manual format if_name#dest_mac_adress,ie:eth0#00:23:45:67:89:b9.

--keep-rule

Monitor iptables and auto re-add iptables rules(for blocking kernel tcp processing) if necessary.Especially useful when iptables rules may be cleared by other programs(for example,if you are using openwrt,everytime you changed and commited a setting,iptables rule may be cleared and re-constructed).

--conf-file

You can also load options from a configuration file in order to keep secrets away from ps command.

For example, rewrite the options for the above server example (in Getting Started section) into configuration file:

server.conf

-s
# You can add comments like this
# Comments MUST occupy an entire line
# Or they will not work as expected
# Listen address
-l 0.0.0.0:4096
# Remote address
-r 127.0.0.1:7777
-a
-k passwd
--raw-mode faketcp

Pay attention to the -k parameter: In command line mode the quotes around the password will be removed by shell. In configuration files we do not remove quotes.

Then start the server with

./udp2raw_amd64 --conf-file server.conf

--fifo

Use a fifo(named pipe) for sending commands to the running program. For example --fifo fifo.file.

At client side,you can use echo reconnect >fifo.file to force client to reconnect.Currently no command has been implemented for server.

Peformance Test

Test method:

iperf3 TCP via OpenVPN + udp2raw (iperf3 UDP mode is not used because of a bug mentioned in this issue: esnet/iperf#296 . Instead, we package the TCP traffic into UDP by OpenVPN to test the performance. Read Application for details.

iperf3 command:

iperf3 -c 10.222.2.1 -P40
iperf3 -c 10.222.2.1 -P40 -R

Environments

  • Client Vultr $2.5/monthly plan (single core 2.4GHz cpu, 512MB RAM, Tokyo, Japan)
  • Server BandwagonHost $3.99/annually plan (single core 2.0GHz cpu, 128MB RAM, Los Angeles, USA)

Test1

raw_mode: faketcp cipher_mode: xor  auth_mode: simple

image4

(reverse speed was simliar and not uploaded)

Test2

raw_mode: faketcp cipher_mode: aes128cbc  auth_mode: md5

image5

(reverse speed was simliar and not uploaded)

wiki

Check wiki for more info:

https://github.com/wangyu-/udp2raw-tunnel/wiki

udp2raw's People

Contributors

brlin-tw avatar broncotc avatar felixonmars avatar gek64 avatar harukama avatar higarfield avatar hsxx avatar jiangtiandao avatar king6cong avatar lance0 avatar ldir-edb0 avatar linusyang avatar petercxy avatar t123yh avatar wangyu- avatar yuchoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

udp2raw's Issues

想问下这个支持BBR吗

如题,最近在用BBR,效果还不错,比KC简单,不知道能不能配合这个一起搞事情?

Random handshake failure

Hello, I've been trying to use this project to tunnel my OpenVPN connections. However, it appears that udp2raw-tunnel will randomly fail on the handshake stage: either the client or the server (or both) will be stuck at sending SYN packets to each other but never finishing that process. For example,

screenshot_20170812_163846
screenshot_20170812_163856

Without any changes to the network configurations, simply try to restart the server / client several times, and the client will connect without any problem.

At first I believed that this might be some sort of problem of time synchronization, thus I tried to synchronize the time on the server and client and made sure that the current timestamp on the server and client are as close as possible, but the problem remains. The RTT from my server to the client is ~80ms. What is strange is that if the connection is set up for one time, then reconnecting the client will not cause any further failures, but restarting the server might bring the problem back on.

I'm not sure if this is reproducible for others, therefore I am posting it here in case that someone may run into the same problem. I still think this is something about time but I can still not figure out where exactly the problem exists.

AES with hardware acceleration on 64-bit platforms

It seems the AES crypto library used in this project (i.e. tiny-AES-c) lacks support of hardware acceleration, while mainstream crypto libraries (e.g. OpenSSL, mbedTLS) support.

I have created a fork with hardware-accelerated AES crypto on x86_64 and arm64. The assembly code is basically taken from PolarSSL/mbedTLS. The code passed the original test in tiny-AES-c. And I have preliminarily tested the udp2raw binary which seems to work. But I didn't do more test or benchmarks.

I also made a fork to automatically build static binaries using Docker. The binaries are linked against Musl Libc which is smaller and more portable than Glibc. The prebuilt binaries are available here.


懒人版:貌似现在用的AES加密库没有硬件加速,我从mbedTLS抄了点汇编代码,可以在64位Intel和ARM上硬件加速。初步测试是可用的,不知道有没有兴趣合并?

使用反馈

坐标:魔都电信 50M光纤
服务端: vultr 2.5刀的vps 架设ss+kcptun+udp2raw
客户端: win7 x64 virtualbox上运行udp2raw 主机上运行ss+kcptun

原始只在vps上跑ss加bbr,一个月前服务器丢包率和延迟暴增(美东的服务器比我朋友美西的还高),改用锐速优化参数后稍微有所改善,但速度仍不满意。改用kcptun,速度明显改善但很不稳定。
用iperf3测试了下udp丢包,丢包率基本在30以上,高峰时期甚至几乎全丢。
qq 20170908011251

前几天使用udp2raw后丢包情况明显改善,(想利用iperf3发udp包通过udp2raw-tunnel测试,发现连接不了,但iperf3->kcptun->udp2raw-tunnel->kcptun->iperf3 可以进行测试,- -技术小白弄不懂其中原因)。只能用youtube统计比较粗略的看
ss+锐速: 1500kbps,高峰时基本不能用。。。
ss+kcp:不稳定但峰值能到30000kbps 平均有30%丢包率且加载很不均匀
ss+kcp+udp2raw:20000kbps 与kcptun服务端:sndwnd和rcvwnd参数基本符合。用了3-4天目前仍旧稳定,。
kcptun的参数:
"client" -r -key "XXX" -crypt aes-192 -nocomp -datashard 30 -parityshard 15 -mtu 1300 -sndwnd 1024 -rcvwnd 1024 -dscp 46 -keepalive 10 -sockbuf 4194304 -mode fast2
"server" -r -key "XXX" -crypt aes-192 -nocomp -datashard 30 -parityshard 15 -mtu 1300 -sndwnd 2048 -rcvwnd 2048 -dscp 46 -keepalive 10 -sockbuf 4194304 -mode fast2 -nc 1 -resend 2 -
使用过程中发现几个问题:
1:kcp服务端的sndwnd rcvwnd在512 512 和 1024 1024时速度比只用kcptun慢很多。后直接调成2048 2048后速度和只用kcptun差不多。
2:udp2raw自动生产的iptables规则好像有点问题-a无法添加参数,-g导出后看了看,手动添加,报错有iptables不能识别的参数。
3:vultr控制面板cpu usage 用了kcptun+udp2raw后一直显示是100%。。。,但用top命令查看 kcp只有5%,udp2raw 10%,这是什么原因?

cpu占用太高了

现在在路由器上跑了ssr,kcptun,还有udp2raw,一看视频,cpu占用那个高啊,而且似乎udp2raw的占用是最高的,能不能使用一些低强度的加密算法,或者可以允许用户选择低强度的加密算法,来降低一些cpu的占用?

openvz+vmware用faketcp不通

环境:
服务器端:openvz+centos6.8_x64+kcptun
客户端:win7+openwrt12.09_x86_vmware_image_with_udp2raw_pre_installed

1.--raw-mode用faketcp不通
2.--raw-mode用udp可以通,说明整个配置是没问题的
3.用ssh服务测试的
4.-a 参数去掉也不行
5.命令是完全参照示例里写的,没有添加其它参数
6.我不确定是否和openvz有关,只是猜测

faketcp 模式下 宿主机防火墙如何设置?

尝试放通 server 监听端口的 tcp
log 显示
[INFO] (re) sent tcp syn
[ERROR] ]xx.xxx.xxx.xxx,xxxxx]rst==1


测试发现 --net=host 参数 不再需要 只需要开放tcp 监听端口 即可
镜像内安装 iptables 后 -a 也可用 需要 --cap-add=NET_ADMIN 以便添加 iptables

udp2raw+finalspeed总断,但是只用finalspeed就不会断

环境:Ubuntu 16 x64
使用udp2raw+finalspeed就会总断,而且Youtube基本处于各种链接失败,下载100M测试文件也就能下载几M就断掉了,但是只用finalspeed就不会断。
测试网络:公司的千兆电信网络,肯定是没有问题的。

`/root/udp2raw# ./udp2raw_amd64 -c -r123.xxx.xxx.xxx:250 -l127.0.0.1:150 --raw-mode faketcp -a -k"passwd"
[2017-09-06 11:18:31][INFO]argc=8 ./udp2raw_amd64 -c -r123.xxx.xxx.xxx:250 -l127.0.0.1:150 --raw-mode faketcp -a -kpasswd
[2017-09-06 11:18:31][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=md5 key=passwd local_ip=127.0.0.1 local_port=150 remote_ip=123.xxx.xxx.xxx remote_port=250 source_ip=0.0.0.0 source_port=0 socket_buf_size=1048576
[2017-09-06 11:18:31][INFO]const_id:124708f8
[2017-09-06 11:18:31][INFO]run_command iptables -N udp2rawDwrW_124708f8_C0
[2017-09-06 11:18:31][INFO]run_command iptables -F udp2rawDwrW_124708f8_C0
[2017-09-06 11:18:31][INFO]run_command iptables -I udp2rawDwrW_124708f8_C0 -j DROP
[2017-09-06 11:18:31][INFO]run_command iptables -I INPUT -s 123.xxx.xxx.xxx/32 -p tcp -m tcp --sport 250 -j udp2rawDwrW_124708f8_C0
[2017-09-06 11:18:31][WARN]auto added iptables rules
[2017-09-06 11:18:31][INFO]get_src_adress called
[2017-09-06 11:18:31][INFO]source ip = 12.34.56.78
[2017-09-06 11:18:31][INFO]using port 18474
[2017-09-06 11:18:31][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:18:31]INFOsent tcp syn
[2017-09-06 11:18:31][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:18:31]INFOsent handshake1
[2017-09-06 11:18:32][INFO]changed state from to client_handshake1 to client_handshake2,my_id is f122fec7,oppsite id is 1ec8977a
[2017-09-06 11:18:32]INFOsent handshake2
[2017-09-06 11:18:32][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:18:41][INFO]new packet from 127.0.0.1:44620,conv_id=599db6e5
[2017-09-06 11:18:56][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:18:56][INFO]using port 26895
[2017-09-06 11:18:56][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:18:56]INFOsent tcp syn
[2017-09-06 11:18:56][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:18:56]INFOsent handshake1
[2017-09-06 11:18:56][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 7dd80add,oppsite id is 236819
[2017-09-06 11:18:56]INFOsent handshake2
[2017-09-06 11:18:57][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:19:11][INFO]state back to client_idle from client_ready bc of server-->client direction timeout
[2017-09-06 11:19:11][INFO]using port 21565
[2017-09-06 11:19:11][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:19:11]INFOsent tcp syn
[2017-09-06 11:19:11][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:19:11]INFOsent handshake1
[2017-09-06 11:19:11][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 4145dd4e,oppsite id is e9e40a67
[2017-09-06 11:19:11]INFOsent handshake2
[2017-09-06 11:19:11][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:19:26][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:19:26][INFO]using port 52940
[2017-09-06 11:19:26][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:19:26]INFOsent tcp syn
[2017-09-06 11:19:26][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:19:26]INFOsent handshake1
[2017-09-06 11:19:26][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 6c529f13,oppsite id is 66366d0e
[2017-09-06 11:19:26]INFOsent handshake2
[2017-09-06 11:19:27][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:19:45][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:19:45][INFO]using port 64820
[2017-09-06 11:19:45][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:19:45]INFOsent tcp syn
[2017-09-06 11:19:45][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:19:45]INFOsent handshake1
[2017-09-06 11:19:45][INFO]changed state from to client_handshake1 to client_handshake2,my_id is b84d3396,oppsite id is c08e3b73
[2017-09-06 11:19:45]INFOsent handshake2
[2017-09-06 11:19:45][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:20:00][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:20:00][INFO]using port 58303
[2017-09-06 11:20:00][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:20:00]INFOsent tcp syn
[2017-09-06 11:20:00][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:20:00]INFOsent handshake1
[2017-09-06 11:20:00][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 27188b95,oppsite id is 5fb9e176
[2017-09-06 11:20:00]INFOsent handshake2
[2017-09-06 11:20:01][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:20:43][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:20:43][INFO]using port 50055
[2017-09-06 11:20:43][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:20:43]INFOsent tcp syn
[2017-09-06 11:20:43][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:20:43]INFOsent handshake1
[2017-09-06 11:20:43][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 52cc974,oppsite id is 9d59182c
[2017-09-06 11:20:43]INFOsent handshake2
[2017-09-06 11:20:44][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:20:58][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:20:59][INFO]using port 43114
[2017-09-06 11:20:59][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:20:59]INFOsent tcp syn
[2017-09-06 11:20:59][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:20:59]INFOsent handshake1
[2017-09-06 11:20:59][INFO]changed state from to client_handshake1 to client_handshake2,my_id is e4233512,oppsite id is 97459974
[2017-09-06 11:20:59]INFOsent handshake2
[2017-09-06 11:20:59][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:21:10][INFO]state back to client_idle from client_ready bc of server-->client direction timeout
[2017-09-06 11:21:11][INFO]using port 44153
[2017-09-06 11:21:11][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:21:11]INFOsent tcp syn
[2017-09-06 11:21:11][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:21:11]INFOsent handshake1
[2017-09-06 11:21:11][INFO]changed state from to client_handshake1 to client_handshake2,my_id is a496edf1,oppsite id is 1d3e48ab
[2017-09-06 11:21:11]INFOsent handshake2
[2017-09-06 11:21:11][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:21:27][INFO]state back to client_idle from client_ready bc of server-->client direction timeout
[2017-09-06 11:21:27][INFO]using port 63132
[2017-09-06 11:21:27][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:21:27]INFOsent tcp syn
[2017-09-06 11:21:27][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:21:27]INFOsent handshake1
[2017-09-06 11:21:27][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 89a343be,oppsite id is 38daf0d7
[2017-09-06 11:21:27]INFOsent handshake2
[2017-09-06 11:21:28][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:21:42][INFO]state back to client_idle from client_ready bc of server-->client direction timeout
[2017-09-06 11:21:43][INFO]using port 22838
[2017-09-06 11:21:43][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:21:43]INFOsent tcp syn
[2017-09-06 11:21:43][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:21:43]INFOsent handshake1
[2017-09-06 11:21:43][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 4966d771,oppsite id is b9d42eea
[2017-09-06 11:21:43]INFOsent handshake2
[2017-09-06 11:21:43][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:22:36][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:22:36][INFO]using port 56794
[2017-09-06 11:22:36][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:22:36]INFOsent tcp syn
[2017-09-06 11:22:36][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:22:36]INFOsent handshake1
[2017-09-06 11:22:36][INFO]changed state from to client_handshake1 to client_handshake2,my_id is a444a924,oppsite id is 628983a7
[2017-09-06 11:22:36]INFOsent handshake2
[2017-09-06 11:22:37][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:22:51][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:22:51][INFO]using port 22902
[2017-09-06 11:22:51][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:22:51]INFOsent tcp syn
[2017-09-06 11:22:52][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:22:52]INFOsent handshake1
[2017-09-06 11:22:52][INFO]changed state from to client_handshake1 to client_handshake2,my_id is e07372b2,oppsite id is 121bbb83
[2017-09-06 11:22:52]INFOsent handshake2
[2017-09-06 11:22:52][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:23:09][INFO]state back to client_idle from client_ready bc of server-->client direction timeout
[2017-09-06 11:23:09][INFO]using port 33424
[2017-09-06 11:23:09][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:23:09]INFOsent tcp syn
[2017-09-06 11:23:09][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:23:09]INFOsent handshake1
[2017-09-06 11:23:09][INFO]changed state from to client_handshake1 to client_handshake2,my_id is f76fcdfc,oppsite id is d88ff9ea
[2017-09-06 11:23:09]INFOsent handshake2
[2017-09-06 11:23:10][INFO]changed state from to client_handshake2 to client_ready
[2017-09-06 11:23:33][INFO]conv 599db6e5 cleared
[2017-09-06 11:23:48][INFO]state back to client_idle from client_ready bc of client-->server direction timeout
[2017-09-06 11:23:49][INFO]using port 33698
[2017-09-06 11:23:49][INFO]state changed from client_idle to client_tcp_handshake
[2017-09-06 11:23:49]INFOsent tcp syn
[2017-09-06 11:23:49][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-09-06 11:23:49]INFOsent handshake1
[2017-09-06 11:23:49][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 1bfbcc4c,oppsite id is e882bac0
[2017-09-06 11:23:49]INFOsent handshake2
[2017-09-06 11:23:49][INFO]changed state from to client_handshake2 to client_ready
^C[2017-09-06 11:24:05][INFO]epoll interrupted by signal

[2017-09-06 11:24:05][INFO]run_command iptables -D INPUT -s 123.xxx.xxx.xxx/32 -p tcp -m tcp --sport 250 -j udp2rawDwrW_124708f8_C0
[2017-09-06 11:24:05][INFO]run_command iptables -F udp2rawDwrW_124708f8_C0
[2017-09-06 11:24:05][INFO]run_command iptables -X udp2rawDwrW_124708f8_C0
`

Security risks regarding to root privileges

As is discussed in #25, it is not necessary to run the whole program as root. On modern Linux witn Capabilities support, CAP_NET_RAW and CAP_NET_ADMIN are enough for this program to run without root. Root will bring possible security exploits.

Therefore, the following workarounds are hereby proposed:

  1. Package the program properly for mainstream package managers (rpm, deb, etc.) with necessary capabilities granted by default (The AUR package and udp2raw-tunnel in archlinuxcn have already implemented this)
  2. Don't mention the need for root permission (except android / openwrt) in documents
  3. Add a warning to stdout when uid=0
  4. If possible, switch to nobody as soon as possible on start
  5. Do not invoke shell commands inside the program. Instead, make use of netfilter APIs.

Extremely low throughput

After fixing #6, the udp2raw handshake works without any problem and both sides could reach the ready state.

However, when trying to encapsulate OpenVPN tunnel over udp2raw, I observed that the throughput became extremely slow as the following picture shows

screenshot_20170813_193446

A normal HTTP download from my server to the client can get ~150Mbps and a Shadowsocks server running on non-standard TCP port (>20000) could get ~80Mbps. Though you mentioned that iperf has some problem in UDP speedtests, I also ran a test with bare iperf UDP over udp2raw and it showed similar results to the above TCP over OpenVPN over udp2raw one.

I have checked my OpenVPN configuration and added the IMPORTANT fields marked in your guide but nothing changed. Switching to OpenVPN TCP mode and tunneling it through shadowsocks could reach at least 50Mbps, and even QoS'ed UDP on my local network can reach at least 10Mbps+ (Tested by connecting to OpenVPN inside CERNET from my home network).

However, I haven't seen anyone experiencing similar issues for now. Not even sure if it is really something about udp2raw-tunnel.

FakeTCP 模式下,端口可以复用吗?

比如,我用 443 端口,这一个端口可以同时用 udp2raw-tunnel 和 nginx(ssl) 吗?

因为我看 udp2raw-tunnel 加入 iptables 的规则其实是 drop 掉包,如果不 drop,这些包可以正常到 nginx 去吗? 就是实现 udp2raw-tunnel 和 https 服务器同时工作,都用 443 端口

不知道这样行不行?

实验配合**R使用,**R无法连接,求教

现在情况是,服务器 server_ready,客户端 client_ready,确认 udp2raw 可用
服务器上安装了监听 80 端口的 **R,udp2raw 设置用 443 端口交流,转发流量至 80 端口
./udp2raw_amd64 -s -l0.0.0.0:443 -r127.0.0.1:80 -k"passwd" --raw-mode faketcp -a

客户端用的是 VirtualBox,地址 192.168.31.238,监听端口 8678
./udp2raw_x86_asm_aes -c -r服务器IP:443 -l0.0.0.0:8678 --raw-mode faketcp -a -k”passwd”

**R 客户端直连 服务器IP:80 可以正常使用,但是连接 192.168.31.238:8678 无法使用
求教哪里配置出错了,谢谢

虚拟机使用 NAT 网卡时存在连接后断线的问题,请用桥接模式.(unstable on NAT mode virutal machine,stick to bridged mode plz)

基本信息

  • 宿主机系统: Ubuntu 16.04
  • 虚拟机宿主软件: VirtualBox 5.1.26
  • 虚拟机内操作系统: Ubuntu 16.04 Server
  • 虚拟机网卡模式: NAT
  • udp2raw 版本: 20170809.0
  • 宿主机防火墙: 关闭
  • 虚拟机防火墙:
    执行 ufw status verbose 的输出:
    Status: active
    Logging: on(low)
    Default: allow (incoming), allow (outgoing), deny (routed)
    ...
    

问题描述

在宿主机内运行 udp2raw 并将某软件设定为把 UDP 流量发送到 udp2raw 后,可以正常使用。
使用了如下命令行参数:

  • 客户端: sudo ./udp2raw_amd64 -c -l 127.0.0.1:12345 -r <server_ip>:<server_port> -a -k "密钥" --raw-mode faketcp
  • 服务器端: sudo ./udp2raw_amd64 -s -l <server_ip>:<server_port> -r 127.0.0.1:12345 -a -k "密钥" --raw-mode faketcp

在虚拟机内使用上面相同的命令行参数,会导致: 大多数情况下 TCP 握手成功后没多久就会重新回到 idle 状态然后又重新开始握手,就这样循环。下面是日志。

客户端日志

root@ubuntu-vm:~# /usr/bin/v2ray/udp2raw_amd64 -c -l 127.0.0.1:12345 -r <server_ip>:<server_port> -a -k "密钥" --raw-mode faketcp
[2017-08-12 18:04:35][INFO]argc=11 /usr/bin/v2ray/udp2raw_amd64 -c -l 127.0.0.1:12345 -r <server_ip>:<server_port> -a -k 密钥 --raw-mode faketcp                                                                     
[2017-08-12 18:04:35][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=crc32 key=密钥 local_ip=127.0.0.1 local_port=12345 remote_ip=<server_ip> remote_port=<server_port> source_ip=0.0.0.0 source_port=0 socket_buf_size=1048576                                                      
[2017-08-12 18:04:35][INFO]const_id:9714f62                                                                  
[2017-08-12 18:04:35][WARN]auto added iptables rule by:  iptables -I INPUT -s <server_ip>/32 -p tcp -m tcp --sport <server_port> -j DROP -m comment --comment udp2raw_dWRwMnJhdw_9714f62_2017-08-12-18:04:35                     
[2017-08-12 18:04:35][INFO]get_src_adress called
[2017-08-12 18:04:35][INFO]source ip = 10.0.2.15                                                             
[2017-08-12 18:04:35][INFO]using port 26485                                                                  
[2017-08-12 18:04:35][INFO]state changed from client_idle to client_tcp_handshake                            
[2017-08-12 18:04:35][INFO](re)sent tcp syn                                                                  
[2017-08-12 18:04:35][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-08-12 18:04:35][INFO](re)sent handshake1
[2017-08-12 18:04:35][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 1fbaddb9,oppsite id is d24e337c
[2017-08-12 18:04:35][INFO](re)sent handshake2
[2017-08-12 18:04:36][INFO]changed state from to client_handshake2 to client_ready
// 从这里开始, 某软件开始向 udp2raw 发送 UDP 包
[2017-08-12 18:04:36][INFO]new packet from 127.0.0.1:46811,conv_id=64985eee
[2017-08-12 18:04:38][INFO]new packet from 127.0.0.1:57660,conv_id=e42401b2
[2017-08-12 18:04:44][INFO]new packet from 127.0.0.1:42744,conv_id=e1f83deb
[2017-08-12 18:04:44][INFO]new packet from 127.0.0.1:32847,conv_id=2c10165
[2017-08-12 18:04:46][INFO]new packet from 127.0.0.1:46727,conv_id=3b823eb8
[2017-08-12 18:04:54][INFO]new packet from 127.0.0.1:52044,conv_id=b41c1778
[2017-08-12 18:04:54][INFO]new packet from 127.0.0.1:41828,conv_id=30405002
[2017-08-12 18:04:54][INFO]new packet from 127.0.0.1:47710,conv_id=3f6ae6a0
[2017-08-12 18:04:56][INFO]state back to client_idle from  client_ready bc of send-direction timeout
[2017-08-12 18:04:56][INFO]using port 28558
[2017-08-12 18:04:56][INFO]state changed from client_idle to client_tcp_handshake
[2017-08-12 18:04:56][INFO](re)sent tcp syn
[2017-08-12 18:04:56][INFO]state changed from client_tcp_handshake to client_handshake1
[2017-08-12 18:04:56][INFO](re)sent handshake1
[2017-08-12 18:04:57][INFO]changed state from to client_handshake1 to client_handshake2,my_id is 4f25bcd3,oppsite id is 21242b51
[2017-08-12 18:04:57][INFO](re)sent handshake2
[2017-08-12 18:04:57][INFO]changed state from to client_handshake2 to client_ready
^C[2017-08-12 18:05:02][INFO]epoll interrupted by signal

[2017-08-12 18:05:02][WARN]iptables rule cleared by: iptables -D INPUT -s <server_ip>/32 -p tcp -m tcp --sport <server_port> -j DROP -m comment --comment udp2raw_dWRwMnJhdw_9714f62_2017-08-12-18:04:35

服务器端日志

root@ubuntu-remote-server:~# /usr/bin/udp2raw-tunnel/udp2raw_amd64 -s -l <server_ip>:<server_port> -r 127.0.0.1:12345 -a -k "密钥" --raw-mode faketcp
[2017-08-12 10:04:33][INFO]argc=11 /usr/bin/udp2raw-tunnel/udp2raw_amd64 -s -l <server_ip>:<server_port> -r 127.0.0.1:12345 -a -k 密钥 --raw-mode faketcp 
[2017-08-12 10:04:33][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=crc32 key=密钥 local_ip=<server_ip> local_port=<server_port> remote_ip=127.0.0.1 remote_port=12345 source_ip=0.0.0.0 source_port=0 socket_buf_size=1048576 
[2017-08-12 10:04:33][INFO]const_id:db10ea89
[2017-08-12 10:04:33][WARN]auto added iptables rule by:  iptables -I INPUT -p tcp -m tcp --dport <server_port> -j DROP -m comment --comment udp2raw_dWRwMnJhdw_db10ea89_2017-08-12-10:04:33
[2017-08-12 10:04:35][INFO][ISP的IP:ISP的端口]received syn,sent syn ack back
[2017-08-12 10:04:35][INFO][ISP的IP:ISP的端口]got packet from a new ip
[2017-08-12 10:04:35][INFO][ISP的IP:ISP的端口]created new conn,state: server_handshake1,my_id is d24e337c
[2017-08-12 10:04:35][INFO][ISP的IP:ISP的端口]changed state to server_handshake1,my_id is d24e337c
[2017-08-12 10:04:36][INFO][ISP的IP:ISP的端口]received handshake oppsite_id:1fbaddb9  my_id:d24e337c
[2017-08-12 10:04:36][INFO][ISP的IP:ISP的端口]oppsite const_id:9714f62 
[2017-08-12 10:04:36][INFO][ISP的IP:ISP的端口]changed state to server_ready
[2017-08-12 10:04:56][INFO][ISP的IP:ISP的端口 新的]received syn,sent syn ack back
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]got packet from a new ip
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]created new conn,state: server_handshake1,my_id is 21242b51
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]changed state to server_handshake1,my_id is 21242b51
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]received handshake oppsite_id:4f25bcd3  my_id:21242b51
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]oppsite const_id:9714f62 
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]grabbed a connection
[2017-08-12 10:04:57][INFO][ISP的IP:ISP的端口 新的]inactive conn cleared 
^C[2017-08-12 10:05:06][INFO]epoll interrupted by signal

[2017-08-12 10:05:06][WARN]iptables rule cleared by: iptables -D INPUT -p tcp -m tcp --dport <server_port> -j DROP -m comment --comment udp2raw_dWRwMnJhdw_db10ea89_2017-08-12-10:04:33

烦请开发者分析该问题的原因以及解决办法。

nohup命令无法让进程在后台运行

nohup 命令可以在后台运行,但只要C或S任一断开了ssh链接,则失效,是nohup命令的问题?但之前用与net-speeder时又是正常的说-。-

nohup ./udp2raw_amd64 -s -l 0.0.0.0:2323 -r 127.0.0.1:65022 -a -k "123456" --raw-mode faketcp --cipher xor >./udp2raw.log 2>&1 &

nohup ./udp2raw_arm -c -r 112.112.51.222:2323 -l 0.0.0.0:65022 --raw-mode faketcp -k "123456" --lower-level ppp0#00:00:00:00:00:00 --cipher xor >./udp2raw.log 2>&1 &

udp2raw如何在Docker 中使用?

测试发现 --net=host 参数 不再需要 只需要开放tcp 监听端口 即可
镜像内安装 iptables 后 -a 也可用 需要 --cap-add=NET_ADMIN 以便添加 iptables

编译失败

怎么报 undefined reference to `__gxx_personality_v0' 错误
32位Ubuntu

在路由上加速kcp的疑问

想在已经跑了kcp的ac68u上运行,假设服务器ip 23.23.223.223,ss端口443,kcp端口666,ss密码为a,kcp密码为b,服务器上的运行参数是?
./udp2raw_amd64 -s -l0.0.0.0:443 -r 127.0.0.1:666 -k "b" --raw-mode faketcp -a

68u参数是?
./udp2raw_arm -c -r 23.23.223.223:443 -l0.0.0.0:666 --raw-mode faketcp -a -k "b"

请教:CPU是BCM4708型号的选哪个文件

查了下,68U的CPU型号是BCM4708,20170818.0 release包里面有两个类似的文件:udp2raw_bcm2708,和udp2raw_arm,那么,BCM4708的CPU选哪个比较适合?(在openwrt页面是有bcm47XX的资源,但自编译手残档看说明也不是很懂(; ̄ェ ̄))

关于facktcp模式下实际上建立的UDP连接数的问题

请问一下作者,在facktcp下实际上建立的UDP连接是只能单连接么,还是可以实现多条连接分拆传输?

这种需要多条连接的场景在多播以及双线网络中用途很大,比如在我的网络中同时有电信和联通的出口,上层路由随机选择一个出口和外界进行通讯(一般是基于tcp session之类的),如果这里可以建立多个facktcp连接就可以充分理由两个出口同时和服务器进行通讯,从而有效的提高传输效率

iptables把服务端的端口DROP了,也能连通

iptables把服务端的端口DROP了,为了只让自己特定的IP连,然而其他IP也能连通,这是为什么?
另外客户端的key和服务端不一致也能连通,不过会有很多丢包.

命令只加了--cipher-mode none,其他和github里的列子一样

Windows下vmware虚拟机里面运行udp2raw,无法加速kcptun

操作系统:windows 10 pro x64
udp2raw版本:0826 X86
kcptun版本:20170525
vmware版本:VMware® Workstation 12 Pro
vmware网络:NAT模式 网关192.168.88.1
openwrt ip:192.168.88.130

openwrt跑在虚拟机,kcptun运行在主机,指向openwrt的udp2raw地址192.168.88.130:3334
报sent tcp syn错误,并且不停的在握手,请问大神有可能是什么原因?

我在路由器上跑udp2raw,kcptun指向路由上的udp2raw是没有问题的。

2017-09-04_131833

希望能弄个 luci-app-udp2raw-tunnel

目前只有一个 ar71xx 的二进制程序,不方便设置和使用。
移植到 openwrt/lede 的 Makefile 容易写,但是不懂lua语音,写不出 luci 界面,请帮忙,谢谢。

Tunnel traffic "firefox"

Hello , i need some help to tunnel all the traffic using udp2raw i excuted udp2raw in the server and in the client but i have no clue how i can tunnel the traffic in firefox , thx for the project

进一步讨论机制问题

你好,我是v站的s82kd92l,咱一起讨论过udp2raw细节问题。这两天看了下代码,也仔细回味了一下。架构上有些建议:

  1. 三次握手根本不需要我们自己完成,我们可以开一个普通的tcp socket和服务器进行初始握手,一切都由内核完成,之后再劫持这个socket进行隧道通信。

  2. 只要有个原生tcp socket,就不再需要"iptables -I INPUT" 这种dirty hack. 我们可以在本地利用setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL,...)这种接口,让原生socket在握手之后发送的包ttl变小,这样原生socket无法收到对方发出的内容,也就不需要iptables了。

有新想法我再加

Does it "handle" TCP traffic automatically?

Which is to say, if I want to use mixed TCP/UDP traffic through this while leveraging the "faketcp" feature, would it work, or do I need something (VPN, udptunnel, etc.) to first "convert" the TCP connections to UDP?

开机无法自动运行

开机无法自动运行,包括使用 nohup 和 screen 命令启动。只有通过 SSH 启动后,通过 exit 退出才能后台运行。

SO_SNDBUFFORCE fail

root@hello:~# ./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777 -a -k "passwd" --raw-mode faketcp
[2017-08-31 22:26:54][INFO]argc=10 ./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777 -a -k passwd --raw-mode faketcp
[2017-08-31 22:26:54][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=md5 key=passwd local_ip=0.0.0.0 local_port=4096 remote_ip=127.0.0.1 remote_port=7777 source_ip=0.0.0.0 source_port=0 socket_buf_size=1048576
[2017-08-31 22:26:54][INFO]const_id:bccc2e1b
[2017-08-31 22:26:54][INFO]run_command iptables -N udp2rawDwrW_bccc2e1b_C0
[2017-08-31 22:26:54][INFO]run_command iptables -F udp2rawDwrW_bccc2e1b_C0
[2017-08-31 22:26:54][INFO]run_command iptables -I udp2rawDwrW_bccc2e1b_C0 -j DROP
[2017-08-31 22:26:54][INFO]run_command iptables -I INPUT -p tcp -m tcp --dport 4096 -j udp2rawDwrW_bccc2e1b_C0
[2017-08-31 22:26:54][WARN]auto added iptables rules
[2017-08-31 22:26:54][FATAL]SO_SNDBUFFORCE fail

[2017-08-31 22:26:54][INFO]run_command iptables -D INPUT -p tcp -m tcp --dport 4096 -j udp2rawDwrW_bccc2e1b_C0
[2017-08-31 22:26:54][INFO]run_command iptables -F udp2rawDwrW_bccc2e1b_C0
[2017-08-31 22:26:54][INFO]run_command iptables -X udp2rawDwrW_bccc2e1b_C0

-h说明的auth cipher mode写错了吧

--auth-mode           <string>        avaliable values:aes128cbc(default),xor,none
--cipher-mode         <string>        avaliable values:md5(default),crc32,simple,none

enum cipher_mode_t {cipher_none=0,cipher_aes128cbc,cipher_xor,cipher_end};
unordered_map<int, const char *> cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}};

lower-level的问题

如果用了--lower-level选项。server虽然还可以bind在0.0.0.0,但是因为你显式指定了网络接口,就只能工作在这一个网络接口了。

这句话是什么意思?只能工作在这一个网络接口,表示我不能通过其他ip来连接运行udp2raw的机器了吗?

SSH tunnel

i Established a faketcp channel between my vps and my machine , so now can tunnel using ssh ??? and how ????

Contribution Guide

1.Better automation for --lower-level option (done)

Many connection issues are caused by in-compatible iptables rules. --lower-level enables the ablity to bypass any local iptables rules,so that one can use udp2raw in any complicated environment without worrying about iptables .However,currently,--lower-level option needs user to specify if_name and dest_mac_adress manually,for example: --lower-level eth0#00:23:45:67:89:b9.
we need to get this automatically for specific ip.Such a function need to be implemented:

int get_lower_level_info(IN u32_t ip,OUT char * if_name,OUT uint8_t hw_addr[6])
{
/* parse /proc/net/route  and /proc/net/arp */
return 0;
}

To implement this,you only need to parse /proc/net/route and /proc/net/arp.This will be not hard but some patient is needed.You will write some code of string parsing and route pre_fix search. If you implement this,i can get everything esle done,or you can implement everything by yourself.

(There is also a better way . You can get those info without parsing strings by using ioctl/sysctl ,any method is okay,as long as its robust.)

I will give more details if anyone is interested.

2.Implement a GUI for andoird.

Currently udp2raw works stablely on rooted android device,however there is no GUI.Need to make an andoird app to wrap android binary to provide better experience.Only android experience is necessary.

3.Implement luci-app-udp2raw-tunnel (done)

Implement luci-app-udp2raw-tunnel to wrap openwrt binary.
repo at:
https://github.com/sensec/luci-app-udp2raw
thanks @sensec

4.Support PolarSSL or OpenSSL (maybe not necessary any more,since we already have hardware/asm aes acceleration for almost all common platforms )

Support PolarSSL or OpenSSL while keep tiny-AES-c supported

5.hardware/asm AES acceleration for MIPS and ARM (done)

Support this without using PolarSSL or OpenSSL if possible.For easier compilation.

great thx to @linusyang,this has been done.

6.BSD system(include MacOs) support (done)

Need to change epoll to kqueue or libuv. iptables rules to PF rules.
done. check https://github.com/wangyu-/udp2raw-multiplatform

7.Windows support (complicated) (done)

epoll to libevent libuv. raw socket to winpcap.Find a way to disable windows kernel processing of tcp for specific port.
done. check https://github.com/wangyu-/udp2raw-multiplatform

8. crypto

Implement HMAC-md5 (to replace plain md5) , Encryp-then-MAC scheme. (done) HMAC-SHA1 is supported instead. Encryp-then-MAC scheme is used.

AEAD support ( optional ).

Currently encryption is mainly implement in encrypt.cpp,which contains of only 300 lines of code(not include aes and md5 implemention).

You can get start from the following two functions:

int my_encrypt(const char *data,char *output,int &len,char * key)

int my_decrypt(const char *data,char *output,int &len,char * key)

9. domain support and ipv6 support

10.http and https obfuscate

pretend to use http/https protocol,to bypass special Qos

11.peformance optimize

especially for eliminating those unnecessary memcpy()s
capture

12. share port with other tcp programs

In a way similiar to https://github.com/yrutschle/sslh .
Complicated, since raw socket is involved.

Discussions at: https://github.com/wangyu-/udp2raw-tunnel/issues/131

13. allow udp2raw to run without iptables

details at:

https://github.com/wangyu-/udp2raw-tunnel/issues/9

linhua55/lkl_study#11

(done in udp2raw-multiplatform)

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.