Git Product home page Git Product logo

kcptun-libev's Introduction

kcptun-libev

MIT License Build Downloads Release

A powerful and extremely lightweight encrypted port forwarder based on reliable UDP protocol.

Status: Stable

User Wiki

Introduction

kcptun-libev is a TCP port forwarder which converts the actual transferring protocol into a UDP based one, called KCP. KCP is more configurable and usually has a much better performance in a lossy but not really congested network. This project can help you to get better bandwidth in such situation.

For example, wrap your server to use KCP instead of TCP:

client -> kcptun-libev client ->
    lossy network (carried by KCP)
-> kcptun-libev server -> server

Or typically, the people who using a lossy network may setup kcptun-libev with a proxy server. To get the internet access speeded up.

network access -> proxy client -> kcptun-libev client ->
    lossy network (carried by KCP)
-> kcptun-libev server -> proxy server -> stable network

Reliable UDP can also help users connect to TCP services behind NAT, see rendezvous mode.

client -> NAT1 -> rendezvous server
server -> NAT2 -> rendezvous server

client -> NAT1 -> NAT2 -> server

Since KCP retransmits packets more aggressively. It is recommended to enable proper QoS at the NIC level when running on a public network.

Read more about KCP

Features

  • Secure: For proper integration with the cryptography methods.
  • Responsive: No muxer, one TCP connection to one KCP connection with 0 RTT connection open.
  • Proper: KCP will be flushed on demand, no mechanistic lag introduced.
  • Simple: Do one thing well. kcptun-libev only acts as a layer 4 forwarder.
  • Morden: Full IPv6 support.
  • DDNS aware: Dynamic IP addresses can be automatically resolved.
  • NAT traversal: Server behind certain types of NAT can be connected directly with the help of a well-known rendezvous server.
  • Configurable: If you plan to use with another encryption implementation (such as udp2raw, wireguard, etc.), encryption can be completely disabled or even excluded from build.
  • Portable: Compliant with ISO C standard. Support both GNU/Linux and POSIX APIs.

There is a previous implementation of kcptun which is written in Go.

Compared to that, kcptun-libev should be much more lightweight. The main executable is around 100~200KiB on most platforms* and it also have a much lower cpu/mem footprint.

* Some required libraries are dynamically linked, see runtime dependencies below. Statically linked executable can be larger due to these libraries.

For your convenience, some statically-linked executables are also provided in the Releases section.

Security

Encryption

kcptun-libev can encrypt packets with a password or pre-shared key. Security and privacy can only be guaranteed if encryption is enabled. We use the authenticated encryption methods provided by libsodium.

In config file:

"method": "// name here"

If the encryption is not enabled or not even compiled, no packet overhead is consumed. However, no authentication tag is added to protect the server from well-crafted packets by an attacker. In this case, security relies on third-party components. We recommend that users only disable encryption when unexpected packets cannot be received. For example: the traffic is already protected by Wireguard etc.

In practice, we suggest user to use --genpsk command-line argument to generate a strong random pre-shared key instead of using a simple password.

Encryption Method Since Form Packet Overhead Notes
xchacha20poly1305_ietf v1.0 AEAD 40 bytes recommended
xsalsa20poly1305 v2.2 AE 40 bytes
chacha20poly1305_ietf v2.0 AEAD 28 bytes
aes256gcm v2.0 AEAD 28 bytes limited hardware*

* Specifically: x86 CPU with SSSE3, aesni and pclmul.

kcptun-libev ships with additional encryption methods to ensure that users have alternatives for specific reasons. Although the strength of each method is discussed, in most cases the recommended one just works.

Obfuscation

The obfuscator is an optional tool to fool eavesdroppers. This feature is only available on Linux.

In config file:

"obfs": "// name here"

Currently only one obfuscator implemented: dpi/tcp-wnd. It behaves like a HTTP service and cannot be probed without knowing the pre-shared key.

