Add Sudoku protocol inbound & outbound support #2397
Add Sudoku protocol inbound & outbound support #2397wwqgtxx merged 9 commits intoMetaCubeX:Alphafrom
Conversation
|
NEVER modify the Go version; we need to maintain Go 1.20 compatibility. |
|
I have downgraded and checked |
|
You need to add a test to |
|
In addition, other dependencies in go.mod should not be downgraded. |
|
added and passed, log as: --- PASS: TestInboundSudoku_Basic (1.43s)
--- PASS: TestInboundSudoku_Basic/Sequential (0.04s)
--- PASS: TestInboundSudoku_Basic/Concurrent (1.02s)
--- PASS: TestInboundSudoku_Entropy (1.47s)
--- PASS: TestInboundSudoku_Entropy/Sequential (0.35s)
--- PASS: TestInboundSudoku_Entropy/Concurrent (0.71s)
--- PASS: TestInboundSudoku_Padding (1.48s)
--- PASS: TestInboundSudoku_Padding/Sequential (0.22s)
--- PASS: TestInboundSudoku_Padding/Concurrent (0.89s)
PASS
ok github.com/metacubex/mihomo/listener/inbound 2.157s |
|
|
In the (HTTP/2 + TLS + Sudoku) test, the HTTP client's read loop runs concurrently with connection closure. Why mieru got test failed this time? |
|
In fact, the use of Firstly, it's not locked or atomic, leading to read/write race issues. Secondly, |
|
mieru's error is likely due to a coding mistake by themselves, and is unrelated to this PR, so it can be ignored. |
|
I haven't encountered any concurrency-related panics in all my time using the sudoku protocol. I intentionally omitted a mutex for performance reasons. Do you think adding atomic operations is strictly necessary? If so, I will add them in v0.0.1-d and ensure the tests pass.
|
|
Frankly, I don't think your code needs to hold The fact that you haven't encountered problems in your personal tests is most likely due to high-concurrency scenarios. Furthermore, your pool isn't shared with |
|
Adding a lock in v0.0.1-d only prevents sc.rawBuf from traversing itself, but it still cannot prevent the buf from being manipulated in Read after it has been returned to the pool. |
|
|
LGTM |
|
Besides code issues, I also want to know about the stability of the Sudoku protocol. Traditionally, we don't easily make Our strategy is that new changes should be able to be enabled or disabled via options, rather than directly breaking the old implementation. |
|
This protocol has been "dogfooding" for a long time by myself and my peers before open-sourcing. It has proven stable for bypassing censorship. |
|
Finally, please add the configuration example from the PR description to |
|
There's a minor issue that doesn't affect usability: the timing and log calls in |
|
well ill adjust it on 30th evening with a tiny feature updated first on my repo. |
|
Do we need to add a sudoku key generator? |
ok ,let me add it in #2407 |
This PR integrates the Sudoku protocol into mihomo as both an outbound proxy type and an inbound listener type.
Config Examples
Outbound:
Inbound:
Notes / Limitations
Testing
go build ./...(pass)go test ./adapter/... ./listener/... ./constant(pass)Tested local and server inbound/outbound, finding successful proxy