github.com/v2fly/v2ray-core/v4@v4.45.2/common/net/network.go (about)

     1  package net
     2  
     3  func (n Network) SystemString() string {
     4  	switch n {
     5  	case Network_TCP:
     6  		return "tcp"
     7  	case Network_UDP:
     8  		return "udp"
     9  	case Network_UNIX:
    10  		return "unix"
    11  	default:
    12  		return "unknown"
    13  	}
    14  }
    15  
    16  // HasNetwork returns true if the network list has a certain network.
    17  func HasNetwork(list []Network, network Network) bool {
    18  	for _, value := range list {
    19  		if value == network {
    20  			return true
    21  		}
    22  	}
    23  	return false
    24  }