Browse Source

remove unused functions

Darien Raymond 7 years ago
parent
commit
d1f318c82a
2 changed files with 8 additions and 30 deletions
  1. 8 1
      common/net/destination.go
  2. 0 29
      common/net/network.go

+ 8 - 1
common/net/destination.go

@@ -83,7 +83,14 @@ func (d Destination) NetAddr() string {
 
 // String returns the strings form of this Destination.
 func (d Destination) String() string {
-	return d.Network.URLPrefix() + ":" + d.NetAddr()
+	prefix := "unknown:"
+	switch d.Network {
+	case Network_TCP:
+		prefix = "tcp:"
+	case Network_UDP:
+		prefix = "udp:"
+	}
+	return prefix + d.NetAddr()
 }
 
 // IsValid returns true if this Destination is valid.

+ 0 - 29
common/net/network.go

@@ -1,23 +1,5 @@
 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 {
 	return &NetworkList{
 		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 {
 	for _, value := range list {
 		if string(value) == string(network) {