Пример #1
0
func TestStringNetworkList(t *testing.T) {
	assert := assert.On(t)

	var list NetworkList
	err := json.Unmarshal([]byte("\"TCP, ip\""), &list)
	assert.Error(err).IsNil()

	nlist := list.Build()
	assert.Bool(nlist.HasNetwork(v2net.ParseNetwork("tcp"))).IsTrue()
	assert.Bool(nlist.HasNetwork(v2net.ParseNetwork("udp"))).IsFalse()
}
Пример #2
0
func (this Network) Build() v2net.Network {
	return v2net.ParseNetwork(string(this))
}
Пример #3
0
func (v Network) Build() v2net.Network {
	return v2net.ParseNetwork(string(v))
}