With obfuscator enabled, kcptun-libev will directly send IP packets over raw sockets. Therefore, Linux capability CAP_NET_RAW is required. For example, the following command may works on some Linux distributions:

# run as root and drop privileges after necessary setup
sudo ./kcptun-libev -u nobody:nogroup -c server.json
# or grant the capability and run as a normal user
sudo setcap cap_net_raw+ep kcptun-libev
./kcptun-libev -c server.json

Compatibility

System

Theoretically all systems that support ISO C11 and POSIX.1-2008.

System Tier Notes
Ubuntu developed
OpenWRT tested
Other Linux / Android supported
macOS supported without obfuscator
Windows (MSYS2) supported without obfuscator

Version Compatibility

For security reasons, kcptun-libev does NOT provide compatibility to any other KCP implementations.

We use semantic versioning.

Given a version number MAJOR.MINOR.PATCH:

  • As long as MAJOR remains unchanged, the versions should speak a compatible protocol.

  • As long as MAJOR.MINOR remains unchanged, later versions should be compatible with working configuration files from previous versions.

Build

Dependencies

Name Version Required Feature
libev >= 4.31 yes
libsodium >= 1.0.18 no encryption
# Debian & Ubuntu
sudo apt install libev-dev libsodium-dev
# Alpine Linux
apk add libev-dev libsodium-dev

Build on Unix-like systems

git clone https://github.com/hexian000/kcptun-libev.git
mkdir "kcptun-libev-build"
cmake -DCMAKE_BUILD_TYPE="Release" \
    -S "kcptun-libev" \
    -B "kcptun-libev-build"
cmake --build "kcptun-libev-build" --parallel

See m.sh for more information about cross compiling support.

Runtime

Dependencies

If you downloaded a *-static build in the Releases section, you don't have to install the dependencies below.

# Debian & Ubuntu
sudo apt install libev4 libsodium23
# Alpine Linux
apk add libev libsodium
# OpenWRT
opkg install libev libsodium

Configurations

Basic Usage

Generate a random key for encryption:

./kcptun-libev --genpsk xchacha20poly1305_ietf

Create a server.json file and fill in the options:

{
    "kcp_bind": "0.0.0.0:12345",
    "connect": "127.0.0.1:1080",
    "method": "xchacha20poly1305_ietf",
    "psk": "// your key here"
}

Start the server:

./kcptun-libev -c server.json

Create a client.json file and fill in the options:

{
    "listen": "127.0.0.1:1080",
    "kcp_connect": "203.0.113.1:12345",
    "method": "xchacha20poly1305_ietf",
    "psk": "// your key here"
}

Start the client:

./kcptun-libev -c client.json

Now 127.0.0.1:1080 on client is forwarded to server by kcptun-libev.

See server.json/client.json in the source repo for more tunables.

Let's explain some common fields in server.json/client.json:

  • The client side "listen" TCP ports and send data to "kcp_connect".
  • The server side receive data from "kcp_bind" and forward the connections to "connect".
  • Set a "password" or "psk" is strongly suggested when using in public networks.
  • "loglevel": 0-7 are Silence, Fatal, Error, Warning, Notice, Info, Debug, Verbose respectively. The default is 4 (Notice). High log levels can affect performance.

Rendezvous Mode

Rendezvous mode may be useful for accessing servers behind NAT. The rendezvous server only helps establish the connection, the traffic goes directly between client and server.

Rendezvous mode requires UDP in transport layer, i.e. is incompatible with non-UDP obfuscators.

The method is non-standard and may not work with all NAT implementations.

rendezvous_server.json: The rendezvous server should have an address which is reachable by both client and server.

{
    "kcp_bind": "0.0.0.0:12345",
    "method": "xchacha20poly1305_ietf",
    "psk": "// your key here"
}

server.json: The server may be behind one or more levels of NAT.

{
    "connect": "127.0.0.1:25565",
    "rendezvous_server": "203.0.113.1:12345",
    "method": "xchacha20poly1305_ietf",
    "psk": "// your key here"
}

