Example #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()
}
Example #2
0
func (this Network) Build() v2net.Network {
	return v2net.ParseNetwork(string(this))
}
Example #3
0
func (v Network) Build() v2net.Network {
	return v2net.ParseNetwork(string(v))
}