1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-26 09:25:23 +00:00
v2fly/common/net/network.go
2016-01-15 14:34:33 +01:00

32 lines
553 B
Go

package net
import (
"strings"
)
const (
TCPNetwork = Network("tcp")
UDPNetwork = Network("udp")
)
type Network string
type NetworkList []Network
func NewNetworkList(networks []string) NetworkList {
list := NetworkList(make([]Network, len(networks)))
for idx, network := range networks {
list[idx] = Network(strings.ToLower(strings.TrimSpace(network)))
}
return list
}
func (this *NetworkList) HasNetwork(network Network) bool {
for _, value := range *this {
if string(value) == string(network) {
return true
}
}
return false
}