|
@@ -1,23 +1,5 @@
|
|
|
package net
|
|
package net
|
|
|
|
|
|
|
|
-import (
|
|
|
|
|
- "strings"
|
|
|
|
|
-)
|
|
|
|
|
-
|
|
|
|
|
-func ParseNetwork(nwStr string) Network {
|
|
|
|
|
- if network, found := Network_value[nwStr]; found {
|
|
|
|
|
- return Network(network)
|
|
|
|
|
- }
|
|
|
|
|
- switch strings.ToLower(nwStr) {
|
|
|
|
|
- case "tcp":
|
|
|
|
|
- return Network_TCP
|
|
|
|
|
- case "udp":
|
|
|
|
|
- return Network_UDP
|
|
|
|
|
- default:
|
|
|
|
|
- return Network_Unknown
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (n Network) AsList() *NetworkList {
|
|
func (n Network) AsList() *NetworkList {
|
|
|
return &NetworkList{
|
|
return &NetworkList{
|
|
|
Network: []Network{n},
|
|
Network: []Network{n},
|
|
@@ -35,17 +17,6 @@ func (n Network) SystemString() string {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (n Network) URLPrefix() string {
|
|
|
|
|
- switch n {
|
|
|
|
|
- case Network_TCP:
|
|
|
|
|
- return "tcp"
|
|
|
|
|
- case Network_UDP:
|
|
|
|
|
- return "udp"
|
|
|
|
|
- default:
|
|
|
|
|
- return "unknown"
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func HasNetwork(list []Network, network Network) bool {
|
|
func HasNetwork(list []Network, network Network) bool {
|
|
|
for _, value := range list {
|
|
for _, value := range list {
|
|
|
if string(value) == string(network) {
|
|
if string(value) == string(network) {
|