增加配置分组配置

This commit is contained in:
刘祥超
2021-09-22 19:39:55 +08:00
parent e8429b8f74
commit 7c530680c0
13 changed files with 1438 additions and 154 deletions

View File

@@ -0,0 +1,34 @@
package serverconfigs
import (
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestServerAddressGroup_Protocol(t *testing.T) {
a := assert.NewAssertion(t)
{
group := NewServerAddressGroup("tcp://127.0.0.1:1234")
a.IsTrue(group.Protocol() == ProtocolTCP)
a.IsTrue(group.Addr() == "127.0.0.1:1234")
}
{
group := NewServerAddressGroup("http4://127.0.0.1:1234")
a.IsTrue(group.Protocol() == ProtocolHTTP4)
a.IsTrue(group.Addr() == "127.0.0.1:1234")
}
{
group := NewServerAddressGroup("127.0.0.1:1234")
a.IsTrue(group.Protocol() == ProtocolHTTP)
a.IsTrue(group.Addr() == "127.0.0.1:1234")
}
{
group := NewServerAddressGroup("unix:/tmp/my.sock")
a.IsTrue(group.Protocol() == ProtocolUnix)
a.IsTrue(group.Addr() == "/tmp/my.sock")
}
}