Skip to content

Conversation

@fokx
Copy link

@fokx fokx commented Sep 18, 2025

tuic-server: allow outbound config: ip_mode(ipv4/v6 preference), bind_ipv4/v6 and bind_device

This commit should fix #26

This is a WIP. Outbound rules other than default are not used until ACL is implemented.

…_ipv4/v6 and bind_device

This commit should fix:
Itsusinn#26

This is WIP. Outbound rules other than default are not used until ACL is implemented.
@fokx
Copy link
Author

fokx commented Sep 18, 2025

This is inspired by Hysteria's outbound settings.
https://v2.hysteria.network/docs/advanced/Full-Server-Config/#outbounds

Considering hysteria uses yaml whereas tuic uses toml, the current configuration syntax is perhaps not optimal. Feel free to modify.

@Itsusinn
Copy link
Owner

I used YAML for my several former programs. It works great whether the configuration is complex or not. TUIC is my first trying of TOML. TOML is very suitable for the original TUIC(minimalist implementation) . However it becomes worse the adding more options to configuration

@fokx
Copy link
Author

fokx commented Sep 19, 2025

From https://toml.io/en/ :

TOML prioritizes humans
TOML aims to be a minimal configuration file format that:
is easy to read due to obvious semantics
maps unambiguously to a hash table
is easy to parse into data structures in a wide variety of languages

For toml, Succinctness is not a priority. Luckily, the outbound configuration format is not too complex. Many fields are optional.

[outbound.prefer_v4]
type = "direct"
# Optional
ip_mode = "prefer_v4"
# Optional
bind_ipv4 = "1.2.3.4"
# Optional
bind_ipv6 = "0:0:0:0:0:ffff:0102:0304"
# Optional
bind_device = "eth1234"

[outbound.through_socks5]
# TODO: `socks5` outbound is not implemented yet
type = "socks5"
# SOCKS5 proxy addr
addr = "127.0.0.1:1080"
# Optional
username = "optional"
# Optional
password = "optional" 

@Itsusinn
Copy link
Owner

Itsusinn commented Sep 21, 2025

I might to merge this PR.
But if you are going to add(or proposal) more advanced features, please consider check my another implementation of singbox-like program

https://github.com/proxy-rs/wind/

It's pretty early stage though, but structure is clear enough to read

@Itsusinn Itsusinn merged commit 20f4885 into Itsusinn:dev Sep 25, 2025
20 checks passed
@fokx fokx deleted the outbound branch October 16, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server添加指定传出网卡/传出IP

2 participants