增加域名快速处理函数

This commit is contained in:
GoEdgeLab
2021-02-07 09:08:06 +08:00
parent 12e11188db
commit eaca2e64a1
2 changed files with 74 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
package serverconfigs
import (
"github.com/iwind/TeaGo/logs"
"testing"
)
func TestNormalizeServerNames(t *testing.T) {
serverNames := []*ServerNameConfig{
{
Name: "Hello.com",
SubNames: []string{"WoRld.com", "XYZ.com"},
},
}
NormalizeServerNames(serverNames)
logs.PrintAsJSON(serverNames, t)
}
func TestPlainServerNames(t *testing.T) {
serverNames := []*ServerNameConfig{
{
Name: "Hello.com",
SubNames: nil,
},
{
Name: "world.com",
SubNames: nil,
},
{
Name: "",
SubNames: []string{"WoRld.com", "XYZ.com"},
},
}
logs.PrintAsJSON(PlainServerNames(serverNames), t)
}