Skip to content

Commit 6f68b06

Browse files
committed
Initial commit
0 parents  commit 6f68b06

20 files changed

Lines changed: 1629 additions & 0 deletions

‎.github/workflows/deploy.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: deploy
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
deploy:
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
25+
- uses: actions/checkout@v4
26+
27+
- uses: astral-sh/setup-uv@v5
28+
with:
29+
enable-cache: true
30+
31+
- run: |
32+
uv sync
33+
uv run mkdocs build
34+
mv site tuic
35+
mkdir site
36+
mv tuic site/
37+
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v5
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: site
45+
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v5

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
site/
2+
.venv/

‎CNAME‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs.ihsin.dev

‎LICENSE‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Creative Commons Legal Code
2+
3+
CC0 1.0 Universal
4+
5+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12+
HEREUNDER.
13+
14+
Statement of Purpose
15+
16+
The laws of most jurisdictions throughout the world automatically confer
17+
exclusive Copyright and Related Rights (defined below) upon the creator
18+
and subsequent owner(s) (each and all, an "owner") of an original work of
19+
authorship and/or a database (each, a "Work").
20+
21+
Certain owners wish to permanently relinquish those rights to a Work for
22+
the purpose of contributing to a commons of creative, cultural and
23+
scientific works ("Commons") that the public can reliably and without fear
24+
of later claims of infringement build upon, modify, incorporate in other
25+
works, reuse and redistribute as freely as possible in any form whatsoever
26+
and for any purposes, including without limitation commercial purposes.
27+
These owners may contribute to the Commons to promote the ideal of a free
28+
culture and the further production of creative, cultural and scientific
29+
works, or to gain reputation or greater distribution for their Work in
30+
part through the use and efforts of others.
31+
32+
For these and/or other purposes and motivations, and without any
33+
expectation of additional consideration or compensation, the person
34+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35+
is an owner of Copyright and Related Rights in the Work, voluntarily
36+
elects to apply CC0 to the Work and publicly distribute the Work under its
37+
terms, with knowledge of his or her Copyright and Related Rights in the
38+
Work and the meaning and intended legal effect of CC0 on those rights.
39+
40+
1. Copyright and Related Rights. A Work made available under CC0 may be
41+
protected by copyright and related or neighboring rights ("Copyright and
42+
Related Rights"). Copyright and Related Rights include, but are not
43+
limited to, the following:
44+
45+
i. the right to reproduce, adapt, distribute, perform, display,
46+
communicate, and translate a Work;
47+
ii. moral rights retained by the original author(s) and/or performer(s);
48+
iii. publicity and privacy rights pertaining to a person's image or
49+
likeness depicted in a Work;
50+
iv. rights protecting against unfair competition in regards to a Work,
51+
subject to the limitations in paragraph 4(a), below;
52+
v. rights protecting the extraction, dissemination, use and reuse of data
53+
in a Work;
54+
vi. database rights (such as those arising under Directive 96/9/EC of the
55+
European Parliament and of the Council of 11 March 1996 on the legal
56+
protection of databases, and under any national implementation
57+
thereof, including any amended or successor version of such
58+
directive); and
59+
vii. other similar, equivalent or corresponding rights throughout the
60+
world based on applicable law or treaty, and any national
61+
implementations thereof.
62+
63+
2. Waiver. To the greatest extent permitted by, but not in contravention
64+
of, applicable law, Affirmer hereby overtly, fully, permanently,
65+
irrevocably and unconditionally waives, abandons, and surrenders all of
66+
Affirmer's Copyright and Related Rights and associated claims and causes
67+
of action, whether now known or unknown (including existing as well as
68+
future claims and causes of action), in the Work (i) in all territories
69+
worldwide, (ii) for the maximum duration provided by applicable law or
70+
treaty (including future time extensions), (iii) in any current or future
71+
medium and for any number of copies, and (iv) for any purpose whatsoever,
72+
including without limitation commercial, advertising or promotional
73+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74+
member of the public at large and to the detriment of Affirmer's heirs and
75+
successors, fully intending that such Waiver shall not be subject to
76+
revocation, rescission, cancellation, termination, or any other legal or
77+
equitable action to disrupt the quiet enjoyment of the Work by the public
78+
as contemplated by Affirmer's express Statement of Purpose.
79+
80+
3. Public License Fallback. Should any part of the Waiver for any reason
81+
be judged legally invalid or ineffective under applicable law, then the
82+
Waiver shall be preserved to the maximum extent permitted taking into
83+
account Affirmer's express Statement of Purpose. In addition, to the
84+
extent the Waiver is so judged Affirmer hereby grants to each affected
85+
person a royalty-free, non transferable, non sublicensable, non exclusive,
86+
irrevocable and unconditional license to exercise Affirmer's Copyright and
87+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
88+
maximum duration provided by applicable law or treaty (including future
89+
time extensions), (iii) in any current or future medium and for any number
90+
of copies, and (iv) for any purpose whatsoever, including without
91+
limitation commercial, advertising or promotional purposes (the
92+
"License"). The License shall be deemed effective as of the date CC0 was
93+
applied by Affirmer to the Work. Should any part of the License for any
94+
reason be judged legally invalid or ineffective under applicable law, such
95+
partial invalidity or ineffectiveness shall not invalidate the remainder
96+
of the License, and in such case Affirmer hereby affirms that he or she
97+
will not (i) exercise any of his or her remaining Copyright and Related
98+
Rights in the Work or (ii) assert any associated claims and causes of
99+
action with respect to the Work, in either case contrary to Affirmer's
100+
express Statement of Purpose.
101+
102+
4. Limitations and Disclaimers.
103+
104+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
105+
surrendered, licensed or otherwise affected by this document.
106+
b. Affirmer offers the Work as-is and makes no representations or
107+
warranties of any kind concerning the Work, express, implied,
108+
statutory or otherwise, including without limitation warranties of
109+
title, merchantability, fitness for a particular purpose, non
110+
infringement, or the absence of latent or other defects, accuracy, or
111+
the present or absence of errors, whether or not discoverable, all to
112+
the greatest extent permissible under applicable law.
113+
c. Affirmer disclaims responsibility for clearing rights of other persons
114+
that may apply to the Work or any use thereof, including without
115+
limitation any person's Copyright and Related Rights in the Work.
116+
Further, Affirmer disclaims responsibility for obtaining any necessary
117+
consents, permissions or other rights required for any use of the
118+
Work.
119+
d. Affirmer understands and acknowledges that Creative Commons is not a
120+
party to this document and has no duty or obligation with respect to
121+
this CC0 or use of the Work.

‎README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# docs.ihsin.dev/tuic
2+
3+
## Development
4+
5+
```bash
6+
# Install dependencies
7+
uv sync
8+
# Run development server
9+
uv run mkdocs serve
10+
```

‎docs/config/client.md‎

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Client Configuration
2+
3+
## Top-level Options
4+
5+
| Key | Type | Default | Description |
6+
| --- | ---- | ------- | ----------- |
7+
| `log_level` | string | `"warn"` | Logging level: `trace`, `debug`, `info`, `warn`, `error`, `off` |
8+
9+
## `[relay]`
10+
11+
Options for connecting to the TUIC server.
12+
13+
| Key | Type | Default | Description |
14+
| --- | ---- | ------- | ----------- |
15+
| `server` | string | — | Server address, e.g. `"example.com:443"` |
16+
| `uuid` | string | — | User UUID |
17+
| `password` | string | — | User password |
18+
| `ip` | string | — | Optional outbound IP address to bind |
19+
| `ipstack_prefer` | string | `"v4first"` | IP stack preference: `v4first`, `v6first`, `v4only`, `v6only` |
20+
| `certificates` | string[] | `[]` | Custom certificate paths for server verification |
21+
| `udp_relay_mode` | string | `"native"` | UDP relay mode: `native` or `quic` |
22+
| `congestion_control` | string | `"cubic"` | Congestion control: `cubic`, `new_reno`, `bbr`, `bbr3` |
23+
| `alpn` | string[] | `[]` | ALPN protocols (e.g. `["h3", "h2"]`) |
24+
| `zero_rtt_handshake` | bool | `false` | Enable 0-RTT handshake |
25+
| `disable_sni` | bool | `false` | Disable SNI (Server Name Indication) |
26+
| `sni` | string | — | Override SNI hostname |
27+
| `timeout` | duration | `"8s"` | Connection timeout |
28+
| `heartbeat` | duration | `"3s"` | Heartbeat interval |
29+
| `disable_native_certs` | bool | `false` | Disable the native OS certificate store |
30+
| `send_window` | integer | `16777216` | QUIC send window size (bytes) |
31+
| `receive_window` | integer | `8388608` | QUIC receive window size (bytes) |
32+
| `initial_mtu` | integer | `1200` | Initial MTU |
33+
| `min_mtu` | integer | `1200` | Minimum MTU |
34+
| `gso` | bool | `true` | Enable Generic Segmentation Offload |
35+
| `pmtu` | bool | `true` | Enable Path MTU Discovery |
36+
| `gc_interval` | duration | `"3s"` | Garbage collection interval |
37+
| `gc_lifetime` | duration | `"15s"` | Garbage collection lifetime |
38+
| `skip_cert_verify` | bool | `false` | Skip TLS certificate verification (insecure, testing only) |
39+
40+
## `[local]`
41+
42+
Options for the local SOCKS5 server.
43+
44+
| Key | Type | Default | Description |
45+
| --- | ---- | ------- | ----------- |
46+
| `server` | string | — | Local SOCKS5 listen address, e.g. `"127.0.0.1:1080"` |
47+
| `username` | string | — | Optional SOCKS5 authentication username |
48+
| `password` | string | — | Optional SOCKS5 authentication password |
49+
| `dual_stack` | bool | `true` | Enable dual-stack (IPv4 and IPv6) |
50+
| `max_packet_size` | integer | `1500` | Maximum UDP packet size |
51+
52+
### TCP Port Forwarding
53+
54+
```toml
55+
[[local.tcp_forward]]
56+
listen = "127.0.0.1:8080"
57+
remote = "example.com:80"
58+
```
59+
60+
### UDP Port Forwarding
61+
62+
```toml
63+
[[local.udp_forward]]
64+
listen = "127.0.0.1:5353"
65+
remote = "8.8.8.8:53"
66+
timeout = "60s"
67+
```
68+
69+
## Full Example
70+
71+
```toml
72+
log_level = "info"
73+
74+
[relay]
75+
server = "example.com:443"
76+
uuid = "f0e12827-fe60-458c-8269-a05ccb0ff8da"
77+
password = "your_password_here"
78+
ipstack_prefer = "v4first"
79+
udp_relay_mode = "native"
80+
congestion_control = "bbr"
81+
alpn = []
82+
zero_rtt_handshake = false
83+
disable_sni = false
84+
timeout = "8s"
85+
heartbeat = "3s"
86+
disable_native_certs = false
87+
send_window = 16777216
88+
receive_window = 8388608
89+
initial_mtu = 1200
90+
min_mtu = 1200
91+
gso = true
92+
pmtu = true
93+
gc_interval = "3s"
94+
gc_lifetime = "15s"
95+
skip_cert_verify = false
96+
97+
[local]
98+
server = "127.0.0.1:1080"
99+
dual_stack = true
100+
max_packet_size = 1500
101+
102+
# [[local.tcp_forward]]
103+
# listen = "127.0.0.1:8080"
104+
# remote = "example.com:80"
105+
106+
# [[local.udp_forward]]
107+
# listen = "127.0.0.1:5353"
108+
# remote = "8.8.8.8:53"
109+
# timeout = "60s"
110+
```

‎docs/config/index.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Configuration
2+
3+
TUIC supports **TOML**, **JSON5**, and **YAML** configuration formats. The format is automatically detected based on the file extension.
4+
5+
| Extension | Format |
6+
| --------- | ------ |
7+
| `.toml` | TOML (recommended) |
8+
| `.json`, `.json5` | JSON5 (legacy) |
9+
| `.yaml`, `.yml` | YAML |
10+
11+
You can also force a specific format with environment variables:
12+
13+
- `TUIC_CONFIG_FORMAT=toml` or `TUIC_CONFIG_FORMAT=json5`
14+
- `TUIC_FORCE_TOML=1` to always parse as TOML
15+
16+
## Pages
17+
18+
- [Server Configuration](server.md)
19+
- [Client Configuration](client.md)

‎docs/config/index.zh.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 配置
2+
3+
TUIC 支持 **TOML**、**JSON5** 和 **YAML** 三种配置格式,根据文件扩展名自动识别。
4+
5+
| 扩展名 | 格式 |
6+
| ------ | ---- |
7+
| `.toml` | TOML(推荐) |
8+
| `.json`, `.json5` | JSON5(旧格式,仍支持) |
9+
| `.yaml`, `.yml` | YAML |
10+
11+
也可通过环境变量强制指定格式:
12+
13+
- `TUIC_CONFIG_FORMAT=toml` 或 `TUIC_CONFIG_FORMAT=json5`
14+
- `TUIC_FORCE_TOML=1` 强制使用 TOML 解析
15+
16+
## 配置页面
17+
18+
- [服务端配置](server.md)
19+
- [客户端配置](client.md)

0 commit comments

Comments
 (0)