client.json: The client may be behind one or more levels of NAT, which may or may not be the same ones as the server.

{
    "listen": "127.0.0.1:25565",
    "rendezvous_server": "203.0.113.1:12345",
    "method": "xchacha20poly1305_ietf",
    "psk": "// your key here"
}

rendezvous_server : server : client = 1 : 1 : n

Peers should be all IPv4 or all IPv6.

Tunables

kcptun-libev works out of the box. In most cases, the default options are recommended.

Some tunables are the same as KCP, read their docs for full explaination. Here are some hints:

  • "kcp.sndwnd", "kcp.rcvwnd":
    1. Should be tuned according to RTT.
    2. For enthusiasts, you can start an idle client with loglevel >= 5 and wait 1 minute to check the theoretical bandwidth of current window values.
    3. On systems with very little memory, you may need to reduce it to save memory.
  • "kcp.nodelay": Enabled by default. Note that this is not an equivalent to TCP_NODELAY.
  • "kcp.interval":
    1. Since we run KCP differently, the recommended value is longer than the previous implementation. This will save some CPU power.
    2. This option is not intended for traffic shaping. For Linux, check out sqm-scripts for it. Read more about CAKE.
  • "kcp.resend": Disabled by default.
  • "kcp.nc": Enabled by default.
  • "kcp.mtu": Specifies the final IP packet size, including all overhead.

Again, there is some kcptun-libev specific options:

  • "kcp.flush": 0 - periodic only, 1 - flush after sending, 2 - also flush acks (for benchmarking)
  • "tcp.sndbuf", "tcp.rcvbuf", "udp.sndbuf", "udp.rcvbuf": Socket options, see your OS manual for further information.
    1. Normally, default value just works.
    2. Usually setting the udp buffers relatively large (e.g. 1048576) gives performance benefits. But since kcptun-libev handles packets efficiently, a receive buffer that is too large doesn't make sense.
    3. All buffers should not be too small, otherwise you may experience performance degradation.
  • "user": switch to this user to drop privileges, e.g. "user": "nobody:" means the user named "nobody" and that user's login group

Observability

There is a builtin HTTP server for monitoring service status.

Add this line to your config file:

"http_listen": "127.0.1.1:8081"

Then run the commands below from shell:

watch curl -sX POST http://127.0.1.1:8081/stats

The URI "/healthy" always responds with HTTP 200, feel free to use it for healthy checks.

Credits

Thanks to:

kcptun-libev's People

Contributors

hexian000 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

Watchers

 avatar  avatar  avatar  avatar  avatar

kcptun-libev's Issues

当客户端连接,服务端就会出现段错误

我使用的是 release 最新版,配置和日志如下:

root@HK ~/test # cat server.json
{
    "connect": "127.0.0.1:1984",
    "udp_bind": "0.0.0.0:1983",
    "kcp": {
        "mtu": 1400,
        "sndwnd": 256,
        "rcvwnd": 256,
        "nodelay": 0,
        "interval": 10,
        "resend": 3,
        "nc": 1
    },
    "udp": {
        "sndbuf": 1048576,
        "rcvbuf": 1048576
    },
    "loglevel": 0
}
root@HK ~/test # ./kcptun-libev-static.x86_64-linux -c server.json
kcptun-libev 2.0
  http://github.com/hexian000/kcptun-libev

I 2022-10-07T17:47:43+0800 main.c:97 initializing...
D 2022-10-07T17:47:43+0800 conf.c:304 resolve: "127.0.0.1:1984" is 127.0.0.1:1984
D 2022-10-07T17:47:43+0800 conf.c:304 resolve: "0.0.0.0:1983" is 0.0.0.0:1983
W 2022-10-07T17:47:43+0800 packet.c:384 data will not be encrypted
I 2022-10-07T17:47:43+0800 server.c:104 udp bind: 0.0.0.0:1983
I 2022-10-07T17:47:43+0800 main.c:130 server start
V 2022-10-07T17:47:53+0800 event_udp.c:91 udp recv: <客户端IP>:59298 28 bytes
段错误 (核心已转储)
root@HK ~/test #

