sandlock icon indicating copy to clipboard operation
sandlock copied to clipboard

Simplify --net-allow syntax for UDP

Open congwang-mk opened this issue 4 months ago • 3 comments

Requested by @SuperManito, simplify --net-allow '*' and --net-allow 'udp://*' to --net-allow '*'.

congwang-mk avatar Jul 08 '26 05:07 congwang-mk

@congwang-mk 还需要再跟您确认一下,这个需求应该是简化表达式语法,主要解决的是表达式在不指定协议时应同时表示 TCP/IP 与 UDP/IP 规则,而不是仅解决通配符的冗余语法场景。可能我的描述不太专业哈

刚发现还有个 ICMP 😂

SuperManito avatar Jul 14 '26 00:07 SuperManito

# Unrestricted outbound: `*` opens any host and any port over both TCP
# and UDP (`:*` / `*:*` are equivalent). ICMP still needs `icmp://`.
sandlock run --net-allow '*'   -r /usr -r /lib -r /etc -- ./client

这个新语法是你预期的,没错吧?

congwang-mk avatar Jul 18 '26 04:07 congwang-mk

# Unrestricted outbound: `*` opens any host and any port over both TCP
# and UDP (`:*` / `*:*` are equivalent). ICMP still needs `icmp://`.
sandlock run --net-allow '*'   -r /usr -r /lib -r /etc -- ./client

这个新语法是你预期的,没错吧?

对的,没毛病,但是我不知道您是只适配了通配符的语法还是全部的。

例如 sandlock run --net-allow '1.1.1.1:443' --net-allow 'udp://1.1.1.1:443' -> sandlock run --net-allow '1.1.1.1:443'

SuperManito avatar Jul 18 '26 05:07 SuperManito