alexkirsz / alexkirsz/socksv5

Add SocksV5Command::Other(u8) to allow for extension requests

未关闭
#12 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
19
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

I'm working up some changes to this effect in my fork; I'd prefer to merge them back here if you are amenable.

The high level outline is as below; the names and so on can be tweaked to match your preference.

* Add `SocksV5Command::Other(u8)`
* `SocksV5Command::from_u8` continues to return `Option` and return only RFC 1928 commands, so that `read_request` continues to have the same semantics wrt. rejecting unknown commands.
* Add `SocksV5Command::from_any_u8(u8) -> SocksV5Command` that will populate `Other` for values outside of RFC 1928
* Add `read_request_impl(reader: Reader, allow_extensions: bool)` that can opt-in to using `SocksV5Command::from_any_u8`.
* Adjust `read_request` to call through to `read_request_impl` to avoid duplicating the logic

I've tried to avoid making backwards-incompatible API changes in the above, but if you prefer, `SocksV5Command::from_u8` could be renamed to `SocksV5Command::from_rfc1928(u8)` to more closely indicate its underlying action/effect and so on.

Is this something that you'd be interesting in merging? I'll send a PR if that is ok!

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。