程序偶尔会崩溃

我把 kcptun-libev 封装成了一个 docker 镜像,今天无意中发现它的启动时间是十几个小时之前,而我部署完之后很久都没有动过这个容器,所以应该是程序崩溃导致容器自动重启了。麻烦作者排查一下😄

关键日志:

Assertion failed: ("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL) (ev_epoll.c: epoll_modify: 134)

具体的日志如下:

root@OpenWrt:~# docker logs kcptun-libev
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-19T01:22:20+0800 main.c:97 initializing...
D 2022-10-19T01:22:20+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-19T01:22:20+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-19T01:22:20+0800 packet.c:385 data will not be encrypted
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
I 2022-10-19T01:23:33+0800 main.c:97 initializing...
D 2022-10-19T01:23:33+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-19T01:23:33+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-19T01:23:33+0800 packet.c:385 data will not be encrypted
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:26+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:26+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:29+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:29+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:35+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:35+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-19T01:55:44+0800 main.c:97 initializing...
D 2022-10-19T01:55:44+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-19T01:55:44+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-19T01:55:44+0800 packet.c:385 data will not be encrypted
E 2022-10-19T23:51:10+0800 event_tcp.c:111 session [750C78B7] fd=35 tcp recv error: [104] Connection reset by peer
E 2022-10-21T13:44:51+0800 event_tcp.c:111 session [750CB771] fd=12 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:25:51+0800 event_tcp.c:111 session [750CC8B5] fd=39 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:25:52+0800 event_tcp.c:177 session [750CC8B8] fd=39 tcp send error: [104] Connection reset by peer
Assertion failed: ("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL) (ev_epoll.c: epoll_modify: 134)
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-21T21:25:52+0800 main.c:97 initializing...
D 2022-10-21T21:25:52+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-21T21:25:52+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-21T21:25:52+0800 packet.c:385 data will not be encrypted
E 2022-10-21T21:27:48+0800 event_tcp.c:111 session [2D3E37EB] fd=24 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:28:51+0800 event_tcp.c:111 session [2D3E3812] fd=37 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:28:53+0800 event_tcp.c:111 session [2D3E3815] fd=26 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:28:53+0800 event_tcp.c:177 session [2D3E3816] fd=26 tcp send error: [104] Connection reset by peer
Assertion failed: ("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL) (ev_epoll.c: epoll_modify: 134)
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-21T21:28:54+0800 main.c:97 initializing...
D 2022-10-21T21:28:54+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-21T21:28:54+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-21T21:28:54+0800 packet.c:385 data will not be encrypted
W 2022-10-23T00:21:42+0800 packet.c:263 session not found [20889C17]
W 2022-10-23T00:21:43+0800 packet.c:263 session not found [20889C17]
W 2022-10-23T00:21:54+0800 packet.c:263 session not found [20889C17]
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-25T11:09:01+0800 main.c:97 initializing...
D 2022-10-25T11:09:01+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-25T11:09:01+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-25T11:09:01+0800 packet.c:385 data will not be encrypted
W 2022-10-25T15:01:51+0800 packet.c:263 session not found [AEE854AF]
W 2022-10-25T15:03:50+0800 packet.c:263 session not found [AEE854C0]
W 2022-10-25T15:05:21+0800 packet.c:263 session not found [AEE854C6]
W 2022-10-25T15:09:43+0800 packet.c:263 session not found [AEE854E1]
root@OpenWrt:~#
root@OpenWrt:~# docker logs kcptun-libev
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-19T01:22:20+0800 main.c:97 initializing...
D 2022-10-19T01:22:20+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-19T01:22:20+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-19T01:22:20+0800 packet.c:385 data will not be encrypted
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:22:32+0800 event_udp.c:21 udp connection refused, closing all sessions
I 2022-10-19T01:23:33+0800 main.c:97 initializing...
D 2022-10-19T01:23:33+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-19T01:23:33+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-19T01:23:33+0800 packet.c:385 data will not be encrypted
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:22+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:24+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:25+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:26+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:26+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:29+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:29+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:30+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:31+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:33+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:35+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:28:35+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
W 2022-10-19T01:32:23+0800 event_udp.c:21 udp connection refused, closing all sessions
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-19T01:55:44+0800 main.c:97 initializing...
D 2022-10-19T01:55:44+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-19T01:55:44+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-19T01:55:44+0800 packet.c:385 data will not be encrypted
E 2022-10-19T23:51:10+0800 event_tcp.c:111 session [750C78B7] fd=35 tcp recv error: [104] Connection reset by peer
E 2022-10-21T13:44:51+0800 event_tcp.c:111 session [750CB771] fd=12 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:25:51+0800 event_tcp.c:111 session [750CC8B5] fd=39 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:25:52+0800 event_tcp.c:177 session [750CC8B8] fd=39 tcp send error: [104] Connection reset by peer
Assertion failed: ("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL) (ev_epoll.c: epoll_modify: 134)
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-21T21:25:52+0800 main.c:97 initializing...
D 2022-10-21T21:25:52+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-21T21:25:52+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-21T21:25:52+0800 packet.c:385 data will not be encrypted
E 2022-10-21T21:27:48+0800 event_tcp.c:111 session [2D3E37EB] fd=24 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:28:51+0800 event_tcp.c:111 session [2D3E3812] fd=37 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:28:53+0800 event_tcp.c:111 session [2D3E3815] fd=26 tcp recv error: [104] Connection reset by peer
E 2022-10-21T21:28:53+0800 event_tcp.c:177 session [2D3E3816] fd=26 tcp send error: [104] Connection reset by peer
Assertion failed: ("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL) (ev_epoll.c: epoll_modify: 134)
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-21T21:28:54+0800 main.c:97 initializing...
D 2022-10-21T21:28:54+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-21T21:28:54+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-21T21:28:54+0800 packet.c:385 data will not be encrypted
W 2022-10-23T00:21:42+0800 packet.c:263 session not found [20889C17]
W 2022-10-23T00:21:43+0800 packet.c:263 session not found [20889C17]
W 2022-10-23T00:21:54+0800 packet.c:263 session not found [20889C17]
kcptun-libev v2.0.1
  http://github.com/hexian000/kcptun-libev

I 2022-10-25T11:09:01+0800 main.c:97 initializing...
D 2022-10-25T11:09:01+0800 conf.c:299 resolve: "127.0.0.1:1983" is 127.0.0.1:1983
D 2022-10-25T11:09:01+0800 conf.c:299 resolve: "127.0.0.1:1982" is 127.0.0.1:1982
W 2022-10-25T11:09:01+0800 packet.c:385 data will not be encrypted
W 2022-10-25T15:01:51+0800 packet.c:263 session not found [AEE854AF]
W 2022-10-25T15:03:50+0800 packet.c:263 session not found [AEE854C0]
W 2022-10-25T15:05:21+0800 packet.c:263 session not found [AEE854C6]
W 2022-10-25T15:09:43+0800 packet.c:263 session not found [AEE854E1]

Building fails

Hello,

Making fails with the following error on Linux 16.04:

log.h:4:20: fatal error: config.h: No such file or directory

And in fact there's no config.h in the directory (just a configure.h, which I renamed to conf.h but didn't fix the error)

Thanks.

Add the ability to bind both tcp and udp

Currently this project can only forward tcp traffic. But in some case, such as shadowsocks/socks5, it is necessary to forward the same TCP and UDP port. Do we have any plan to support this feature?

obfs

Hi, how should I use obfs ? what is the proper value?

优化配置文件

请问能否把 method 增加一个可选项 none 来禁用加密?
目前只能把 method 一整项去掉来禁用加密,似乎不太优雅。

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.