mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-19 00:10:06 +08:00
chore: add sudoku ed25519key test
Some checks are pending
Test / test (1.20, macos-15-intel) (push) Waiting to run
Test / test (1.20, macos-latest) (push) Waiting to run
Test / test (1.20, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.20, ubuntu-latest) (push) Waiting to run
Test / test (1.20, windows-latest) (push) Waiting to run
Test / test (1.21, macos-15-intel) (push) Waiting to run
Test / test (1.21, macos-latest) (push) Waiting to run
Test / test (1.21, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.21, ubuntu-latest) (push) Waiting to run
Test / test (1.21, windows-latest) (push) Waiting to run
Test / test (1.22, macos-15-intel) (push) Waiting to run
Test / test (1.22, macos-latest) (push) Waiting to run
Test / test (1.22, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.22, ubuntu-latest) (push) Waiting to run
Test / test (1.22, windows-latest) (push) Waiting to run
Test / test (1.23, macos-15-intel) (push) Waiting to run
Test / test (1.23, macos-latest) (push) Waiting to run
Test / test (1.23, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.23, ubuntu-latest) (push) Waiting to run
Test / test (1.23, windows-latest) (push) Waiting to run
Test / test (1.24, macos-15-intel) (push) Waiting to run
Test / test (1.24, macos-latest) (push) Waiting to run
Test / test (1.24, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.24, ubuntu-latest) (push) Waiting to run
Test / test (1.24, windows-latest) (push) Waiting to run
Test / test (1.25, macos-15-intel) (push) Waiting to run
Test / test (1.25, macos-latest) (push) Waiting to run
Test / test (1.25, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.25, ubuntu-latest) (push) Waiting to run
Test / test (1.25, windows-latest) (push) Waiting to run
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
Some checks are pending
Test / test (1.20, macos-15-intel) (push) Waiting to run
Test / test (1.20, macos-latest) (push) Waiting to run
Test / test (1.20, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.20, ubuntu-latest) (push) Waiting to run
Test / test (1.20, windows-latest) (push) Waiting to run
Test / test (1.21, macos-15-intel) (push) Waiting to run
Test / test (1.21, macos-latest) (push) Waiting to run
Test / test (1.21, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.21, ubuntu-latest) (push) Waiting to run
Test / test (1.21, windows-latest) (push) Waiting to run
Test / test (1.22, macos-15-intel) (push) Waiting to run
Test / test (1.22, macos-latest) (push) Waiting to run
Test / test (1.22, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.22, ubuntu-latest) (push) Waiting to run
Test / test (1.22, windows-latest) (push) Waiting to run
Test / test (1.23, macos-15-intel) (push) Waiting to run
Test / test (1.23, macos-latest) (push) Waiting to run
Test / test (1.23, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.23, ubuntu-latest) (push) Waiting to run
Test / test (1.23, windows-latest) (push) Waiting to run
Test / test (1.24, macos-15-intel) (push) Waiting to run
Test / test (1.24, macos-latest) (push) Waiting to run
Test / test (1.24, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.24, ubuntu-latest) (push) Waiting to run
Test / test (1.24, windows-latest) (push) Waiting to run
Test / test (1.25, macos-15-intel) (push) Waiting to run
Test / test (1.25, macos-latest) (push) Waiting to run
Test / test (1.25, ubuntu-24.04-arm) (push) Waiting to run
Test / test (1.25, ubuntu-latest) (push) Waiting to run
Test / test (1.25, windows-latest) (push) Waiting to run
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
This commit is contained in:
parent
c33d9ad857
commit
f44aa22d50
@ -6,9 +6,12 @@ import (
|
|||||||
|
|
||||||
"github.com/metacubex/mihomo/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/metacubex/mihomo/listener/inbound"
|
"github.com/metacubex/mihomo/listener/inbound"
|
||||||
|
"github.com/metacubex/mihomo/transport/sudoku"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var sudokuPrivateKey, sudokuPublicKey, _ = sudoku.GenKeyPair()
|
||||||
|
|
||||||
func testInboundSudoku(t *testing.T, inboundOptions inbound.SudokuOption, outboundOptions outbound.SudokuOption) {
|
func testInboundSudoku(t *testing.T, inboundOptions inbound.SudokuOption, outboundOptions outbound.SudokuOption) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@ -58,6 +61,14 @@ func TestInboundSudoku_Basic(t *testing.T) {
|
|||||||
Key: key,
|
Key: key,
|
||||||
}
|
}
|
||||||
testInboundSudoku(t, inboundOptions, outboundOptions)
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
|
||||||
|
t.Run("ed25519key", func(t *testing.T) {
|
||||||
|
inboundOptions := inboundOptions
|
||||||
|
outboundOptions := outboundOptions
|
||||||
|
inboundOptions.Key = sudokuPublicKey
|
||||||
|
outboundOptions.Key = sudokuPrivateKey
|
||||||
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInboundSudoku_Entropy(t *testing.T) {
|
func TestInboundSudoku_Entropy(t *testing.T) {
|
||||||
@ -71,23 +82,39 @@ func TestInboundSudoku_Entropy(t *testing.T) {
|
|||||||
TableType: "prefer_entropy",
|
TableType: "prefer_entropy",
|
||||||
}
|
}
|
||||||
testInboundSudoku(t, inboundOptions, outboundOptions)
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
|
||||||
|
t.Run("ed25519key", func(t *testing.T) {
|
||||||
|
inboundOptions := inboundOptions
|
||||||
|
outboundOptions := outboundOptions
|
||||||
|
inboundOptions.Key = sudokuPublicKey
|
||||||
|
outboundOptions.Key = sudokuPrivateKey
|
||||||
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInboundSudoku_Padding(t *testing.T) {
|
func TestInboundSudoku_Padding(t *testing.T) {
|
||||||
key := "test_key_padding"
|
key := "test_key_padding"
|
||||||
min := 10
|
paddingMin := 10
|
||||||
max := 100
|
paddingMax := 100
|
||||||
inboundOptions := inbound.SudokuOption{
|
inboundOptions := inbound.SudokuOption{
|
||||||
Key: key,
|
Key: key,
|
||||||
PaddingMin: &min,
|
PaddingMin: &paddingMin,
|
||||||
PaddingMax: &max,
|
PaddingMax: &paddingMax,
|
||||||
}
|
}
|
||||||
outboundOptions := outbound.SudokuOption{
|
outboundOptions := outbound.SudokuOption{
|
||||||
Key: key,
|
Key: key,
|
||||||
PaddingMin: &min,
|
PaddingMin: &paddingMin,
|
||||||
PaddingMax: &max,
|
PaddingMax: &paddingMax,
|
||||||
}
|
}
|
||||||
testInboundSudoku(t, inboundOptions, outboundOptions)
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
|
||||||
|
t.Run("ed25519key", func(t *testing.T) {
|
||||||
|
inboundOptions := inboundOptions
|
||||||
|
outboundOptions := outboundOptions
|
||||||
|
inboundOptions.Key = sudokuPublicKey
|
||||||
|
outboundOptions.Key = sudokuPrivateKey
|
||||||
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInboundSudoku_PackedDownlink(t *testing.T) {
|
func TestInboundSudoku_PackedDownlink(t *testing.T) {
|
||||||
@ -102,4 +129,12 @@ func TestInboundSudoku_PackedDownlink(t *testing.T) {
|
|||||||
EnablePureDownlink: &enablePure,
|
EnablePureDownlink: &enablePure,
|
||||||
}
|
}
|
||||||
testInboundSudoku(t, inboundOptions, outboundOptions)
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
|
||||||
|
t.Run("ed25519key", func(t *testing.T) {
|
||||||
|
inboundOptions := inboundOptions
|
||||||
|
outboundOptions := outboundOptions
|
||||||
|
inboundOptions.Key = sudokuPublicKey
|
||||||
|
outboundOptions.Key = sudokuPrivateKey
|
||||||
|
testInboundSudoku(t, inboundOptions, outboundOptions)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user