#quic #tuic #udp-server #proxy #networking

app tuic-server

简约风格的TUIC服务器实现作为参考

1个稳定版本

1.0.0 2023年6月8日
1.0.0-rc0 2023年6月4日
1.0.0-pre-alpha2 2023年5月26日

#13 in #udp-server

Download history 79/week @ 2024-04-15

71 每月下载量

GPL-3.0-or-later

135KB
3K SLoC

tuic-server

简约风格的TUIC服务器实现作为参考

Version License

概述

本TUIC服务器实现的主要目标不是提供一个功能齐全、适用于生产的TUIC服务器,而是提供一个最小参考以实现TUIC协议服务器。

本实现仅包含功能齐全的TUIC协议服务器最基本的需要。如果您需要出站控制、DNS缓存等功能,请尝试其他实现或自行实现。

用法

发行版下载最新二进制文件。

或从crates.io安装

cargo install tuic-server

使用配置文件运行TUIC服务器

tuic-server -c PATH/TO/CONFIG

配置

{
    // The socket address to listen on
    "server": "[::]:443",

    // User list, contains user UUID and password
    "users": {
        "00000000-0000-0000-0000-000000000000": "PASSWORD_0",
        "00000000-0000-0000-0000-000000000001": "PASSWORD_1"
    },

    // The path to the certificate file
    "certificate": "PATH/TO/CERTIFICATE",

    // The path to the private key file
    "private_key": "PATH/TO/PRIVATE_KEY",

    // Optional. Congestion control algorithm, available options:
    // "cubic", "new_reno", "bbr"
    // Default: "cubic"
    "congestion_control": "cubic",

    // Optional. Application layer protocol negotiation
    // Default being empty (no ALPN)
    "alpn": ["h3", "spdy/3.1"],

    // Optional. If the server should create separate UDP sockets for relaying IPv6 UDP packets
    // Default: true
    "udp_relay_ipv6": true,

    // Optional. Enable 0-RTT QUIC connection handshake on the server side
    // This is not impacting much on the performance, as the protocol is fully multiplexed
    // WARNING: Disabling this is highly recommended, as it is vulnerable to replay attacks. See https://blog.cloudflare.com/even-faster-connection-establishment-with-quic-0-rtt-resumption/#attack-of-the-clones
    // Default: false
    "zero_rtt_handshake": false,

    // Optional. Set if the listening socket should be dual-stack
    // If this option is not set, the socket behavior is platform dependent
    "dual_stack": true,

    // Optional. How long the server should wait for the client to send the authentication command
    // Default: 3s
    "auth_timeout": "3s",

    // Optional. Maximum duration server expects for task negotiation
    // Default: 3s
    "task_negotiation_timeout": "3s",

    // Optional. How long the server should wait before closing an idle connection
    // Default: 10s
    "max_idle_time": "10s",

    // Optional. Maximum packet size the server can receive from outbound UDP sockets, in bytes
    // Default: 1500
    "max_external_packet_size": 1500,

    // Optional. Maximum number of bytes to transmit to a peer without acknowledgment
    // Should be set to at least the expected connection latency multiplied by the maximum desired throughput
    // Default: 8MiB * 2
    "send_window": 16777216,

    // Optional. Maximum number of bytes the peer may transmit without acknowledgement on any one stream before becoming blocked
    // Should be set to at least the expected connection latency multiplied by the maximum desired throughput
    // Default: 8MiB
    "receive_window": 8388608,

    // Optional. Interval between UDP packet fragment garbage collection
    // Default: 3s
    "gc_interval": "3s",

    // Optional. How long the server should keep a UDP packet fragment. Outdated fragments will be dropped
    // Default: 15s
    "gc_lifetime": "15s",

    // Optional. Set the log level
    // Default: "warn"
    "log_level": "warn"
}

许可协议

GNU通用公共许可证v3.0

依赖关系

~14–25MB
~468K SLoC