Commands: Add -outpbfile for convert pb#5048
Merged
Conversation
Contributor
|
或者删掉输出到 STDOUT 的功能吧,不然以后还是会有人踩坑。我想了一下,输出到 STDOUT 最终还是要生成文件,有点多余。 |
Contributor
Author
|
出 proto 基本是要写文件,出到 STDOUT 直接写入文件和复制粘贴到文件出来会是两种不同的数据流 出 debug JSON 那个是原样写在 STDOUT 还是给输出选项?虽然 debug JSON 也是没法直接用只能阅读 |
Contributor
Author
|
就这样吧,
|
| } | ||
|
|
||
| if len(optFile) > 0 { | ||
| switch core.GetFormatByExtension(getFileExtension(optFile)){ |
Contributor
Author
There was a problem hiding this comment.
这里能用 core.getFormat() 的话能这边能少写一点,就是得连带 core 包的代码得跟着改成 GetFormat()
-outpbfile to convert pb-outpbfile for convert pb
This was referenced Aug 31, 2025
it2konst
pushed a commit
to it2konst/gametunnel-core
that referenced
this pull request
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这么久了似乎没人发现用xray convert pb config.json c1.json c2.json c3.json > mix.pb这个方式出来的 proto 文件没法正常用的吗,看来现在用 proto 配置的没几个了用
xray convert pb config.json c1.json c2.json c3.json > mix.pb转换配置文件到 proto 文件的时候,这个操作其实是将控制台输出写到文件(期望的 proto),但是会将读取配置文件产生的 log (写到控制台)也一并写进文件,导致产生的文件不能用。其实用十六进制编辑器或者什么的把头部的 log 去掉就好,但是依然比较麻烦现增加一个选项 -outpbfile,直接将生成的 proto 直接写到指定文件位置,出来的 proto 文件直接就能用。
比如:
xray convert pb -outpbfile output.pb config.json c1.json c2.json c3.json将 config.json c1.json c2.json c3.json 合并后转换成 proto 并直接写入到 output.pb功能描述要不要再调整,调用core.LoadConfig可以使用 JSON(C) YAML TOML 格式的配置