Added router priority to webui's list and detail page
This commit is contained in:
parent
cd90b9761a
commit
8cd4923e72
43 changed files with 2913 additions and 131 deletions
|
@ -444,6 +444,39 @@ func Test_Priority(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetRulePriority(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
rule string
|
||||
expected int
|
||||
}{
|
||||
{
|
||||
desc: "simple rule",
|
||||
rule: "HostSNI(`example.org`)",
|
||||
expected: 22,
|
||||
},
|
||||
{
|
||||
desc: "HostSNI(`*`) rule",
|
||||
rule: "HostSNI(`*`)",
|
||||
expected: -1,
|
||||
},
|
||||
{
|
||||
desc: "strange HostSNI(`*`) rule",
|
||||
rule: " HostSNI ( `*` ) ",
|
||||
expected: -1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
assert.Equal(t, test.expected, GetRulePriority(test.rule))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type fakeConn struct {
|
||||
call map[string]int
|
||||
remoteAddr net.Addr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue