1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-29 10:45:22 +00:00
v2fly/common/net/network.go

25 lines
423 B
Go
Raw Normal View History

2015-10-30 14:56:46 +00:00
package net
2017-08-22 13:15:09 +00:00
func (n Network) SystemString() string {
switch n {
2017-01-03 13:53:59 +00:00
case Network_TCP:
2016-09-20 08:44:44 +00:00
return "tcp"
case Network_UDP:
2016-09-20 08:44:44 +00:00
return "udp"
2020-10-29 07:30:38 +00:00
case Network_UNIX:
return "unix"
2016-09-20 08:44:44 +00:00
default:
return "unknown"
}
2016-06-03 22:38:22 +00:00
}
2018-11-20 16:05:32 +00:00
// HasNetwork returns true if the network list has a certain network.
2018-04-03 15:51:01 +00:00
func HasNetwork(list []Network, network Network) bool {
for _, value := range list {
2018-11-20 15:58:26 +00:00
if value == network {
2018-04-03 15:51:01 +00:00
return true
}
}
return false
}